From 8bf6a02036dd2ef3aed046601dc04be5f511036f Mon Sep 17 00:00:00 2001 From: Jesse Howard Date: Tue, 28 Jul 2026 10:47:32 -0400 Subject: [PATCH] Initial GDevelop project import --- Export/8BitOperatorPlus8Regular_Edited.fnt | 95 + Export/8BitOperatorPlus8Regular_Edited.png | Bin 0 -> 4317 bytes Export/AsyncTasksManager.js | 5 + Export/CustomRuntimeObject.js | 2 + Export/CustomRuntimeObject2D.js | 2 + .../CustomRuntimeObjectInstanceContainer.js | 2 + Export/Extensions/3D/DirectionalLight.js | 2 + Export/Extensions/3D/HemisphereLight.js | 2 + .../AnchorBehavior/anchorruntimebehavior.js | 2 + .../bitmaptextruntimeobject-pixi-renderer.js | 2 + .../BitmapText/bitmaptextruntimeobject.js | 2 + .../Extensions/DebuggerTools/debuggertools.js | 2 + .../panelspriteruntimeobject-pixi-renderer.js | 2 + .../panelspriteruntimeobject.js | 2 + .../textinputruntimeobject-pixi-renderer.js | 2 + .../TextInput/textinputruntimeobject.js | 2 + .../textruntimeobject-pixi-renderer.js | 2 + .../TextObject/textruntimeobject.js | 2 + .../topdownmovementruntimebehavior.js | 2 + .../Extensions/TweenBehavior/TweenManager.js | 13 + .../TweenBehavior/tweenruntimebehavior.js | 2 + Export/LICENSE.GDevelop.txt | 2 + Export/Model3DManager.js | 2 + Export/NewSprite.png | Bin 0 -> 198 bytes Export/NewSprite2.png | Bin 0 -> 198 bytes Export/NewSprite3.png | Bin 0 -> 533 bytes Export/ResourceCache.js | 2 + Export/ResourceLoader.js | 2 + Export/RuntimeCustomObjectLayer.js | 2 + Export/RuntimeInstanceContainer.js | 2 + Export/RuntimeLayer.js | 2 + Export/Small Blue Button_Hovered.png | Bin 0 -> 292 bytes Export/Small Blue Button_Idle.png | Bin 0 -> 230 bytes Export/Small Blue Button_Pressed.png | Bin 0 -> 4559 bytes Export/SpriteAnimator.js | 2 + Export/affinetransformation.js | 2 + Export/code0.js | 480 + Export/code1.js | 500 + Export/code2.js | 95 + Export/code3.js | 1235 ++ Export/code4.js | 1231 ++ Export/code5.js | 1143 ++ Export/code6.js | 21 + Export/data.js | 2 + Export/events-tools/cameratools.js | 2 + Export/events-tools/commontools.js | 2 + Export/events-tools/inputtools.js | 2 + Export/events-tools/networktools.js | 2 + Export/events-tools/objecttools.js | 2 + Export/events-tools/runtimescenetools.js | 2 + Export/events-tools/soundtools.js | 2 + Export/events-tools/storagetools.js | 2 + Export/events-tools/stringtools.js | 3 + Export/events-tools/variabletools.js | 2 + Export/events-tools/windowtools.js | 2 + .../fontfaceobserver-font-manager.js | 2 + .../fontfaceobserver.js | 16 + Export/force.js | 2 + Export/gd.js | 2 + Export/gdjs-evtsext__mqtt__connect-func.js | 137 + Export/gdjs-evtsext__mqtt__disconnect-func.js | 96 + ...djs-evtsext__mqtt__getcurrenterror-func.js | 92 + ...gdjs-evtsext__mqtt__getlastmessage-func.js | 98 + .../gdjs-evtsext__mqtt__isconnected-func.js | 94 + ...-evtsext__mqtt__onfirstsceneloaded-func.js | 128 + Export/gdjs-evtsext__mqtt__onmessage-func.js | 99 + ...s-evtsext__mqtt__onscenepostevents-func.js | 104 + Export/gdjs-evtsext__mqtt__publish-func.js | 102 + Export/gdjs-evtsext__mqtt__subscribe-func.js | 105 + .../gdjs-evtsext__mqtt__unsubscribe-func.js | 97 + ...panelspritebutton__bitmaptextstylestate.js | 600 + ...s-evtsext__panelspritebutton__buttonfsm.js | 1595 ++ ...panelspritebutton__isingameedition-func.js | 93 + ...t__panelspritebutton__panelspritebutton.js | 2815 +++ ...sext__panelspritebutton__textstylestate.js | 656 + ...elperfectmovement__brakingdistance-func.js | 93 + ...vement__definejavascriptfortopdown-func.js | 536 + ...pixelperfectmovement__speedtoreach-func.js | 110 + .../howler-sound-manager.js | 2 + Export/howler-sound-manager/howler.min.js | 3 + Export/index.html | 167 + Export/indexeddb.js | 2 + Export/inputmanager.js | 2 + Export/jsonmanager.js | 2 + Export/layer.js | 2 + Export/libs/jshashtable.js | 2 + Export/libs/rbush.js | 624 + Export/logger.js | 2 + Export/manifest.webmanifest | 12 + .../object-capabilities/AnimatableBehavior.js | 2 + Export/object-capabilities/EffectBehavior.js | 2 + .../object-capabilities/FlippableBehavior.js | 2 + Export/object-capabilities/OpacityBehavior.js | 2 + .../object-capabilities/ResizableBehavior.js | 2 + .../object-capabilities/ScalableBehavior.js | 2 + .../TextContainerBehavior.js | 2 + Export/oncetriggers.js | 2 + .../CustomRuntimeObject2DPixiRenderer.js | 2 + Export/pixi-renderers/DebuggerPixiRenderer.js | 2 + Export/pixi-renderers/layer-pixi-renderer.js | 15 + .../loadingscreen-pixi-renderer.js | 2 + .../pixi-renderers/pixi-bitmapfont-manager.js | 4 + Export/pixi-renderers/pixi-effects-manager.js | 2 + Export/pixi-renderers/pixi-filters-tools.js | 2 + Export/pixi-renderers/pixi-image-manager.js | 2 + Export/pixi-renderers/pixi.js | 1109 ++ .../runtimegame-pixi-renderer.js | 2 + .../runtimescene-pixi-renderer.js | 3 + .../spriteruntimeobject-pixi-renderer.js | 2 + Export/polygon.js | 2 + Export/profiler.js | 2 + Export/runtimebehavior.js | 2 + Export/runtimegame.js | 2 + Export/runtimeobject.js | 2 + Export/runtimescene.js | 2 + Export/runtimewatermark.js | 100 + Export/scenestack.js | 2 + Export/splash/gd-logo-light.js | 2 + Export/spriteruntimeobject.js | 2 + Export/timemanager.js | 2 + Export/timer.js | 2 + Export/variable.js | 2 + Export/variablescontainer.js | 2 + MultiplayerTest01.json | 14681 ++++++++++++++++ MultiplayerTest01.json.autosave | 1 + assets/8BitOperatorPlus8Regular_Edited.fnt | 95 + assets/8BitOperatorPlus8Regular_Edited.png | Bin 0 -> 4317 bytes assets/NewSprite.png | Bin 0 -> 198 bytes assets/NewSprite2.png | Bin 0 -> 198 bytes assets/NewSprite3.png | Bin 0 -> 533 bytes assets/Small Blue Button_Hovered.png | Bin 0 -> 292 bytes assets/Small Blue Button_Idle.png | Bin 0 -> 230 bytes assets/Small Blue Button_Pressed.png | Bin 0 -> 4559 bytes jsonServerGET.cartero | 3 + jsonserver.cartero | 3 + jsonserverDELETE.cartero | 3 + jsonserverPOST.cartero | 21 + 137 files changed, 29483 insertions(+) create mode 100644 Export/8BitOperatorPlus8Regular_Edited.fnt create mode 100644 Export/8BitOperatorPlus8Regular_Edited.png create mode 100644 Export/AsyncTasksManager.js create mode 100644 Export/CustomRuntimeObject.js create mode 100644 Export/CustomRuntimeObject2D.js create mode 100644 Export/CustomRuntimeObjectInstanceContainer.js create mode 100644 Export/Extensions/3D/DirectionalLight.js create mode 100644 Export/Extensions/3D/HemisphereLight.js create mode 100644 Export/Extensions/AnchorBehavior/anchorruntimebehavior.js create mode 100644 Export/Extensions/BitmapText/bitmaptextruntimeobject-pixi-renderer.js create mode 100644 Export/Extensions/BitmapText/bitmaptextruntimeobject.js create mode 100644 Export/Extensions/DebuggerTools/debuggertools.js create mode 100644 Export/Extensions/PanelSpriteObject/panelspriteruntimeobject-pixi-renderer.js create mode 100644 Export/Extensions/PanelSpriteObject/panelspriteruntimeobject.js create mode 100644 Export/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js create mode 100644 Export/Extensions/TextInput/textinputruntimeobject.js create mode 100644 Export/Extensions/TextObject/textruntimeobject-pixi-renderer.js create mode 100644 Export/Extensions/TextObject/textruntimeobject.js create mode 100644 Export/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js create mode 100644 Export/Extensions/TweenBehavior/TweenManager.js create mode 100644 Export/Extensions/TweenBehavior/tweenruntimebehavior.js create mode 100644 Export/LICENSE.GDevelop.txt create mode 100644 Export/Model3DManager.js create mode 100644 Export/NewSprite.png create mode 100644 Export/NewSprite2.png create mode 100644 Export/NewSprite3.png create mode 100644 Export/ResourceCache.js create mode 100644 Export/ResourceLoader.js create mode 100644 Export/RuntimeCustomObjectLayer.js create mode 100644 Export/RuntimeInstanceContainer.js create mode 100644 Export/RuntimeLayer.js create mode 100644 Export/Small Blue Button_Hovered.png create mode 100644 Export/Small Blue Button_Idle.png create mode 100644 Export/Small Blue Button_Pressed.png create mode 100644 Export/SpriteAnimator.js create mode 100644 Export/affinetransformation.js create mode 100644 Export/code0.js create mode 100644 Export/code1.js create mode 100644 Export/code2.js create mode 100644 Export/code3.js create mode 100644 Export/code4.js create mode 100644 Export/code5.js create mode 100644 Export/code6.js create mode 100644 Export/data.js create mode 100644 Export/events-tools/cameratools.js create mode 100644 Export/events-tools/commontools.js create mode 100644 Export/events-tools/inputtools.js create mode 100644 Export/events-tools/networktools.js create mode 100644 Export/events-tools/objecttools.js create mode 100644 Export/events-tools/runtimescenetools.js create mode 100644 Export/events-tools/soundtools.js create mode 100644 Export/events-tools/storagetools.js create mode 100644 Export/events-tools/stringtools.js create mode 100644 Export/events-tools/variabletools.js create mode 100644 Export/events-tools/windowtools.js create mode 100644 Export/fontfaceobserver-font-manager/fontfaceobserver-font-manager.js create mode 100644 Export/fontfaceobserver-font-manager/fontfaceobserver.js create mode 100644 Export/force.js create mode 100644 Export/gd.js create mode 100644 Export/gdjs-evtsext__mqtt__connect-func.js create mode 100644 Export/gdjs-evtsext__mqtt__disconnect-func.js create mode 100644 Export/gdjs-evtsext__mqtt__getcurrenterror-func.js create mode 100644 Export/gdjs-evtsext__mqtt__getlastmessage-func.js create mode 100644 Export/gdjs-evtsext__mqtt__isconnected-func.js create mode 100644 Export/gdjs-evtsext__mqtt__onfirstsceneloaded-func.js create mode 100644 Export/gdjs-evtsext__mqtt__onmessage-func.js create mode 100644 Export/gdjs-evtsext__mqtt__onscenepostevents-func.js create mode 100644 Export/gdjs-evtsext__mqtt__publish-func.js create mode 100644 Export/gdjs-evtsext__mqtt__subscribe-func.js create mode 100644 Export/gdjs-evtsext__mqtt__unsubscribe-func.js create mode 100644 Export/gdjs-evtsext__panelspritebutton__bitmaptextstylestate.js create mode 100644 Export/gdjs-evtsext__panelspritebutton__buttonfsm.js create mode 100644 Export/gdjs-evtsext__panelspritebutton__isingameedition-func.js create mode 100644 Export/gdjs-evtsext__panelspritebutton__panelspritebutton.js create mode 100644 Export/gdjs-evtsext__panelspritebutton__textstylestate.js create mode 100644 Export/gdjs-evtsext__pixelperfectmovement__brakingdistance-func.js create mode 100644 Export/gdjs-evtsext__pixelperfectmovement__definejavascriptfortopdown-func.js create mode 100644 Export/gdjs-evtsext__pixelperfectmovement__speedtoreach-func.js create mode 100644 Export/howler-sound-manager/howler-sound-manager.js create mode 100644 Export/howler-sound-manager/howler.min.js create mode 100644 Export/index.html create mode 100644 Export/indexeddb.js create mode 100644 Export/inputmanager.js create mode 100644 Export/jsonmanager.js create mode 100644 Export/layer.js create mode 100644 Export/libs/jshashtable.js create mode 100644 Export/libs/rbush.js create mode 100644 Export/logger.js create mode 100644 Export/manifest.webmanifest create mode 100644 Export/object-capabilities/AnimatableBehavior.js create mode 100644 Export/object-capabilities/EffectBehavior.js create mode 100644 Export/object-capabilities/FlippableBehavior.js create mode 100644 Export/object-capabilities/OpacityBehavior.js create mode 100644 Export/object-capabilities/ResizableBehavior.js create mode 100644 Export/object-capabilities/ScalableBehavior.js create mode 100644 Export/object-capabilities/TextContainerBehavior.js create mode 100644 Export/oncetriggers.js create mode 100644 Export/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js create mode 100644 Export/pixi-renderers/DebuggerPixiRenderer.js create mode 100644 Export/pixi-renderers/layer-pixi-renderer.js create mode 100644 Export/pixi-renderers/loadingscreen-pixi-renderer.js create mode 100644 Export/pixi-renderers/pixi-bitmapfont-manager.js create mode 100644 Export/pixi-renderers/pixi-effects-manager.js create mode 100644 Export/pixi-renderers/pixi-filters-tools.js create mode 100644 Export/pixi-renderers/pixi-image-manager.js create mode 100644 Export/pixi-renderers/pixi.js create mode 100644 Export/pixi-renderers/runtimegame-pixi-renderer.js create mode 100644 Export/pixi-renderers/runtimescene-pixi-renderer.js create mode 100644 Export/pixi-renderers/spriteruntimeobject-pixi-renderer.js create mode 100644 Export/polygon.js create mode 100644 Export/profiler.js create mode 100644 Export/runtimebehavior.js create mode 100644 Export/runtimegame.js create mode 100644 Export/runtimeobject.js create mode 100644 Export/runtimescene.js create mode 100644 Export/runtimewatermark.js create mode 100644 Export/scenestack.js create mode 100644 Export/splash/gd-logo-light.js create mode 100644 Export/spriteruntimeobject.js create mode 100644 Export/timemanager.js create mode 100644 Export/timer.js create mode 100644 Export/variable.js create mode 100644 Export/variablescontainer.js create mode 100644 MultiplayerTest01.json create mode 100644 MultiplayerTest01.json.autosave create mode 100644 assets/8BitOperatorPlus8Regular_Edited.fnt create mode 100644 assets/8BitOperatorPlus8Regular_Edited.png create mode 100644 assets/NewSprite.png create mode 100644 assets/NewSprite2.png create mode 100644 assets/NewSprite3.png create mode 100644 assets/Small Blue Button_Hovered.png create mode 100644 assets/Small Blue Button_Idle.png create mode 100644 assets/Small Blue Button_Pressed.png create mode 100644 jsonServerGET.cartero create mode 100644 jsonserver.cartero create mode 100644 jsonserverDELETE.cartero create mode 100644 jsonserverPOST.cartero diff --git a/Export/8BitOperatorPlus8Regular_Edited.fnt b/Export/8BitOperatorPlus8Regular_Edited.fnt new file mode 100644 index 0000000..def784a --- /dev/null +++ b/Export/8BitOperatorPlus8Regular_Edited.fnt @@ -0,0 +1,95 @@ +info face="8-bitOperatorPlus8-Regular" size=23 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=10,10,10,10 spacing=5,5 +common lineHeight=23 base=14 scaleW=392 scaleH=387 pages=1 packed=0 +page id=0 file="8BitOperatorPlus8Regular_Edited.png" +chars count=91 +char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=0 xadvance=8 page=0 chnl=15 +char id=33 x=364 y=111 width=26 height=38 xoffset=-10 yoffset=-11.98 xadvance=6 page=0 chnl=15 +char id=34 x=288 y=152 width=34 height=30 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=35 x=52 y=0 width=36 height=36 xoffset=-10 yoffset=-9.98 xadvance=16 page=0 chnl=15 +char id=36 x=210 y=86 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=37 x=0 y=339 width=36 height=36 xoffset=-10 yoffset=-9.98 xadvance=16 page=0 chnl=15 +char id=38 x=210 y=129 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=39 x=364 y=76 width=28 height=30 xoffset=-10 yoffset=-11.98 xadvance=8 page=0 chnl=15 +char id=40 x=327 y=203 width=30 height=38 xoffset=-10 yoffset=-11.98 xadvance=10 page=0 chnl=15 +char id=41 x=327 y=246 width=30 height=38 xoffset=-10 yoffset=-11.98 xadvance=10 page=0 chnl=15 +char id=42 x=0 y=210 width=38 height=34 xoffset=-10 yoffset=-9.98 xadvance=18 page=0 chnl=15 +char id=43 x=288 y=78 width=34 height=34 xoffset=-10 yoffset=-9.98 xadvance=14 page=0 chnl=15 +char id=44 x=364 y=41 width=28 height=30 xoffset=-10 yoffset=-1.99 xadvance=8 page=0 chnl=15 +char id=45 x=327 y=0 width=32 height=26 xoffset=-10 yoffset=-5.99 xadvance=12 page=0 chnl=15 +char id=46 x=364 y=236 width=26 height=26 xoffset=-10 yoffset=0 xadvance=6 page=0 chnl=15 +char id=47 x=288 y=222 width=32 height=40 xoffset=-10 yoffset=-11.98 xadvance=12 page=0 chnl=15 +char id=48 x=52 y=86 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=49 x=327 y=31 width=30 height=38 xoffset=-10 yoffset=-11.98 xadvance=10 page=0 chnl=15 +char id=50 x=52 y=129 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=51 x=52 y=172 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=52 x=52 y=215 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=53 x=52 y=258 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=54 x=52 y=301 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=55 x=52 y=344 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=56 x=93 y=0 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=57 x=93 y=43 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=58 x=364 y=197 width=26 height=34 xoffset=-10 yoffset=-7.98 xadvance=6 page=0 chnl=15 +char id=59 x=364 y=0 width=28 height=36 xoffset=-10 yoffset=-7.98 xadvance=8 page=0 chnl=15 +char id=61 x=288 y=117 width=34 height=30 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=63 x=210 y=43 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=64 x=0 y=294 width=36 height=40 xoffset=-10 yoffset=-11.98 xadvance=16 page=0 chnl=15 +char id=65 x=93 y=258 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=66 x=93 y=301 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=67 x=93 y=344 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=68 x=132 y=0 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=69 x=132 y=43 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=70 x=132 y=86 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=71 x=132 y=129 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=72 x=132 y=172 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=73 x=327 y=160 width=30 height=38 xoffset=-10 yoffset=-11.98 xadvance=10 page=0 chnl=15 +char id=74 x=132 y=215 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=75 x=132 y=258 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=76 x=132 y=301 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=77 x=0 y=46 width=38 height=38 xoffset=-10 yoffset=-11.98 xadvance=18 page=0 chnl=15 +char id=78 x=132 y=344 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=79 x=171 y=0 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=80 x=171 y=43 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=81 x=0 y=249 width=36 height=40 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=82 x=171 y=86 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=83 x=171 y=129 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=84 x=171 y=172 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=85 x=171 y=215 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=86 x=171 y=258 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=87 x=0 y=89 width=38 height=38 xoffset=-10 yoffset=-11.98 xadvance=18 page=0 chnl=15 +char id=88 x=171 y=301 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=89 x=171 y=344 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=90 x=210 y=0 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=91 x=327 y=289 width=30 height=38 xoffset=-10 yoffset=-11.98 xadvance=10 page=0 chnl=15 +char id=93 x=327 y=332 width=30 height=38 xoffset=-10 yoffset=-11.98 xadvance=10 page=0 chnl=15 +char id=94 x=288 y=187 width=34 height=30 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=95 x=288 y=353 width=32 height=26 xoffset=-12 yoffset=2 xadvance=8 page=0 chnl=15 +char id=97 x=249 y=41 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=98 x=93 y=86 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=99 x=249 y=80 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=100 x=93 y=129 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=101 x=249 y=119 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=102 x=288 y=267 width=32 height=38 xoffset=-10 yoffset=-11.98 xadvance=12 page=0 chnl=15 +char id=103 x=210 y=258 width=34 height=36 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=104 x=93 y=172 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=105 x=327 y=74 width=30 height=38 xoffset=-10 yoffset=-11.98 xadvance=10 page=0 chnl=15 +char id=106 x=52 y=41 width=34 height=40 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=107 x=93 y=215 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=108 x=327 y=117 width=30 height=38 xoffset=-10 yoffset=-11.98 xadvance=10 page=0 chnl=15 +char id=109 x=0 y=132 width=38 height=34 xoffset=-10 yoffset=-7.98 xadvance=18 page=0 chnl=15 +char id=110 x=249 y=158 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=111 x=249 y=197 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=112 x=210 y=299 width=34 height=36 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=113 x=210 y=340 width=34 height=36 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=114 x=249 y=236 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=115 x=249 y=275 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=116 x=288 y=310 width=32 height=38 xoffset=-10 yoffset=-11.98 xadvance=12 page=0 chnl=15 +char id=117 x=249 y=314 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=118 x=249 y=353 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=119 x=0 y=171 width=38 height=34 xoffset=-10 yoffset=-7.98 xadvance=18 page=0 chnl=15 +char id=120 x=288 y=0 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=121 x=249 y=0 width=34 height=36 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=122 x=288 y=39 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=123 x=210 y=172 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=124 x=364 y=154 width=26 height=38 xoffset=-10 yoffset=-11.98 xadvance=6 page=0 chnl=15 +char id=125 x=210 y=215 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=8470 x=0 y=0 width=47 height=41 xoffset=-13 yoffset=-8 xadvance=22 page=0 chnl=15 diff --git a/Export/8BitOperatorPlus8Regular_Edited.png b/Export/8BitOperatorPlus8Regular_Edited.png new file mode 100644 index 0000000000000000000000000000000000000000..1ebff0aa7ee38d39303be374db8a1e65955fe465 GIT binary patch literal 4317 zcmZWs2UJtp7QG2AQUf!L2th+YW<-$Ypo{^6^o|h_h!p990YRh+L_mpDBVABxq$mWC zGPD6jrAjm-H9`c02vVdgMgGJ8|623cKkH>B_vWpe^UgkdpPf6F<^}@1;=BL=0V6|Q zJOD5<^ol`nLp#c`ansNn>>A$SENrA(J_=fJdTN_#15lm9w{wXLTBBVJ@n!&o$pS!% z1z-!>B7Fkjx)K0$&H((81;D|pxlQM=03ZoQy4qGDqYGmuHOzVuU^zSJ5RIqGp*nrQu=co18jg>BiO+w^?_t2JT ze@SoM+Sq2Ela|4!hD>g9xMWQxf)6Q$hz-(osI2oJpu(oD7tD!mP+n_n2D_p>H#~x{ z?Z}+0s~D8sWV*HyEGCJq#BW-Utq~Y`lAMc8hKTaD&r*b*ZnbS18sq-FZd>7O+w`tz zwfOwRw+#mGb(i4MYdrNc16B*EtD^M zF65BIiyo=AO_R3ljJBbcHb$QGj=40;)1+17@g>=0u(h!!uQjTCbco7te zeBQpYhrg*IYHSi>jayFg6x>_r9Ays?5+wLZH;zI&`ds}ZA!R58}G6K##Bl5sCBy>ho)Hdzy|6=>!Rd~R*du&v1PVa&Cv|tBNWj3ue z+GfNB1Ara?)tmkIw6`D}fGi6xSo@bJF7T$Fe)djq=hSj(gB22#qDMXCRYcrAFFajs z+uLHZ%IIyoUsqB^#sKwnEDl z$|}BXD$u48MM822V1@Llxrwj~dy#m;g*u=k`@Z9Mv#BjgRGzS0Tvyx8(TMs`uIj*_ zx(svl!G@cEP|eAwv)56JH<~U+(F-wFNUEA{SFE%n>*2OS!1cdZPF*_k!j)caaQw-p zC+h=P>qhBn$11;;aSx!x_`paBtV=D$VW#X1!_#j&!GHmemIQ#bnNJlQpVP%H^o+vB^2vN$mMzHKUaf z)|@O}9Uzc8WfjPHB|)Z+gmhl`&+3=`?UkAlNI4z=bNQ`KR6-c;^igdiggaI3IoA9d zm$QW6XO7{xmpY~FAqf6I=&Fq4g1Ixi?Zx|GJs>Z&8;QPN4#AeAp>)Ca zx|hdJU%ia*Xl({B9Efs$3DL*mJ$CpnFHSI16!QulIt!5{$E^5!NfCOG>+d+JA*$`1F!2s(Q~mDp=grk8*4?kX7v@B&0k& zZB^zLRKzhak4r36<3?S&SUs50#ilpRx2**mMAEd&CJ*~#b0oRQcspMgK4*R*y7tGB zAqKsu=jl2EM(gzdZg}k+b$zF7CB8QP*qGmKk2~#}2vFa9@7f(?E^$Lme8%n9>lsu%?6aDB@e-;%6GL-}f3NmQ1(z0SWunD{ z;}W(Pg2`80xwCVdhG*JW!ap|>-?)=(oA#dlh4=@Gz?l}Ng{nOWu@pxF!vyM49H?r9 zIJlM}%#K54XnIOQzn0p9l+5a5BnTzlR-_x#IQlK_oQPPoANTdC%>2PerMBqblGr6f zEA>xg!pd9hH&P+4lvKqZ$a2F*Wn1}Ed3|CPub@d#z0h&|2+R96;m1 zeD~;`fX7)RJt0xHWEmQK%BA*zn~AkOpBF~wwpm zSrja;qabDIxW2Ee1+65pg~>AFEJefR%qrO|orLW-xtt0kJP;LJj4uah>}j42`u1rv zoJg=3a9+^l6y zhsMQ`-NO)EP$;@TI+A5IO7gg688!6ft&fKwq+J`@Al1%u_5&_lV5@rLi^2Y_t8!$= zagnZTP|=ZSP-x`>(Rr*U{=iqX)}gvJjp-gKV=XAf_Vc!#{HAgb;_r_?Yv1jWI;%zX z`RYZ0*aW`x@w(LRO8L>}_;W6UAaOJhV|MgjG*LW|Qu~6B#0`U!!Wb=&!MXbvy0rE- zrg}?Qd-Gn-K=g$r#*IV6Lnie3o5F>ddT9XA5zk!b0UM?I|eXKkc$H+j4k!N_;aa>B3S> z*O^PjE4(-^?XFa@%=+xe^zmoTx(l%KSZ>D$@&`)g$YVBwp+ScVUPopztFXCb z)F4lL@t9}CwaqiS!$uCH#bTkE!LegK!puh^e@AI383_a)5#xV-0BLcqxf-(&1Bodn z_Z!|mLbV}kbF`juLj-{Y7N!q}Z!b5+ug(S#BRB>}k!4B3QGW_EGa9-%d>xK@ENXMX zzDOyF-RJm_0{kH#37HZ5awKfnpY-M@x_c1{r1oh82W!E&m_{B5BQra3Zc~rhmvQ1J<8^jN|Gq!Ul2#2)kKPJ}THyL?SyQNM^5@_1s97^zorRu9mZCwH zn;_iw1ym-;?|gSnhCxRLXU70drOq!Q)7MWY*7Xv8_@aA`jwczY{tg{es^C@fFYRJb z7FW=cK9rfO`dO*AD73fY{8f}9bPnn4(P|UH6}au*llhzOm5?g{eV&4FXPvrR*dKyl zq`Q3|(HkV~YyL#R$G34_J%Bkg9+i=>Nl;I$x)0ef67S^0uBlrZzUHXQsCvD<8{5m% zsg852hg2AvX? z)1J5actv%RS!+zZQ)^HZxWGSv!GR~GC{8?Vl4|Gi(X=vdqS-KAw@iUzW1qgLs8a_$ zqmY&0ornu`s%q4}r6|q5=uIe7s9S=7?;>8x0n42nW~6<$lBQUq##0atzFKl+z+>ku zNx%`kay41{s$&OV%nvxS`udZWilPBD2j5K}zZLLm7xEtvRNv2^iN`Xu6QPe@?Y0;t zJE?ay!8wc{juiCpT#%L9ZwM&*AWWS(r~^(KOW0EoJ!Q_6!PHJNPWbJAjqP2?q%W(QS8a?8t8Sz7CpwC=8jYTa zN#W9FWQ-ND&Kk?Xyn6TsPo`8K7nz436;1nOy5d+VU7E>AByxZNa z)+t>r-f8HmMEnJfFG;L_iNbL`8#6tDw?Q*6X0{ab`Yd|TFW6Ltcj;TloZ&~7oqzuZ zz+c=A8~*g`{tX|~bz&1~feTg%frro;{pwk#xh%Bqo$4R-tht4am1D!tAy8uI_ee{Tm4})q%O{= zZF7ulSK`@y`mi99+H+}9^8j!O|2m-&Mk1dK9PF?(nhle9)u^ZiJ4w5E)Hcvs+qQxe zjeBDR5|uWxQ_2jwZkQ0`YqQTszqEuE+Ncj}3qUP_PcgWqD@HRvpi?}cPE}i1!pglZ z>;>nx&mGIYlqgdcrzhN|T0l4PZTIr|+lS~qGQ(g+{QEDNc$t<#NXO9l(y8bRNKlcM z!F5DXUy+mipgifb0gATa`Z8ibi-zLDaaGF@QnG$eA01SAT)uvx_E|G|cPUF#(&uAEDQ*KvQxNY7li@~m_8 FzW}Y0l4Jk? literal 0 HcmV?d00001 diff --git a/Export/AsyncTasksManager.js b/Export/AsyncTasksManager.js new file mode 100644 index 0000000..ea83434 --- /dev/null +++ b/Export/AsyncTasksManager.js @@ -0,0 +1,5 @@ +var gdjs;(function(i){class S{constructor(){this.tasksWithCallback=new Array}processTasks(e){for(let t=0;ta.getNetworkSyncData?{callbackId:s,asyncTask:a.getNetworkSyncData(),objectsList:o.getNetworkSyncData(e)}:null).filter(Boolean)}}updateFromNetworkSyncData(e,t,a,s){this.clearTasks();const o=[];e.tasks.forEach(({callbackId:y,asyncTask:n,objectsList:w})=>{if(!n)return;const u=t.get(y);if(u){const p=new i.LongLivedObjectsList;if(p.updateFromNetworkSyncData(w,a,s),n.type==="group"){const r=new l;r.updateFromNetworkSyncData(n),this.addTask(r,u,y,p)}else if(n.type==="wait"){const r=new i.evtTools.runtimeScene.WaitTask(n.duration);r.updateFromNetworkSyncData(n),this.addTask(r,u,y,p)}else o.push(n.type)}}),o.length&&console.warn(`${o.length} asynchronous task(s) could not be restored from network sync data. ${o.join(", ")}`)}}i.AsyncTasksManager=S;class c{}i.AsyncTask=c;class l extends c{constructor(){super(...arguments);this.tasks=new Array}addTask(e){this.tasks.push(e)}update(e){for(let t=0;te.getNetworkSyncData())}}updateFromNetworkSyncData(e){const t=[];e.tasks.forEach(a=>{if(!!a)if(a.type==="group"){const s=new l;s.updateFromNetworkSyncData(a),this.addTask(s)}else if(a.type==="wait"){const s=new i.evtTools.runtimeScene.WaitTask(a.duration);s.updateFromNetworkSyncData(a),this.addTask(s)}else t.push(a.type)}),t.length&&console.warn(`${t.length} asynchronous task(s) could not be restored from network sync data. ${t.join(", ")}`)}}i.TaskGroup=l;class g extends c{update(){return!0}getNetworkSyncData(){return null}updateFromNetworkSyncData(e){}}i.ResolveTask=g;const d=new i.Logger("Internal PromiseTask");class h extends c{constructor(e){super();this.isResolved=!1;this.promise=e.catch(t=>{d.error(`A promise error has not been handled, this should never happen! +If you are using JavaScript promises in an asynchronous action, make sure to add a .catch(). +Otherwise, report this as a bug on the GDevelop forums! +${t?"The following error was thrown: "+t:""}`)}).then(t=>(this.isResolved=!0,t))}update(){return this.isResolved}getNetworkSyncData(){return null}updateFromNetworkSyncData(e){}}i.PromiseTask=h;class D extends c{constructor(){super(...arguments);this.isResolved=!1}resolve(){this.isResolved=!0}update(){return this.isResolved}getNetworkSyncData(){return null}updateFromNetworkSyncData(e){}}i.ManuallyResolvableTask=D})(gdjs||(gdjs={})); +//# sourceMappingURL=AsyncTasksManager.js.map diff --git a/Export/CustomRuntimeObject.js b/Export/CustomRuntimeObject.js new file mode 100644 index 0000000..602e020 --- /dev/null +++ b/Export/CustomRuntimeObject.js @@ -0,0 +1,2 @@ +var gdjs;(function(s){const o=new s.Logger("CustomRuntimeObject");class h extends s.RuntimeObject{constructor(t,e,i){super(t,e,i);this._isUntransformedHitBoxesDirty=!0;this._untransformedHitBoxes=[];this._unrotatedAABB={min:[0,0],max:[0,0]};this._innerArea=null;this._isInnerAreaFollowingParentSize=!1;this._scaleX=1;this._scaleY=1;this._flippedX=!1;this._flippedY=!1;this.opacity=255;this._customCenter=null;this._localTransformation=new s.AffineTransformation;this._localInverseTransformation=new s.AffineTransformation;this._isLocalTransformationDirty=!0;this._type=e.type,this._instanceContainer=new s.CustomRuntimeObjectInstanceContainer(t,this),this._renderer=this._createRender(),this._initializeFromObjectData(e)}_initializeFromObjectData(t){const e=this._runtimeScene.getGame().getEventsBasedObjectData(t.type);if(!e){o.error(`A CustomRuntimeObject was initialized (or re-initialized) from object data referring to an non existing events based object data with type "${t.type}".`);return}const i=this.getRuntimeScene().getGame().getEventsBasedObjectVariantData(t.type,t.variant);if(!i){o.error(`Unknown variant "${t.variant}" for object "${t.type}".`);return}this._isInnerAreaFollowingParentSize=e.isInnerAreaFollowingParentSize,i.instances.length>0&&(this._innerArea||(this._innerArea={min:[0,0,0],max:[0,0,0]}),this._innerArea.min[0]=i.areaMinX,this._innerArea.min[1]=i.areaMinY,this._innerArea.min[2]=i.areaMinZ,this._innerArea.max[0]=i.areaMaxX,this._innerArea.max[1]=i.areaMaxY,this._innerArea.max[2]=i.areaMaxZ),this._instanceContainer.loadFrom(t,i)}reinitialize(t){super.reinitialize(t),this._reinitializeContentFromObjectData(t),this.onCreated()}_reinitializeContentFromObjectData(t){this._reinitializeRenderer(),this._instanceContainer._unloadContent(),this._initializeFromObjectData(t)}updateFromObjectData(t,e){const i=this.getAnimator();if(i&&i.updateFromObjectData(t.animatable||[],e.animatable||[]),t.variant!==e.variant){const n=this.getWidth(),r=this.getHeight(),a=t.isInnerAreaFollowingParentSize&&this._instanceContainer._initialInnerArea&&this._innerArea&&(this._instanceContainer._initialInnerArea.min[0]!==this._innerArea.min[0]||this._instanceContainer._initialInnerArea.min[1]!==this._innerArea.min[1]||this._instanceContainer._initialInnerArea.max[0]!==this._innerArea.max[0]||this._instanceContainer._initialInnerArea.max[1]!==this._innerArea.max[1]);this._reinitializeContentFromObjectData(e),this.onCreated(),a&&(this.setWidth(n),this.setHeight(r))}return!0}getNetworkSyncData(t){const e=this.getAnimator(),i={...super.getNetworkSyncData(t),ifx:this.isFlippedX(),ify:this.isFlippedY(),sx:this._scaleX,sy:this._scaleY,op:this.opacity};return e&&(i.anim=e.getNetworkSyncData()),this._customCenter&&(i.cc=this._customCenter),i}updateFromNetworkSyncData(t,e){if(super.updateFromNetworkSyncData(t,e),t.ifx!==void 0&&this.flipX(t.ifx),t.ify!==void 0&&this.flipY(t.ify),t.sx!==void 0&&this.setScaleX(Math.abs(t.sx)),t.sy!==void 0&&this.setScaleY(Math.abs(t.sy)),t.op!==void 0&&this.setOpacity(t.op),t.anim){const i=this.getAnimator();i&&i.updateFromNetworkSyncData(t.anim)}t.cc&&this.setRotationCenter(t.cc[0],t.cc[1]),(t.ifx!==void 0||t.ify!==void 0||t.sx!==void 0||t.sy!==void 0||t.anim!==void 0||t.cc!==void 0)&&this.onChildrenLocationChanged()}extraInitializationFromInitialInstance(t){const e=this.getAnimator();if(t.numberProperties)for(let i=0,n=t.numberProperties.length;i=this.hitBoxes.length&&this.hitBoxes.push(new s.Polygon);for(let i=0;i=this.hitBoxes[e].vertices.length&&this.hitBoxes[e].vertices.push([0,0]),t.transform(this._untransformedHitBoxes[e].vertices[i],this.hitBoxes[e].vertices[i]);this.hitBoxes[e].vertices.length=this._untransformedHitBoxes[e].vertices.length}}_updateUntransformedHitBoxes(){this._isUntransformedHitBoxesDirty=!1,this._untransformedHitBoxes.length=0;let t=Number.MAX_VALUE,e=Number.MAX_VALUE,i=-Number.MAX_VALUE,n=-Number.MAX_VALUE;for(const r of this._instanceContainer.getAdhocListOfAllInstances()){if(!r.isIncludedInParentCollisionMask())continue;Array.prototype.push.apply(this._untransformedHitBoxes,r.getHitBoxes());const a=r.getAABB();t=Math.min(t,a.min[0]),e=Math.min(e,a.min[1]),i=Math.max(i,a.max[0]),n=Math.max(n,a.max[1])}for(t===Number.MAX_VALUE&&(t=0,e=0,i=1,n=1),this._unrotatedAABB.min[0]=t,this._unrotatedAABB.min[1]=e,this._unrotatedAABB.max[0]=i,this._unrotatedAABB.max[1]=n;this.hitBoxes.length255&&(t=255),this.opacity=t,this.getRenderer().updateOpacity()}getOpacity(){return this.opacity}hide(t){t===void 0&&(t=!0),this.hidden=t,this.getRenderer().updateVisibility()}flipX(t){t!==this._flippedX&&(this._scaleX*=-1,this._flippedX=t,this.invalidateHitboxes(),this.getRenderer().update())}flipY(t){t!==this._flippedY&&(this._scaleY*=-1,this._flippedY=t,this.invalidateHitboxes(),this.getRenderer().update())}isFlippedX(){return this._flippedX}isFlippedY(){return this._flippedY}getAnimator(){return null}}s.CustomRuntimeObject=h,h.supportsReinitialization=!1})(gdjs||(gdjs={})); +//# sourceMappingURL=CustomRuntimeObject.js.map diff --git a/Export/CustomRuntimeObject2D.js b/Export/CustomRuntimeObject2D.js new file mode 100644 index 0000000..19c58a3 --- /dev/null +++ b/Export/CustomRuntimeObject2D.js @@ -0,0 +1,2 @@ +var gdjs;(function(t){class i extends t.CustomRuntimeObject{constructor(e,r,n){super(e,r,n)}_createRender(){const e=this._runtimeScene;return new t.CustomRuntimeObject2DRenderer(this,this._instanceContainer,e)}_reinitializeRenderer(){this.getRenderer().reinitialize(this,this.getParent())}getRenderer(){return super.getRenderer()}getRendererObject(){return this.getRenderer().getRendererObject()}}t.CustomRuntimeObject2D=i})(gdjs||(gdjs={})); +//# sourceMappingURL=CustomRuntimeObject2D.js.map diff --git a/Export/CustomRuntimeObjectInstanceContainer.js b/Export/CustomRuntimeObjectInstanceContainer.js new file mode 100644 index 0000000..ee7eed6 --- /dev/null +++ b/Export/CustomRuntimeObjectInstanceContainer.js @@ -0,0 +1,2 @@ +var gdjs;(function(s){class l extends s.RuntimeInstanceContainer{constructor(e,t){super(e.getGame());this._isLoaded=!1;this._initialInnerArea=null;this._parent=e,this._customObject=t,this._runtimeScene=e.getScene(),this._debuggerRenderer=new s.DebuggerRenderer(this)}addLayer(e){if(this._layers.containsKey(e.name))return;const t=new s.RuntimeCustomObjectLayer(e,this);this._layers.put(e.name,t),this._orderedLayers.push(t)}_unloadContent(){this.onDeletedFromScene(this._parent),this._layers.clear(),this._orderedLayers.length=0}createObject(e,t){const r=super.createObject(e,t);return this._customObject.onChildrenLocationChanged(),r}loadFrom(e,t){this._setOriginalInnerArea(t);for(let r=0,n=t.objects.length;r0)for(let r=0,n=t.layers.length;r0||this.getGame().isInGameEdition())&&(e._initialInnerArea||(e._initialInnerArea={min:[e.areaMinX,e.areaMinY,e.areaMinZ],max:[e.areaMaxX,e.areaMaxY,e.areaMaxZ]}),this._initialInnerArea=e._initialInnerArea)}onDeletedFromScene(e){if(!this._isLoaded)return;const t=this.getAdhocListOfAllInstances();for(let r=0,n=t.length;r255&&(t=255),this._opacity=t,this._renderer.updateOpacity()}getOpacity(){return this._opacity}setWrappingWidth(t){this._wrappingWidth=t,this._renderer.updateWrappingWidth(),this.invalidateHitboxes()}getWrappingWidth(){return this._wrappingWidth}setWrapping(t){this._wrapping=t,this._renderer.updateWrappingWidth(),this.invalidateHitboxes()}isWrapping(){return this._wrapping}getWidth(){return this._wrapping?this._wrappingWidth:this._renderer.getWidth()}getHeight(){return this._renderer.getHeight()}setWidth(t){this.setWrappingWidth(t)}getDrawableY(){return this.getY()-(this._verticalTextAlignment==="center"?this.getHeight()/2:this._verticalTextAlignment==="bottom"?this.getHeight():0)}}i.BitmapTextRuntimeObject=r,i.registerObject("BitmapText::BitmapTextObject",i.BitmapTextRuntimeObject)})(gdjs||(gdjs={})); +//# sourceMappingURL=bitmaptextruntimeobject.js.map diff --git a/Export/Extensions/DebuggerTools/debuggertools.js b/Export/Extensions/DebuggerTools/debuggertools.js new file mode 100644 index 0000000..cd051a4 --- /dev/null +++ b/Export/Extensions/DebuggerTools/debuggertools.js @@ -0,0 +1,2 @@ +var gdjs;(function(e){let c;(function(r){let i;(function(a){a.pause=function(n){n.getGame().pause(!0)},a.log=function(n,t,o){e.Logger.getLoggerOutput().log(o,n,t,!1)},a.enableDebugDraw=function(n,t,o,p,u){n.enableDebugDraw(t,o,p,u)}})(i=r.debuggerTools||(r.debuggerTools={}))})(c=e.evtTools||(e.evtTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=debuggertools.js.map diff --git a/Export/Extensions/PanelSpriteObject/panelspriteruntimeobject-pixi-renderer.js b/Export/Extensions/PanelSpriteObject/panelspriteruntimeobject-pixi-renderer.js new file mode 100644 index 0000000..f7b2514 --- /dev/null +++ b/Export/Extensions/PanelSpriteObject/panelspriteruntimeobject-pixi-renderer.js @@ -0,0 +1,2 @@ +var gdjs;(function(n){class p{constructor(t,o,e,r){this._wasRendered=!1;this._textureWidth=0;this._textureHeight=0;this._object=t;const s=o.getGame().getImageManager().getPIXITexture(e),i=r?PIXI.TilingSprite:PIXI.Sprite;this._spritesContainer=new PIXI.Container,this._wrapperContainer=new PIXI.Container,this._centerSprite=new i(new PIXI.Texture(s.baseTexture)),this._borderSprites=[new i(new PIXI.Texture(s.baseTexture)),new PIXI.Sprite(new PIXI.Texture(s.baseTexture)),new i(new PIXI.Texture(s.baseTexture)),new PIXI.Sprite(new PIXI.Texture(s.baseTexture)),new i(new PIXI.Texture(s.baseTexture)),new PIXI.Sprite(new PIXI.Texture(s.baseTexture)),new i(new PIXI.Texture(s.baseTexture)),new PIXI.Sprite(new PIXI.Texture(s.baseTexture))],this.setTexture(e,o),this._spritesContainer.removeChildren(),this._spritesContainer.addChild(this._centerSprite);for(let h=0;h=1;this._spritesContainer.cacheAsBitmap=t}this._wasRendered=!0}updateOpacity(){this._wrapperContainer.alpha=this._object.opacity/255}updateAngle(){this._wrapperContainer.rotation=n.toRad(this._object.angle)}updatePosition(){this._wrapperContainer.position.x=this._object.x+this._object._width/2,this._wrapperContainer.position.y=this._object.y+this._object._height/2}_updateLocalPositions(){const t=this._object;this._centerSprite.width=Math.max(t._width-t._rBorder-t._lBorder,0),this._centerSprite.height=Math.max(t._height-t._tBorder-t._bBorder,0);let o=t._lBorder,e=t._rBorder;this._centerSprite.width===0&&t._lBorder+t._rBorder>0&&(o=t._width*t._lBorder/(t._lBorder+t._rBorder),e=t._width-o);let r=t._tBorder,s=t._bBorder;this._centerSprite.height===0&&t._tBorder+t._bBorder>0&&(r=t._height*t._tBorder/(t._tBorder+t._bBorder),s=t._height-r),this._borderSprites[0].width=e,this._borderSprites[0].height=Math.max(t._height-r-s,0),this._borderSprites[2].height=r,this._borderSprites[2].width=Math.max(t._width-e-o,0),this._borderSprites[4].width=o,this._borderSprites[4].height=Math.max(t._height-r-s,0),this._borderSprites[6].height=s,this._borderSprites[6].width=Math.max(t._width-e-o,0),this._borderSprites[1].width=e,this._borderSprites[1].height=r,this._borderSprites[3].width=o,this._borderSprites[3].height=r,this._borderSprites[5].width=o,this._borderSprites[5].height=s,this._borderSprites[7].width=e,this._borderSprites[7].height=s,this._wasRendered=!0,this._spritesContainer.cacheAsBitmap=!1;const i=o,h=r,d=t._width-e,_=t._height-s;this._centerSprite.position.x=i,this._centerSprite.position.y=h,this._borderSprites[0].position.x=d,this._borderSprites[0].position.y=h,this._borderSprites[1].position.x=d,this._borderSprites[1].position.y=0,this._borderSprites[2].position.x=i,this._borderSprites[2].position.y=0,this._borderSprites[3].position.x=0,this._borderSprites[3].position.y=0,this._borderSprites[4].position.x=0,this._borderSprites[4].position.y=h,this._borderSprites[5].position.x=0,this._borderSprites[5].position.y=_,this._borderSprites[6].position.x=i,this._borderSprites[6].position.y=_,this._borderSprites[7].position.x=d,this._borderSprites[7].position.y=_}setTexture(t,o){const e=this._object,r=o.getGame().getImageManager().getPIXITexture(t).baseTexture;this._textureWidth=r.width,this._textureHeight=r.height;function s(i){return i.width<0&&(i.width=0),i.height<0&&(i.height=0),i.x<0&&(i.x=0),i.y<0&&(i.y=0),i.x>r.width&&(i.x=r.width),i.y>r.height&&(i.y=r.height),i.x+i.width>r.width&&(i.width=r.width-i.x),i.y+i.height>r.height&&(i.height=r.height-i.y),i}this._centerSprite.texture.destroy(!1),this._centerSprite.texture=new PIXI.Texture(r,s(new PIXI.Rectangle(e._lBorder,e._tBorder,r.width-e._lBorder-e._rBorder,r.height-e._tBorder-e._bBorder))),this._borderSprites[0].texture.destroy(!1),this._borderSprites[0].texture=new PIXI.Texture(r,s(new PIXI.Rectangle(r.width-e._rBorder,e._tBorder,e._rBorder,r.height-e._tBorder-e._bBorder))),this._borderSprites[2].texture.destroy(!1),this._borderSprites[2].texture=new PIXI.Texture(r,s(new PIXI.Rectangle(e._lBorder,0,r.width-e._lBorder-e._rBorder,e._tBorder))),this._borderSprites[4].texture.destroy(!1),this._borderSprites[4].texture=new PIXI.Texture(r,s(new PIXI.Rectangle(0,e._tBorder,e._lBorder,r.height-e._tBorder-e._bBorder))),this._borderSprites[6].texture.destroy(!1),this._borderSprites[6].texture=new PIXI.Texture(r,s(new PIXI.Rectangle(e._lBorder,r.height-e._bBorder,r.width-e._lBorder-e._rBorder,e._bBorder))),this._borderSprites[1].texture.destroy(!1),this._borderSprites[1].texture=new PIXI.Texture(r,s(new PIXI.Rectangle(r.width-e._rBorder,0,e._rBorder,e._tBorder))),this._borderSprites[3].texture.destroy(!1),this._borderSprites[3].texture=new PIXI.Texture(r,s(new PIXI.Rectangle(0,0,e._lBorder,e._tBorder))),this._borderSprites[5].texture.destroy(!1),this._borderSprites[5].texture=new PIXI.Texture(r,s(new PIXI.Rectangle(0,r.height-e._bBorder,e._lBorder,e._bBorder))),this._borderSprites[7].texture.destroy(!1),this._borderSprites[7].texture=new PIXI.Texture(r,s(new PIXI.Rectangle(r.width-e._rBorder,r.height-e._bBorder,e._rBorder,e._bBorder))),this._updateLocalPositions(),this.updatePosition(),this._wrapperContainer.pivot.x=this._object._width/2,this._wrapperContainer.pivot.y=this._object._height/2}updateWidth(){this._wrapperContainer.pivot.x=this._object._width/2,this._updateLocalPositions(),this.updatePosition()}updateHeight(){this._wrapperContainer.pivot.y=this._object._height/2,this._updateLocalPositions(),this.updatePosition()}setColor(t){const o=n.rgbOrHexStringToNumber(t);this._centerSprite.tint=o;for(let e=0;e255&&(e=255),this.opacity=e,this._renderer.updateOpacity()}getOpacity(){return this.opacity}setColor(e){this._renderer.setColor(e)}getColor(){return this._renderer.getColor()}getScale(){const e=Math.abs(this.getScaleX()),t=Math.abs(this.getScaleY());return e===t?e:Math.sqrt(e*t)}getScaleX(){return this._width/this._renderer.getTextureWidth()}getScaleY(){return this._height/this._renderer.getTextureHeight()}setScale(e){this.setWidth(this._renderer.getTextureWidth()*e),this.setHeight(this._renderer.getTextureHeight()*e)}setScaleX(e){this.setWidth(this._renderer.getTextureWidth()*e)}setScaleY(e){this.setHeight(this._renderer.getTextureHeight()*e)}}i.PanelSpriteRuntimeObject=s,i.registerObject("PanelSpriteObject::PanelSprite",i.PanelSpriteRuntimeObject)})(gdjs||(gdjs={})); +//# sourceMappingURL=panelspriteruntimeobject.js.map diff --git a/Export/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js b/Export/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js new file mode 100644 index 0000000..8525345 --- /dev/null +++ b/Export/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js @@ -0,0 +1,2 @@ +var gdjs;(function(a){const f={text:"text",email:"email",password:"password",number:"number","telephone number":"tel",url:"url",search:"search"},o=(h,t)=>"rgba("+h[0]+","+h[1]+","+h[2]+","+t/255+")";class r{constructor(t,e){this._input=null;this._form=null;this._object=t,this._instanceContainer=e,this._runtimeGame=this._instanceContainer.getGame(),this._createElement()}_createElement(){if(this._input)throw new Error("Tried to recreate an input while it already exists.");this._form=document.createElement("form");const t=this._object.getInputType()==="text area";this._input=document.createElement(t?"textarea":"input"),this._form.style.border="0px",this._form.style.borderRadius="0px",this._form.style.backgroundColor="transparent",this._form.style.position="absolute",this._form.style.pointerEvents="auto",this._form.style.display="none",this._form.style.boxSizing="border-box",this._form.style.textAlign=this._object.getTextAlign(),this._input.autocomplete="off",this._input.style.backgroundColor="white",this._input.style.outline="none",this._input.style.resize="none",this._input.style.border="1px solid black",this._input.style.boxSizing="border-box",this._input.style.borderRadius="0px",this._input.style.width="100%",this._input.style.height="100%",this._input.maxLength=this._object.getMaxLength(),this._input.style.padding=`${this._object.getPaddingY().toFixed(2)}px ${this._object.getPaddingX().toFixed(2)}px`,this._form.appendChild(this._input),this._input.addEventListener("input",()=>{!this._input||this._object.onRendererInputValueChanged(this._input.value)}),this._input.addEventListener("touchstart",()=>{!this._input||document.activeElement!==this._input&&this._input.focus()}),this._form.addEventListener("submit",e=>{e.preventDefault(),this._object.onRendererFormSubmitted()}),this.updateString(),this.updateFont(),this.updatePlaceholder(),this.updateOpacity(),this.updateInputType(),this.updateTextColor(),this.updateFillColorAndOpacity(),this.updateBorderColorAndOpacity(),this.updateBorderWidth(),this.updateDisabled(),this.updateReadOnly(),this.updateSpellCheck(),this.updateTextAlign(),this.updateMaxLength(),this.updatePadding(),this._runtimeGame.getRenderer().getDomElementContainer().appendChild(this._form)}_destroyElement(){this._form&&(this._form.remove(),this._form=null),this._input&&(this._input.remove(),this._input=null)}onScenePaused(){this._destroyElement()}onSceneResumed(){this._input||this._createElement()}onDestroy(){this._destroyElement()}updatePreRender(){if(!this._input||!this._form)return;if(this._object.isHidden()){this._form.style.display="none";return}{let n=this._instanceContainer,s=this._object,b=!0;do{if(!n.getLayer(s.getLayer()).isVisible()||!s.isVisible()){this._form.style.display="none";return}n instanceof a.CustomRuntimeObjectInstanceContainer?(s=n.getOwner(),n=s.getInstanceContainer()):b=!1}while(b)}const t=a.staticArray(r.prototype.updatePreRender),e=this._instanceContainer.getGame(),i=e.getRenderer(),u=this._instanceContainer.getLayer(this._object.getLayer()),p=u.convertInverseCoords(this._object.x,this._object.y,0,t),l=p[0],d=p[1],c=u.convertInverseCoords(this._object.x+this._object.getWidth(),this._object.y+this._object.getHeight(),0,t),_=c[0],m=c[1];if(_<0||m<0||l>e.getGameResolutionWidth()||d>e.getGameResolutionHeight()){this._form.style.display="none";return}t[0]=l,t[1]=d,i.convertCanvasToDomElementContainerCoords(t,t);const g=t[0],y=t[1];t[0]=_,t[1]=m,i.convertCanvasToDomElementContainerCoords(t,t);const x=t[0],j=t[1],C=x-g,T=j-y;this._form.style.left=g+"px",this._form.style.top=y+"px",this._form.style.width=C+"px",this._form.style.height=T+"px",this._form.style.transform="rotate3d(0,0,1,"+this._object.getAngle()%360+"deg)",this._form.style.textAlign=this._object.getTextAlign(),this._input.style.padding=`${this._object.getPaddingY().toFixed(2)}px ${this._object.getPaddingX().toFixed(2)}px`,this._input.style.fontSize=this._object.getFontSize()*i.getCanvasToDomElementContainerHeightScale()+"px",this._form.style.display="initial"}updateString(){!this._input||(this._input.value=this._object.getString())}updatePlaceholder(){!this._input||(this._input.placeholder=this._object.getPlaceholder())}updateFont(){!this._input||(this._input.style.fontFamily=this._instanceContainer.getGame().getFontManager().getFontFamily(this._object.getFontResourceName()))}updateOpacity(){!this._form||(this._form.style.opacity=(this._object.getOpacity()/255).toFixed(3))}updateInputType(){if(!this._input)return;const t=this._input instanceof HTMLTextAreaElement,e=this._object.getInputType()==="text area";t!==e&&(this._destroyElement(),this._createElement());const i=f[this._object.getInputType()]||"text";this._input.setAttribute("type",i)}updateTextColor(){!this._input||(this._input.style.color=o(this._object._getRawTextColor(),255))}updateFillColorAndOpacity(){!this._input||(this._input.style.backgroundColor=o(this._object._getRawFillColor(),this._object.getFillOpacity()))}updateBorderColorAndOpacity(){!this._input||(this._input.style.borderColor=o(this._object._getRawBorderColor(),this._object.getBorderOpacity()))}updateBorderWidth(){!this._input||(this._input.style.borderWidth=this._object.getBorderWidth()+"px")}updateDisabled(){!this._input||(this._input.disabled=this._object.isDisabled())}updateReadOnly(){!this._input||(this._input.readOnly=this._object.isReadOnly())}updateSpellCheck(){!this._input||(this._input.spellcheck=this._object.isSpellCheckEnabled())}updateMaxLength(){const t=this._input;if(!!t){if(this._object.getMaxLength()<=0){t.removeAttribute("maxLength");return}t.maxLength=this._object.getMaxLength()}}updatePadding(){!this._input||(this._input.style.padding=`${this._object.getPaddingY().toFixed(2)}px ${this._object.getPaddingX().toFixed(2)}px`)}updateTextAlign(){if(!this._input)return;const t=this._object.getTextAlign();this._input.style.textAlign=t}isFocused(){return this._input===document.activeElement}focus(){!this._input||this._input.focus()}}a.TextInputRuntimeObjectRenderer=r})(gdjs||(gdjs={})); +//# sourceMappingURL=textinputruntimeobject-pixi-renderer.js.map diff --git a/Export/Extensions/TextInput/textinputruntimeobject.js b/Export/Extensions/TextInput/textinputruntimeobject.js new file mode 100644 index 0000000..d61b97a --- /dev/null +++ b/Export/Extensions/TextInput/textinputruntimeobject.js @@ -0,0 +1,2 @@ +var gdjs;(function(i){const d=["text","email","password","number","telephone number","url","search","text area"],l=["left","center","right"],n=r=>{const e=r.toLowerCase();return d.includes(e)?r:"text"},o=r=>{if(!r)return"left";const e=r.toLowerCase();return l.includes(e)?r:"left"},p=300,h=30,s=(r,e,t)=>Math.max(0,Math.min(e/2-t,r));class g extends i.RuntimeObject{constructor(e,t,u){super(e,t,u);this.opacity=255;this._width=p;this._height=h;this._string=t.content.initialValue,this._placeholder=t.content.placeholder,this._fontResourceName=t.content.fontResourceName,this._fontSize=t.content.fontSize||20,this._inputType=n(t.content.inputType),this._textColor=i.rgbOrHexToRGBColor(t.content.textColor),this._fillColor=i.rgbOrHexToRGBColor(t.content.fillColor),this._fillOpacity=t.content.fillOpacity,this._borderColor=i.rgbOrHexToRGBColor(t.content.borderColor),this._borderOpacity=t.content.borderOpacity,this._borderWidth=t.content.borderWidth,this._disabled=e.getGame().isInGameEdition()?!0:t.content.disabled,this._readOnly=t.content.readOnly,this._spellCheck=t.content.spellCheck!==void 0?t.content.spellCheck:!1,this._textAlign=o(t.content.textAlign),this._maxLength=t.content.maxLength||0,this._paddingX=t.content.paddingX!==void 0?t.content.paddingX:2,this._paddingY=t.content.paddingY!==void 0?t.content.paddingY:1,this._isSubmitted=!1,this._renderer=new i.TextInputRuntimeObjectRenderer(this,e),this.onCreated()}getRendererObject(){return null}updateFromObjectData(e,t){return e.content.initialValue!==t.content.initialValue&&this._string===e.content.initialValue&&this.setString(t.content.initialValue),e.content.placeholder!==t.content.placeholder&&this.setPlaceholder(t.content.placeholder),e.content.fontResourceName!==t.content.fontResourceName&&this.setFontResourceName(t.content.fontResourceName),e.content.fontSize!==t.content.fontSize&&this.setFontSize(t.content.fontSize),e.content.inputType!==t.content.inputType&&this.setInputType(t.content.inputType),e.content.textColor!==t.content.textColor&&this.setTextColor(t.content.textColor),e.content.fillColor!==t.content.fillColor&&this.setFillColor(t.content.fillColor),e.content.fillOpacity!==t.content.fillOpacity&&this.setFillOpacity(t.content.fillOpacity),e.content.borderColor!==t.content.borderColor&&this.setBorderColor(t.content.borderColor),e.content.borderOpacity!==t.content.borderOpacity&&this.setBorderOpacity(t.content.borderOpacity),e.content.borderWidth!==t.content.borderWidth&&this.setBorderWidth(t.content.borderWidth),e.content.disabled!==t.content.disabled&&this.setDisabled(t.content.disabled),e.content.readOnly!==t.content.readOnly&&this.setReadOnly(t.content.readOnly),t.content.spellCheck!==void 0&&e.content.spellCheck!==t.content.spellCheck&&this.setSpellCheck(t.content.spellCheck),t.content.maxLength!==void 0&&e.content.maxLength!==t.content.maxLength&&this.setMaxLength(t.content.maxLength),t.content.textAlign&&e.content.textAlign!==t.content.textAlign&&(this._textAlign=t.content.textAlign),t.content.paddingX!==void 0&&e.content.paddingX!==t.content.paddingX&&this.setPaddingX(t.content.paddingX),t.content.paddingY!==void 0&&e.content.paddingY!==t.content.paddingY&&this.setPaddingY(t.content.paddingY),!0}getNetworkSyncData(e){return{...super.getNetworkSyncData(e),opa:this.getOpacity(),txt:this.getText(),frn:this.getFontResourceName(),fs:this.getFontSize(),place:this.getPlaceholder(),it:this.getInputType(),tc:this.getTextColor(),fc:this.getFillColor(),fo:this.getFillOpacity(),bc:this.getBorderColor(),bo:this.getBorderOpacity(),bw:this.getBorderWidth(),dis:this.isDisabled(),ro:this.isReadOnly(),sc:this.isSpellCheckEnabled()}}updateFromNetworkSyncData(e,t){super.updateFromNetworkSyncData(e,t),e.opa!==void 0&&this.setOpacity(e.opa),e.txt!==void 0&&this.setText(e.txt),e.frn!==void 0&&this.setFontResourceName(e.frn),e.fs!==void 0&&this.setFontSize(e.fs),e.place!==void 0&&this.setPlaceholder(e.place),e.it!==void 0&&this.setInputType(e.it),e.tc!==void 0&&this.setTextColor(e.tc),e.fc!==void 0&&this.setFillColor(e.fc),e.fo!==void 0&&this.setFillOpacity(e.fo),e.bc!==void 0&&this.setBorderColor(e.bc),e.bo!==void 0&&this.setBorderOpacity(e.bo),e.bw!==void 0&&this.setBorderWidth(e.bw),e.dis!==void 0&&this.setDisabled(e.dis),e.ro!==void 0&&this.setReadOnly(e.ro),e.sc!==void 0&&this.setSpellCheck(e.sc)}updatePreRender(e){this._isSubmitted=!1,this._renderer.updatePreRender()}extraInitializationFromInitialInstance(e){for(const t of e.stringProperties)t.name==="initialValue"?this.setString(t.value):t.name==="placeholder"&&this.setPlaceholder(t.value);e.customSize&&(this.setWidth(e.width),this.setHeight(e.height),this._renderer.updatePadding()),this.setOpacity(e.opacity===void 0?255:e.opacity)}onScenePaused(e){this._renderer.onScenePaused()}onSceneResumed(e){this._renderer.onSceneResumed()}onDestroyed(){super.onDestroyed(),this._renderer.onDestroy()}setOpacity(e){this.opacity=Math.max(0,Math.min(255,e)),this._renderer.updateOpacity()}getOpacity(){return this.opacity}setSize(e,t){this.setWidth(e),this.setHeight(t)}setWidth(e){this._width=e,this._renderer.updatePadding()}setHeight(e){this._height=e,this._renderer.updatePadding()}getWidth(){return this._width}getHeight(){return this._height}getString(){return this.getText()}setString(e){this.setText(e)}getText(){return this._string}setText(e){e!==this._string&&(this._string=e,this._renderer.updateString())}onRendererInputValueChanged(e){this._string=e}onRendererFormSubmitted(){this._isSubmitted=!0}getFontResourceName(){return this._fontResourceName}setFontResourceName(e){this._fontResourceName!==e&&(this._fontResourceName=e,this._renderer.updateFont())}getFontSize(){return this._fontSize}setFontSize(e){this._fontSize=e}getPlaceholder(){return this._placeholder}setPlaceholder(e){e!==this._placeholder&&(this._placeholder=e,this._renderer.updatePlaceholder())}getInputType(){return this._inputType}setInputType(e){const t=e.toLowerCase();t!==this._inputType&&(this._inputType=n(t),this._renderer.updateInputType())}setTextColor(e){this._textColor=i.rgbOrHexToRGBColor(e),this._renderer.updateTextColor()}getTextColor(){return this._textColor[0]+";"+this._textColor[1]+";"+this._textColor[2]}_getRawTextColor(){return this._textColor}setFillColor(e){this._fillColor=i.rgbOrHexToRGBColor(e),this._renderer.updateFillColorAndOpacity()}getFillColor(){return this._fillColor[0]+";"+this._fillColor[1]+";"+this._fillColor[2]}_getRawFillColor(){return this._fillColor}setFillOpacity(e){this._fillOpacity=Math.max(0,Math.min(255,e)),this._renderer.updateFillColorAndOpacity()}getFillOpacity(){return this._fillOpacity}setBorderColor(e){this._borderColor=i.rgbOrHexToRGBColor(e),this._renderer.updateBorderColorAndOpacity()}getBorderColor(){return this._borderColor[0]+";"+this._borderColor[1]+";"+this._borderColor[2]}_getRawBorderColor(){return this._borderColor}setBorderOpacity(e){this._borderOpacity=Math.max(0,Math.min(255,e)),this._renderer.updateBorderColorAndOpacity()}getBorderOpacity(){return this._borderOpacity}setBorderWidth(e){this._borderWidth=Math.max(0,e),this._renderer.updateBorderWidth()}getBorderWidth(){return this._borderWidth}setDisabled(e){this.getInstanceContainer().getGame().isInGameEdition()||(this._disabled=e,this._renderer.updateDisabled())}isDisabled(){return this._disabled}setReadOnly(e){this._readOnly=e,this._renderer.updateReadOnly()}isReadOnly(){return this._readOnly}setSpellCheck(e){this._spellCheck=e,this._renderer.updateSpellCheck()}isSpellCheckEnabled(){return this._spellCheck}isFocused(){return this._renderer.isFocused()}isSubmitted(){return this._isSubmitted}getMaxLength(){return this._maxLength}setMaxLength(e){this._maxLength!==e&&(this._maxLength=e,this._renderer.updateMaxLength())}getPaddingX(){return s(this._paddingX,this._width,this._borderWidth)}setPaddingX(e){if(this._paddingX!==e){if(e<0){this._paddingX=0;return}this._paddingX=e,this._renderer.updatePadding()}}getPaddingY(){return s(this._paddingY,this._height,this._borderWidth)}setPaddingY(e){if(this._paddingY!==e){if(e<0){this._paddingY=0;return}this._paddingY=e,this._renderer.updatePadding()}}getTextAlign(){return this._textAlign}setTextAlign(e){const t=o(e);t!==this._textAlign&&(this._textAlign=t,this._renderer.updateTextAlign())}focus(){this.isFocused()||this.getInstanceContainer().getGame().getInputManager().clearAllPressedKeys(),this._renderer.focus()}}i.TextInputRuntimeObject=g,i.registerObject("TextInput::TextInputObject",i.TextInputRuntimeObject)})(gdjs||(gdjs={})); +//# sourceMappingURL=textinputruntimeobject.js.map diff --git a/Export/Extensions/TextObject/textruntimeobject-pixi-renderer.js b/Export/Extensions/TextObject/textruntimeobject-pixi-renderer.js new file mode 100644 index 0000000..1412057 --- /dev/null +++ b/Export/Extensions/TextObject/textruntimeobject-pixi-renderer.js @@ -0,0 +1,2 @@ +var gdjs;(function(i){class s{constructor(e,t){this._justCreated=!0;this._object=e,this._fontManager=t.getGame().getFontManager(),this._text=new PIXI.Text(" ",{align:"left"}),this._text.anchor.x=.5,this._text.anchor.y=.5,t.getLayer("").getRenderer().addRendererObject(this._text,e.getZOrder()),this._text.text=e._str.length===0?" ":e._str,this.updateStyle(),this.updatePosition()}getRendererObject(){return this._text}ensureUpToDate(){this._justCreated&&(this._text.updateText(!1),this.updatePosition(),this._justCreated=!1)}updateStyle(){const e='"'+this._fontManager.getFontFamily(this._object._fontName)+'"',t=this._text.style;t.fontStyle=this._object._italic?"italic":"normal",t.fontWeight=this._object._bold?"bold":"normal",t.fontSize=this._object._characterSize,t.fontFamily=e,this._object._useGradient?t.fill=this._getGradientHex():t.fill=this._getColorHex(),this._object._gradientType==="LINEAR_VERTICAL"?t.fillGradientType=PIXI.TEXT_GRADIENT.LINEAR_VERTICAL:t.fillGradientType=PIXI.TEXT_GRADIENT.LINEAR_HORIZONTAL,t.align=this._object._textAlign,t.wordWrap=this._object._wrapping,t.wordWrapWidth=this._object._wrappingWidth,t.breakWords=!0,t.stroke=i.rgbToHexNumber(this._object._outlineColor[0],this._object._outlineColor[1],this._object._outlineColor[2]),t.strokeThickness=this._object._isOutlineEnabled?this._object._outlineThickness:0,t.dropShadow=this._object._shadow,t.dropShadowColor=i.rgbToHexNumber(this._object._shadowColor[0],this._object._shadowColor[1],this._object._shadowColor[2]),t.dropShadowAlpha=this._object._shadowOpacity/255,t.dropShadowBlur=this._object._shadowBlur,t.dropShadowAngle=i.toRad(this._object._shadowAngle),t.dropShadowDistance=this._object._shadowDistance;const o=t.dropShadow?t.dropShadowDistance+t.dropShadowBlur:0;t.padding=Math.ceil(this._object._padding+o),t.lineHeight=this._object._lineHeight,t.miterLimit=3,this.updatePosition(),this._text.dirty=!0}updatePosition(){if(this._object.isWrapping()&&this._text.width!==0){const t=this._object._textAlign==="right"?1:this._object._textAlign==="center"?.5:0,o=this._object.getWrappingWidth(),h=(o-this._text.width)*(t-.5);this._text.position.x=this._object.x+o/2,this._text.anchor.x=.5-h/this._text.width}else this._text.position.x=this._object.x+this._text.width/2,this._text.anchor.x=.5;const e=this._object._verticalTextAlignment==="bottom"?1:this._object._verticalTextAlignment==="center"?.5:0;this._text.position.y=this._object.y+this._text.height*(.5-e),this._text.anchor.y=.5}updateAngle(){this._text.rotation=i.toRad(this._object.angle)}updateOpacity(){this._text.alpha=this._object.opacity/255}updateString(){this._text.text=this._object._str.length===0?" ":this._object._str,this._text.updateText(!1)}getWidth(){return this._text.width}getHeight(){return this._text.height}_getColorHex(){return i.rgbToHexNumber(this._object._color[0],this._object._color[1],this._object._color[2])}_getGradientHex(){const e=[];for(let t=0;t255&&(e=255),this.opacity=e,this._renderer.updateOpacity()}getOpacity(){return this.opacity}getString(){return this.getText()}setString(e){this.setText(e)}getText(){return this._str}setText(e){e!==this._str&&(this._str=e,this._renderer.updateString(),this._updateTextPosition())}getCharacterSize(){return this._characterSize}setCharacterSize(e){e<=1&&(e=1),this._characterSize=e,this._renderer.updateStyle()}getLineHeight(){return this._lineHeight}setLineHeight(e){this._lineHeight=e,this._renderer.updateStyle()}setFontName(e){this._fontName=e,this._renderer.updateStyle()}isBold(){return this._bold}setBold(e){this._bold=e,this._renderer.updateStyle()}isItalic(){return this._italic}setItalic(e){this._italic=e,this._renderer.updateStyle()}getWidth(){return this._wrapping?this._wrappingWidth:this._renderer.getWidth()}getHeight(){return this._renderer.getHeight()}getScaleMean(){return(Math.abs(this._scaleX)+Math.abs(this._scaleY))/2}getScale(){const e=Math.abs(this._scaleX),r=Math.abs(this._scaleY);return e===r?e:Math.sqrt(e*r)}getScaleX(){return this._scaleX}getScaleY(){return this._scaleY}setScale(e){this._scaleX===e&&this._scaleY===e||(this._scaleX=e,this._scaleY=e,this._renderer.setScale(e),this.invalidateHitboxes())}setScaleX(e){this._scaleX!==e&&(this._scaleX=e,this._renderer.setScaleX(e),this.invalidateHitboxes())}setScaleY(e){this._scaleY!==e&&(this._scaleY=e,this._renderer.setScaleY(e),this.invalidateHitboxes())}setColor(e){this._color=s.rgbOrHexToRGBColor(e),this._useGradient=!1,this._renderer.updateStyle()}getColor(){return this._color[0]+";"+this._color[1]+";"+this._color[2]}setVerticalTextAlignment(e){this._verticalTextAlignment=e,this._renderer.updateStyle()}getVerticalTextAlignment(){return this._verticalTextAlignment}setTextAlignment(e){this._textAlign=e,this._renderer.updateStyle()}getTextAlignment(){return this._textAlign}isWrapping(){return this._wrapping}setWrapping(e){this._wrapping!==e&&(this._wrapping=e,this._renderer.updateStyle(),this.invalidateHitboxes())}getWrappingWidth(){return this._wrappingWidth}setWrappingWidth(e){e<=1&&(e=1),this._wrappingWidth!==e&&(this._wrappingWidth=e,this._wrapping&&(this._renderer.updateStyle(),this.invalidateHitboxes()))}setWidth(e){this.setWrappingWidth(e)}getDrawableY(){return this.getY()-(this._verticalTextAlignment==="center"?this.getHeight()/2:this._verticalTextAlignment==="bottom"?this.getHeight():0)}setOutline(e,r){this._outlineColor=s.rgbOrHexToRGBColor(e),this._outlineThickness=r,this._renderer.updateStyle()}isOutlineEnabled(){return this._isOutlineEnabled}setOutlineEnabled(e){this._isOutlineEnabled=e,this._renderer.updateStyle()}getOutlineThickness(){return this._outlineThickness}setOutlineThickness(e){this._outlineThickness=e,this._renderer.updateStyle()}setOutlineColor(e){this._outlineColor=s.rgbOrHexToRGBColor(e),this._renderer.updateStyle()}setShadow(e,r,i,t){this._shadowColor=s.rgbOrHexToRGBColor(e),this._shadowDistance=r,this._shadowBlur=i,this._shadowAngle=t,this._shadow=!0,this._renderer.updateStyle()}isShadowEnabled(){return this._shadow}showShadow(e){this._shadow=e,this._renderer.updateStyle()}getShadowOpacity(){return this._shadowOpacity}setShadowOpacity(e){this._shadowOpacity=e,this._renderer.updateStyle()}getShadowDistance(){return this._shadowDistance}setShadowDistance(e){this._shadowDistance=e,this._renderer.updateStyle()}getShadowAngle(){return this._shadowAngle}setShadowAngle(e){this._shadowAngle=e,this._renderer.updateStyle()}getShadowBlurRadius(){return this._shadowBlur}setShadowBlurRadius(e){this._shadowBlur=e,this._renderer.updateStyle()}setShadowColor(e){this._shadowColor=s.rgbOrHexToRGBColor(e),this._renderer.updateStyle()}setGradient(e,r,i,t,n){this._gradient=[],r&&this._gradient.push(s.rgbOrHexToRGBColor(r)),i&&this._gradient.push(s.rgbOrHexToRGBColor(i)),t&&this._gradient.push(s.rgbOrHexToRGBColor(t)),n&&this._gradient.push(s.rgbOrHexToRGBColor(n)),this._gradientType=e,this._useGradient=this._gradient.length>1,this._renderer.updateStyle()}getPadding(){return this._padding}setPadding(e){this._padding=e,this._renderer.updateStyle()}}s.TextRuntimeObject=o,s.registerObject("TextObject::Text",s.TextRuntimeObject)})(gdjs||(gdjs={})); +//# sourceMappingURL=textruntimeobject.js.map diff --git a/Export/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js b/Export/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js new file mode 100644 index 0000000..8e8b267 --- /dev/null +++ b/Export/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(f){class d extends f.RuntimeBehavior{constructor(e,t,s){super(e,t,s);this._angle=0;this._xVelocity=0;this._yVelocity=0;this._angularSpeed=0;this._leftKey=!1;this._rightKey=!1;this._upKey=!1;this._downKey=!1;this._leftKeyPressedDuration=0;this._rightKeyPressedDuration=0;this._upKeyPressedDuration=0;this._downKeyPressedDuration=0;this._wasStickUsed=!1;this._stickAngle=0;this._stickForce=0;this._clearInputsBetweenFrames=!0;this._ignoreDefaultControlsAsSyncedByNetwork=!1;this._wasLeftKeyPressed=!1;this._wasRightKeyPressed=!1;this._wasUpKeyPressed=!1;this._wasDownKeyPressed=!1;this._temporaryPointForTransformations=[0,0];this._topDownMovementHooks=[];this._allowDiagonals=t.allowDiagonals,this._acceleration=t.acceleration,this._deceleration=t.deceleration,this._maxSpeed=t.maxSpeed,this._angularMaxSpeed=t.angularMaxSpeed,this._rotateObject=t.rotateObject,this._angleOffset=t.angleOffset,this._ignoreDefaultControls=t.ignoreDefaultControls,this.setViewpoint(t.viewpoint,t.customIsometryAngle),this._movementAngleOffset=t.movementAngleOffset||0,this._useLegacyTurnBack=t.useLegacyTurnBack===void 0?!0:t.useLegacyTurnBack}getNetworkSyncData(e){return this._clearInputsBetweenFrames=!0,this._ignoreDefaultControlsAsSyncedByNetwork=!1,{...super.getNetworkSyncData(e),props:{a:this._angle,xv:this._xVelocity,yv:this._yVelocity,as:this._angularSpeed,lk:this._wasLeftKeyPressed,rk:this._wasRightKeyPressed,uk:this._wasUpKeyPressed,dk:this._wasDownKeyPressed,wsu:this._wasStickUsed,sa:this._stickAngle,sf:this._stickForce}}}updateFromNetworkSyncData(e,t){super.updateFromNetworkSyncData(e,t);const s=e.props;s.a!==void 0&&(this._angle=s.a),s.xv!==void 0&&(this._xVelocity=s.xv),s.yv!==void 0&&(this._yVelocity=s.yv),s.as!==void 0&&(this._angularSpeed=s.as),s.lk!==void 0&&(this._leftKey=s.lk),s.rk!==void 0&&(this._rightKey=s.rk),s.uk!==void 0&&(this._upKey=s.uk),s.dk!==void 0&&(this._downKey=s.dk),s.wsu!==void 0&&(this._wasStickUsed=s.wsu),s.sa!==void 0&&(this._stickAngle=s.sa),s.sf!==void 0&&(this._stickForce=s.sf),this._clearInputsBetweenFrames=!!t.clearInputs,this._ignoreDefaultControlsAsSyncedByNetwork=!t.keepControl}applyBehaviorOverriding(e){return e.allowDiagonals!==void 0&&(this._allowDiagonals=e.allowDiagonals),e.acceleration!==void 0&&(this._acceleration=e.acceleration),e.deceleration!==void 0&&(this._deceleration=e.deceleration),e.maxSpeed!==void 0&&(this._maxSpeed=e.maxSpeed),e.angularMaxSpeed!==void 0&&(this._angularMaxSpeed=e.angularMaxSpeed),e.rotateObject!==void 0&&(this._rotateObject=e.rotateObject),e.angleOffset!==void 0&&(this._angleOffset=e.angleOffset),e.ignoreDefaultControls!==void 0&&(this._ignoreDefaultControls=e.ignoreDefaultControls),(e.platformType!==void 0||e.customIsometryAngle!==void 0)&&this.setViewpoint(e.platformType,e.customIsometryAngle),e.movementAngleOffset!==void 0&&(this._movementAngleOffset=e.movementAngleOffset),!0}setViewpoint(e,t){e==="PixelIsometry"?this._basisTransformation=new f.TopDownMovementRuntimeBehavior.IsometryTransformation(Math.atan(.5)):e==="TrueIsometry"?this._basisTransformation=new f.TopDownMovementRuntimeBehavior.IsometryTransformation(Math.PI/6):e==="CustomIsometry"?this._basisTransformation=new f.TopDownMovementRuntimeBehavior.IsometryTransformation(t*Math.PI/180):this._basisTransformation=null}setAcceleration(e){this._acceleration=e}getAcceleration(){return this._acceleration}setDeceleration(e){this._deceleration=e}getDeceleration(){return this._deceleration}setMaxSpeed(e){this._maxSpeed=e}getMaxSpeed(){return this._maxSpeed}setAngularMaxSpeed(e){this._angularMaxSpeed=e}getAngularMaxSpeed(){return this._angularMaxSpeed}setAngleOffset(e){this._angleOffset=e}getAngleOffset(){return this._angleOffset}allowDiagonals(e){this._allowDiagonals=e}diagonalsAllowed(){return this._allowDiagonals}setRotateObject(e){this._rotateObject=e}isObjectRotated(){return this._rotateObject}isMoving(){return this._xVelocity!==0||this._yVelocity!==0}getSpeed(){return Math.hypot(this._xVelocity,this._yVelocity)}getXVelocity(){return this._xVelocity}setXVelocity(e){this._xVelocity=e}getYVelocity(){return this._yVelocity}setYVelocity(e){this._yVelocity=e}getAngle(){return this._angle}isMovementAngleAround(e,t){return Math.abs(f.evtTools.common.angleDifference(this._angle,e))<=t}setMovementAngleOffset(e){this._movementAngleOffset=e}getMovementAngleOffset(){return this._movementAngleOffset}doStepPreEvents(e){const t=37,s=38,h=39,r=40;this._leftKey||(this._leftKey=!this.shouldIgnoreDefaultControls()&&e.getGame().getInputManager().isKeyPressed(t)),this._rightKey||(this._rightKey=!this.shouldIgnoreDefaultControls()&&e.getGame().getInputManager().isKeyPressed(h)),this._downKey||(this._downKey=!this.shouldIgnoreDefaultControls()&&e.getGame().getInputManager().isKeyPressed(r)),this._upKey||(this._upKey=!this.shouldIgnoreDefaultControls()&&e.getGame().getInputManager().isKeyPressed(s));const a=this.owner.getElapsedTime();this._leftKey?this._leftKeyPressedDuration+=a:this._leftKeyPressedDuration=0,this._rightKey?this._rightKeyPressedDuration+=a:this._rightKeyPressedDuration=0,this._downKey?this._downKeyPressedDuration+=a:this._downKeyPressedDuration=0,this._upKey?this._upKeyPressedDuration+=a:this._upKeyPressedDuration=0;let o=-1;this._allowDiagonals?this._upKey&&!this._downKey?this._leftKey&&!this._rightKey?o=5:!this._leftKey&&this._rightKey?o=7:o=6:!this._upKey&&this._downKey?this._leftKey&&!this._rightKey?o=3:!this._leftKey&&this._rightKey?o=1:o=2:this._leftKey&&!this._rightKey?o=4:!this._leftKey&&this._rightKey&&(o=0):(this._upKey&&!this._downKey?o=6:!this._upKey&&this._downKey&&(o=2),this._leftKey&&!this._rightKey&&(this._upKey===this._downKey||this._upKey&&this._leftKeyPressedDurationthis._maxSpeed*this._maxSpeed){const n=this._maxSpeed/Math.sqrt(m);this._xVelocity*=n,this._yVelocity*=n}this._angularSpeed=this._angularMaxSpeed;for(const n of this._topDownMovementHooks)n.beforePositionUpdate(i);const w=(x+this._xVelocity)/2*p,K=(D+this._yVelocity)/2*p;if(this._basisTransformation===null)l.setX(l.getX()+w),l.setY(l.getY()+K);else{const n=this._temporaryPointForTransformations;n[0]=w,n[1]=K,this._basisTransformation.toScreen(n,n),l.setX(l.getX()+n[0]),l.setY(l.getY()+n[1])}(this._xVelocity!==0||this._yVelocity!==0)&&(this._angle=y,this._rotateObject&&l.rotateTowardAngle(y+this._angleOffset,this._angularSpeed)),this._wasLeftKeyPressed=this._leftKey,this._wasRightKeyPressed=this._rightKey,this._wasUpKeyPressed=this._upKey,this._wasDownKeyPressed=this._downKey,this._clearInputsBetweenFrames&&(this._leftKey=!1,this._rightKey=!1,this._upKey=!1,this._downKey=!1,this._stickForce=0)}static getAcceleratedSpeed(e,t,s,h,r,a,o=!1){let i=e;const l=o?h:Math.max(h,r);return t<0?e<=t?i=Math.min(t,e+l*a):e<=0?i-=Math.max(-s,h*a):i=Math.max(t,e-l*a):t>0?e>=t?i=Math.max(t,e-l*a):e>=0?i=Math.min(s,e+h*a):i=Math.min(t,e+l*a):(e<0&&(i=Math.min(e+r*a,0)),e>0&&(i=Math.max(e-r*a,0))),i}simulateControl(e){e==="Left"?this._leftKey=!0:e==="Right"?this._rightKey=!0:e==="Up"?this._upKey=!0:e==="Down"&&(this._downKey=!0)}ignoreDefaultControls(e){this._ignoreDefaultControls=e}shouldIgnoreDefaultControls(){return this._ignoreDefaultControls||this._ignoreDefaultControlsAsSyncedByNetwork}simulateLeftKey(){this._leftKey=!0}simulateRightKey(){this._rightKey=!0}simulateUpKey(){this._upKey=!0}simulateDownKey(){this._downKey=!0}simulateStick(e,t){this._stickAngle=e%360,this._stickForce=Math.max(0,Math.min(1,t))}isUsingControl(e){return e==="Left"?this._leftKeyPressedDuration>0:e==="Right"?this._rightKeyPressedDuration>0:e==="Up"?this._upKeyPressedDuration>0:e==="Down"?this._downKeyPressedDuration>0:e==="Stick"?this._wasStickUsed:!1}getLastStickInputAngle(){return this._stickAngle}registerHook(e){this._topDownMovementHooks.push(e)}}f.TopDownMovementRuntimeBehavior=d,function(s){class P{constructor(){this.direction=-1}getDirection(){return this.direction}_setDirection(r){this.direction=r}}s.TopDownMovementHookContext=P,s._topDownMovementHookContext=new f.TopDownMovementRuntimeBehavior.TopDownMovementHookContext;class t{constructor(r){if(r<=0||r>=Math.PI/4)throw new RangeError("An isometry angle must be in ]0; pi/4] but was: "+r);const a=Math.asin(Math.tan(r)),o=Math.sin(a),i=Math.cos(Math.PI/4),l=i;this._screen=[[i,-l],[o*l,o*i]]}toScreen(r,a){const o=this._screen[0][0]*r[0]+this._screen[0][1]*r[1],i=this._screen[1][0]*r[0]+this._screen[1][1]*r[1];a[0]=o,a[1]=i}}s.IsometryTransformation=t}(d=f.TopDownMovementRuntimeBehavior||(f.TopDownMovementRuntimeBehavior={})),f.registerBehavior("TopDownMovementBehavior::TopDownMovementBehavior",f.TopDownMovementRuntimeBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=topdownmovementruntimebehavior.js.map diff --git a/Export/Extensions/TweenBehavior/TweenManager.js b/Export/Extensions/TweenBehavior/TweenManager.js new file mode 100644 index 0000000..023c65e --- /dev/null +++ b/Export/Extensions/TweenBehavior/TweenManager.js @@ -0,0 +1,13 @@ +var gdjs;(function(u){let I;(function(w){let p;(function(d){/*! + * All equations are adapted from Thomas Fuchs' + * [Scripty2](https://github.com/madrobby/scripty2/blob/master/src/effects/transitions/penner.js). + * + * Based on Easing Equations (c) 2003 [Robert + * Penner](http://www.robertpenner.com/), all rights reserved. This work is + * [subject to terms](http://www.robertpenner.com/easing_terms_of_use.html). + *//*! + * TERMS OF USE - EASING EQUATIONS + * Open source under the BSD License. + * Easing Equations (c) 2003 Robert Penner, all rights reserved. + *//*! Shifty 3.0.3 - https://github.com/jeremyckahn/shifty */d.easingFunctions={linear:e=>e,easeInQuad:e=>Math.pow(e,2),easeOutQuad:e=>-(Math.pow(e-1,2)-1),easeInOutQuad:e=>(e/=.5)<1?.5*Math.pow(e,2):-.5*((e-=2)*e-2),easeInCubic:e=>Math.pow(e,3),easeOutCubic:e=>Math.pow(e-1,3)+1,easeInOutCubic:e=>(e/=.5)<1?.5*Math.pow(e,3):.5*(Math.pow(e-2,3)+2),easeInQuart:e=>Math.pow(e,4),easeOutQuart:e=>-(Math.pow(e-1,4)-1),easeInOutQuart:e=>(e/=.5)<1?.5*Math.pow(e,4):-.5*((e-=2)*Math.pow(e,3)-2),easeInQuint:e=>Math.pow(e,5),easeOutQuint:e=>Math.pow(e-1,5)+1,easeInOutQuint:e=>(e/=.5)<1?.5*Math.pow(e,5):.5*(Math.pow(e-2,5)+2),easeInSine:e=>-Math.cos(e*(Math.PI/2))+1,easeOutSine:e=>Math.sin(e*(Math.PI/2)),easeInOutSine:e=>-.5*(Math.cos(Math.PI*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>e===0?0:e===1?1:(e/=.5)<1?.5*Math.pow(2,10*(e-1)):.5*(-Math.pow(2,-10*--e)+2),easeInCirc:e=>-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeOutBounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,easeInBack:e=>{const t=1.70158;return e*e*((t+1)*e-t)},easeOutBack:e=>{const t=1.70158;return(e=e-1)*e*((t+1)*e+t)+1},easeInOutBack:e=>{let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},elastic:e=>-1*Math.pow(4,-8*e)*Math.sin((e*6-1)*(2*Math.PI)/2)+1,swingFromTo:e=>{let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},swingFrom:e=>{const t=1.70158;return e*e*((t+1)*e-t)},swingTo:e=>{const t=1.70158;return(e-=1)*e*((t+1)*e+t)+1},bounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,bouncePast:e=>e<1/2.75?7.5625*e*e:e<2/2.75?2-(7.5625*(e-=1.5/2.75)*e+.75):e<2.5/2.75?2-(7.5625*(e-=2.25/2.75)*e+.9375):2-(7.5625*(e-=2.625/2.75)*e+.984375),easeFromTo:e=>(e/=.5)<1?.5*Math.pow(e,4):-.5*((e-=2)*Math.pow(e,3)-2),easeFrom:e=>Math.pow(e,4),easeTo:e=>Math.pow(e,.25)};class V{constructor(){this._tweens=new Map;this._activeTweens=new Array}step(){let t=0;for(let n=0;ni===t);this._activeTweens.splice(n,1)}getProgress(t){const n=this._tweens.get(t);return n?n.getProgress():0}getValue(t){const n=this._tweens.get(t);return n?n.getValue():0}getNetworkSyncData(){const t={tweens:{}};return this._tweens.forEach((n,i)=>{t.tweens[i]=n.getNetworkSyncData()}),t}updateFromNetworkSyncData(t,n,i,r){Object.entries(t.tweens).forEach(([o,a])=>{const s=n(a.tweenInformation),h=i(a.tweenInformation),c=r(a.tweenInformation),m=a.interpolationString==="exponential"?u.evtTools.common.exponentialInterpolation:u.evtTools.common.lerp,f={type:a.tweenInformation.type,layerName:a.tweenInformation.layerName,effectName:a.tweenInformation.effectName,propertyName:a.tweenInformation.propertyName,scaleFromCenterOfObject:a.tweenInformation.scaleFromCenterOfObject,useHSLColorTransition:a.tweenInformation.useHSLColorTransition,destroyObjectWhenFinished:a.tweenInformation.destroyObjectWhenFinished};if(a.tweenInformation.variablePath&&(s instanceof u.RuntimeScene||s instanceof u.RuntimeObject)){const l=s.getVariables().getVariableFromPath(a.tweenInformation.variablePath);l&&(f.variable=l)}if(typeof a.initialValue=="number"&&typeof a.targetedValue=="number"){this.addSimpleTween(o,s,a.totalDuration,a.easingIdentifier,m,a.initialValue,a.targetedValue,h,f,c);const l=this._tweens.get(o);l&&(l.updateElapsedTime(a.elapsedTime),a.isPaused&&this.pauseTween(o))}else if(Array.isArray(a.initialValue)&&Array.isArray(a.targetedValue)){this.addMultiTween(o,s,a.totalDuration,a.easingIdentifier,m,a.initialValue,a.targetedValue,h,f,c);const l=this._tweens.get(o);l&&(l.updateElapsedTime(a.elapsedTime),a.isPaused&&this.pauseTween(o))}})}}d.TweenManager=V;const b=()=>{};class T{constructor(t,n,i,r,o,a,s){this.isPaused=!1;this.timeSource=t,this.totalDuration=n,this.easing=i,this.easingIdentifier=r,this.interpolate=o,this.tweenInformation=a,this.elapsedTime=0,this.onFinish=s||b}step(){!this.isPlaying()||(this.elapsedTime=Math.min(this.elapsedTime+this.timeSource.getElapsedTime()/1e3,this.totalDuration),this._updateValue())}isPlaying(){return!this.isPaused&&!this.hasFinished()}hasFinished(){return this.elapsedTime===this.totalDuration}stop(t){this.elapsedTime=this.totalDuration,t&&this._updateValue()}resume(){this.isPaused=!1}pause(){this.isPaused=!0}getProgress(){return this.elapsedTime/this.totalDuration}updateElapsedTime(t){this.elapsedTime=t}}d.AbstractTweenInstance=T;class v extends T{constructor(t,n,i,r,o,a,s,h,c,m){super(t,n,i,r,o,c,m);this.initialValue=a,this.currentValue=a,this.targetedValue=s,this.setValue=h}_updateValue(){const t=this.easing(this.getProgress()),n=this.interpolate(this.initialValue,this.targetedValue,t);this.currentValue=n,this.setValue(n),this.hasFinished()&&this.onFinish()}getValue(){return this.currentValue}getNetworkSyncData(){const t=this.interpolate===u.evtTools.common.exponentialInterpolation?"exponential":"linear",n={type:this.tweenInformation.type,layerName:this.tweenInformation.layerName,effectName:this.tweenInformation.effectName,propertyName:this.tweenInformation.propertyName,scaleFromCenterOfObject:this.tweenInformation.scaleFromCenterOfObject,useHSLColorTransition:this.tweenInformation.useHSLColorTransition,destroyObjectWhenFinished:this.tweenInformation.destroyObjectWhenFinished};if(this.tweenInformation.variable&&(this.timeSource instanceof u.RuntimeScene||this.timeSource instanceof u.RuntimeObject)){const i=this.timeSource.getVariables().getVariablePathInContainerByLoopingThroughAllVariables(this.tweenInformation.variable);i&&(n.variablePath=i)}return{initialValue:this.initialValue,targetedValue:this.targetedValue,elapsedTime:this.elapsedTime,totalDuration:this.totalDuration,easingIdentifier:this.easingIdentifier,interpolationString:t,isPaused:this.isPaused,tweenInformation:n}}}d.SimpleTweenInstance=v;class M extends T{constructor(t,n,i,r,o,a,s,h,c,m){super(t,n,i,r,o,c,m);this.currentValues=new Array;this.initialValue=a,this.targetedValue=s,this.setValue=h}_updateValue(){const t=this.easing(this.getProgress()),n=this.initialValue.length;this.currentValues.length=n;for(let i=0;i{e/=255,t/=255,n/=255;let i=Math.max(e,t,n),r=i-Math.min(e,t,n),o=1-Math.abs(i+i-r-1),a=r&&(i===e?(t-n)/r:i===t?2+(n-e)/r:4+(e-t)/r);return[Math.round(60*(a<0?a+6:a)),Math.round((o?r/o:0)*100),Math.round((i+i-r)/2*100)]},d.hslToRgb=(e,t,n)=>{e=e%=360,e<0&&(e+=360),t=t/100,n=n/100;const i=t*Math.min(n,1-n),r=(o=0,a=(o+e/30)%12)=>n-i*Math.max(Math.min(a-3,9-a,1),-1);return[Math.round(r(0)*255),Math.round(r(8)*255),Math.round(r(4)*255)]},d.ease=(e,t,n,i)=>{const r=u.evtTools.tween.easingFunctions,o=r.hasOwnProperty(e)?r[e]:r.linear;return t+(n-t)*o(i)}})(p=w.tween||(w.tween={}))})(I=u.evtTools||(u.evtTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=TweenManager.js.map diff --git a/Export/Extensions/TweenBehavior/tweenruntimebehavior.js b/Export/Extensions/TweenBehavior/tweenruntimebehavior.js new file mode 100644 index 0000000..f516a73 --- /dev/null +++ b/Export/Extensions/TweenBehavior/tweenruntimebehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(d){const S=new d.Logger("Tween");function T(i){return i.setScaleX&&i.setScaleY&&i.getScaleX&&i.getScaleY}function j(i){return i.setOpacity&&i.getOpacity}function u(i){return i.getZ&&i.setZ}function m(i){return i.setColor&&i.getColor}function O(i){return i.setCharacterSize&&i.getCharacterSize}const g=d.evtTools.common.lerp,h=d.evtTools.common.exponentialInterpolation,_=()=>{},p=i=>e=>i.setNumber(e),v=i=>e=>i.setX(e),C=i=>e=>i.setY(e),R=i=>u(i)?e=>i.setZ(e):()=>{},y=i=>([e,t])=>i.setPosition(e,t),P=i=>e=>i.setAngle(e),X=i=>e=>i.setWidth(e),Y=i=>e=>i.setHeight(e),D=i=>e=>i.setRotationX(e),H=i=>e=>i.setRotationY(e),B=i=>e=>i.setDepth(e),I=(i,e)=>e?([t,o])=>{const r=i.getCenterXInScene(),n=i.getCenterYInScene();i.setScaleX(t),i.setScaleY(o),i.setCenterPositionInScene(r,n)}:([t,o])=>{i.setScaleX(t),i.setScaleY(o)},x=(i,e,t)=>t?o=>{const r=i.getCenterXInScene(),n=i.getCenterYInScene(),a=e?e.getCenterZInScene():0;i.setScale(o),i.setCenterXInScene(r),i.setCenterYInScene(n),e&&e.setCenterZInScene(a)}:o=>i.setScale(o),M=(i,e)=>e?t=>{const o=i.getCenterXInScene();i.setScaleX(t),i.setCenterXInScene(o)}:t=>i.setScaleX(t),V=(i,e)=>e?t=>{const o=i.getCenterYInScene();i.setScaleY(t),i.setCenterYInScene(o)}:t=>i.setScaleY(t),F=i=>e=>i.setOpacity(e),N=i=>e=>i.setCharacterSize(e),A=(i,e)=>t=>{i.updateDoubleParameter(e,t)},k=(i,e)=>([t,o,r])=>{const n=d.evtTools.tween.hslToRgb(t,o,r);i.updateColorParameter(e,d.rgbToHexNumber(n[0],n[1],n[2]))},z=(i,e)=>e?([t,o,r])=>{const n=d.evtTools.tween.hslToRgb(t,o,r);i.setColor(Math.floor(n[0])+";"+Math.floor(n[1])+";"+Math.floor(n[2]))}:([t,o,r])=>{i.setColor(Math.floor(t)+";"+Math.floor(o)+";"+Math.floor(r))},Z=i=>([e,t,o])=>{const r=d.evtTools.tween.hslToRgb(e,t,o);i.setColor(Math.floor(r[0])+";"+Math.floor(r[1])+";"+Math.floor(r[2]))},E=i=>e=>{const t=e.type,o=e.variablePath,r=e.effectName,n=e.propertyName,a=!!e.scaleFromCenterOfObject,s=!!e.useHSLColorTransition;if(t==="objectValue")return _;if(t==="variable"&&o){const l=i.getVariables().getVariableFromPath(o);return l?p(l):()=>{}}if(t==="positionX")return v(i);if(t==="positionY")return C(i);if(t==="position")return y(i);if(t==="positionZ")return R(i);if(t==="width")return X(i);if(t==="height")return Y(i);if(t==="depth")return u(i)?B(i):()=>{};if(t==="angle")return P(i);if(t==="rotationX")return u(i)?D(i):()=>{};if(t==="rotationY")return u(i)?H(i):()=>{};if(t==="scale"){if(!T(i))return()=>{};const l=u(i)?i:null;return x(i,l,a)}if(t==="scaleXY")return T(i)?I(i,a):()=>{};if(t==="scaleX")return T(i)?M(i,a):()=>{};if(t==="scaleY")return T(i)?V(i,a):()=>{};if(t==="opacity")return j(i)?F(i):()=>{};if(t==="characterSize")return O(i)?N(i):()=>{};if(t==="numberEffectProperty"&&r&&n){const l=i.getRendererEffects()[r];return l||S.error(`The object "${i.name}" doesn't have any effect called "${r}"`),A(l,n)}if(t==="colorEffectProperty"&&r&&n){const l=i.getRendererEffects()[r];return l||S.error(`The object "${i.name}" doesn't have any effect called "${r}"`),k(l,n)}return t==="objectColor"?m(i)?z(i,s):()=>{}:t==="objectColorHSL"?m(i)?Z(i):()=>{}:()=>{}};class q extends d.RuntimeBehavior{constructor(e,t,o){super(e,t,o);this._tweens=new d.evtTools.tween.TweenManager;this._isActive=!0}applyBehaviorOverriding(e){return!0}getNetworkSyncData(e){return{...super.getNetworkSyncData(e),props:{tweenManager:this._tweens.getNetworkSyncData()}}}updateFromNetworkSyncData(e,t){super.updateFromNetworkSyncData(e,t),e.props.tweenManager&&this._tweens.updateFromNetworkSyncData(e.props.tweenManager,o=>this.owner,o=>E(this.owner)(o),o=>o.destroyObjectWhenFinished?()=>this._deleteFromScene():null)}doStepPreEvents(e){this._tweens.step()}_deleteFromScene(){this.owner.deleteFromScene()}addVariableTween(e,t,o,r,n,a,s){this._tweens.addSimpleTween(e,this.owner.getRuntimeScene(),a/1e3,n,g,o,r,p(t),{type:"variable",variable:t,destroyObjectWhenFinished:s},s?()=>this._deleteFromScene():null)}addVariableTween2(e,t,o,r,n,a){this._addVariableTween(e,t,o,r,n/1e3,a,this.owner.getRuntimeScene())}addVariableTween3(e,t,o,r,n,a){this._addVariableTween(e,t,o,r,n,a,this.owner)}_addVariableTween(e,t,o,r,n,a,s){t.getType()==="number"&&this._tweens.addSimpleTween(e,s,n,r,g,t.getValue(),o,p(t),{type:"variable",variable:t,destroyObjectWhenFinished:a},a?()=>this._deleteFromScene():null)}addValueTween(e,t,o,r,n,a,s){this._tweens.addSimpleTween(e,this.owner,n,r,a?h:g,t,o,_,{type:"objectValue",destroyObjectWhenFinished:s},s?()=>this._deleteFromScene():null)}addObjectPositionTween(e,t,o,r,n,a){this._addObjectPositionTween(e,t,o,r,n/1e3,a,this.owner.getRuntimeScene())}addObjectPositionTween2(e,t,o,r,n,a){this._addObjectPositionTween(e,t,o,r,n,a,this.owner)}_addObjectPositionTween(e,t,o,r,n,a,s){this._tweens.addMultiTween(e,s,n,r,g,[this.owner.getX(),this.owner.getY()],[t,o],y(this.owner),{type:"position",destroyObjectWhenFinished:a},a?()=>this._deleteFromScene():null)}addObjectPositionXTween(e,t,o,r,n){this._addObjectPositionXTween(e,t,o,r/1e3,n,this.owner.getRuntimeScene())}addObjectPositionXTween2(e,t,o,r,n){this._addObjectPositionXTween(e,t,o,r,n,this.owner)}_addObjectPositionXTween(e,t,o,r,n,a){this._tweens.addSimpleTween(e,a,r,o,g,this.owner.getX(),t,v(this.owner),{type:"positionX",destroyObjectWhenFinished:n},n?()=>this._deleteFromScene():null)}addObjectPositionYTween(e,t,o,r,n){this._addObjectPositionYTween(e,t,o,r/1e3,n,this.owner.getRuntimeScene())}addObjectPositionYTween2(e,t,o,r,n){this._addObjectPositionYTween(e,t,o,r,n,this.owner)}_addObjectPositionYTween(e,t,o,r,n,a){this._tweens.addSimpleTween(e,a,r,o,g,this.owner.getY(),t,C(this.owner),{type:"positionY",destroyObjectWhenFinished:n},n?()=>this._deleteFromScene():null)}addObjectPositionZTween(e,t,o,r,n){this._addObjectPositionZTween(e,t,o,r/1e3,n,this.owner.getRuntimeScene())}addObjectPositionZTween2(e,t,o,r,n,a){this._addObjectPositionZTween(t,o,r,n,a,this.owner)}_addObjectPositionZTween(e,t,o,r,n,a){const{owner:s}=this;!u(s)||this._tweens.addSimpleTween(e,a,r,o,g,s.getZ(),t,R(s),{type:"positionZ",destroyObjectWhenFinished:n},n?()=>this._deleteFromScene():null)}addObjectAngleTween(e,t,o,r,n){this._addObjectAngleTween(e,t,o,r/1e3,n,this.owner.getRuntimeScene())}addObjectAngleTween2(e,t,o,r,n){this._addObjectAngleTween(e,t,o,r,n,this.owner)}_addObjectAngleTween(e,t,o,r,n,a){this._tweens.addSimpleTween(e,a,r,o,g,this.owner.getAngle(),t,P(this.owner),{type:"angle",destroyObjectWhenFinished:n},n?()=>this._deleteFromScene():null)}addObjectRotationXTween(e,t,o,r,n,a){const{owner:s}=this;!u(s)||this._tweens.addSimpleTween(t,this.owner,n,r,g,s.getRotationX(),o,D(s),{type:"rotationX",destroyObjectWhenFinished:a},a?()=>this._deleteFromScene():null)}addObjectRotationYTween(e,t,o,r,n,a){const{owner:s}=this;!u(s)||this._tweens.addSimpleTween(t,this.owner,n,r,g,s.getRotationY(),o,H(s),{type:"rotationY",destroyObjectWhenFinished:a},a?()=>this._deleteFromScene():null)}addObjectScaleTween(e,t,o,r,n,a,s){this._addObjectScaleTween(e,t,o,r,n/1e3,a,s,this.owner.getRuntimeScene(),g)}addObjectScaleTween2(e,t,o,r,n,a,s){this._addObjectScaleTween(e,t,o,r,n,a,s,this.owner,h)}_addObjectScaleTween(e,t,o,r,n,a,s,l,c){const w=this.owner;!T(w)||(t<0&&(t=0),o<0&&(o=0),this._tweens.addMultiTween(e,l,n,r,c,[w.getScaleX(),w.getScaleY()],[t,o],I(w,s),{type:"scaleXY",destroyObjectWhenFinished:a},a?()=>this._deleteFromScene():null))}addObjectScaleTween3(e,t,o,r,n,a){this._addObjectScaleXTween(e,t,o,r,n,a,this.owner,h);const s=this.owner;if(!T(s))return;const l=u(s)?s:null;this._tweens.addSimpleTween(e,this.owner,r,o,h,s.getScale(),t,x(s,l,a),{type:"scale",scaleFromCenterOfObject:a,destroyObjectWhenFinished:n},n?()=>this._deleteFromScene():null)}addObjectScaleXTween(e,t,o,r,n,a){this._addObjectScaleXTween(e,t,o,r/1e3,n,a,this.owner.getRuntimeScene(),g)}addObjectScaleXTween2(e,t,o,r,n,a){this._addObjectScaleXTween(e,t,o,r,n,a,this.owner,h)}_addObjectScaleXTween(e,t,o,r,n,a,s,l){const c=this.owner;!T(c)||this._tweens.addSimpleTween(e,s,r,o,l,c.getScaleX(),t,M(c,a),{type:"scaleX",scaleFromCenterOfObject:a,destroyObjectWhenFinished:n},n?()=>this._deleteFromScene():null)}addObjectScaleYTween(e,t,o,r,n,a){this._addObjectScaleYTween(e,t,o,r/1e3,n,a,this.owner.getRuntimeScene(),g)}addObjectScaleYTween2(e,t,o,r,n,a){this._addObjectScaleYTween(e,t,o,r,n,a,this.owner,h)}_addObjectScaleYTween(e,t,o,r,n,a,s,l){const c=this.owner;!T(c)||this._tweens.addSimpleTween(e,s,r,o,l,c.getScaleY(),t,V(c,a),{type:"scaleY",scaleFromCenterOfObject:a,destroyObjectWhenFinished:n},n?()=>this._deleteFromScene():null)}addObjectOpacityTween(e,t,o,r,n){this._addObjectOpacityTween(e,t,o,r/1e3,n,this.owner.getRuntimeScene())}addObjectOpacityTween2(e,t,o,r,n){this._addObjectOpacityTween(e,t,o,r,n,this.owner)}_addObjectOpacityTween(e,t,o,r,n,a){const s=this.owner;!j(s)||this._tweens.addSimpleTween(e,a,r,o,g,s.getOpacity(),t,F(s),{type:"opacity",destroyObjectWhenFinished:n},n?()=>this._deleteFromScene():null)}addNumberEffectPropertyTween(e,t,o,r,n,a,s,l){const c=this.owner.getRendererEffects()[r];c||S.error(`The object "${this.owner.name}" doesn't have any effect called "${r}"`),this._tweens.addSimpleTween(t,this.owner,s,a,g,c?c.getDoubleParameter(n):0,o,A(c,n),{type:"numberEffectProperty",effectName:r,propertyName:n,destroyObjectWhenFinished:l},l?()=>this._deleteFromScene():null)}addColorEffectPropertyTween(e,t,o,r,n,a,s,l){const c=this.owner.getRendererEffects()[r];c||S.error(`The object "${this.owner.name}" doesn't have any effect called "${r}"`);const w=d.hexNumberToRGB(c?c.getColorParameter(n):0),b=d.rgbOrHexToRGBColor(o);this._tweens.addMultiTween(t,this.owner,s,a,g,d.evtTools.tween.rgbToHsl(w.r,w.g,w.b),d.evtTools.tween.rgbToHsl(b[0],b[1],b[2]),k(c,n),{type:"colorEffectProperty",effectName:r,propertyName:n,destroyObjectWhenFinished:l},l?()=>this._deleteFromScene():null)}addObjectColorTween(e,t,o,r,n,a){this._addObjectColorTween(e,t,o,r/1e3,n,a,this.owner.getRuntimeScene())}addObjectColorTween2(e,t,o,r,n,a=!0){this._addObjectColorTween(e,t,o,r,n,a,this.owner)}_addObjectColorTween(e,t,o,r,n,a,s){const l=this.owner;if(!m(l))return;const c=d.rgbOrHexToRGBColor(l.getColor()),w=d.rgbOrHexToRGBColor(t),b=a?d.evtTools.tween.rgbToHsl(c[0],c[1],c[2]):c,f=a?d.evtTools.tween.rgbToHsl(w[0],w[1],w[2]):w;this._tweens.addMultiTween(e,s,r,o,g,b,f,z(l,a),{type:"objectColor",useHSLColorTransition:a,destroyObjectWhenFinished:n},n?()=>this._deleteFromScene():null)}addObjectColorHSLTween(e,t,o,r,n,a,s,l){this._addObjectColorHSLTween(e,t,o,r,n,a,s/1e3,l,this.owner.getRuntimeScene())}addObjectColorHSLTween2(e,t,o,r,n,a,s,l){this._addObjectColorHSLTween(e,t,o,r,n,a,s,l,this.owner)}_addObjectColorHSLTween(e,t,o,r,n,a,s,l,c){if(!m(this.owner))return;const w=this.owner,b=d.rgbOrHexToRGBColor(w.getColor()),f=d.evtTools.tween.rgbToHsl(b[0],b[1],b[2]),L=o?t:f[0],$=r===-1?f[1]:Math.min(Math.max(r,0),100),G=n===-1?f[2]:Math.min(Math.max(n,0),100);this._tweens.addMultiTween(e,c,s,a,g,f,[L,$,G],Z(w),{type:"objectColorHSL",destroyObjectWhenFinished:l},l?()=>this._deleteFromScene():null)}addTextObjectCharacterSizeTween(e,t,o,r,n){this._addTextObjectCharacterSizeTween(e,t,o,r/1e3,n,this.owner.getRuntimeScene(),g)}addTextObjectCharacterSizeTween2(e,t,o,r,n){this._addTextObjectCharacterSizeTween(e,t,o,r,n,this.owner,h)}_addTextObjectCharacterSizeTween(e,t,o,r,n,a,s){const l=this.owner;!O(l)||this._tweens.addSimpleTween(e,a,r,o,s,l.getCharacterSize(),t,N(l),{type:"characterSize",destroyObjectWhenFinished:n},n?()=>this._deleteFromScene():null)}addObjectWidthTween(e,t,o,r,n){this._addObjectWidthTween(e,t,o,r/1e3,n,this.owner.getRuntimeScene())}addObjectWidthTween2(e,t,o,r,n){this._addObjectWidthTween(e,t,o,r,n,this.owner)}_addObjectWidthTween(e,t,o,r,n,a){this._tweens.addSimpleTween(e,a,r,o,g,this.owner.getWidth(),t,X(this.owner),{type:"width",destroyObjectWhenFinished:n},n?()=>this._deleteFromScene():null)}addObjectHeightTween(e,t,o,r,n){this._addObjectHeightTween(e,t,o,r/1e3,n,this.owner.getRuntimeScene())}addObjectHeightTween2(e,t,o,r,n){this._addObjectHeightTween(e,t,o,r,n,this.owner)}_addObjectHeightTween(e,t,o,r,n,a){this._tweens.addSimpleTween(e,a,r,o,g,this.owner.getHeight(),t,Y(this.owner),{type:"height",destroyObjectWhenFinished:n},n?()=>this._deleteFromScene():null)}addObjectDepthTween(e,t,o,r,n){this._addObjectDepthTween(e,t,o,r/1e3,n,this.owner.getRuntimeScene())}addObjectDepthTween2(e,t,o,r,n,a){this._addObjectDepthTween(t,o,r,n,a,this.owner)}_addObjectDepthTween(e,t,o,r,n,a){const{owner:s}=this;!u(s)||this._tweens.addSimpleTween(e,a,r,o,g,s.getDepth(),t,B(s),{type:"depth",destroyObjectWhenFinished:n},n?()=>this._deleteFromScene():null)}isPlaying(e){return this._tweens.isPlaying(e)}exists(e){return this._tweens.exists(e)}hasFinished(e){return this._tweens.hasFinished(e)}pauseTween(e){this._isActive&&this._tweens.pauseTween(e)}stopTween(e,t){this._isActive&&this._tweens.stopTween(e,t)}resumeTween(e){this._isActive&&this._tweens.resumeTween(e)}removeTween(e){this._tweens.removeTween(e)}getProgress(e){return this._tweens.getProgress(e)}getValue(e){return this._tweens.getValue(e)}onDeActivate(){this._isActive=!1}onActivate(){this._isActive=!0}}d.TweenRuntimeBehavior=q,d.registerBehavior("Tween::TweenBehavior",d.TweenRuntimeBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=tweenruntimebehavior.js.map diff --git a/Export/LICENSE.GDevelop.txt b/Export/LICENSE.GDevelop.txt new file mode 100644 index 0000000..b707a92 --- /dev/null +++ b/Export/LICENSE.GDevelop.txt @@ -0,0 +1,2 @@ +Part of this app is using the GDevelop game engine, which is licensed under the MIT license. +Find more information on https://gdevelop.io/. \ No newline at end of file diff --git a/Export/Model3DManager.js b/Export/Model3DManager.js new file mode 100644 index 0000000..0907c41 --- /dev/null +++ b/Export/Model3DManager.js @@ -0,0 +1,2 @@ +var gdjs;(function(t){const s=new t.Logger("Model3DManager"),i=["model3D"];class n{constructor(r){this._loadedThreeModels=new t.ResourceCache;this._downloadedArrayBuffers=new t.ResourceCache;this._loader=null;this._dracoLoader=null;if(this._resourceLoader=r,typeof THREE!="undefined"){this._loader=new THREE_ADDONS.GLTFLoader,this._dracoLoader=new THREE_ADDONS.DRACOLoader,this._dracoLoader.setDecoderPath("./pixi-renderers/draco/gltf/"),this._loader.setDRACOLoader(this._dracoLoader);const e=new THREE.Group;e.add(new THREE.Mesh(new THREE.BoxGeometry(1,1,1),new THREE.MeshBasicMaterial({color:"#ff00ff"}))),this._invalidModel={scene:e,animations:[],cameras:[],scenes:[],asset:{},userData:{},parser:null}}}getResourceKinds(){return i}async processResource(r){const e=this._resourceLoader.getResource(r);if(!e){s.warn('Unable to find texture for resource "'+r+'".');return}const a=this._loader;if(!a)return;const d=this._downloadedArrayBuffers.get(e);if(!!d){this._downloadedArrayBuffers.delete(e);try{const o=await a.parseAsync(d,"");this._loadedThreeModels.set(e,o)}catch(o){s.error("Can't fetch the 3D model file "+e.file+", error: "+o)}}}async loadResource(r){const e=this._resourceLoader.getResource(r);if(!e){s.warn('Unable to find texture for resource "'+r+'".');return}if(!this._loader||this._loadedThreeModels.get(e))return;const d=this._resourceLoader.getFullUrl(e.file);try{const o=await fetch(d,{credentials:this._resourceLoader.checkIfCredentialsRequired(d)?"include":"omit"});if(!o.ok)throw new Error("Network response was not ok");const l=await o.arrayBuffer();this._downloadedArrayBuffers.set(e,l)}catch(o){throw s.error("Can't fetch the 3D model file "+e.file+", error: "+o),o}}getModel(r){return this._loadedThreeModels.getFromName(r)||this._invalidModel}dispose(){this._loadedThreeModels.clear(),this._downloadedArrayBuffers.clear(),this._loader=null,this._dracoLoader=null,this._invalidModel&&(this._invalidModel.cameras=[],this._invalidModel.animations=[],this._invalidModel.scenes=[],this._invalidModel.userData={},this._invalidModel.asset={},this._invalidModel.scene.clear())}unloadResource(r){const e=this._loadedThreeModels.getFromName(r.name);e&&(e.scene.clear(),this._loadedThreeModels.delete(r)),this._downloadedArrayBuffers.getFromName(r.name)&&this._downloadedArrayBuffers.delete(r)}}t.Model3DManager=n})(gdjs||(gdjs={})); +//# sourceMappingURL=Model3DManager.js.map diff --git a/Export/NewSprite.png b/Export/NewSprite.png new file mode 100644 index 0000000000000000000000000000000000000000..05edc8477a881ae7e6ab4c5d55bf359fc652dbf4 GIT binary patch literal 198 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D$|8a!PbLn`9l zUT+j+P~c%Q-2MN8#fjsB7T$fgw~5!OGuR*Ce9=(AZl~(O$Q97QB*LNI;K-9C&@92D zoWPR^q>m`D8A|vuKpAcaq(A~4Ks5$)7@&-v22+p#NO6J%Ba|V*m@Uv;%4WaG^S@)v T0q1_8TNpfD{an^LB{Ts5V@NlW literal 0 HcmV?d00001 diff --git a/Export/NewSprite2.png b/Export/NewSprite2.png new file mode 100644 index 0000000000000000000000000000000000000000..05edc8477a881ae7e6ab4c5d55bf359fc652dbf4 GIT binary patch literal 198 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D$|8a!PbLn`9l zUT+j+P~c%Q-2MN8#fjsB7T$fgw~5!OGuR*Ce9=(AZl~(O$Q97QB*LNI;K-9C&@92D zoWPR^q>m`D8A|vuKpAcaq(A~4Ks5$)7@&-v22+p#NO6J%Ba|V*m@Uv;%4WaG^S@)v T0q1_8TNpfD{an^LB{Ts5V@NlW literal 0 HcmV?d00001 diff --git a/Export/NewSprite3.png b/Export/NewSprite3.png new file mode 100644 index 0000000000000000000000000000000000000000..ede2650d12dcf48717c107ff5885b285640fb2d6 GIT binary patch literal 533 zcmV+w0_y#VP)Px$&q+i(T0Y(eoH#|40=ASngq z?;hh014tsgqppFF+Ky-#0x&YL)}++ls>KArBYKh{%kLIlY5-Q!7DLu+G#XU^G#y*T zdtHZWB>Tv`Q`D;b`XtPdpuddJ3dv3;}p51j&5z1p{~*1jIZ6XcO?16ri)OPC&V% zlK%eo{|L7>bhWxvHQ>%W$eLL%eGCD(%aX8~H!lH?=y~h}CF9!2*W(T+pzP2?5CX#^?D>tp#ZLG1tM&8ZKGpM1%Qg0*^U5a(!S$Z+b7@` XYq?NR*(~9F00000NkvXXu0mjfS5W14 literal 0 HcmV?d00001 diff --git a/Export/ResourceCache.js b/Export/ResourceCache.js new file mode 100644 index 0000000..b4e7d89 --- /dev/null +++ b/Export/ResourceCache.js @@ -0,0 +1,2 @@ +var gdjs;(function(a){class n{constructor(){this._nameToContent=new Map;this._fileToContent=new Map}getFromName(e){return this._nameToContent.get(e)||null}get(e){let t=this._nameToContent.get(e.name);return t||(t=this._fileToContent.get(e.file),t?(this._nameToContent.set(e.name,t),t):null)}set(e,t){this._nameToContent.set(e.name,t),this._fileToContent.set(e.file,t)}delete(e){this._nameToContent.delete(e.name),this._fileToContent.delete(e.file)}clear(){this._nameToContent.clear(),this._fileToContent.clear()}}a.ResourceCache=n})(gdjs||(gdjs={})); +//# sourceMappingURL=ResourceCache.js.map diff --git a/Export/ResourceLoader.js b/Export/ResourceLoader.js new file mode 100644 index 0000000..b659ab1 --- /dev/null +++ b/Export/ResourceLoader.js @@ -0,0 +1,2 @@ +var gdjs;(function(c){const d=new c.Logger("ResourceLoader"),i=new c.Logger("ResourceLoader - debug").enable(!1),R=(g,e,s)=>{if(g.startsWith("data:")||g.startsWith("blob:"))return g;const r=g.indexOf("?")===-1?"?":"&";return g+r+e+"="+s},p=g=>g.startsWith("https://project-resources.gdevelop.io/")||g.startsWith("https://project-resources-dev.gdevelop.io/");class m{constructor(e){this.isFinished=!1;this.identifier=e,this.onProgressCallbacks=new Array,this.onFinishCallbacks=new Array}registerCallback(e,s){if(this.isFinished){e();return}this.onFinishCallbacks.push(e),s&&this.onProgressCallbacks.push(s)}onProgress(e,s){for(const r of this.onProgressCallbacks)r(e,s)}onFinish(){this.isFinished=!0;for(const e of this.onFinishCallbacks)e()}}c.LoadingTask=m;class _{async loadResource(e){}async processResource(e){}getResourceKinds(){return["internal-in-game-editor-only-svg"]}unloadResource(e){}dispose(){}}const u=class{constructor(e,s,r,o){this._spineAtlasManager=null;this._spineManager=null;this.privateResourceManager=new y(this);this.sceneResourceLoadingQueue=new M("scene",this.privateResourceManager,!1,(e,s,r,o)=>this._getResourcesOnlyUsedInUnloadedScene(e,s,r,o));this.objectResourceLoadingQueues=new Map;this._runtimeGame=e,this._globalResources=r,this.setResources(s,r,o),this._imageManager=new c.ImageManager(this),this._soundManager=new c.SoundManager(this),this._fontManager=new c.FontManager(this),this._jsonManager=new c.JsonManager(this),this._bitmapFontManager=new c.BitmapFontManager(this,this._imageManager),this._model3DManager=new c.Model3DManager(this),this._svgManager=new _;const t=[this._imageManager,this._soundManager,this._fontManager,this._jsonManager,this._bitmapFontManager,this._model3DManager,this._svgManager];this._resourceManagersMap=new Map;for(const a of t)for(const n of a.getResourceKinds())this._resourceManagersMap.set(n,a);this._registerOptionalManagersIfNeeded()}getRuntimeGame(){return this._runtimeGame}setResources(e,s,r){this._globalResources=s,this.sceneResourceLoadingQueue.clear();for(const o of this.objectResourceLoadingQueues.values())o.clear();for(const o of r)this.sceneResourceLoadingQueue.registerResources(o.name,o.usedResources);for(let o=r.length-1;o>=0;o--){const t=r[o],a=t.resourcesPreloading||"inherit";(a==="inherit"?this._runtimeGame.getSceneResourcesPreloading():a)==="at-startup"&&this.sceneResourceLoadingQueue.enqueue(t.name)}this.privateResourceManager._resources.clear();for(const o of e)!o.file||this.privateResourceManager._resources.set(o.name,o)}async loadAllResources(e){let s=0;await u.processAndRetryIfNeededWithPromisePool([...this.privateResourceManager._resources.values()],u.maxForegroundConcurrency,u.maxAttempt,async r=>{await this.privateResourceManager._loadResource(r),await this.privateResourceManager._processResource(r),s++,e(s,this.privateResourceManager._resources.size)}),this.sceneResourceLoadingQueue.setAllResourcesAs("ready");for(const r of this.objectResourceLoadingQueues.values())r.setAllResourcesAs("ready")}async loadResources(e,s){let r=0;await u.processAndRetryIfNeededWithPromisePool(e,u.maxForegroundConcurrency,u.maxAttempt,async o=>{const t=this.privateResourceManager._resources.get(o);t&&(await this.privateResourceManager._loadResource(t),await this.privateResourceManager._processResource(t)),r++,s(r,this.privateResourceManager._resources.size)})}async loadGlobalAndFirstSceneResources(e,s){const r=this.sceneResourceLoadingQueue.getResourceNamesFor(e);if(!r){d.warn(`Can't load resource for unknown scene: "`+e+'".');return}let o=0;const t=[...this._globalResources,...r];await u.processAndRetryIfNeededWithPromisePool(t,u.maxForegroundConcurrency,u.maxAttempt,async a=>{const n=this.privateResourceManager._resources.get(a);if(!n){d.warn('Unable to find resource "'+a+'".');return}await this.privateResourceManager._loadResource(n),await this.privateResourceManager._processResource(n),o++,s(o,t.length)}),this.sceneResourceLoadingQueue.setResourcesAs(e,"ready")}async loadAllSceneInBackground(){this.sceneResourceLoadingQueue.loadAllTasksInBackground()}async loadAndProcessSceneResources(e,s){this.areSceneAssetsReady(e)||(await this.loadSceneResources(e,s),await this.sceneResourceLoadingQueue.processResources(e,s))}async loadSceneResources(e,s){i.log(`Prioritization of loading of resources for scene ${e} was requested.`),this.sceneResourceLoadingQueue.isLoadingInForeground=!0;const r=this.sceneResourceLoadingQueue.prioritize(e);return new Promise((o,t)=>{if(!r){this.sceneResourceLoadingQueue.isLoadingInForeground=!1,i.log(`Loading of resources for scene ${e} was immediately resolved.`),o();return}r.registerCallback(()=>{i.log(`Loading of resources for scene ${e} just finished.`),this.sceneResourceLoadingQueue.isLoadingInForeground=!1,o()},s)})}async loadObjectResources(e,s,r){i.log(`Loading of resources for object ${s} was requested.`);const o=this.getObjectResourceLoadingQueue(e);o.registerResources(s,r);const t=o.enqueue(s);return o.loadAllTasksInBackground(),new Promise((a,n)=>{if(!t){i.log(`Loading of resources for object ${s} was immediately resolved.`),a();return}t.registerCallback(()=>{i.log(`Loading of resources for object ${s} just finished.`),a()})})}getObjectResourceLoadingQueue(e){let s=this.objectResourceLoadingQueues.get(e);return s||(s=new M(`Independent objects of ${e}`,this.privateResourceManager,!0,(r,o,t,a)=>this._getResourcesOnlyUsedInObject(e,r,o)),this.objectResourceLoadingQueues.set(e,s)),s}dispose(){for(const e of this._resourceManagersMap.values())e.dispose()}unloadSceneResources({unloadedSceneName:e,newSceneName:s}){if(!e)return;i.log(`Unloading of resources for scene ${e} was requested.`),this.sceneResourceLoadingQueue.unloadResources(e,s),this.getObjectResourceLoadingQueue(e).clear(),i.log(`Unloading of resources for scene ${e} finished.`)}unloadObjectResources(e,s){const r=this.getObjectResourceLoadingQueue(e);if(!r.areAssetsReady(s)){i.log(`Can't unload of resources for object ${s} as it is not loaded.`);return}for(const o of this._runtimeGame._sceneStack.getAllScenes())if(o.getObjects(s).length>0){i.log(`Can't unload of resources for object ${s} as it still have instances living in the scene.`);return}i.log(`Unloading of resources for object ${s} was requested.`),r.unloadResources(s),r.unregisterResources(s),i.log(`Unloading of resources for object ${s} finished.`)}unloadAllResources(){i.log("Unloading of all resources was requested.");for(const e of this.privateResourceManager._resources.values())this.privateResourceManager._unloadResource(e.name);this.sceneResourceLoadingQueue.setAllResourcesAs("not-loaded");for(const e of this.objectResourceLoadingQueues.values())e.clear();i.log("Unloading of all resources finished.")}getSceneLoadingProgress(e){return this.sceneResourceLoadingQueue.getLoadingProgress(e)}areSceneAssetsLoaded(e){return this.sceneResourceLoadingQueue.areAssetsLoaded(e)}areSceneAssetsReady(e){return this.sceneResourceLoadingQueue.areAssetsReady(e)}areObjectAssetsReady(e,s){return this.getObjectResourceLoadingQueue(e).areAssetsReady(s)}getResource(e){return this.privateResourceManager._resources.get(e)||null}getFullUrl(e){this._runtimeGame.isInGameEdition()&&(e.startsWith("file://")||!e.startsWith("http"))&&(e=R(e,"cache",""+Date.now()));const{gdevelopResourceToken:s}=this._runtimeGame._options;return!s||!p(e)?e:R(e,"gd_resource_token",encodeURIComponent(s))}checkIfCredentialsRequired(e){return this._runtimeGame._options.gdevelopResourceToken?!1:!!p(e)}getSoundManager(){return this._soundManager}getImageManager(){return this._imageManager}getFontManager(){return this._fontManager}getBitmapFontManager(){return this._bitmapFontManager}getJsonManager(){return this._jsonManager}getModel3DManager(){return this._model3DManager}getSpineManager(){return this._spineManager}getSpineAtlasManager(){return this._spineAtlasManager}registerOptionalManagersForHotReload(){this._registerOptionalManagersIfNeeded()}_registerOptionalManagersIfNeeded(){if(!this._spineAtlasManager&&c.SpineAtlasManager){this._spineAtlasManager=new c.SpineAtlasManager(this,this._imageManager);for(const e of this._spineAtlasManager.getResourceKinds())this._resourceManagersMap.set(e,this._spineAtlasManager)}if(!this._spineManager&&c.SpineManager&&this._spineAtlasManager){this._spineManager=new c.SpineManager(this,this._spineAtlasManager);for(const e of this._spineManager.getResourceKinds())this._resourceManagersMap.set(e,this._spineManager)}}injectMockResourceManagerForTesting(e,s){this._resourceManagersMap.set(e,s)}_getResourcesOnlyUsedInUnloadedScene(e,s,r,o){const t=new Set(s.resourceNames),a=e?this.getObjectResourceLoadingQueue(e):null;if(a)for(const n of a.loadingStates.values())for(const l of n.resourceNames)t.add(l);for(const n of this.sceneResourceLoadingQueue.loadingStates.values())if(n!==s&&(n===o||n.status==="loaded"||n.status==="ready"))for(const l of n.resourceNames)t.delete(l);for(const n of this.objectResourceLoadingQueues.values())if(n!==a)for(const l of n.loadingStates.values())for(const v of l.resourceNames)t.delete(v);return t}_getResourcesOnlyUsedInObject(e,s,r){const o=new Set(r.resourceNames),t=this.getObjectResourceLoadingQueue(e);for(const a of t.loadingStates.values())if(a!==r)for(const n of a.resourceNames)o.delete(n);for(const a of this.sceneResourceLoadingQueue.loadingStates.values())if(a.status==="loaded"||a.status==="ready")for(const n of a.resourceNames)o.delete(n);for(const a of this.objectResourceLoadingQueues.values())if(a!==t)for(const n of a.loadingStates.values())for(const l of n.resourceNames)o.delete(l);return o}static processWithPromisePool(e,s,r){const o=[],t=[];let a=0,n=0;return new Promise((l,v)=>{const L=()=>{if(e.length===0){l({results:o,errors:t});return}for(;ao.push(f)).catch(f=>t.push({item:b,error:f})).finally(()=>{a--,n===e.length&&a===0?l({results:o,errors:t}):L()})}};L()})}static async processAndRetryIfNeededWithPromisePool(e,s,r,o){const t=await u.processWithPromisePool(e,s,o);t.errors.length!==0&&d.warn("Some assets couldn't be downloaded. Trying again now.");for(let a=1;a0;){i.log(`Still resources of ${this.loadingTaskQueue.length} ${this.name}(s) to load: ${this.loadingTaskQueue.map(s=>s.identifier).join(", ")}`);const e=this.loadingTaskQueue[this.loadingTaskQueue.length-1];if(e!==void 0)if(this.currentLoadingTaskIdentifier=e.identifier,this.areAssetsLoaded(e.identifier))this.loadingTaskQueue.pop();else{i.log(`Loading (but not processing) resources for ${this.name} ${e.identifier}.`);const s=this.loadingStates.get(e.identifier);if(s)await this._doLoadResources(s,async(r,o)=>e.onProgress(r,o));else{d.warn(`Can't load resource for unknown ${this.name}: "${e.identifier}".`);return}i.log(`Done loading (but not processing) resources for ${this.name} ${e.identifier}.`),this.loadingTaskQueue.splice(this.loadingTaskQueue.findIndex(r=>r===e),1),e.onFinish()}}i.log(`${this.name} resources loading finished.`),this.currentLoadingTaskIdentifier=""}}async _doLoadResources(e,s){let r=0;await h.processAndRetryIfNeededWithPromisePool(e.resourceNames,this.isLoadingInForeground?h.maxForegroundConcurrency:h.maxBackgroundConcurrency,h.maxAttempt,async o=>{const t=this.resourceLoader._resources.get(o);if(!t){d.warn('Unable to find resource "'+o+'".');return}await this.resourceLoader._loadResource(t),this.shouldProcessResources&&await this.resourceLoader._processResource(t),r++,this.currentTaskProgress=r/e.resourceNames.length,s&&await s(r,e.resourceNames.length)}),e.status=this.shouldProcessResources?"ready":"loaded"}async processResources(e,s){const r=this.loadingStates.get(e);if(!r){d.warn(`Can't load resource for unknown ${this.name}: "${e}".`);return}if(r.status!=="loaded"){d.warn(`Resources are not loaded can't process them: "${e}".`);return}let o=0;for(const t of r.resourceNames){const a=this.resourceLoader._resources.get(t);if(!a){d.warn('Unable to find resource "'+t+'".');continue}await this.resourceLoader._processResource(a),o++,s&&await s(o,r.resourceNames.length)}r.status="ready"}prioritize(e){const s=this.loadingStates.get(e);if(!s)return null;if(s.status==="loaded"||s.status==="ready")return i.log(`Scene ${e} is already loaded. Skipping prioritization.`),null;const r=this.loadingTaskQueue.findIndex(t=>t.identifier===e);let o;return r!==-1?(o=this.loadingTaskQueue[r],this.loadingTaskQueue.splice(r,1),this.loadingTaskQueue.push(o)):(o=new m(e),this.loadingTaskQueue.push(o)),this.loadAllTasksInBackground(),o}registerResources(e,s){if(this.loadingStates.get(e)){i.log(`${this.name} ${e} is already registered.`);return}this.loadingStates.set(e,{resourceNames:s.map(o=>o.name),status:"not-loaded"})}unregisterResources(e){this.loadingStates.delete(e)}enqueue(e){const s=this.loadingStates.get(e);if(!s)return i.log(`Resources for ${this.name} ${e} are not registered.`),null;if(s.status!=="not-loaded")return i.log(`Resources for ${this.name} ${e} are already loading or loaded.`),null;i.log(`Loading of resources for ${this.name} ${e} was requested.`);const r=new m(e);return this.loadingTaskQueue.push(r),r}unloadResources(e,s=null){if(e===s||!e)return;i.log(`Unloading of resources for ${this.name} ${e} was requested.`);const r=this.loadingStates.get(e),o=s&&this.loadingStates.get(s)||null;if(!!r){for(const t of this.getResourcesDifference(e,r,s,o))this.resourceLoader._unloadResource(t);i.log(`Unloading of resources for ${this.name} ${e} finished.`),r.status="not-loaded"}}areAssetsLoaded(e){const s=this.loadingStates.get(e);return s?s.status==="loaded"||s.status==="ready":!1}areAssetsReady(e){const s=this.loadingStates.get(e);return s?s.status==="ready":!1}setAllResourcesAs(e){for(const s of this.loadingStates.values())s.status=e}setResourcesAs(e,s){const r=this.loadingStates.get(e);!r||(r.status=s)}getResourceNamesFor(e){const s=this.loadingStates.get(e);return s?s.resourceNames:null}getLoadingProgress(e){return e===this.currentLoadingTaskIdentifier?this.currentTaskProgress:this.areAssetsLoaded(e)?1:0}clear(){this.loadingStates.clear(),this.loadingTaskQueue.length=0}}c.ResourceLoadingQueue=M})(gdjs||(gdjs={})); +//# sourceMappingURL=ResourceLoader.js.map diff --git a/Export/RuntimeCustomObjectLayer.js b/Export/RuntimeCustomObjectLayer.js new file mode 100644 index 0000000..4839537 --- /dev/null +++ b/Export/RuntimeCustomObjectLayer.js @@ -0,0 +1,2 @@ +var gdjs;(function(o){class n extends o.RuntimeLayer{constructor(e,r){super(e,r);this._cameraDeltaX=0;this._cameraDeltaY=0;this._renderer.onCreated()}onGameResolutionResized(e,r){}getCameraX(e){return this._cameraDeltaX+this._runtimeScene.getViewportOriginX()}getCameraY(e){return this._cameraDeltaY+this._runtimeScene.getViewportOriginY()}setCameraX(e,r){this._cameraDeltaX=e-this._runtimeScene.getViewportOriginX(),this._renderer.updatePosition()}setCameraY(e,r){this._cameraDeltaY=e-this._runtimeScene.getViewportOriginY(),this._renderer.updatePosition()}getCameraWidth(e){return this.getWidth()}getCameraHeight(e){return this.getHeight()}setCameraZoom(e,r){}getCameraZoom(e){return 1}setCameraZ(e,r,i){}getCameraZ(e,r){return 0}getCameraRotation(e){return 0}setCameraRotation(e,r){}getCameraRotationY(e){return 0}setCameraRotationY(e,r){}getCameraRotationX(e){return 0}setCameraRotationX(e,r){}getCameraForwardX(e){return 0}getCameraForwardY(e){return 0}getCameraForwardZ(e){return-1}getCameraUpX(e){return 0}getCameraUpY(e){return-1}getCameraUpZ(e){return 0}getCameraRightX(e){return 1}getCameraRightY(e){return 0}getCameraRightZ(e){return 0}convertCoords(e,r,i,t){let a=t||[0,0];return e+=this._cameraDeltaX,r+=this._cameraDeltaY,this._runtimeScene.convertCoords(e,r,a)}convertInverseCoords(e,r,i,t){let a=t||[0,0];return this._runtimeScene.convertInverseCoords(e,r,a),a[0]-=this._cameraDeltaX,a[1]-=this._cameraDeltaY,a}applyLayerInverseTransformation(e,r,i,t){return t[0]=e-this._cameraDeltaX,t[1]=r-this._cameraDeltaY,t}applyLayerTransformation(e,r,i,t){return t[0]=e+this._cameraDeltaX,t[1]=r+this._cameraDeltaY,t}}o.RuntimeCustomObjectLayer=n})(gdjs||(gdjs={})); +//# sourceMappingURL=RuntimeCustomObjectLayer.js.map diff --git a/Export/RuntimeInstanceContainer.js b/Export/RuntimeInstanceContainer.js new file mode 100644 index 0000000..e746683 --- /dev/null +++ b/Export/RuntimeInstanceContainer.js @@ -0,0 +1,2 @@ +var gdjs;(function(l){const h=new l.Logger("RuntimeInstanceContainer"),u={name:"",type:"",variables:[],behaviors:[],effects:[],content:{width:32,height:32,depth:32}};class f{constructor(e){this._allInstancesList=[];this._allInstancesListIsUpToDate=!0;this._instancesRemoved=[];this._layersCameraCoordinates={};this._debugDrawEnabled=!1;this._debugDrawShowHiddenInstances=!1;this._debugDrawShowPointsNames=!1;this._debugDrawShowCustomPoints=!1;this._initialBehaviorSharedData=new Hashtable,this._instances=new Hashtable,this._instancesCache=new Hashtable,this._objects=new Hashtable,this._objectsCtor=new Hashtable,this._layers=new Hashtable,this._orderedLayers=[],e.isInGameEdition()&&this.registerObject(u),this._onceTriggers=new l.OnceTriggers}enableDebugDraw(e,t,s,a){this._debugDrawEnabled&&!e&&this.getDebuggerRenderer().clearDebugDraw(),this._debugDrawEnabled=e,this._debugDrawShowHiddenInstances=t,this._debugDrawShowPointsNames=s,this._debugDrawShowCustomPoints=a}isObjectRegistered(e){return this._objects.containsKey(e)&&this._instances.containsKey(e)&&this._objectsCtor.containsKey(e)}registerObject(e){this._objects.put(e.name,e),this._instances.put(e.name,[]);const t=l.getObjectConstructor(e.type);this._objectsCtor.put(e.name,t),t.supportsReinitialization&&this._instancesCache.put(e.name,[])}updateObject(e){this.isObjectRegistered(e.name)||h.warn("Tried to call updateObject for an object that was not registered ("+e.name+"). Call registerObject first."),this._objects.put(e.name,e)}unregisterObject(e){const t=this._instances.get(e);if(t){const s=t.slice();for(let a=0;ar==="3d"?1:r==="2d+3d"||r===""?2:0;let s;(function(a){a[a.PERSPECTIVE=0]="PERSPECTIVE",a[a.ORTHOGRAPHIC=1]="ORTHOGRAPHIC"})(s=i.RuntimeLayerCameraType||(i.RuntimeLayerCameraType={}));const m=r=>r==="orthographic"?1:0;let o;(function(a){a[a.DO_NOTHING=0]="DO_NOTHING",a[a.TOP_LEFT_ANCHORED_IF_NEVER_MOVED=1]="TOP_LEFT_ANCHORED_IF_NEVER_MOVED"})(o=i.RuntimeLayerDefaultCameraBehavior||(i.RuntimeLayerDefaultCameraBehavior={}));const d=r=>r==="top-left-anchored-if-never-moved"?1:0;class c{constructor(e,a){this._timeScale=1;this._defaultZOrder=0;this._rendererEffects={};this._name=e.name,this._renderingType=f(e.renderingType),this._cameraType=m(e.cameraType),this._defaultCameraBehavior=d(e.defaultCameraBehavior||"top-left-anchored-if-never-moved"),this._hidden=!e.visibility,this._initialCamera3DFieldOfView=e.camera3DFieldOfView||45,this._initialCamera3DNearPlaneDistance=e.camera3DNearPlaneDistance||.1,this._initialCamera3DFarPlaneDistance=e.camera3DFarPlaneDistance||2e3,this._initialCamera2DPlaneMaxDrawingDistance=e.camera2DPlaneMaxDrawingDistance||5e3,this._initialLayerData=e,this._runtimeScene=a,this._effectsManager=a.getGame().getEffectsManager(),this._isLightingLayer=e.isLightingLayer,this._followBaseLayerCamera=e.followBaseLayerCamera,this._clearColor=[e.ambientLightColorR/255,e.ambientLightColorG/255,e.ambientLightColorB/255,1],this._renderer=new i.LayerRenderer(this,a.getRenderer(),a.getGame().getRenderer()),this.show(!this._hidden);for(let t=0;t=0&&(this._timeScale=e)}getTimeScale(){return this._timeScale}getElapsedTime(e){return(e||this._runtimeScene).getElapsedTime()*this._timeScale}followBaseLayer(){const e=this._runtimeScene.getLayer("");this.setCameraX(e.getCameraX()),this.setCameraY(e.getCameraY()),this.setCameraRotation(e.getCameraRotation()),this.setCameraZoom(e.getCameraZoom())}getClearColor(){return this._clearColor}setClearColor(e,a,t){this._clearColor[0]=e/255,this._clearColor[1]=a/255,this._clearColor[2]=t/255,this._renderer.updateClearColor()}setFollowBaseLayerCamera(e){this._followBaseLayerCamera=e}isLightingLayer(){return this._isLightingLayer&&!this._runtimeScene.getGame().isInGameEdition()}}i.RuntimeLayer=c})(gdjs||(gdjs={})); +//# sourceMappingURL=RuntimeLayer.js.map diff --git a/Export/Small Blue Button_Hovered.png b/Export/Small Blue Button_Hovered.png new file mode 100644 index 0000000000000000000000000000000000000000..16f208cb46228e46ae2256dae79d997a1d99b9d0 GIT binary patch literal 292 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC#^NA%C&rs6b?Si}mUKs7M+SzC z{oH>NS%G|oWRD45dI*UL`OvSj}Ky5HFasE6@fgvB=ZK zF(l*O+glrXn+*h7AC`AWYAC5_oaA^jk?{u0Mo#7wezgrAovKrmtRn&f9K;-~Ue-^& zdw2QscR7FS$kcwMxZ#i-{I0&#_@KvnX z*t+%2!)h=8cne3TX}aoH4I zswfr+D)NvP161g7u~?0^P)u!k=_&FM5Q+-OBO%GR^M!&f?Aa}Q_K$53^PT(U&b>Ex z?(fb$GxJTx>t1{&-G~kVU<$Uo`NH1~7*Waa9fVgL2Y{8j{|!NeKwt%^PzJ!CAklyZ z5CINy7y;Zgk9Bar;PE&DAV75rBm(3yTg)%{7rf!mJZ6W(Py0!SJpN~1r3*W-QMC`+ ziar7?PY;0y90(g6zR(9?8=#WO6f%iQp-^ZvDqY8bsl#CCEMKCpYw(H@XXPtK#>T76 zY|K}gTCX-Xws5qx-eAk+ayjNsn_sotWMj{@!<^t~G@1@WXBm^Z%+AEv#BRY2y#e&7 zSWE<*DZuOD2zog5E5Lzql5pBK4Fv;AAd<)wDvi#7230HoGey7?2_zDc2(`zc9uW0N zOH6EC$of9}D5h}+cJE~sP*=NFd}-(_e{Ny#+-S{Oa|=r=uER#hSDl=< zxw(7rw+lS|`~w1m-U!|q{^tIO$f)SI;u8`NB^^F;^!*Rg(vN?bAv$^L@7W)pK9h4+ zQh4FwrJ~ElC0C`DRn?zgtEsKO`PHr4vO9Ob{_g(wKQye#(VeaVB6>t$*8EX~4uOG6(xavq)-;dO@!Jaa8& z*_`Ejsyy%aeT0OEAj0(xC`jY9ws1O5jPg49<`*w9nQvb{OHoLV$`Dmpj{;#wD=K%sjm^XMv6Cp`9@_WdQom3&pUgXRbM%`E;RLkqS zhfy$?qY10DK|!;4A}YPUxMq*YqST&lAxT*%S?@%y@SZjcr6}NJpddsx>QE4^sYJmS z!OA9;&|DqQY53kd+%q{n6IzI&MboHZL6W8tfd-B$Ax|C8YY0s1P|7t!tX8X-Ac@GT zpk6$1$mgWt5PgUiWp+MG!wAiW|qvnUE-}>DrorQ?38wD-)s#{UJQE-I=qn{U> z+eZ4i?0$(zx=p%~0eZZ+J3qtO2p#IWIQ1ac;)pjQv z8RWz0=fx&xre1n{)Iw6$U?CBKg;K@bsc24{6PnNFOv|T6b0#9Pe{N)z+x9LN$=m{7 zERtWB?_!ZGt|b4DD@pMt=DKuW+rP%|iS5*753rS$6|XTr^TEYt?{a!rH{DbeO&Q9uc+%0#_OEd{u(?Q-;ME6vd zkgtl;v|ZEmgl3_@$mw44#{b}n8=pV^&OPlo@^QiDpi#Js4V@D|byskP3uj&Sx%|{t zpj8+Cbn@t@eZeT0IXAsLm4Ewwn{=C2&2KXs3;h;u%+)cx8g>tITRiLXJVhFDT&ose z6%5p!k3_-0IIKJCMl|Yb^_(|P{eU<(y~MKIB63@CMF^=8S_Z+ev} z!fVjBt@{t3hM$?ZcwfFNuI;Wh0z1S=mmMwuREQa>eI(dl6~5hf2LMOc!b^t_08m0v zN1!*;b>D@eG=ZCof7Fjd?G?0?tvYF)>^S_Ndv2^L+kGQ5w{v4Hsr(Sl z#X2EP>KydZBeXU_fiGT?@$QOK7g&D7t*Q!}2$M^8Uea%#Jlhqx>%?g7ZU^3r^Jc}v s|G=(5{%v~{nlj-Vy1wJbE=^lEuID0av@_ZX-p~LbaQAX6cio%%Po_hKg8%>k literal 0 HcmV?d00001 diff --git a/Export/SpriteAnimator.js b/Export/SpriteAnimator.js new file mode 100644 index 0000000..8fc2b2e --- /dev/null +++ b/Export/SpriteAnimator.js @@ -0,0 +1,2 @@ +var gdjs;(function(a){class c{constructor(t,i){this.center={x:0,y:0};this.origin={x:0,y:0};this.hasCustomHitBoxes=!1;this.customHitBoxes=[];this.image=t?t.image:"",this.texture=i.getAnimationFrameTexture(this.image),this.points=new Hashtable,this.reinitialize(t,i)}reinitialize(t,i){this.image=t.image,this.texture=i.getAnimationFrameTexture(this.image),this.points.clear();for(let n=0,o=t.points.length;n=this.customHitBoxes.length&&this.customHitBoxes.push(new a.Polygon);let s=0;for(const u=m.length;s=this.customHitBoxes[n].vertices.length&&this.customHitBoxes[n].vertices.push([0,0]),this.customHitBoxes[n].vertices[s][0]=l.x,this.customHitBoxes[n].vertices[s][1]=l.y}this.customHitBoxes[n].vertices.length=s}this.customHitBoxes.length=n}else this.customHitBoxes.length=0}getPoint(t){return t==="Centre"||t==="Center"?this.center:t==="Origin"?this.origin:this.points.containsKey(t)?this.points.get(t):this.origin}}a.SpriteAnimationFrame=c;class _{constructor(t,i){this.frames=[];this.timeBetweenFrames=t?t.timeBetweenFrames:1,this.loop=!!t.looping,this.reinitialize(t,i)}reinitialize(t,i){this.timeBetweenFrames=t?t.timeBetweenFrames:1,this.loop=!!t.looping;let e=0;for(const r=t.sprites.length;e=this._animations.length||this._currentDirection>=this._animations[this._currentAnimation].directions.length)return!1;const i=this._animations[this._currentAnimation].directions[this._currentDirection],e=this.getAnimationDuration();if(!this._animationPaused&&(i.loop||this._animationElapsedTime!==e)&&i.timeBetweenFrames){const r=this._animationElapsedTime+t*this._animationSpeedScale;return this.setAnimationElapsedTime(i.loop?a.evtTools.common.mod(r,e):a.evtTools.common.clamp(r,0,e))}return!1}setOnFrameChangeCallback(t){this._onFrameChange=t}getAnimationIndex(){return this._currentAnimation}setAnimationIndex(t){return t=t|0,t=0?(this._currentAnimation=t,this._currentFrameIndex=0,this._animationElapsedTime=0,this.invalidateFrame(),!0):!1}getAnimationName(){return this._currentAnimation>=this._animations.length?"":this._animations[this._currentAnimation].name}setAnimationName(t){if(!t)return!1;for(let i=0;i=this._animations.length||this._currentDirection>=this._animations[this._currentAnimation].directions.length)return!0;const t=this._animations[this._currentAnimation].directions[this._currentDirection];return t.loop?!1:this._currentFrameIndex===t.frames.length-1&&this._animationElapsedTime===t.frames.length*t.timeBetweenFrames}isAnimationPaused(){return this._animationPaused}pauseAnimation(){this._animationPaused=!0}resumeAnimation(){this._animationPaused=!1}getAnimationSpeedScale(){return this._animationSpeedScale}setAnimationSpeedScale(t){this._animationSpeedScale=t}setAnimationFrameIndex(t){if(this._currentAnimation>=this._animations.length||this._currentDirection>=this._animations[this._currentAnimation].directions.length)return!1;const i=this._animations[this._currentAnimation].directions[this._currentDirection];return t>=0&&t=this._animations.length)return 0;const t=this._animations[this._currentAnimation];return this._currentDirection>=t.directions.length?0:t.directions[this._currentDirection].frames.length}setDirectionOrAngle(t,i){if(this._currentAnimation>=this._animations.length)return null;const e=this._animations[this._currentAnimation];return e.hasMultipleDirections?(i=i|0,i===this._currentDirection||i>=e.directions.length||e.directions[i].frames.length===0?null:(this._currentDirection=i,this._currentFrameIndex=0,this._animationElapsedTime=0,this.invalidateFrame(),0)):t===i?null:i}getDirectionOrAngle(t){return this._currentAnimation>=this._animations.length?0:this._animations[this._currentAnimation].hasMultipleDirections?this._currentDirection:t}getAngle(t){return this._currentAnimation>=this._animations.length?0:this._animations[this._currentAnimation].hasMultipleDirections?this._currentDirection*45:t}setAngle(t,i){return this._currentAnimation>=this._animations.length?null:this._animations[this._currentAnimation].hasMultipleDirections?(i=i%360,i<0&&(i+=360),this.setDirectionOrAngle(t,Math.round(i/45)%8)):t===i?null:i}hasAnimationEndedLegacy(){if(this._currentAnimation>=this._animations.length||this._currentDirection>=this._animations[this._currentAnimation].directions.length)return!0;const t=this._animations[this._currentAnimation].directions[this._currentDirection];return t.loop?!1:this._currentFrameIndex===t.frames.length-1}}a.SpriteAnimator=g})(gdjs||(gdjs={})); +//# sourceMappingURL=SpriteAnimator.js.map diff --git a/Export/affinetransformation.js b/Export/affinetransformation.js new file mode 100644 index 0000000..916c620 --- /dev/null +++ b/Export/affinetransformation.js @@ -0,0 +1,2 @@ +var gdjs;(function(c){class y{constructor(){this.matrix=new Float32Array([1,0,0,1,0,0])}setToIdentity(){const o=this.matrix;o[0]=1,o[1]=0,o[2]=0,o[3]=1,o[4]=0,o[5]=0}isIdentity(){const o=this.matrix;return o[0]===1&&o[1]===0&&o[2]===0&&o[3]===1&&o[4]===0&&o[5]===0}equals(o){const t=this.matrix,a=o.matrix;return this===o||t[0]===a[0]&&t[1]===a[1]&&t[2]===a[2]&&t[3]===a[3]&&t[4]===a[4]&&t[5]===a[5]}nearlyEquals(o,t){const a=this.matrix,s=o.matrix;return this===o||c.nearlyEqual(a[0],s[0],t)&&c.nearlyEqual(a[1],s[1],t)&&c.nearlyEqual(a[2],s[2],t)&&c.nearlyEqual(a[3],s[3],t)&&c.nearlyEqual(a[4],s[4],t)&&c.nearlyEqual(a[5],s[5],t)}copyFrom(o){const t=this.matrix,a=o.matrix;return t[0]=a[0],t[1]=a[1],t[2]=a[2],t[3]=a[3],t[4]=a[4],t[5]=a[5],this}setToTranslation(o,t){const a=this.matrix;a[0]=1,a[1]=0,a[2]=0,a[3]=1,a[4]=o,a[5]=t}translate(o,t){var a=this.matrix;a[4]=a[0]*o+a[2]*t+a[4],a[5]=a[1]*o+a[3]*t+a[5]}setToScale(o,t){const a=this.matrix;a[0]=o,a[1]=0,a[2]=0,a[3]=t,a[4]=0,a[5]=0}scale(o,t){const a=this.matrix;a[0]*=o,a[1]*=o,a[2]*=t,a[3]*=t}setToRotation(o){const t=this.matrix;let a=Math.cos(o),s=Math.sin(o);(a===-1||a===1)&&(s=0),(s===-1||s===1)&&(a=0),t[0]=a,t[1]=s,t[2]=-s,t[3]=a,t[4]=0,t[5]=0}rotate(o){const t=this.matrix;let a=Math.cos(o),s=Math.sin(o);(a===-1||a===1)&&(s=0),(s===-1||s===1)&&(a=0);const i=t[0],n=t[1],m=t[2],r=t[3];t[0]=i*a+m*s,t[1]=n*a+r*s,t[2]=i*-s+m*a,t[3]=n*-s+r*a}setToRotationAround(o,t,a){const s=this.matrix;let i=Math.cos(o),n=Math.sin(o);(i===-1||i===1)&&(n=0),(n===-1||n===1)&&(i=0),s[0]=i,s[1]=n,s[2]=-n,s[3]=i,s[4]=t-t*i+a*n,s[5]=a-t*n+a*i}rotateAround(o,t,a){this.translate(t,a),this.rotate(o),this.translate(-t,-a)}setToFlipX(o){const t=this.matrix;t[0]=-1,t[1]=0,t[2]=0,t[3]=1,t[4]=2*o,t[5]=0}flipX(o){this.translate(o,0),this.scale(-1,1),this.translate(-o,0)}setToFlipY(o){const t=this.matrix;t[0]=-1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=2*o}flipY(o){this.translate(0,o),this.scale(1,-1),this.translate(0,-o)}concatenate(o){const t=this.matrix,a=o.matrix,s=t[0],i=t[1],n=t[2],m=t[3],r=t[4],h=t[5],l=a[0],e=a[1],x=a[2],f=a[3],u=a[4],T=a[5];t[0]=l*s+e*n,t[1]=l*i+e*m,t[2]=x*s+f*n,t[3]=x*i+f*m,t[4]=u*s+T*n+r,t[5]=u*i+T*m+h}preConcatenate(o){const t=this.matrix,a=o.matrix,s=t[0],i=t[1],n=t[2],m=t[3],r=t[4],h=t[5],l=a[0],e=a[1],x=a[2],f=a[3],u=a[4],T=a[5];t[0]=s*l+i*x,t[1]=s*e+i*f,t[2]=n*l+m*x,t[3]=n*e+m*f,t[4]=r*l+h*x+u,t[5]=r*e+h*f+T}transform(o,t){const a=this.matrix,s=a[0]*o[0]+a[2]*o[1]+a[4],i=a[1]*o[0]+a[3]*o[1]+a[5];t[0]=s,t[1]=i}invert(){const o=this.matrix,t=o[0],a=o[1],s=o[2],i=o[3],n=o[4],m=o[5],r=t*i-a*s;return o[0]=i/r,o[1]=-a/r,o[2]=-s/r,o[3]=t/r,o[4]=(s*m-i*n)/r,o[5]=-(t*m-a*n)/r,this}toString(){const o=this.matrix;return`[[${o[0]} ${o[1]}] [${o[2]} ${o[3]}] [${o[4]} ${o[5]}]]`}}c.AffineTransformation=y})(gdjs||(gdjs={})); +//# sourceMappingURL=affinetransformation.js.map diff --git a/Export/code0.js b/Export/code0.js new file mode 100644 index 0000000..b85380e --- /dev/null +++ b/Export/code0.js @@ -0,0 +1,480 @@ +gdjs.LoginCode = {}; +gdjs.LoginCode.localVariables = []; +gdjs.LoginCode.idToCallbackMap = new Map(); +gdjs.LoginCode.GDtxtbx_9595UsernameObjects1= []; +gdjs.LoginCode.GDtxtbx_9595UsernameObjects2= []; +gdjs.LoginCode.GDtxtbx_9595UsernameObjects3= []; +gdjs.LoginCode.GDtxtbx_9595PasswordObjects1= []; +gdjs.LoginCode.GDtxtbx_9595PasswordObjects2= []; +gdjs.LoginCode.GDtxtbx_9595PasswordObjects3= []; +gdjs.LoginCode.GDbtn_9595LoginObjects1= []; +gdjs.LoginCode.GDbtn_9595LoginObjects2= []; +gdjs.LoginCode.GDbtn_9595LoginObjects3= []; +gdjs.LoginCode.GDbtn_9595RegisterObjects1= []; +gdjs.LoginCode.GDbtn_9595RegisterObjects2= []; +gdjs.LoginCode.GDbtn_9595RegisterObjects3= []; +gdjs.LoginCode.GDtxt_9595lblServerStatusObjects1= []; +gdjs.LoginCode.GDtxt_9595lblServerStatusObjects2= []; +gdjs.LoginCode.GDtxt_9595lblServerStatusObjects3= []; +gdjs.LoginCode.GDtxt_9595lblMQTTStatusObjects1= []; +gdjs.LoginCode.GDtxt_9595lblMQTTStatusObjects2= []; +gdjs.LoginCode.GDtxt_9595lblMQTTStatusObjects3= []; +gdjs.LoginCode.GDtxt_9595ServerStatusObjects1= []; +gdjs.LoginCode.GDtxt_9595ServerStatusObjects2= []; +gdjs.LoginCode.GDtxt_9595ServerStatusObjects3= []; +gdjs.LoginCode.GDtxt_9595MQTTStatusObjects1= []; +gdjs.LoginCode.GDtxt_9595MQTTStatusObjects2= []; +gdjs.LoginCode.GDtxt_9595MQTTStatusObjects3= []; +gdjs.LoginCode.GDtxt_9595debugObjects1= []; +gdjs.LoginCode.GDtxt_9595debugObjects2= []; +gdjs.LoginCode.GDtxt_9595debugObjects3= []; +gdjs.LoginCode.GDtxt_9595gameTitleObjects1= []; +gdjs.LoginCode.GDtxt_9595gameTitleObjects2= []; +gdjs.LoginCode.GDtxt_9595gameTitleObjects3= []; +gdjs.LoginCode.GDtxt_9595dateObjects1= []; +gdjs.LoginCode.GDtxt_9595dateObjects2= []; +gdjs.LoginCode.GDtxt_9595dateObjects3= []; +gdjs.LoginCode.GDspr_9595playerObjects1= []; +gdjs.LoginCode.GDspr_9595playerObjects2= []; +gdjs.LoginCode.GDspr_9595playerObjects3= []; +gdjs.LoginCode.GDspr_9595otherPlayersObjects1= []; +gdjs.LoginCode.GDspr_9595otherPlayersObjects2= []; +gdjs.LoginCode.GDspr_9595otherPlayersObjects3= []; +gdjs.LoginCode.GDspr_9595doorObjects1= []; +gdjs.LoginCode.GDspr_9595doorObjects2= []; +gdjs.LoginCode.GDspr_9595doorObjects3= []; +gdjs.LoginCode.GDbtn_9595LogoutObjects1= []; +gdjs.LoginCode.GDbtn_9595LogoutObjects2= []; +gdjs.LoginCode.GDbtn_9595LogoutObjects3= []; +gdjs.LoginCode.GDbtn_9595FullscreenObjects1= []; +gdjs.LoginCode.GDbtn_9595FullscreenObjects2= []; +gdjs.LoginCode.GDbtn_9595FullscreenObjects3= []; + + +gdjs.LoginCode.eventsList0 = function(runtimeScene) { + +{ + +gdjs.copyArray(runtimeScene.getObjects("btn_Register"), gdjs.LoginCode.GDbtn_9595RegisterObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.LoginCode.GDbtn_9595RegisterObjects1.length;i (gdjs.LoginCode.asyncCallback9098812(runtimeScene, asyncObjectsList)), 9098812, asyncObjectsList); +} +} + +} + + +};gdjs.LoginCode.eventsList2 = function(runtimeScene) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtTools.runtimeScene.sceneJustBegins(runtimeScene); +if (isConditionTrue_0) { +{gdjs.evtsExt__MQTT__connect.func(runtimeScene, runtimeScene.getGame().getVariables().getFromIndex(2).getAsString(), "", false, null); +} +{gdjs.evtTools.network.sendAsyncRequest(runtimeScene.getGame().getVariables().getFromIndex(1).getAsString() + "/users", "", "GET", "", runtimeScene.getScene().getVariables().getFromIndex(2), gdjs.VariablesContainer.badVariable); +} +{gdjs.evtTools.network.sendAsyncRequest(runtimeScene.getGame().getVariables().getFromIndex(1).getAsString() + "/server", "", "GET", "", runtimeScene.getScene().getVariables().getFromIndex(2), gdjs.VariablesContainer.badVariable); +} + +{ //Subevents +gdjs.LoginCode.eventsList1(runtimeScene);} //End of subevents +} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = (runtimeScene.getScene().getVariables().getFromIndex(2).getAsString() != "[]"); +} +if (isConditionTrue_0) { +gdjs.copyArray(runtimeScene.getObjects("txt_ServerStatus"), gdjs.LoginCode.GDtxt_9595ServerStatusObjects2); +{for(var i = 0, len = gdjs.LoginCode.GDtxt_9595ServerStatusObjects2.length ;i < len;++i) { + gdjs.LoginCode.GDtxt_9595ServerStatusObjects2[i].getBehavior("Text").setText("ONLINE"); +} +} +{for(var i = 0, len = gdjs.LoginCode.GDtxt_9595ServerStatusObjects2.length ;i < len;++i) { + gdjs.LoginCode.GDtxt_9595ServerStatusObjects2[i].setColor("0;255;0"); +} +} +} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtsExt__MQTT__isConnected.func(runtimeScene, null); +if (isConditionTrue_0) { +gdjs.copyArray(runtimeScene.getObjects("txt_MQTTStatus"), gdjs.LoginCode.GDtxt_9595MQTTStatusObjects1); +{for(var i = 0, len = gdjs.LoginCode.GDtxt_9595MQTTStatusObjects1.length ;i < len;++i) { + gdjs.LoginCode.GDtxt_9595MQTTStatusObjects1[i].getBehavior("Text").setText("ONLINE"); +} +} +{for(var i = 0, len = gdjs.LoginCode.GDtxt_9595MQTTStatusObjects1.length ;i < len;++i) { + gdjs.LoginCode.GDtxt_9595MQTTStatusObjects1[i].setColor("0;255;0"); +} +} +} + +} + + +};gdjs.LoginCode.asyncCallback14196748 = function (runtimeScene, asyncObjectsList) { +asyncObjectsList.restoreLocalVariablesContainers(gdjs.LoginCode.localVariables); +{gdjs.evtTools.network.jsonToVariableStructure(runtimeScene.getScene().getVariables().getFromIndex(2).getAsString(), runtimeScene.getScene().getVariables().getFromIndex(3)); +} +gdjs.LoginCode.localVariables.length = 0; +} +gdjs.LoginCode.idToCallbackMap.set(14196748, gdjs.LoginCode.asyncCallback14196748); +gdjs.LoginCode.eventsList3 = function(runtimeScene) { + +{ + + +{ +{ +const asyncObjectsList = new gdjs.LongLivedObjectsList(); +asyncObjectsList.backupLocalVariablesContainers(gdjs.LoginCode.localVariables); +runtimeScene.getAsyncTasksManager().addTask(gdjs.evtTools.runtimeScene.wait(0.1), (runtimeScene) => (gdjs.LoginCode.asyncCallback14196748(runtimeScene, asyncObjectsList)), 14196748, asyncObjectsList); +} +} + +} + + +};gdjs.LoginCode.eventsList4 = function(runtimeScene) { + +{ + +gdjs.copyArray(runtimeScene.getObjects("btn_Login"), gdjs.LoginCode.GDbtn_9595LoginObjects2); +gdjs.copyArray(runtimeScene.getObjects("txtbx_Password"), gdjs.LoginCode.GDtxtbx_9595PasswordObjects2); +gdjs.copyArray(runtimeScene.getObjects("txtbx_Username"), gdjs.LoginCode.GDtxtbx_9595UsernameObjects2); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.LoginCode.GDbtn_9595LoginObjects2.length;i (gdjs.RegisterCode.asyncCallback10840044(runtimeScene, asyncObjectsList)), 10840044, asyncObjectsList); +} +} + +} + + +};gdjs.RegisterCode.eventsList5 = function(runtimeScene) { +{ + +let elseEventsChainSatisfied = false; + +{ + + +elseEventsChainSatisfied = false; +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = (runtimeScene.getScene().getVariables().getFromIndex(3).getAsString() != "[]"); +} +if (isConditionTrue_0) { +gdjs.copyArray(runtimeScene.getObjects("txt_RegMessageUser"), gdjs.RegisterCode.GDtxt_9595RegMessageUserObjects2); +{for(var i = 0, len = gdjs.RegisterCode.GDtxt_9595RegMessageUserObjects2.length ;i < len;++i) { + gdjs.RegisterCode.GDtxt_9595RegMessageUserObjects2[i].hide(false); +} +} +elseEventsChainSatisfied = true; +} + +} + + +{ + + +if (!elseEventsChainSatisfied) { +let isConditionTrue_0 = false; +if (!elseEventsChainSatisfied) { +gdjs.copyArray(runtimeScene.getObjects("txt_RegMessageSuccess"), gdjs.RegisterCode.GDtxt_9595RegMessageSuccessObjects1); +gdjs.copyArray(runtimeScene.getObjects("txt_RegMessageUser"), gdjs.RegisterCode.GDtxt_9595RegMessageUserObjects1); +{for(var i = 0, len = gdjs.RegisterCode.GDtxt_9595RegMessageUserObjects1.length ;i < len;++i) { + gdjs.RegisterCode.GDtxt_9595RegMessageUserObjects1[i].hide(); +} +} +{for(var i = 0, len = gdjs.RegisterCode.GDtxt_9595RegMessageSuccessObjects1.length ;i < len;++i) { + gdjs.RegisterCode.GDtxt_9595RegMessageSuccessObjects1[i].hide(false); +} +} +{gdjs.evtTools.network.sendAsyncRequest(runtimeScene.getGame().getVariables().getFromIndex(1).getAsString() + "/users", "{\"username\":\"" + runtimeScene.getScene().getVariables().getFromIndex(2).getAsString() + "\",\"password\":\"" + runtimeScene.getScene().getVariables().getFromIndex(0).getAsString() + "\",\"color\":\"" + runtimeScene.getScene().getVariables().getFromIndex(5).getAsString() + "\",\"room\":\"000000\",\"last_room\":\"000000\"}", "POST", "application/json", gdjs.VariablesContainer.badVariable, gdjs.VariablesContainer.badVariable); +} + +{ //Subevents +gdjs.RegisterCode.eventsList4(runtimeScene);} //End of subevents +elseEventsChainSatisfied = true; +} +} + +} + +} + +};gdjs.RegisterCode.eventsList6 = function(runtimeScene) { +{ + +let elseEventsChainSatisfied = false; + +{ + + +elseEventsChainSatisfied = false; +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = (runtimeScene.getScene().getVariables().getFromIndex(0).getAsString() != runtimeScene.getScene().getVariables().getFromIndex(1).getAsString()); +} +if (isConditionTrue_0) { +gdjs.copyArray(runtimeScene.getObjects("txt_RegMessagePassword"), gdjs.RegisterCode.GDtxt_9595RegMessagePasswordObjects2); +{for(var i = 0, len = gdjs.RegisterCode.GDtxt_9595RegMessagePasswordObjects2.length ;i < len;++i) { + gdjs.RegisterCode.GDtxt_9595RegMessagePasswordObjects2[i].hide(false); +} +} +elseEventsChainSatisfied = true; +} + +} + + +{ + + +if (!elseEventsChainSatisfied) { +let isConditionTrue_0 = false; +if (!elseEventsChainSatisfied) { +gdjs.copyArray(runtimeScene.getObjects("txt_RegMessagePassword"), gdjs.RegisterCode.GDtxt_9595RegMessagePasswordObjects1); +{for(var i = 0, len = gdjs.RegisterCode.GDtxt_9595RegMessagePasswordObjects1.length ;i < len;++i) { + gdjs.RegisterCode.GDtxt_9595RegMessagePasswordObjects1[i].hide(); +} +} + +{ //Subevents +gdjs.RegisterCode.eventsList5(runtimeScene);} //End of subevents +elseEventsChainSatisfied = true; +} +} + +} + +} + +};gdjs.RegisterCode.eventsList7 = function(runtimeScene) { + +{ + +gdjs.copyArray(runtimeScene.getObjects("btn_regRegister"), gdjs.RegisterCode.GDbtn_9595regRegisterObjects1); +gdjs.copyArray(runtimeScene.getObjects("txtbx_regPassword01"), gdjs.RegisterCode.GDtxtbx_9595regPassword01Objects1); +gdjs.copyArray(runtimeScene.getObjects("txtbx_regPassword02"), gdjs.RegisterCode.GDtxtbx_9595regPassword02Objects1); +gdjs.copyArray(runtimeScene.getObjects("txtbx_regUsername"), gdjs.RegisterCode.GDtxtbx_9595regUsernameObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.RegisterCode.GDbtn_9595regRegisterObjects1.length;i (gdjs.Logged_32inCode.asyncCallback13149116(runtimeScene, asyncObjectsList)), 13149116, asyncObjectsList); +} +} + +} + + +};gdjs.Logged_32inCode.eventsList1 = function(runtimeScene) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtTools.runtimeScene.sceneJustBegins(runtimeScene); +if (isConditionTrue_0) { + +{ //Subevents +gdjs.Logged_32inCode.eventsList0(runtimeScene);} //End of subevents +} + +} + + +}; + +gdjs.Logged_32inCode.func = function(runtimeScene) { +runtimeScene.getOnceTriggers().startNewFrame(); + +gdjs.Logged_32inCode.GDtxt_9595loggedInObjects1.length = 0; +gdjs.Logged_32inCode.GDtxt_9595loggedInObjects2.length = 0; +gdjs.Logged_32inCode.GDspr_9595playerObjects1.length = 0; +gdjs.Logged_32inCode.GDspr_9595playerObjects2.length = 0; +gdjs.Logged_32inCode.GDspr_9595otherPlayersObjects1.length = 0; +gdjs.Logged_32inCode.GDspr_9595otherPlayersObjects2.length = 0; +gdjs.Logged_32inCode.GDspr_9595doorObjects1.length = 0; +gdjs.Logged_32inCode.GDspr_9595doorObjects2.length = 0; +gdjs.Logged_32inCode.GDbtn_9595LogoutObjects1.length = 0; +gdjs.Logged_32inCode.GDbtn_9595LogoutObjects2.length = 0; +gdjs.Logged_32inCode.GDbtn_9595FullscreenObjects1.length = 0; +gdjs.Logged_32inCode.GDbtn_9595FullscreenObjects2.length = 0; + +gdjs.Logged_32inCode.eventsList1(runtimeScene); +gdjs.Logged_32inCode.GDtxt_9595loggedInObjects1.length = 0; +gdjs.Logged_32inCode.GDtxt_9595loggedInObjects2.length = 0; +gdjs.Logged_32inCode.GDspr_9595playerObjects1.length = 0; +gdjs.Logged_32inCode.GDspr_9595playerObjects2.length = 0; +gdjs.Logged_32inCode.GDspr_9595otherPlayersObjects1.length = 0; +gdjs.Logged_32inCode.GDspr_9595otherPlayersObjects2.length = 0; +gdjs.Logged_32inCode.GDspr_9595doorObjects1.length = 0; +gdjs.Logged_32inCode.GDspr_9595doorObjects2.length = 0; +gdjs.Logged_32inCode.GDbtn_9595LogoutObjects1.length = 0; +gdjs.Logged_32inCode.GDbtn_9595LogoutObjects2.length = 0; +gdjs.Logged_32inCode.GDbtn_9595FullscreenObjects1.length = 0; +gdjs.Logged_32inCode.GDbtn_9595FullscreenObjects2.length = 0; + + +return; + +} + +gdjs['Logged_32inCode'] = gdjs.Logged_32inCode; diff --git a/Export/code3.js b/Export/code3.js new file mode 100644 index 0000000..15215c4 --- /dev/null +++ b/Export/code3.js @@ -0,0 +1,1235 @@ +gdjs._4800000Code = {}; +gdjs._4800000Code.localVariables = []; +gdjs._4800000Code.idToCallbackMap = new Map(); +gdjs._4800000Code.forEachIndex2 = 0; + +gdjs._4800000Code.forEachObjects2 = []; + +gdjs._4800000Code.forEachTemporary2 = null; + +gdjs._4800000Code.forEachTotalCount2 = 0; + +gdjs._4800000Code.GDtxt_9595debugObjects1= []; +gdjs._4800000Code.GDtxt_9595debugObjects2= []; +gdjs._4800000Code.GDtxt_9595debugObjects3= []; +gdjs._4800000Code.GDtxt_9595debugObjects4= []; +gdjs._4800000Code.GDtxt_9595debugObjects5= []; +gdjs._4800000Code.GDspr_9595playerObjects1= []; +gdjs._4800000Code.GDspr_9595playerObjects2= []; +gdjs._4800000Code.GDspr_9595playerObjects3= []; +gdjs._4800000Code.GDspr_9595playerObjects4= []; +gdjs._4800000Code.GDspr_9595playerObjects5= []; +gdjs._4800000Code.GDspr_9595otherPlayersObjects1= []; +gdjs._4800000Code.GDspr_9595otherPlayersObjects2= []; +gdjs._4800000Code.GDspr_9595otherPlayersObjects3= []; +gdjs._4800000Code.GDspr_9595otherPlayersObjects4= []; +gdjs._4800000Code.GDspr_9595otherPlayersObjects5= []; +gdjs._4800000Code.GDspr_9595doorObjects1= []; +gdjs._4800000Code.GDspr_9595doorObjects2= []; +gdjs._4800000Code.GDspr_9595doorObjects3= []; +gdjs._4800000Code.GDspr_9595doorObjects4= []; +gdjs._4800000Code.GDspr_9595doorObjects5= []; +gdjs._4800000Code.GDbtn_9595LogoutObjects1= []; +gdjs._4800000Code.GDbtn_9595LogoutObjects2= []; +gdjs._4800000Code.GDbtn_9595LogoutObjects3= []; +gdjs._4800000Code.GDbtn_9595LogoutObjects4= []; +gdjs._4800000Code.GDbtn_9595LogoutObjects5= []; +gdjs._4800000Code.GDbtn_9595FullscreenObjects1= []; +gdjs._4800000Code.GDbtn_9595FullscreenObjects2= []; +gdjs._4800000Code.GDbtn_9595FullscreenObjects3= []; +gdjs._4800000Code.GDbtn_9595FullscreenObjects4= []; +gdjs._4800000Code.GDbtn_9595FullscreenObjects5= []; + + +gdjs._4800000Code.mapOfGDgdjs_9546_95954800000Code_9546GDspr_95959595playerObjects2Objects = Hashtable.newFrom({"spr_player": gdjs._4800000Code.GDspr_9595playerObjects2}); +gdjs._4800000Code.mapOfGDgdjs_9546_95954800000Code_9546GDspr_95959595playerObjects2Objects = Hashtable.newFrom({"spr_player": gdjs._4800000Code.GDspr_9595playerObjects2}); +gdjs._4800000Code.mapOfGDgdjs_9546_95954800000Code_9546GDspr_95959595playerObjects1Objects = Hashtable.newFrom({"spr_player": gdjs._4800000Code.GDspr_9595playerObjects1}); +gdjs._4800000Code.eventsList0 = function(runtimeScene) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = (runtimeScene.getGame().getVariables().getFromIndex(0).getChild(0).getChild("last_room").getAsString() == "null"); +} +if (isConditionTrue_0) { +gdjs._4800000Code.GDspr_9595playerObjects2.length = 0; + +{gdjs.evtTools.object.createObjectOnScene(runtimeScene, gdjs._4800000Code.mapOfGDgdjs_9546_95954800000Code_9546GDspr_95959595playerObjects2Objects, runtimeScene.getGame().getVariables().getFromIndex(0).getChild(0).getChild("x").getAsNumber(), runtimeScene.getGame().getVariables().getFromIndex(0).getChild(0).getChild("y").getAsNumber(), ""); +} +{for(var i = 0, len = gdjs._4800000Code.GDspr_9595playerObjects2.length ;i < len;++i) { + gdjs._4800000Code.GDspr_9595playerObjects2[i].returnVariable(gdjs._4800000Code.GDspr_9595playerObjects2[i].getVariables().getFromIndex(0)).setNumber(runtimeScene.getGame().getVariables().getFromIndex(0).getChild(0).getChild("id").getAsNumber()); +} +} +} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = (runtimeScene.getGame().getVariables().getFromIndex(0).getChild(0).getChild("last_room").getAsString() == "000000"); +} +if (isConditionTrue_0) { +gdjs._4800000Code.GDspr_9595playerObjects2.length = 0; + +{gdjs.evtTools.object.createObjectOnScene(runtimeScene, gdjs._4800000Code.mapOfGDgdjs_9546_95954800000Code_9546GDspr_95959595playerObjects2Objects, 560, 352, ""); +} +{for(var i = 0, len = gdjs._4800000Code.GDspr_9595playerObjects2.length ;i < len;++i) { + gdjs._4800000Code.GDspr_9595playerObjects2[i].returnVariable(gdjs._4800000Code.GDspr_9595playerObjects2[i].getVariables().getFromIndex(0)).setNumber(runtimeScene.getGame().getVariables().getFromIndex(0).getChild(0).getChild("id").getAsNumber()); +} +} +} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = (runtimeScene.getGame().getVariables().getFromIndex(0).getChild(0).getChild("last_room").getAsString() == "000001"); +} +if (isConditionTrue_0) { +gdjs._4800000Code.GDspr_9595playerObjects1.length = 0; + +{gdjs.evtTools.object.createObjectOnScene(runtimeScene, gdjs._4800000Code.mapOfGDgdjs_9546_95954800000Code_9546GDspr_95959595playerObjects1Objects, 1088, 352, ""); +} +{for(var i = 0, len = gdjs._4800000Code.GDspr_9595playerObjects1.length ;i < len;++i) { + gdjs._4800000Code.GDspr_9595playerObjects1[i].returnVariable(gdjs._4800000Code.GDspr_9595playerObjects1[i].getVariables().getFromIndex(0)).setNumber(runtimeScene.getGame().getVariables().getFromIndex(0).getChild(0).getChild("id").getAsNumber()); +} +} +} + +} + + +};gdjs._4800000Code.eventsList1 = function(runtimeScene) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtTools.runtimeScene.sceneJustBegins(runtimeScene); +if (isConditionTrue_0) { + +{ //Subevents +gdjs._4800000Code.eventsList0(runtimeScene);} //End of subevents +} + +} + + +};gdjs._4800000Code.mapOfGDgdjs_9546_95954800000Code_9546GDspr_95959595otherPlayersObjects4Objects = Hashtable.newFrom({"spr_otherPlayers": gdjs._4800000Code.GDspr_9595otherPlayersObjects4}); +gdjs._4800000Code.eventsList2 = function(runtimeScene, asyncObjectsList) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = (runtimeScene.getScene().getVariables().getFromIndex(3).getChild("id").getAsString() != runtimeScene.getGame().getVariables().getFromIndex(0).getChild(0).getChild("id").getAsString()); +} +if (isConditionTrue_0) { +gdjs._4800000Code.GDspr_9595otherPlayersObjects4.length = 0; + +{gdjs.evtTools.object.createObjectOnScene(runtimeScene, gdjs._4800000Code.mapOfGDgdjs_9546_95954800000Code_9546GDspr_95959595otherPlayersObjects4Objects, runtimeScene.getScene().getVariables().getFromIndex(3).getChild("x").getAsNumber(), runtimeScene.getScene().getVariables().getFromIndex(3).getChild("y").getAsNumber(), ""); +} +{for(var i = 0, len = gdjs._4800000Code.GDspr_9595otherPlayersObjects4.length ;i < len;++i) { + gdjs._4800000Code.GDspr_9595otherPlayersObjects4[i].setColor(runtimeScene.getScene().getVariables().getFromIndex(3).getChild("color").getAsString()); +} +} +{for(var i = 0, len = gdjs._4800000Code.GDspr_9595otherPlayersObjects4.length ;i < len;++i) { + gdjs._4800000Code.GDspr_9595otherPlayersObjects4[i].returnVariable(gdjs._4800000Code.GDspr_9595otherPlayersObjects4[i].getVariables().getFromIndex(0)).setNumber(runtimeScene.getScene().getVariables().getFromIndex(3).getChild("id").getAsNumber()); +} +} +} + +} + + +};gdjs._4800000Code.eventsList3 = function(runtimeScene, asyncObjectsList) { + +{ + + +const keyIteratorReference3 = runtimeScene.getScene().getVariables().getFromIndex(4); +const valueIteratorReference3 = runtimeScene.getScene().getVariables().getFromIndex(3); +const iterableReference3 = runtimeScene.getScene().getVariables().getFromIndex(1); +if(!iterableReference3.isPrimitive()) { +for( + const iteratorKey3 in + iterableReference3.getType() === "structure" + ? iterableReference3.getAllChildren() + : iterableReference3.getType() === "array" + ? iterableReference3.getAllChildrenArray() + : [] +) { + if(iterableReference3.getType() === "structure") + keyIteratorReference3.setString(iteratorKey3); + else if(iterableReference3.getType() === "array") + keyIteratorReference3.setNumber(iteratorKey3); + const structureChildVariable3 = iterableReference3.getChild(iteratorKey3) + valueIteratorReference3.castTo(structureChildVariable3.getType()) + if(structureChildVariable3.isPrimitive()) { + valueIteratorReference3.setValue(structureChildVariable3.getValue()); + } else if (structureChildVariable3.getType() === "structure") { + // Structures are passed by reference like JS objects + valueIteratorReference3.replaceChildren(structureChildVariable3.getAllChildren()); + } else if (structureChildVariable3.getType() === "array") { + // Arrays are passed by reference like JS objects + valueIteratorReference3.replaceChildrenArray(structureChildVariable3.getAllChildrenArray()); + } else console.warn("Cannot identify type: ", type); + +let isConditionTrue_0 = false; +if (true) +{ + +{ //Subevents: +gdjs._4800000Code.eventsList2(runtimeScene, asyncObjectsList);} //Subevents end. +} +} +} + +} + + +};gdjs._4800000Code.asyncCallback13872876 = function (runtimeScene, asyncObjectsList) { +asyncObjectsList.restoreLocalVariablesContainers(gdjs._4800000Code.localVariables); +{gdjs.evtTools.network.jsonToVariableStructure(runtimeScene.getScene().getVariables().getFromIndex(2).getAsString(), runtimeScene.getScene().getVariables().getFromIndex(1)); +} +{gdjs.evtsExt__MQTT__connect.func(runtimeScene, runtimeScene.getGame().getVariables().getFromIndex(2).getAsString(), "", false, null); +} + +{ //Subevents +gdjs._4800000Code.eventsList3(runtimeScene, asyncObjectsList);} //End of subevents +gdjs._4800000Code.localVariables.length = 0; +} +gdjs._4800000Code.idToCallbackMap.set(13872876, gdjs._4800000Code.asyncCallback13872876); +gdjs._4800000Code.eventsList4 = function(runtimeScene) { + +{ + + +{ +{ +const asyncObjectsList = new gdjs.LongLivedObjectsList(); +asyncObjectsList.backupLocalVariablesContainers(gdjs._4800000Code.localVariables); +runtimeScene.getAsyncTasksManager().addTask(gdjs.evtTools.runtimeScene.wait(0.1), (runtimeScene) => (gdjs._4800000Code.asyncCallback13872876(runtimeScene, asyncObjectsList)), 13872876, asyncObjectsList); +} +} + +} + + +};gdjs._4800000Code.eventsList5 = function(runtimeScene) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtTools.runtimeScene.sceneJustBegins(runtimeScene); +if (isConditionTrue_0) { +gdjs.copyArray(runtimeScene.getObjects("spr_player"), gdjs._4800000Code.GDspr_9595playerObjects1); +{for(var i = 0, len = gdjs._4800000Code.GDspr_9595playerObjects1.length ;i < len;++i) { + gdjs._4800000Code.GDspr_9595playerObjects1[i].setColor(runtimeScene.getGame().getVariables().getFromIndex(0).getChild(0).getChild("color").getAsString()); +} +} +{gdjs.evtTools.network.sendAsyncRequest(runtimeScene.getGame().getVariables().getFromIndex(1).getAsString() + "/users/" + runtimeScene.getGame().getVariables().getFromIndex(0).getChild(0).getChild("id").getAsString(), "{\"x\":\"" + gdjs.evtTools.common.toString(Math.round((( gdjs._4800000Code.GDspr_9595playerObjects1.length === 0 ) ? 0 :gdjs._4800000Code.GDspr_9595playerObjects1[0].getPointX("")))) + "\",\"y\":\"" + gdjs.evtTools.common.toString(Math.round((( gdjs._4800000Code.GDspr_9595playerObjects1.length === 0 ) ? 0 :gdjs._4800000Code.GDspr_9595playerObjects1[0].getPointY("")))) + "\"}", "PATCH", "application/json", gdjs.VariablesContainer.badVariable, gdjs.VariablesContainer.badVariable); +} +{gdjs.evtTools.network.sendAsyncRequest(runtimeScene.getGame().getVariables().getFromIndex(1).getAsString() + "/users?online=true&room=" + gdjs.evtTools.runtimeScene.getSceneName(runtimeScene), "", "GET", "", runtimeScene.getScene().getVariables().getFromIndex(2), gdjs.VariablesContainer.badVariable); +} + +{ //Subevents +gdjs._4800000Code.eventsList4(runtimeScene);} //End of subevents +} + +} + + +};gdjs._4800000Code.mapOfGDgdjs_9546_95954800000Code_9546GDspr_95959595otherPlayersObjects2Objects = Hashtable.newFrom({"spr_otherPlayers": gdjs._4800000Code.GDspr_9595otherPlayersObjects2}); +gdjs._4800000Code.eventsList6 = function(runtimeScene) { + +};gdjs._4800000Code.eventsList7 = function(runtimeScene) { + +{ + +gdjs.copyArray(runtimeScene.getObjects("spr_otherPlayers"), gdjs._4800000Code.GDspr_9595otherPlayersObjects1); + +for (gdjs._4800000Code.forEachIndex2 = 0;gdjs._4800000Code.forEachIndex2 < gdjs._4800000Code.GDspr_9595otherPlayersObjects1.length;++gdjs._4800000Code.forEachIndex2) { +gdjs._4800000Code.GDspr_9595otherPlayersObjects2.length = 0; + + +gdjs._4800000Code.forEachTemporary2 = gdjs._4800000Code.GDspr_9595otherPlayersObjects1[gdjs._4800000Code.forEachIndex2]; +gdjs._4800000Code.GDspr_9595otherPlayersObjects2.push(gdjs._4800000Code.forEachTemporary2); +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs._4800000Code.GDspr_9595otherPlayersObjects2.length;i (gdjs._4800001Code.asyncCallback13872876(runtimeScene, asyncObjectsList)), 13872876, asyncObjectsList); +} +} + +} + + +};gdjs._4800001Code.eventsList5 = function(runtimeScene) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtTools.runtimeScene.sceneJustBegins(runtimeScene); +if (isConditionTrue_0) { +gdjs.copyArray(runtimeScene.getObjects("spr_player"), gdjs._4800001Code.GDspr_9595playerObjects1); +{for(var i = 0, len = gdjs._4800001Code.GDspr_9595playerObjects1.length ;i < len;++i) { + gdjs._4800001Code.GDspr_9595playerObjects1[i].setColor(runtimeScene.getGame().getVariables().getFromIndex(0).getChild(0).getChild("color").getAsString()); +} +} +{gdjs.evtTools.network.sendAsyncRequest(runtimeScene.getGame().getVariables().getFromIndex(1).getAsString() + "/users/" + runtimeScene.getGame().getVariables().getFromIndex(0).getChild(0).getChild("id").getAsString(), "{\"x\":\"" + gdjs.evtTools.common.toString(Math.round((( gdjs._4800001Code.GDspr_9595playerObjects1.length === 0 ) ? 0 :gdjs._4800001Code.GDspr_9595playerObjects1[0].getPointX("")))) + "\",\"y\":\"" + gdjs.evtTools.common.toString(Math.round((( gdjs._4800001Code.GDspr_9595playerObjects1.length === 0 ) ? 0 :gdjs._4800001Code.GDspr_9595playerObjects1[0].getPointY("")))) + "\"}", "PATCH", "application/json", gdjs.VariablesContainer.badVariable, gdjs.VariablesContainer.badVariable); +} +{gdjs.evtTools.network.sendAsyncRequest(runtimeScene.getGame().getVariables().getFromIndex(1).getAsString() + "/users?online=true&room=" + gdjs.evtTools.runtimeScene.getSceneName(runtimeScene), "", "GET", "", runtimeScene.getScene().getVariables().getFromIndex(0), gdjs.VariablesContainer.badVariable); +} + +{ //Subevents +gdjs._4800001Code.eventsList4(runtimeScene);} //End of subevents +} + +} + + +};gdjs._4800001Code.mapOfGDgdjs_9546_95954800001Code_9546GDspr_95959595otherPlayersObjects2Objects = Hashtable.newFrom({"spr_otherPlayers": gdjs._4800001Code.GDspr_9595otherPlayersObjects2}); +gdjs._4800001Code.eventsList6 = function(runtimeScene) { + +};gdjs._4800001Code.eventsList7 = function(runtimeScene) { + +{ + +gdjs.copyArray(runtimeScene.getObjects("spr_otherPlayers"), gdjs._4800001Code.GDspr_9595otherPlayersObjects1); + +for (gdjs._4800001Code.forEachIndex2 = 0;gdjs._4800001Code.forEachIndex2 < gdjs._4800001Code.GDspr_9595otherPlayersObjects1.length;++gdjs._4800001Code.forEachIndex2) { +gdjs._4800001Code.GDspr_9595otherPlayersObjects2.length = 0; + + +gdjs._4800001Code.forEachTemporary2 = gdjs._4800001Code.GDspr_9595otherPlayersObjects1[gdjs._4800001Code.forEachIndex2]; +gdjs._4800001Code.GDspr_9595otherPlayersObjects2.push(gdjs._4800001Code.forEachTemporary2); +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs._4800001Code.GDspr_9595otherPlayersObjects2.length;i (gdjs.FunctionsCode.asyncCallback13872876(runtimeScene, asyncObjectsList)), 13872876, asyncObjectsList); +} +} + +} + + +};gdjs.FunctionsCode.eventsList3 = function(runtimeScene) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtTools.runtimeScene.sceneJustBegins(runtimeScene); +if (isConditionTrue_0) { +gdjs.copyArray(runtimeScene.getObjects("spr_player"), gdjs.FunctionsCode.GDspr_9595playerObjects1); +{for(var i = 0, len = gdjs.FunctionsCode.GDspr_9595playerObjects1.length ;i < len;++i) { + gdjs.FunctionsCode.GDspr_9595playerObjects1[i].setColor(runtimeScene.getGame().getVariables().getFromIndex(0).getChild(0).getChild("color").getAsString()); +} +} +{gdjs.evtTools.network.sendAsyncRequest(runtimeScene.getGame().getVariables().getFromIndex(1).getAsString() + "/users/" + runtimeScene.getGame().getVariables().getFromIndex(0).getChild(0).getChild("id").getAsString(), "{\"x\":\"" + gdjs.evtTools.common.toString(Math.round((( gdjs.FunctionsCode.GDspr_9595playerObjects1.length === 0 ) ? 0 :gdjs.FunctionsCode.GDspr_9595playerObjects1[0].getPointX("")))) + "\",\"y\":\"" + gdjs.evtTools.common.toString(Math.round((( gdjs.FunctionsCode.GDspr_9595playerObjects1.length === 0 ) ? 0 :gdjs.FunctionsCode.GDspr_9595playerObjects1[0].getPointY("")))) + "\"}", "PATCH", "application/json", gdjs.VariablesContainer.badVariable, gdjs.VariablesContainer.badVariable); +} +{gdjs.evtTools.network.sendAsyncRequest(runtimeScene.getGame().getVariables().getFromIndex(1).getAsString() + "/users?online=true&room=" + gdjs.evtTools.runtimeScene.getSceneName(runtimeScene), "", "GET", "", runtimeScene.getScene().getVariables().getFromIndex(0), gdjs.VariablesContainer.badVariable); +} + +{ //Subevents +gdjs.FunctionsCode.eventsList2(runtimeScene);} //End of subevents +} + +} + + +};gdjs.FunctionsCode.mapOfGDgdjs_9546FunctionsCode_9546GDspr_95959595otherPlayersObjects2Objects = Hashtable.newFrom({"spr_otherPlayers": gdjs.FunctionsCode.GDspr_9595otherPlayersObjects2}); +gdjs.FunctionsCode.eventsList4 = function(runtimeScene) { + +};gdjs.FunctionsCode.eventsList5 = function(runtimeScene) { + +{ + +gdjs.copyArray(runtimeScene.getObjects("spr_otherPlayers"), gdjs.FunctionsCode.GDspr_9595otherPlayersObjects1); + +for (gdjs.FunctionsCode.forEachIndex2 = 0;gdjs.FunctionsCode.forEachIndex2 < gdjs.FunctionsCode.GDspr_9595otherPlayersObjects1.length;++gdjs.FunctionsCode.forEachIndex2) { +gdjs.FunctionsCode.GDspr_9595otherPlayersObjects2.length = 0; + + +gdjs.FunctionsCode.forEachTemporary2 = gdjs.FunctionsCode.GDspr_9595otherPlayersObjects1[gdjs.FunctionsCode.forEachIndex2]; +gdjs.FunctionsCode.GDspr_9595otherPlayersObjects2.push(gdjs.FunctionsCode.forEachTemporary2); +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.FunctionsCode.GDspr_9595otherPlayersObjects2.length;i=5.5.230","helpPath":"","iconUrl":"","name":"PanelSpriteButton","previewIconUrl":"","shortDescription":"","version":"","description":"","tags":["button","ui"],"authorIds":["IWykYNRvhCZBN3vEgKEbBPOR3Oc2"],"dependencies":[],"globalVariables":[],"sceneVariables":[],"eventsFunctions":[],"eventsFunctionsFolderStructure":{"folderName":"__ROOT"},"eventsBasedBehaviors":[],"eventsBasedObjects":[{"areaMaxX":256,"areaMaxY":64,"areaMaxZ":64,"areaMinX":0,"areaMinY":0,"areaMinZ":0,"assetStoreTag":"menu buttons","defaultName":"Button","description":"","fullName":"","helpPath":"","iconUrl":"","isInnerAreaFollowingParentSize":true,"isUsingLegacyInstancesRenderer":false,"name":"PanelSpriteButton","previewIconUrl":"","objects":[{"assetStoreId":"","bold":false,"italic":false,"name":"Label","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":4.0,"topEdgeAnchor":4.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"useLegacyBottomAndRightAnchors":false},{"name":"Effect","type":"EffectCapability::EffectBehavior"},{"name":"Opacity","type":"OpacityCapability::OpacityBehavior"},{"name":"Scale","type":"ScalableCapability::ScalableBehavior"},{"name":"Text","type":"TextContainerCapability::TextContainerBehavior"},{"name":"TextStyleState","type":"PanelSpriteButton::TextStyleState","ShouldEnableOutlineOnHover":false,"HoverColor":"","ShouldEnableShadowOnHover":false,"HoverFontSize":0.0,"IsHovered":false,"IdleFontSize":0.0,"IdleColor":""}],"string":"Text","font":"","textAlignment":"center","characterSize":20.0,"color":{"b":0,"g":0,"r":0},"content":{"bold":false,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"Text","font":"","textAlignment":"center","verticalTextAlignment":"center","characterSize":20.0,"lineHeight":0.0,"color":"0;0;0"}},{"assetStoreId":"","bottomMargin":0.0,"height":32.0,"leftMargin":0.0,"name":"Idle","rightMargin":0.0,"texture":"","tiled":false,"topMargin":0.0,"type":"PanelSpriteObject::PanelSprite","width":32.0,"variables":[{"folded":true,"name":"State","type":"string","value":"Idle"}],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":2.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"topEdgeAnchor":1.0,"useLegacyBottomAndRightAnchors":false},{"name":"ButtonFSM","type":"PanelSpriteButton::ButtonFSM","ShouldCheckHovering":true},{"name":"Effect","type":"EffectCapability::EffectBehavior"},{"name":"Opacity","type":"OpacityCapability::OpacityBehavior"},{"name":"Resizable","type":"ResizableCapability::ResizableBehavior"}]},{"assetStoreId":"","bottomMargin":0.0,"height":32.0,"leftMargin":0.0,"name":"Hovered","rightMargin":0.0,"texture":"","tiled":false,"topMargin":0.0,"type":"PanelSpriteObject::PanelSprite","width":32.0,"variables":[],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":2.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"topEdgeAnchor":1.0,"useLegacyBottomAndRightAnchors":false},{"name":"Effect","type":"EffectCapability::EffectBehavior"},{"name":"Opacity","type":"OpacityCapability::OpacityBehavior"},{"name":"Resizable","type":"ResizableCapability::ResizableBehavior"},{"name":"Tween","type":"Tween::TweenBehavior"}]},{"assetStoreId":"","bottomMargin":0.0,"height":32.0,"leftMargin":0.0,"name":"Pressed","rightMargin":0.0,"texture":"","tiled":false,"topMargin":0.0,"type":"PanelSpriteObject::PanelSprite","width":32.0,"variables":[],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":2.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"topEdgeAnchor":1.0,"useLegacyBottomAndRightAnchors":false},{"name":"Effect","type":"EffectCapability::EffectBehavior"},{"name":"Opacity","type":"OpacityCapability::OpacityBehavior"},{"name":"Resizable","type":"ResizableCapability::ResizableBehavior"}]},{"assetStoreId":"","name":"BitmapLabel","type":"BitmapText::BitmapTextObject","variables":[],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":4.0,"topEdgeAnchor":4.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"useLegacyBottomAndRightAnchors":false},{"name":"BitmapTextStyleState","type":"PanelSpriteButton::BitmapTextStyleState","HoverColor":"","HoverPrefix":"","HoverSuffix":"","IsHovered":false,"IdleText":"","IdleColor":""},{"name":"Effect","type":"EffectCapability::EffectBehavior"},{"name":"Opacity","type":"OpacityCapability::OpacityBehavior"},{"name":"Scale","type":"ScalableCapability::ScalableBehavior"},{"name":"Text","type":"TextContainerCapability::TextContainerBehavior"}],"content":{"text":"Text","opacity":255.0,"scale":1.0,"fontSize":20.0,"tint":"255;255;255","bitmapFontResourceName":"","textureAtlasResourceName":"","align":"center","verticalTextAlignment":"center"}}],"objectsFolderStructure":{"folderName":"__ROOT"},"objectsGroups":[{"name":"Background","objects":[{"name":"Idle"},{"name":"Hovered"},{"name":"Pressed"}]},{"name":"Labels","objects":[{"name":"Label"},{"name":"BitmapLabel"}]}],"layers":[{"ambientLightColorB":200,"ambientLightColorG":200,"ambientLightColorR":200,"camera2DPlaneMaxDrawingDistance":5000.0,"camera3DFarPlaneDistance":10000.0,"camera3DFieldOfView":45.0,"camera3DNearPlaneDistance":3.0,"cameraType":"","followBaseLayerCamera":false,"isLightingLayer":false,"isLocked":false,"name":"","renderingType":"","visibility":true,"cameras":[{"defaultSize":true,"defaultViewport":true,"height":0.0,"viewportBottom":1.0,"viewportLeft":0.0,"viewportRight":1.0,"viewportTop":0.0,"width":0.0}],"effects":[]}],"instances":[{"angle":0.0,"customSize":true,"depth":1.0,"height":64.0,"layer":"","name":"Idle","persistentUuid":"24882334-eec8-403e-8bf1-70fc928a46e6","width":256.0,"x":0.0,"y":0.0,"zOrder":1,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":true,"depth":1.0,"height":64.0,"layer":"","name":"Label","persistentUuid":"3b29c95c-5363-4e25-bf47-eecf13e8a226","width":256.0,"x":0.0,"y":32.0,"zOrder":2,"numberProperties":[],"stringProperties":[],"initialVariables":[]}],"editionSettings":{"grid":false,"gridType":"rectangular","gridWidth":32.0,"gridHeight":32.0,"gridDepth":32.0,"gridOffsetX":0.0,"gridOffsetY":0.0,"gridOffsetZ":0.0,"gridColor":10401023.0,"gridAlpha":0.8,"snap":false,"zoomFactor":2.734375,"windowMask":false,"selectedLayer":"","gameEditorMode":"instances-editor"},"eventsFunctions":[],"eventsFunctionsFolderStructure":{"folderName":"__ROOT"},"propertyDescriptors":[],"propertiesFolderStructure":{"folderName":"__ROOT"},"variants":[{"areaMaxX":128,"areaMaxY":48,"areaMaxZ":64,"areaMinX":0,"areaMinY":0,"areaMinZ":0,"assetStoreAssetId":"80b9ddd78c8727888bb53c7524f443682746667b1ba493c223114c04e7661bbf","assetStoreOriginalName":"Small Blue Button","name":"Small Blue Button","objects":[{"assetStoreId":"","bold":false,"italic":false,"name":"Label","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":4.0,"topEdgeAnchor":4.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"useLegacyBottomAndRightAnchors":false},{"name":"Effect","type":"EffectCapability::EffectBehavior"},{"name":"Opacity","type":"OpacityCapability::OpacityBehavior"},{"name":"Scale","type":"ScalableCapability::ScalableBehavior"},{"name":"Text","type":"TextContainerCapability::TextContainerBehavior"},{"name":"TextStyleState","type":"PanelSpriteButton::TextStyleState","ShouldEnableOutlineOnHover":false,"HoverColor":"","ShouldEnableShadowOnHover":false,"HoverFontSize":0.0,"IsHovered":false,"IdleFontSize":0.0,"IdleColor":""}],"string":"Text","font":"","textAlignment":"center","characterSize":20.0,"color":{"b":0,"g":0,"r":0},"content":{"bold":false,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"Text","font":"","textAlignment":"center","verticalTextAlignment":"center","characterSize":20.0,"lineHeight":0.0,"color":"0;0;0"}},{"assetStoreId":"","bottomMargin":5.0,"height":32.0,"leftMargin":3.0,"name":"Idle","rightMargin":3.0,"texture":"assets\\Small Blue Button_Idle.png","tiled":false,"topMargin":3.0,"type":"PanelSpriteObject::PanelSprite","width":32.0,"variables":[{"folded":true,"name":"State","type":"string","value":"Idle"}],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":2.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"topEdgeAnchor":1.0,"useLegacyBottomAndRightAnchors":false},{"name":"ButtonFSM","type":"PanelSpriteButton::ButtonFSM","ShouldCheckHovering":true},{"name":"Effect","type":"EffectCapability::EffectBehavior"},{"name":"Opacity","type":"OpacityCapability::OpacityBehavior"},{"name":"Resizable","type":"ResizableCapability::ResizableBehavior"}]},{"assetStoreId":"","bottomMargin":5.0,"height":32.0,"leftMargin":3.0,"name":"Hovered","rightMargin":3.0,"texture":"assets\\Small Blue Button_Hovered.png","tiled":false,"topMargin":3.0,"type":"PanelSpriteObject::PanelSprite","width":32.0,"variables":[],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":2.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"topEdgeAnchor":1.0,"useLegacyBottomAndRightAnchors":false},{"name":"Effect","type":"EffectCapability::EffectBehavior"},{"name":"Opacity","type":"OpacityCapability::OpacityBehavior"},{"name":"Resizable","type":"ResizableCapability::ResizableBehavior"},{"name":"Tween","type":"Tween::TweenBehavior"}]},{"assetStoreId":"","bottomMargin":3.0,"height":32.0,"leftMargin":3.0,"name":"Pressed","rightMargin":3.0,"texture":"assets\\Small Blue Button_Pressed.png","tiled":false,"topMargin":3.0,"type":"PanelSpriteObject::PanelSprite","width":32.0,"variables":[],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":2.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"topEdgeAnchor":1.0,"useLegacyBottomAndRightAnchors":false},{"name":"Effect","type":"EffectCapability::EffectBehavior"},{"name":"Opacity","type":"OpacityCapability::OpacityBehavior"},{"name":"Resizable","type":"ResizableCapability::ResizableBehavior"}]},{"assetStoreId":"","name":"BitmapLabel","type":"BitmapText::BitmapTextObject","variables":[],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":4.0,"topEdgeAnchor":4.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"useLegacyBottomAndRightAnchors":false},{"name":"BitmapTextStyleState","type":"PanelSpriteButton::BitmapTextStyleState","HoverColor":"","HoverPrefix":"","HoverSuffix":"","IsHovered":false,"IdleText":"","IdleColor":""},{"name":"Effect","type":"EffectCapability::EffectBehavior"},{"name":"Opacity","type":"OpacityCapability::OpacityBehavior"},{"name":"Scale","type":"ScalableCapability::ScalableBehavior"},{"name":"Text","type":"TextContainerCapability::TextContainerBehavior"}],"content":{"text":"Button","opacity":255.0,"scale":1.0,"fontSize":20.0,"tint":"255;255;255","bitmapFontResourceName":"assets\\8BitOperatorPlus8Regular_Edited.fnt","textureAtlasResourceName":"assets\\8BitOperatorPlus8Regular_Edited.png","align":"center","verticalTextAlignment":"center"}}],"objectsFolderStructure":{"folderName":"__ROOT"},"objectsGroups":[{"name":"Background","objects":[{"name":"Idle"},{"name":"Hovered"},{"name":"Pressed"}]},{"name":"Labels","objects":[{"name":"Label"},{"name":"BitmapLabel"}]}],"layers":[{"ambientLightColorB":200,"ambientLightColorG":200,"ambientLightColorR":200,"camera2DPlaneMaxDrawingDistance":5000.0,"camera3DFarPlaneDistance":10000.0,"camera3DFieldOfView":45.0,"camera3DNearPlaneDistance":3.0,"cameraType":"","followBaseLayerCamera":false,"isLightingLayer":false,"isLocked":false,"name":"","renderingType":"","visibility":true,"cameras":[{"defaultSize":true,"defaultViewport":true,"height":0.0,"viewportBottom":1.0,"viewportLeft":0.0,"viewportRight":1.0,"viewportTop":0.0,"width":0.0}],"effects":[]}],"instances":[{"angle":0.0,"customSize":true,"depth":1.0,"height":48.0,"layer":"","name":"Idle","persistentUuid":"24882334-eec8-403e-8bf1-70fc928a46e6","width":128.0,"x":0.0,"y":0.0,"zOrder":1,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":true,"depth":1.0,"height":48.0,"keepRatio":true,"layer":"","name":"BitmapLabel","persistentUuid":"c3c3200d-dec4-4ac4-9dc5-4715d8989830","width":128.0,"x":5.0,"y":26.0,"zOrder":2,"numberProperties":[],"stringProperties":[],"initialVariables":[]}],"editionSettings":[]}]}]}],"externalLayouts":[],"usedResources":[{"name":"NewSprite2"},{"name":"NewSprite3"},{"name":"assets\\8BitOperatorPlus8Regular_Edited.fnt"},{"name":"assets\\8BitOperatorPlus8Regular_Edited.png"},{"name":"assets\\Small Blue Button_Hovered.png"},{"name":"assets\\Small Blue Button_Idle.png"},{"name":"assets\\Small Blue Button_Pressed.png"}]}; +gdjs.runtimeGameOptions = {}; diff --git a/Export/events-tools/cameratools.js b/Export/events-tools/cameratools.js new file mode 100644 index 0000000..6345aac --- /dev/null +++ b/Export/events-tools/cameratools.js @@ -0,0 +1,2 @@ +var gdjs;(function(a){let b;(function(p){let j;(function(r){r.setCameraX=function(t,e,n,s){!t.hasLayer(n)||t.getLayer(n).setCameraX(e,s)},r.setCameraY=function(t,e,n,s){!t.hasLayer(n)||t.getLayer(n).setCameraY(e,s)},r.getCameraX=function(t,e,n){return t.hasLayer(e)?t.getLayer(e).getCameraX():0},r.getCameraY=function(t,e,n){return t.hasLayer(e)?t.getLayer(e).getCameraY():0},r.getCameraWidth=function(t,e,n){return t.hasLayer(e)?t.getLayer(e).getCameraWidth():0},r.getCameraHeight=function(t,e,n){return t.hasLayer(e)?t.getLayer(e).getCameraHeight():0},r.getCameraBorderLeft=function(t,e,n){return t.hasLayer(e)?r.getCameraX(t,e,n)-r.getCameraWidth(t,e,n)/2:0},r.getCameraBorderRight=function(t,e,n){return t.hasLayer(e)?r.getCameraX(t,e,n)+r.getCameraWidth(t,e,n)/2:0},r.getCameraBorderTop=function(t,e,n){return t.hasLayer(e)?r.getCameraY(t,e,n)-r.getCameraHeight(t,e,n)/2:0},r.getCameraBorderBottom=function(t,e,n){return t.hasLayer(e)?r.getCameraY(t,e,n)+r.getCameraHeight(t,e,n)/2:0},r.showLayer=function(t,e){if(!!t.hasLayer(e))return t.getLayer(e).show(!0)},r.hideLayer=function(t,e){if(!!t.hasLayer(e))return t.getLayer(e).show(!1)},r.layerIsVisible=function(t,e){return t.hasLayer(e)&&t.getLayer(e).isVisible()},r.setCameraRotation=function(t,e,n,s){if(!!t.hasLayer(n))return t.getLayer(n).setCameraRotation(e,s)},r.getCameraRotation=function(t,e,n){return t.hasLayer(e)?t.getLayer(e).getCameraRotation(n):0},r.getCameraZoom=function(t,e,n){return t.hasLayer(e)?t.getLayer(e).getCameraZoom(n):0},r.setCameraZoom=function(t,e,n,s){if(!!t.hasLayer(n))return t.getLayer(n).setCameraZoom(e,s)},r.centerCamera=function(t,e,n,s,o){if(!t.hasLayer(s)||e==null)return;let f=0,i=0;if(n&&!e.hasNoForces()){const u=e.getAverageForce(),L=e.getElapsedTime()/1e3;f=u.getX()*L,i=u.getY()*L}const g=t.getLayer(s);g.setCameraX(e.getCenterXInScene()+f,o),g.setCameraY(e.getCenterYInScene()+i,o)},r.centerCameraWithinLimits=function(t,e,n,s,o,f,i,g,u){r.centerCamera(t,e,i,g,u),r.clampCamera(t,n,s,o,f,g,u)},r.clampCamera=function(t,e,n,s,o,f,i){if(!t.hasLayer(f))return;const g=t.getLayer(f),u=g.getCameraWidth(i)/2,L=g.getCameraHeight(i)/2,m=e+u,c=s-u,h=n+L,d=o-L,B=m0?1:-1},n.cbrt=function(t){return Math.pow(t,1/3)},n.nthroot=function(t,e){return Math.pow(t,1/e)},n.mod=function(t,e){return t-e*Math.floor(t/e)},n.angleDifference=function(t,e){return o.evtTools.common.mod(o.evtTools.common.mod(t-e,360)+180,360)-180},n.angleBetweenPositions=function(t,e,r,i){return Math.atan2(i-e,r-t)*180/Math.PI},n.distanceBetweenPositions=function(t,e,r,i){return Math.sqrt((t-r)*(t-r)+(e-i)*(e-i))},n.lerp=function(t,e,r){return t+(e-t)*r},n.exponentialInterpolation=(t,e,r)=>{if(r===0)return t;if(r===1)return e;if(t<=0||e<=0)return 0;const i=Math.log(t),l=Math.log(e);return Math.exp(i+(l-i)*r)},n.trunc=function(t){return t|0},n.getXFromAngleAndDistance=function(t,e){return e*Math.cos(o.toRad(t))},n.getYFromAngleAndDistance=function(t,e){return e*Math.sin(o.toRad(t))},n.roundTo=function(t,e){return!e||!Number.isInteger(e)?Math.round(t):Math.round(t*Math.pow(10,e))/Math.pow(10,e)},n.floorTo=function(t,e){return!e||!Number.isInteger(e)?Math.floor(t):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)},n.ceilTo=function(t,e){return!e||!Number.isInteger(e)?Math.ceil(t):Math.ceil(t*Math.pow(10,e))/Math.pow(10,e)},n.pi=function(){return Math.PI},n.lerpAngle=function(t,e,r){return t+o.evtTools.common.angleDifference(e,t)*r},n.resolveAsyncEventsFunction=t=>{!!t&&!!t.task&&!!t.task.resolve&&t.task.resolve()};const c=()=>{if(typeof cc!="undefined"&&cc.sys)return cc.sys.isMobile;if(typeof Cocoon!="undefined"&&Cocoon.App)return!0;if(typeof window!="undefined"&&window.cordova)return!0;if(typeof window!="undefined"){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))||/iPad|iPhone|iPod/.test(navigator.platform))return!0;if(/MacIntel/.test(navigator.platform))return!!navigator.maxTouchPoints&&navigator.maxTouchPoints>2}return!1};let a=null;n.isMobile=()=>a!==null?a:a=c()})(p=u.common||(u.common={}))})(s=o.evtTools||(o.evtTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=commontools.js.map diff --git a/Export/events-tools/inputtools.js b/Export/events-tools/inputtools.js new file mode 100644 index 0000000..3fc316d --- /dev/null +++ b/Export/events-tools/inputtools.js @@ -0,0 +1,2 @@ +var gdjs;(function(o){let i;(function(c){let d;(function(n){n.lastTouchId=0,n.lastEndedTouchId=0,n.keysNameToCode={a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,Num0:48,Num1:49,Num2:50,Num3:51,Num4:52,Num5:53,Num6:54,Num7:55,Num8:56,Num9:57,Numpad0:96,Numpad1:97,Numpad2:98,Numpad3:99,Numpad4:100,Numpad5:101,Numpad6:102,Numpad7:103,Numpad8:104,Numpad9:105,LShift:1016,RShift:2016,LControl:1017,RControl:2017,LAlt:1018,RAlt:2018,LSystem:1091,RSystem:2091,SemiColon:186,Comma:188,Period:190,Quote:222,Slash:191,BackSlash:220,Equal:187,Dash:189,Menu:93,LBracket:219,RBracket:221,Tilde:192,Space:32,Back:8,Tab:9,Delete:46,Insert:45,Escape:27,PageUp:33,PageDown:34,End:35,Home:36,Return:13,NumpadPageUp:3033,NumpadPageDown:3034,NumpadEnd:3035,NumpadHome:3036,NumpadReturn:3013,Add:107,Subtract:109,Multiply:106,Divide:111,NumpadAdd:3107,NumpadSubtract:3109,NumpadMultiply:3106,NumpadDivide:3111,Left:37,Up:38,Right:39,Down:40,NumpadLeft:3037,NumpadUp:3038,NumpadRight:3039,NumpadDown:3040,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,Pause:19};const u={};for(const e in n.keysNameToCode)n.keysNameToCode.hasOwnProperty(e)&&(u[n.keysNameToCode[e]]=e);n.mouseButtonsNameToCode={Left:o.InputManager.MOUSE_LEFT_BUTTON,Right:o.InputManager.MOUSE_RIGHT_BUTTON,Middle:o.InputManager.MOUSE_MIDDLE_BUTTON,Back:o.InputManager.MOUSE_BACK_BUTTON,Forward:o.InputManager.MOUSE_FORWARD_BUTTON},n.isKeyPressed=function(e,t){return o.evtTools.input.keysNameToCode.hasOwnProperty(t)?e.getGame().getInputManager().isKeyPressed(o.evtTools.input.keysNameToCode[t]):!1},n.wasKeyJustPressed=function(e,t){return e.getGame().getInputManager().wasKeyJustPressed(o.evtTools.input.keysNameToCode[t])},n.wasKeyReleased=function(e,t){return o.evtTools.input.keysNameToCode.hasOwnProperty(t)?e.getGame().getInputManager().wasKeyReleased(o.evtTools.input.keysNameToCode[t]):!1},n.lastPressedKey=function(e){const t=e.getGame().getInputManager().getLastPressedKey();return u.hasOwnProperty(t)?u[t]:""},n.anyKeyPressed=function(e){return e.getGame().getInputManager().anyKeyPressed()},n.anyKeyReleased=function(e){return e.getGame().getInputManager().anyKeyReleased()},n.isMouseButtonPressed=function(e,t){return o.evtTools.input.mouseButtonsNameToCode.hasOwnProperty(t)?e.getGame().getInputManager().isMouseButtonPressed(o.evtTools.input.mouseButtonsNameToCode[t]):!1},n.isMouseButtonReleased=function(e,t){return o.evtTools.input.mouseButtonsNameToCode.hasOwnProperty(t)?e.getGame().getInputManager().isMouseButtonReleased(o.evtTools.input.mouseButtonsNameToCode[t]):!1},n.hideCursor=function(e){e.getScene().getRenderer().hideCursor()},n.showCursor=function(e){e.getScene().getRenderer().showCursor()},n.getMouseWheelDelta=function(e){return e.getGame().getInputManager().getMouseWheelDelta()},n.isScrollingUp=function(e){return e.getGame().getInputManager().isScrollingUp()},n.isScrollingDown=function(e){return e.getGame().getInputManager().isScrollingDown()},n.getMouseX=function(e,t,r){return n.getCursorX(e,t,r)},n.getMouseY=function(e,t,r){return n.getCursorY(e,t,r)},n.getCursorX=function(e,t,r){const a=o.staticArray(o.evtTools.input.getCursorX);return e.getLayer(t).convertCoords(e.getGame().getInputManager().getCursorX(),e.getGame().getInputManager().getCursorY(),0,a)[0]},n.getCursorY=function(e,t,r){const a=o.staticArray(o.evtTools.input.getCursorY);return e.getLayer(t).convertCoords(e.getGame().getInputManager().getCursorX(),e.getGame().getInputManager().getCursorY(),0,a)[1]},n.getMouseOnlyCursorX=function(e,t,r){const a=o.staticArray(o.evtTools.input.getMouseOnlyCursorX);return e.getLayer(t).convertCoords(e.getGame().getInputManager().getMouseX(),e.getGame().getInputManager().getMouseY(),0,a)[0]},n.getMouseOnlyCursorY=function(e,t,r){const a=o.staticArray(o.evtTools.input.getMouseOnlyCursorY);return e.getLayer(t).convertCoords(e.getGame().getInputManager().getMouseX(),e.getGame().getInputManager().getMouseY(),0,a)[1]},n.isMouseInsideCanvas=function(e){return e.getGame().getInputManager().isMouseInsideCanvas()};const I=function(e){return e.cursorOnObject()};n.cursorOnObject=function(e,t,r,a){return o.evtTools.object.pickObjectsIf(I,e,a,null)},n.getTouchX=function(e,t,r,a){const g=o.staticArray(o.evtTools.input.getTouchX);return e.getLayer(r).convertCoords(e.getGame().getInputManager().getTouchX(t),e.getGame().getInputManager().getTouchY(t),0,g)[0]},n.getTouchY=(e,t,r,a)=>{const g=o.staticArray(o.evtTools.input.getTouchY);return e.getLayer(r).convertCoords(e.getGame().getInputManager().getTouchX(t),e.getGame().getInputManager().getTouchY(t),0,g)[1]},n.hasAnyTouchStarted=e=>{const t=e.getGame().getInputManager().getStartedTouchIdentifiers();return t.length>1||t.length>0&&t[0]!==o.InputManager.MOUSE_TOUCH_ID},n.getStartedTouchCount=e=>{const t=e.getGame().getInputManager().getStartedTouchIdentifiers();return t.length+(t.includes(o.InputManager.MOUSE_TOUCH_ID)?-1:0)},n.getStartedTouchIdentifier=(e,t)=>{const r=e.getGame().getInputManager().getStartedTouchIdentifiers(),a=r.indexOf(o.InputManager.MOUSE_TOUCH_ID);return a<0?r[t]:r[te.getGame().getInputManager().getStartedTouchIdentifiers().length>0,n.getStartedTouchOrMouseCount=e=>e.getGame().getInputManager().getStartedTouchIdentifiers().length,n.getStartedTouchOrMouseIdentifier=(e,t)=>e.getGame().getInputManager().getStartedTouchIdentifiers()[t]||0,n.hasTouchEnded=(e,t)=>e.getGame().getInputManager().hasTouchEnded(t),n.getLastTouchId=function(){return o.evtTools.input.lastTouchId||0},n.getLastEndedTouchId=function(){return o.evtTools.input.lastEndedTouchId||0},n.popStartedTouch=function(e){const t=e.getGame().getInputManager().popStartedTouch();return t!==void 0?(o.evtTools.input.lastTouchId=t,!0):!1},n.popEndedTouch=function(e){const t=e.getGame().getInputManager().popEndedTouch();return t!==void 0?(o.evtTools.input.lastEndedTouchId=t,!0):!1},n.touchSimulateMouse=function(e,t){e.getGame().getInputManager().touchSimulateMouse(t)}})(d=c.input||(c.input={}))})(i=o.evtTools||(o.evtTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=inputtools.js.map diff --git a/Export/events-tools/networktools.js b/Export/events-tools/networktools.js new file mode 100644 index 0000000..be69e96 --- /dev/null +++ b/Export/events-tools/networktools.js @@ -0,0 +1,2 @@ +var gdjs;(function(u){let d;(function(g){let p;(function(r){r.sendAsyncRequest=function(e,s,i,c,a,o){const n=t=>{t instanceof ProgressEvent&&t.currentTarget&&t.currentTarget instanceof XMLHttpRequest&&t.currentTarget.status===0?o.setString("REQUEST_NOT_SENT"):o.setString(""+t)};try{const t=new XMLHttpRequest;t.onerror=n,t.ontimeout=n,t.onabort=n,t.onreadystatechange=()=>{t.readyState===XMLHttpRequest.DONE&&(t.status>=400&&n(""+t.status),a.setString(t.responseText))},t.open(i,e),t.setRequestHeader("Content-Type",c===""?"application/x-www-form-urlencoded":c),t.send(s)}catch(t){n(t)}},r.sendAwaitableAsyncRequest=(e,s,i,c,a,o)=>new u.PromiseTask(fetch(e,{body:i!=="GET"?s:void 0,method:i,headers:{"Content-Type":c||"application/x-www-form-urlencoded"}}).then(async n=>{const t=await n.text();n.status>=400&&o.setString(""+n.status),a.setString(t)},n=>{o.setString(""+n)}));const b=e=>new Promise(s=>setTimeout(s,e));r.retryIfFailed=async({times:e,delayInMs:s},i)=>{let c=0,a=null;for(;c=s&&(n=s-1);let r=0,f=null;for(let i in t.items)if(t.items.hasOwnProperty(i)){let u=t.items[i];if(n-r=O&&(O=p.farSqDist,l=w,c=p.farX,a=p.farY))}}return l?(o.evtTools.object.pickOnly(e,l),f.setNumber(c),i.setNumber(a),!0):!1},b.doCreateObjectOnScene=function(e,t,s,n,r,f){const i=e.createObject(t),u=e.getLayer(f);return i!==null&&(i.setPosition(n,r),i.setLayer(f),i.setZOrder(u.getDefaultZOrder()),s.containsKey(t)&&s.get(t).push(i)),i},b.createObjectOnScene=function(e,t,s,n,r){return o.evtTools.object.doCreateObjectOnScene(e,t.firstKey(),t,s,n,r)},b.createObjectFromGroupOnScene=function(e,t,s,n,r,f){o.evtTools.object.doCreateObjectOnScene(e,s,t,n,r,f)},b.getPickedInstancesCount=e=>{let t=0;const s=o.staticArray(o.evtTools.object.getPickedInstancesCount);e.values(s);for(let n=0,r=s.length;n{let s=0;const n=o.staticArray(o.evtTools.object.getSceneInstancesCount);t.keys(n);const r=new Set(n);for(const f of r)s+=e.getInstancesCountOnScene(f);return s},b.pickedObjectsCount=b.getPickedInstancesCount})(I=g.object||(g.object={}))})(V=o.evtTools||(o.evtTools={}));const A=new o.Logger("LongLivedObjectsLists");class R{constructor(){this.objectsLists=new Map;this.localVariablesContainers=[];this.callbacks=new Map;this.parent=null}static from(g){const d=new R;return d.parent=g,d}getOrCreateList(g){return this.objectsLists.has(g)||this.objectsLists.set(g,[]),this.objectsLists.get(g)}getObjects(g){return!this.objectsLists.has(g)&&this.parent?this.parent.getObjects(g):this.objectsLists.get(g)||[]}addObject(g,d){const L=this.getOrCreateList(g);if(L.includes(d))return;L.push(d);const k=()=>this.removeObject(g,d);this.callbacks.set(d,k),d.registerDestroyCallback(k)}removeObject(g,d){const L=this.getOrCreateList(g),k=L.indexOf(d);k!==-1&&(L.splice(k,1),d.unregisterDestroyCallback(this.callbacks.get(d)),this.callbacks.delete(d))}restoreLocalVariablesContainers(g){o.copyArray(this.localVariablesContainers,g)}backupLocalVariablesContainers(g){o.copyArray(g,this.localVariablesContainers)}getNetworkSyncData(g){const d={};for(const[L,k]of this.objectsLists.entries()){const v=[];for(const T of k){const y=T.getNetworkId();if(!y){A.warn("Tried to get sync data of a LongLivedObjectsList and found an object without a network ID");continue}v.push(y)}d[L]=v}return{objectsLists:d,localVariablesContainers:this.localVariablesContainers.map(L=>L.getNetworkSyncData(g))}}updateFromNetworkSyncData(g,d,L){const{objectsLists:k,localVariablesContainers:v}=g;this.objectsLists.clear(),this.localVariablesContainers.length=0;for(const[T,y]of Object.entries(k)){const S=d.getObjects(T);if(!S){A.warn("Tried to update sync data of a LongLivedObjectsList but cannot find objects with name: "+T);continue}const N=S.filter(x=>{const D=x.getNetworkId();return!!D&&y.includes(D)});for(const x of N)this.addObject(T,x)}this.localVariablesContainers=v.map(T=>{const y=new o.VariablesContainer;return y.updateFromNetworkSyncData(T,L),y})}}o.LongLivedObjectsList=R})(gdjs||(gdjs={})); +//# sourceMappingURL=objecttools.js.map diff --git a/Export/events-tools/runtimescenetools.js b/Export/events-tools/runtimescenetools.js new file mode 100644 index 0000000..e853d0a --- /dev/null +++ b/Export/events-tools/runtimescenetools.js @@ -0,0 +1,2 @@ +var gdjs;(function(r){let c;(function(i){let u;(function(s){s.sceneJustBegins=function(t){return t.getScene().getTimeManager().isFirstFrame()},s.sceneJustResumed=function(t){return t.getScene().sceneJustResumed()},s.getSceneName=function(t){return t.getScene().getName()},s.setBackgroundColor=function(t,e){const n=r.rgbOrHexToRGBColor(e);t.getScene().setBackgroundColor(n[0],n[1],n[2])},s.getElapsedTimeInSeconds=function(t){return t.getScene().getTimeManager().getElapsedTime()/1e3},s.setTimeScale=function(t,e){return t.getScene().getTimeManager().setTimeScale(e)},s.getTimeScale=function(t){return t.getScene().getTimeManager().getTimeScale()},s.timerElapsedTime=function(t,e,n){const a=t.getScene().getTimeManager();return a.hasTimer(n)?a.getTimer(n).getTime()/1e3>=e:(a.addTimer(n),!1)},s.timerPaused=function(t,e){const n=t.getScene().getTimeManager();return n.hasTimer(e)?n.getTimer(e).isPaused():!1},s.resetTimer=function(t,e){const n=t.getScene().getTimeManager();n.hasTimer(e)?n.getTimer(e).reset():n.addTimer(e)},s.pauseTimer=function(t,e){const n=t.getScene().getTimeManager();n.hasTimer(e)||n.addTimer(e),n.getTimer(e).setPaused(!0)},s.unpauseTimer=function(t,e){const n=t.getScene().getTimeManager();return n.hasTimer(e)||n.addTimer(e),n.getTimer(e).setPaused(!1)},s.removeTimer=function(t,e){t.getScene().getTimeManager().removeTimer(e)};class d extends r.AsyncTask{constructor(e){super();this.timeElapsedOnScene=0;this.duration=e}update(e){return this.timeElapsedOnScene+=e.getScene().getTimeManager().getElapsedTime(),this.timeElapsedOnScene>=this.duration}getNetworkSyncData(){return{type:"wait",duration:this.duration,timeElapsedOnScene:this.timeElapsedOnScene}}updateFromNetworkSyncData(e){this.duration=e.duration,this.timeElapsedOnScene=e.timeElapsedOnScene}}s.WaitTask=d,s.wait=t=>new d(t*1e3),s.getTimerElapsedTimeInSeconds=function(t,e){const n=t.getScene().getTimeManager();return n.hasTimer(e)?n.getTimer(e).getTime()/1e3:0},s.getTimerElapsedTimeInSecondsOrNaN=function(t,e){const n=t.getScene().getTimeManager();return n.hasTimer(e)?n.getTimer(e).getTime()/1e3:Number.NaN},s.getTimeFromStartInSeconds=function(t){return t.getScene().getTimeManager().getTimeFromStart()/1e3},s.getTime=function(t,e){if(e==="timestamp")return Date.now();const n=new Date;if(e==="hour")return n.getHours();if(e==="min")return n.getMinutes();if(e==="sec")return n.getSeconds();if(e==="mday")return n.getDate();if(e==="mon")return n.getMonth();if(e==="year")return n.getFullYear()-1900;if(e==="wday")return n.getDay();if(e==="yday"){const a=new Date(n.getFullYear(),0,0),g=n.getTime()-a.getTime(),o=1e3*60*60*24;return Math.floor(g/o)}return 0},s.replaceScene=function(t,e,n){!t.getGame().getSceneAndExtensionsData(e)||t.getScene().requestChange(n?r.SceneChangeRequest.CLEAR_SCENES:r.SceneChangeRequest.REPLACE_SCENE,e)},s.pushScene=function(t,e){!t.getGame().getSceneAndExtensionsData(e)||t.getScene().requestChange(r.SceneChangeRequest.PUSH_SCENE,e)},s.popScene=function(t){t.getScene().requestChange(r.SceneChangeRequest.POP_SCENE)},s.stopGame=function(t){t.getScene().requestChange(r.SceneChangeRequest.STOP_GAME)},s.createObjectsFromExternalLayout=function(t,e,n,a,g){const o=t.getGame().getExternalLayoutData(e);o!==null&&t.getScene().createObjectsFrom(o.instances,n,a,g||0,!1)},s.hasGameJustResumed=t=>t.getGame().hasJustResumed(),s.doesSceneExist=(t,e)=>t.getGame().hasScene(e),s.prioritizeLoadingOfScene=(t,e)=>{t.getGame().prioritizeLoadingOfScene(e)},s.getSceneLoadingProgress=(t,e)=>t.getGame().getSceneLoadingProgress(e),s.areSceneAssetsLoaded=(t,e)=>t.getGame().areSceneAssetsLoaded(e),s.loadObjectOrGroupAssets=(t,e,n)=>{t.getGame().loadObjectOrGroupAssets(e,n)},s.unloadObjectOrGroupAssets=(t,e,n)=>{t.getGame().unloadObjectOrGroupAssets(e,n)},s.areObjectOrGroupAssetsLoaded=(t,e,n)=>t.getGame().areObjectOrGroupAssetsLoaded(e,n)})(u=i.runtimeScene||(i.runtimeScene={}))})(c=r.evtTools||(r.evtTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=runtimescenetools.js.map diff --git a/Export/events-tools/soundtools.js b/Export/events-tools/soundtools.js new file mode 100644 index 0000000..ec587a1 --- /dev/null +++ b/Export/events-tools/soundtools.js @@ -0,0 +1,2 @@ +var gdjs;(function(u){let s;(function(i){let r;(function(o){o.getGlobalVolume=function(n){return n.getScene().getSoundManager().getGlobalVolume()},o.setGlobalVolume=function(n,t){n.getScene().getSoundManager().setGlobalVolume(t)},o.unloadAllAudio=function(n){n.getScene().getSoundManager().unloadAll()},o.playSound=function(n,t,e,g,a){n.getScene().getSoundManager().playSound(t,e,g,a)},o.playSoundOnChannel=function(n,t,e,g,a,c){n.getScene().getSoundManager().playSoundOnChannel(t,e,g,a,c)},o.stopSoundOnChannel=function(n,t){const e=n.getScene().getSoundManager().getSoundOnChannel(t);e&&e.stop()},o.pauseSoundOnChannel=function(n,t){const e=n.getScene().getSoundManager().getSoundOnChannel(t);e&&e.pause()},o.continueSoundOnChannel=function(n,t){const e=n.getScene().getSoundManager().getSoundOnChannel(t);e&&(e.playing()||e.play())},o.isSoundOnChannelPlaying=function(n,t){const e=n.getScene().getSoundManager().getSoundOnChannel(t);return e?e.playing():!1},o.isSoundOnChannelPaused=function(n,t){const e=n.getScene().getSoundManager().getSoundOnChannel(t);return e?e.paused():!1},o.isSoundOnChannelStopped=function(n,t){const e=n.getScene().getSoundManager().getSoundOnChannel(t);return e?e.stopped():!0},o.getSoundOnChannelVolume=function(n,t){const e=n.getScene().getSoundManager().getSoundOnChannel(t);return e?e.getVolume()*100:100},o.setSoundOnChannelVolume=function(n,t,e){const g=n.getScene().getSoundManager().getSoundOnChannel(t);g&&g.setVolume(e/100)},o.getSoundOnChannelPlayingOffset=function(n,t){const e=n.getScene().getSoundManager().getSoundOnChannel(t);return e?e.getSeek():0},o.setSoundOnChannelPlayingOffset=function(n,t,e){const g=n.getScene().getSoundManager().getSoundOnChannel(t);g&&g.setSeek(e)},o.getSoundOnChannelPitch=function(n,t){const e=n.getScene().getSoundManager().getSoundOnChannel(t);return e?e.getRate():1},o.setSoundOnChannelPitch=function(n,t,e){const g=n.getScene().getSoundManager().getSoundOnChannel(t);g&&g.setRate(e)},o.preloadSound=(n,t)=>n.getScene().getSoundManager().loadAudio(t,!1),o.unloadSound=(n,t)=>n.getScene().getSoundManager().unloadAudio(t,!1),o.playMusic=function(n,t,e,g,a){n.getScene().getSoundManager().playMusic(t,e,g,a)},o.playMusicOnChannel=function(n,t,e,g,a,c){n.getScene().getSoundManager().playMusicOnChannel(t,e,g,a,c)},o.stopMusicOnChannel=function(n,t){const e=n.getScene().getSoundManager().getMusicOnChannel(t);e&&e.stop()},o.pauseMusicOnChannel=function(n,t){const e=n.getScene().getSoundManager().getMusicOnChannel(t);e&&e.pause()},o.continueMusicOnChannel=function(n,t){const e=n.getScene().getSoundManager().getMusicOnChannel(t);e&&(e.playing()||e.play())},o.isMusicOnChannelPlaying=function(n,t){const e=n.getScene().getSoundManager().getMusicOnChannel(t);return e?e.playing():!1},o.isMusicOnChannelPaused=function(n,t){const e=n.getScene().getSoundManager().getMusicOnChannel(t);return e?e.paused():!1},o.isMusicOnChannelStopped=function(n,t){const e=n.getScene().getSoundManager().getMusicOnChannel(t);return e?e.stopped():!0},o.getMusicOnChannelVolume=function(n,t){const e=n.getScene().getSoundManager().getMusicOnChannel(t);return e?e.getVolume()*100:100},o.setMusicOnChannelVolume=function(n,t,e){const g=n.getScene().getSoundManager().getMusicOnChannel(t);g&&g.setVolume(e/100)},o.getMusicOnChannelPlayingOffset=function(n,t){const e=n.getScene().getSoundManager().getMusicOnChannel(t);return e?e.getSeek():0},o.setMusicOnChannelPlayingOffset=function(n,t,e){const g=n.getScene().getSoundManager().getMusicOnChannel(t);g&&g.setSeek(e)},o.getMusicOnChannelPitch=function(n,t){const e=n.getScene().getSoundManager().getMusicOnChannel(t);return e?e.getRate():1},o.setMusicOnChannelPitch=function(n,t,e){const g=n.getScene().getSoundManager().getMusicOnChannel(t);g&&g.setRate(e)},o.preloadMusic=(n,t)=>n.getScene().getSoundManager().loadAudio(t,!0),o.unloadMusic=(n,t)=>n.getScene().getSoundManager().unloadAudio(t,!0),o.fadeSoundVolume=(n,t,e,g)=>{const a=n.getScene().getSoundManager().getSoundOnChannel(t);a&&a.fade(a.getVolume(),e/100,g*1e3)},o.fadeMusicVolume=(n,t,e,g)=>{const a=n.getScene().getSoundManager().getMusicOnChannel(t);a&&a.fade(a.getVolume(),e/100,g*1e3)}})(r=i.sound||(i.sound={}))})(s=u.evtTools||(u.evtTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=soundtools.js.map diff --git a/Export/events-tools/storagetools.js b/Export/events-tools/storagetools.js new file mode 100644 index 0000000..2a41f6d --- /dev/null +++ b/Export/events-tools/storagetools.js @@ -0,0 +1,2 @@ +var gdjs;(function(S){const f=new S.Logger("Storage");let d;(function(p){let h;(function(a){let c=null;try{typeof cc!="undefined"?c=cc.sys.localStorage:typeof window!="undefined"&&(c=window.localStorage)}catch(t){f.error("Unable to get access to the localStorage: "+t)}c||f.error("Storage actions won't work as no localStorage was found.");const u=new Hashtable;a.loadJSONFileFromStorage=t=>{if(u.containsKey(t))return;let i=null;try{c&&(i=c.getItem("GDJS_"+t))}catch(l){f.error('Unable to load data from localStorage for "'+t+'": '+l)}let o={};try{i&&(o=JSON.parse(i))}catch(l){f.error('Unable to load data from "'+t+'" - data is not valid JSON: '+l)}u.put(t,o)},a.unloadJSONFile=t=>{if(!u.containsKey(t))return;const i=u.get(t),o=JSON.stringify(i);try{c&&c.setItem("GDJS_"+t,o)}catch(l){f.error('Unable to save data to localStorage for "'+t+'": '+l)}u.remove(t)};const g=(t,i)=>{let o=!1;u.containsKey(t)||(o=!0,a.loadJSONFileFromStorage(t));const l=i(u.get(t));return o&&a.unloadJSONFile(t),l};a.clearJSONFile=t=>g(t,i=>{for(const o in i)i.hasOwnProperty(o)&&delete i[o];return!0}),a.elementExistsInJSONFile=(t,i)=>g(t,o=>{const l=i.split("/");let n=o;for(let e=0;eg(t,o=>{const l=i.split("/");let n=o;for(let e=0;eg(t,l=>{const n=i.split("/");let e=l;for(let r=0;rg(t,l=>{const n=i.split("/");let e=l;for(let r=0;rg(t,n=>{const e=i.split("/");let r=n;for(let s=0;sg(t,n=>{const e=i.split("/");let r=n;for(let s=0;s=0?t.substr(n,r):""},e.strAt=function(t,n){return n=0?t.substr(n,1):""},e.strRepeat=function(t,n){let r="";for(let o=0;oo.length));)i=o.indexOf(n,u);return o},e.strRFindFrom=s.evtTools.string.strFindLastFrom})(f=c.string||(c.string={}))})(p=s.evtTools||(s.evtTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=stringtools.js.map diff --git a/Export/events-tools/variabletools.js b/Export/events-tools/variabletools.js new file mode 100644 index 0000000..4d87d6f --- /dev/null +++ b/Export/events-tools/variabletools.js @@ -0,0 +1,2 @@ +var gdjs;(function(a){let l;(function(o){let i;(function(r){r.getVariableNumber=function(e){return e.getAsNumber()},r.getVariableString=function(e){return e.getAsString()},r.getVariableBoolean=function(e,t){return e.getAsBoolean()===t},r.setVariableBoolean=function(e,t){e.setBoolean(t)},r.toggleVariableBoolean=function(e){e.setBoolean(!e.getAsBoolean())},r.sceneVariableExists=function(e,t){return e.getScene().getVariables().has(t)},r.globalVariableExists=function(e,t){return e.getGame().getVariables().has(t)},r.variableChildExists=function(e,t){return e.hasChild(t)},r.variableRemoveChild=function(e,t){e.removeChild(t)},r.variableClearChildren=function(e){e.clearChildren()},r.variablePushCopy=function(e,t){e.pushVariableCopy(t)},r.valuePush=function(e,t){e.pushValue(t)},r.variableRemoveAt=function(e,t){e.removeAtIndex(t)},r.getVariableChildCount=function(e){return e.getChildrenCount()},r.getFirstVariableNumber=function(e){return e.getChildrenCount()===0?0:e.getAllChildrenArray()[0].getAsNumber()},r.getFirstVariableString=function(e){return e.getChildrenCount()===0?"":e.getAllChildrenArray()[0].getAsString()},r.getLastVariableNumber=function(e){const t=e.getAllChildrenArray();return t.length===0?0:t[t.length-1].getAsNumber()},r.getLastVariableString=function(e){const t=e.getAllChildrenArray();return t.length===0?"":t[t.length-1].getAsString()}})(i=o.variable||(o.variable={}));let s;(function(n){n.getVariableNumber=a.evtTools.variable.getVariableNumber,n.getVariableString=a.evtTools.variable.getVariableString,n.getVariableBoolean=a.evtTools.variable.getVariableBoolean,n.setVariableBoolean=a.evtTools.variable.setVariableBoolean,n.toggleVariableBoolean=a.evtTools.variable.toggleVariableBoolean,n.sceneVariableExists=a.evtTools.variable.sceneVariableExists,n.globalVariableExists=a.evtTools.variable.globalVariableExists,n.variableChildExists=a.evtTools.variable.variableChildExists,n.variableRemoveChild=a.evtTools.variable.variableRemoveChild,n.variableClearChildren=a.evtTools.variable.variableClearChildren,n.variablePushCopy=a.evtTools.variable.variablePushCopy,n.valuePush=a.evtTools.variable.valuePush,n.variableRemoveAt=a.evtTools.variable.variableRemoveAt,n.getVariableChildCount=a.evtTools.variable.getVariableChildCount})(s=o.common||(o.common={}))})(l=a.evtTools||(a.evtTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=variabletools.js.map diff --git a/Export/events-tools/windowtools.js b/Export/events-tools/windowtools.js new file mode 100644 index 0000000..080febd --- /dev/null +++ b/Export/events-tools/windowtools.js @@ -0,0 +1,2 @@ +var gdjs;(function(r){let s;(function(u){let m;(function(t){t.setMargins=function(e,n,o,i,g){e.getGame().getRenderer().setMargins(n,o,i,g)},t.setFullScreen=function(e,n,o){e.getGame().getRenderer().keepAspectRatio(o),e.getGame().getRenderer().setFullScreen(n)},t.isFullScreen=function(e){return e.getGame().getRenderer().isFullScreen()},t.setWindowSize=function(e,n,o,i){e.getGame().getRenderer().setWindowSize(n,o),i&&e.getGame().setGameResolutionSize(n,o)},t.centerWindow=function(e){e.getGame().getRenderer().centerWindow()},t.setGameResolutionSize=function(e,n,o){e.getGame().setGameResolutionSize(n,o)},t.setGameResolutionResizeMode=function(e,n){e.getGame().setGameResolutionResizeMode(n)},t.setAdaptGameResolutionAtRuntime=function(e,n){e.getGame().setAdaptGameResolutionAtRuntime(n)},t.setWindowTitle=function(e,n){e.getGame().getRenderer().setWindowTitle(n)},t.getWindowTitle=function(e){return e.getGame().getRenderer().getWindowTitle()},t.getWindowInnerWidth=function(){return r.RuntimeGameRenderer&&r.RuntimeGameRenderer.getWindowInnerWidth?r.RuntimeGameRenderer.getWindowInnerWidth():typeof t!="undefined"?t.innerWidth:800},t.getWindowInnerHeight=function(){return r.RuntimeGameRenderer&&r.RuntimeGameRenderer.getWindowInnerHeight?r.RuntimeGameRenderer.getWindowInnerHeight():typeof t!="undefined"?t.innerHeight:800},t.getGameResolutionWidth=function(e){return e.getGame().getGameResolutionWidth()},t.getGameResolutionHeight=function(e){return e.getGame().getGameResolutionHeight()},t.openURL=function(e,n){return n.getGame().getRenderer().openURL(e)}})(m=u.window||(u.window={}))})(s=r.evtTools||(r.evtTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=windowtools.js.map diff --git a/Export/fontfaceobserver-font-manager/fontfaceobserver-font-manager.js b/Export/fontfaceobserver-font-manager/fontfaceobserver-font-manager.js new file mode 100644 index 0000000..f00b465 --- /dev/null +++ b/Export/fontfaceobserver-font-manager/fontfaceobserver-font-manager.js @@ -0,0 +1,2 @@ +var gdjs;(function(i){const s=new i.Logger("Font manager"),d=["font"];class l{constructor(e){this._loadedFontFamily=new i.ResourceCache;this._loadedFontFamilySet=new Set;this._resourceLoader=e}getResourceKinds(){return d}getFontFamily(e){return this._loadedFontFamily.getFromName(e)||"Arial"}getFontFile(e){const t=this._resourceLoader.getResource(e);return t?t.file||"":e}_getFontFamilyFromFilename(e){let t="gdjs_font_"+e.file.toLowerCase().replace(/[^\w]/gi,"-");const o=t;let n=2;for(;this._loadedFontFamilySet.has(t);)t=t+"-"+n,n++;return o}_loadFont(e,t){const o={},n="url("+encodeURI(t)+")";if(typeof FontFace!="undefined")return fetch(this._resourceLoader.getFullUrl(t),{credentials:this._resourceLoader.checkIfCredentialsRequired(t)?"include":"same-origin"}).then(r=>{if(!r.ok){const a="Unable to fetch "+t+" to be loaded as a font. HTTP status is: "+r.status+".";throw s.error(a),new Error(a)}return r.arrayBuffer()}).then(r=>{const a=new FontFace(e,r,o);document.fonts.add(a)});{const r=document.createElement("style");return r.appendChild(document.createTextNode("@font-face { font-family: '"+e+"'; src: "+n+"; }")),document.head.appendChild(r),new FontFaceObserver(e,o).load()}}async processResource(e){}async loadResource(e){const t=this._resourceLoader.getResource(e);if(!t){s.warn('Unable to find font for resource "'+e+'".');return}if(this._loadedFontFamily.get(t))return;const o=t.file;if(!o)return;const n=this._getFontFamilyFromFilename(t);this._loadedFontFamily.set(t,n),this._loadedFontFamilySet.add(n);try{await this._loadFont(n,o)}catch(r){const a=r;throw s.error('Error loading font resource "'+t.name+'" (file: '+o+"): "+(a.message||"Unknown error")),a}}dispose(){this._loadedFontFamily.clear(),this._loadedFontFamilySet.clear()}unloadResource(e){this._loadedFontFamily.getFromName(e.name)&&this._loadedFontFamily.delete(e);const o=this._getFontFamilyFromFilename(e);o&&this._loadedFontFamilySet.delete(o)}}i.FontFaceObserverFontManager=l,i.FontManager=l})(gdjs||(gdjs={})); +//# sourceMappingURL=fontfaceobserver-font-manager.js.map diff --git a/Export/fontfaceobserver-font-manager/fontfaceobserver.js b/Export/fontfaceobserver-font-manager/fontfaceobserver.js new file mode 100644 index 0000000..3ff4b31 --- /dev/null +++ b/Export/fontfaceobserver-font-manager/fontfaceobserver.js @@ -0,0 +1,16 @@ +(function() { +var module; //Define an undefined module variable to avoid fontfaceobserver thinking it's used in an environment using require. + +/* Font Face Observer v2.0.13 - © Bram Stein. License: BSD-3-Clause */(function(){'use strict';var f,g=[];function l(a){g.push(a);1==g.length&&f()}function m(){for(;g.length;)g[0](),g.shift()}f=function(){setTimeout(m)};function n(a){this.a=p;this.b=void 0;this.f=[];var b=this;try{a(function(a){q(b,a)},function(a){r(b,a)})}catch(c){r(b,c)}}var p=2;function t(a){return new n(function(b,c){c(a)})}function u(a){return new n(function(b){b(a)})}function q(a,b){if(a.a==p){if(b==a)throw new TypeError;var c=!1;try{var d=b&&b.then;if(null!=b&&"object"==typeof b&&"function"==typeof d){d.call(b,function(b){c||q(a,b);c=!0},function(b){c||r(a,b);c=!0});return}}catch(e){c||r(a,e);return}a.a=0;a.b=b;v(a)}} +function r(a,b){if(a.a==p){if(b==a)throw new TypeError;a.a=1;a.b=b;v(a)}}function v(a){l(function(){if(a.a!=p)for(;a.f.length;){var b=a.f.shift(),c=b[0],d=b[1],e=b[2],b=b[3];try{0==a.a?"function"==typeof c?e(c.call(void 0,a.b)):e(a.b):1==a.a&&("function"==typeof d?e(d.call(void 0,a.b)):b(a.b))}catch(h){b(h)}}})}n.prototype.g=function(a){return this.c(void 0,a)};n.prototype.c=function(a,b){var c=this;return new n(function(d,e){c.f.push([a,b,d,e]);v(c)})}; +function w(a){return new n(function(b,c){function d(c){return function(d){h[c]=d;e+=1;e==a.length&&b(h)}}var e=0,h=[];0==a.length&&b(h);for(var k=0;kparseInt(a[1],10)}else C=!1;return C}function J(){null===F&&(F=!!document.fonts);return F} +function K(){if(null===E){var a=document.createElement("div");try{a.style.font="condensed 100px sans-serif"}catch(b){}E=""!==a.style.font}return E}function L(a,b){return[a.style,a.weight,K()?a.stretch:"","100px",b].join(" ")} +A.prototype.load=function(a,b){var c=this,k=a||"BESbswy",q=0,D=b||3E3,H=(new Date).getTime();return new Promise(function(a,b){if(J()&&!G()){var M=new Promise(function(a,b){function e(){(new Date).getTime()-H>=D?b():document.fonts.load(L(c,'"'+c.family+'"'),k).then(function(c){1<=c.length?a():setTimeout(e,25)},function(){b()})}e()}),N=new Promise(function(a,c){q=setTimeout(c,D)});Promise.race([N,M]).then(function(){clearTimeout(q);a(c)},function(){b(c)})}else m(function(){function u(){var b;if(b=-1!= +f&&-1!=g||-1!=f&&-1!=h||-1!=g&&-1!=h)(b=f!=g&&f!=h&&g!=h)||(null===B&&(b=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),B=!!b&&(536>parseInt(b[1],10)||536===parseInt(b[1],10)&&11>=parseInt(b[2],10))),b=B&&(f==v&&g==v&&h==v||f==w&&g==w&&h==w||f==x&&g==x&&h==x)),b=!b;b&&(d.parentNode&&d.parentNode.removeChild(d),clearTimeout(q),a(c))}function I(){if((new Date).getTime()-H>=D)d.parentNode&&d.parentNode.removeChild(d),b(c);else{var a=document.hidden;if(!0===a||void 0===a)f=e.a.offsetWidth, +g=n.a.offsetWidth,h=p.a.offsetWidth,u();q=setTimeout(I,50)}}var e=new r(k),n=new r(k),p=new r(k),f=-1,g=-1,h=-1,v=-1,w=-1,x=-1,d=document.createElement("div");d.dir="ltr";t(e,L(c,"sans-serif"));t(n,L(c,"serif"));t(p,L(c,"monospace"));d.appendChild(e.a);d.appendChild(n.a);d.appendChild(p.a);document.body.appendChild(d);v=e.a.offsetWidth;w=n.a.offsetWidth;x=p.a.offsetWidth;I();z(e,function(a){f=a;u()});t(e,L(c,'"'+c.family+'",sans-serif'));z(n,function(a){g=a;u()});t(n,L(c,'"'+c.family+'",serif')); +z(p,function(a){h=a;u()});t(p,L(c,'"'+c.family+'",monospace'))})})};"object"===typeof module?module.exports=A:(window.FontFaceObserver=A,window.FontFaceObserver.prototype.load=A.prototype.load);}()); +})() \ No newline at end of file diff --git a/Export/force.js b/Export/force.js new file mode 100644 index 0000000..b2002e6 --- /dev/null +++ b/Export/force.js @@ -0,0 +1,2 @@ +var gdjs;(function(e){class s{constructor(t,i,h){this._dirty=!1;this._x=t||0,this._y=i||0,this._angle=Math.atan2(i,t)*180/Math.PI,this._length=Math.sqrt(t*t+i*i),this._multiplier=h}getX(){return this._x}getY(){return this._y}setX(t){this._x=t,this._dirty=!0}setY(t){this._y=t,this._dirty=!0}clear(){this._x=0,this._y=0,this._length=0,this._dirty=!1}addForce(t){this._x+=t._x,this._y+=t._y,this._dirty=!0}add(t,i){this._x+=t,this._y+=i,this._dirty=!0}setAngle(t){this._dirty&&(this._length=Math.sqrt(this._x*this._x+this._y*this._y),this._dirty=!1),this._angle=t;const i=t/180*Math.PI;this._x=Math.cos(i)*this._length,this._y=Math.sin(i)*this._length}setLength(t){this._dirty&&(this._angle=Math.atan2(this._y,this._x)*180/Math.PI,this._dirty=!1),this._length=t;const i=this._angle/180*Math.PI;this._x=Math.cos(i)*this._length,this._y=Math.sin(i)*this._length}getAngle(){return this._dirty&&(this._angle=Math.atan2(this._y,this._x)*180/Math.PI,this._length=Math.sqrt(this._x*this._x+this._y*this._y),this._dirty=!1),this._angle}getLength(){return this._dirty&&(this._angle=Math.atan2(this._y,this._x)*180/Math.PI,this._length=Math.sqrt(this._x*this._x+this._y*this._y),this._dirty=!1),this._length}getMultiplier(){return this._multiplier}setMultiplier(t){this._multiplier=t}getNetworkSyncData(){return{x:this._x,y:this._y,a:this._angle,l:this._length,m:this._multiplier}}updateFromNetworkSyncData(t){this._x=t.x,this._y=t.y,this._angle=t.a,this._length=t.l,this._multiplier=t.m}}e.Force=s})(gdjs||(gdjs={})); +//# sourceMappingURL=force.js.map diff --git a/Export/gd.js b/Export/gd.js new file mode 100644 index 0000000..1b6b727 --- /dev/null +++ b/Export/gd.js @@ -0,0 +1,2 @@ +var gdjs;(function(t){const i=new t.Logger("Engine runtime"),u=/^(#{0,1}[A-Fa-f0-9]{6})$/,s=/^(#{0,1}[A-Fa-f0-9]{3})$/;let m;(function(n){const e=!0})(m=t.evtTools||(t.evtTools={})),t.objectsTypes=new Hashtable,t.behaviorsTypes=new Hashtable,t.callbacksFirstRuntimeSceneLoaded=[],t.callbacksRuntimeSceneLoaded=[],t.callbacksRuntimeScenePreEvents=[],t.callbacksRuntimeScenePostEvents=[],t.callbacksInGameEditorPostStep=[],t.callbacksRuntimeScenePaused=[],t.callbacksRuntimeSceneResumed=[],t.callbacksRuntimeSceneUnloading=[],t.callbacksRuntimeSceneUnloaded=[],t.callbacksObjectDeletedFromScene=[],t.callbacksRuntimeSceneGetSyncData=[],t.callbacksRuntimeSceneUpdateFromSyncData=[],t.gdevelopLogo="",t.rgbToHex=function(e,n,r){return""+((1<<24)+(e<<16)+(n<<8)+r).toString(16).slice(1)},t.hexToRGBColor=function(e){const n=parseInt(e.replace("#",""),16);return Number.isFinite(n)?[n>>16&255,n>>8&255,n&255]:[0,0,0]},t.shorthandHexToRGBColor=function(e){const n=parseInt(e.replace("#",""),16);return Number.isFinite(n)?[17*(n>>8&15),17*(n>>4&15),17*(n&15)]:[0,0,0]},t.rgbOrHexToRGBColor=function(e){if(!e.startsWith("#")){const o=e.split(";");if(o.length===3)return[Math.min(255,parseInt(o[0],10)),Math.min(255,parseInt(o[1],10)),Math.min(255,parseInt(o[2],10))]}const n=t.extractHexString(e);if(n)return t.hexToRGBColor(n);const r=t.extractShorthandHexString(e);return r?t.shorthandHexToRGBColor(r):[0,0,0]},t.rgbOrHexStringToNumber=e=>{const n=t.rgbOrHexToRGBColor(e);return t.rgbToHexNumber(n[0],n[1],n[2])},t.rgbToHexNumber=function(e,n,r){return(Math.round(e)<<16)+(Math.round(n)<<8)+Math.round(r)},t.hexNumberToRGB=e=>({r:e>>16&255,g:e>>8&255,b:e&255,a:255}),t.hexNumberToRGBArray=e=>[e>>16&255,e>>8&255,e&255],t.extractHexString=e=>{const n=e.match(u);return n?n[0]:null},t.extractShorthandHexString=e=>{const n=e.match(s);return n?n[0]:null},t.random=function(e){return e<=0?0:Math.floor(Math.random()*(e+1))},t.randomInRange=function(e,n){return e+t.random(n-e)},t.randomFloat=function(e){return e<=0?0:Math.random()*e},t.randomFloatInRange=function(e,n){return e+t.randomFloat(n-e)},t.randomWithStep=function(e,n,r){return r<=0?e+t.random(n-e):e+t.random(Math.floor((n-e)/r))*r},t.toRad=function(e){return e/180*Math.PI},t.toDegrees=function(e){return e*180/Math.PI},t.registerObject=function(e,n){t.objectsTypes.put(e,n)},t.registerBehavior=function(e,n){t.behaviorsTypes.put(e,n)},t.registerFirstRuntimeSceneLoadedCallback=function(e){t.callbacksFirstRuntimeSceneLoaded.push(e)},t.registerRuntimeSceneLoadedCallback=function(e){t.callbacksRuntimeSceneLoaded.push(e)},t.registerRuntimeScenePreEventsCallback=function(e){t.callbacksRuntimeScenePreEvents.push(e)},t.registerRuntimeScenePostEventsCallback=function(e){t.callbacksRuntimeScenePostEvents.push(e)},t.registerInGameEditorPostStepCallback=function(e){t.callbacksInGameEditorPostStep.push(e)},t.registerRuntimeScenePausedCallback=function(e){t.callbacksRuntimeScenePaused.push(e)},t.registerRuntimeSceneResumedCallback=function(e){t.callbacksRuntimeSceneResumed.push(e)},t.registerRuntimeSceneUnloadingCallback=function(e){t.callbacksRuntimeSceneUnloading.push(e)},t.registerRuntimeSceneUnloadedCallback=function(e){t.callbacksRuntimeSceneUnloaded.push(e)},t.registerObjectDeletedFromSceneCallback=function(e){t.callbacksObjectDeletedFromScene.push(e)},t.registerRuntimeSceneGetSyncDataCallback=function(e){t.callbacksRuntimeSceneGetSyncData.push(e)},t.registerRuntimeSceneUpdateFromSyncDataCallback=function(e){t.callbacksRuntimeSceneUpdateFromSyncData.push(e)},t._unregisterCallback=function(e){const n=r=>{for(let o=0;oa?(a^Math.random()*16>>a/4).toString(16):(""+1e7+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,o);return o()}if(!t.makeUuid.hex){t.makeUuid.hex=[];for(var e=0;e<256;e++)t.makeUuid.hex[e]=(e<16?"0":"")+e.toString(16)}const n=t.makeUuid.hex;var r=crypto.getRandomValues(new Uint8Array(16));return r[6]=r[6]&15|64,r[8]=r[8]&63|128,n[r[0]]+n[r[1]]+n[r[2]]+n[r[3]]+"-"+n[r[4]]+n[r[5]]+"-"+n[r[6]]+n[r[7]]+"-"+n[r[8]]+n[r[9]]+"-"+n[r[10]]+n[r[11]]+n[r[12]]+n[r[13]]+n[r[14]]+n[r[15]]},t.nearlyEqual=(e,n,r)=>{const o=Math.abs(e),a=Math.abs(n),c=Math.abs(e-n);return e===n?!0:e==0||n==0||o+a{l.push(e)},t.getAllAsynchronouslyLoadingLibraryPromise=()=>Promise.all(l)})(gdjs||(gdjs={})),console.warn=console.warn||console.log,console.error=console.error||console.log; +//# sourceMappingURL=gd.js.map diff --git a/Export/gdjs-evtsext__mqtt__connect-func.js b/Export/gdjs-evtsext__mqtt__connect-func.js new file mode 100644 index 0000000..85a85af --- /dev/null +++ b/Export/gdjs-evtsext__mqtt__connect-func.js @@ -0,0 +1,137 @@ + +if (typeof gdjs.evtsExt__MQTT__connect !== "undefined") { + gdjs.evtsExt__MQTT__connect.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__MQTT__connect = {}; +gdjs.evtsExt__MQTT__connect.idToCallbackMap = new Map(); + + +gdjs.evtsExt__MQTT__connect.userFunc0xe51bd8 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +// Parse settings +const settings = eventsFunctionContext.getArgument("settings"); +let settingsParsed; +if (settings.length > 2) + try { + settingsParsed = JSON.parse(settings); + } catch (e) { + settingsParsed = {} + console.error("Invalid settings: ", settings, ", Error:", e); + }; + +// Connect to broker +gdjs.evtTools.mqtt.connection = mqtt.connect( + (eventsFunctionContext.getArgument("secure") + ? "wss://" + : "ws://") + + eventsFunctionContext.getArgument("host"), + settingsParsed +); + +// Set up listeners +gdjs.evtTools.mqtt.connection.on("message", (channel, message) => { + if (typeof gdjs.evtTools.mqtt.events[channel] === undefined) { + gdjs.evtTools.mqtt.events[channel] = { + loss: false, + data: [message], + }; + return; + } + + const mqttEvent = gdjs.evtTools.mqtt.events[channel]; + if (mqttEvent.loss) { + mqttEvent.data = message; + } else { + if (!Array.isArray(mqttEvent.data)) mqttEvent.data = []; + mqttEvent.data.push(message); + } +}); + +gdjs.evtTools.mqtt.connection.on("error", function (e) { + gdjs.evtTools.mqtt.lastError = e; +}); + +}; +gdjs.evtsExt__MQTT__connect.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__MQTT__connect.userFunc0xe51bd8(runtimeScene, eventsFunctionContext); + +} + + +}; + +gdjs.evtsExt__MQTT__connect.func = function(runtimeScene, host, settings, secure, parentEventsFunctionContext) { +let scopeInstanceContainer = null; +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("MQTT"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("MQTT"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "host") return host; +if (argName === "settings") return settings; +if (argName === "secure") return secure; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__MQTT__connect.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__MQTT__connect.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/Export/gdjs-evtsext__mqtt__disconnect-func.js b/Export/gdjs-evtsext__mqtt__disconnect-func.js new file mode 100644 index 0000000..1c2dfe1 --- /dev/null +++ b/Export/gdjs-evtsext__mqtt__disconnect-func.js @@ -0,0 +1,96 @@ + +if (typeof gdjs.evtsExt__MQTT__disconnect !== "undefined") { + gdjs.evtsExt__MQTT__disconnect.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__MQTT__disconnect = {}; +gdjs.evtsExt__MQTT__disconnect.idToCallbackMap = new Map(); + + +gdjs.evtsExt__MQTT__disconnect.userFunc0xe51bd8 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +if (gdjs.evtTools.mqtt.connection === null) return; +gdjs.evtTools.mqtt.connection.end(eventsFunctionContext.getArgument("force")); +gdjs.evtTools.mqtt.connection = null; + +}; +gdjs.evtsExt__MQTT__disconnect.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__MQTT__disconnect.userFunc0xe51bd8(runtimeScene, eventsFunctionContext); + +} + + +}; + +gdjs.evtsExt__MQTT__disconnect.func = function(runtimeScene, force, parentEventsFunctionContext) { +let scopeInstanceContainer = null; +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("MQTT"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("MQTT"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "force") return force; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__MQTT__disconnect.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__MQTT__disconnect.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/Export/gdjs-evtsext__mqtt__getcurrenterror-func.js b/Export/gdjs-evtsext__mqtt__getcurrenterror-func.js new file mode 100644 index 0000000..f03383a --- /dev/null +++ b/Export/gdjs-evtsext__mqtt__getcurrenterror-func.js @@ -0,0 +1,92 @@ + +if (typeof gdjs.evtsExt__MQTT__getCurrentError !== "undefined") { + gdjs.evtsExt__MQTT__getCurrentError.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__MQTT__getCurrentError = {}; +gdjs.evtsExt__MQTT__getCurrentError.idToCallbackMap = new Map(); + + +gdjs.evtsExt__MQTT__getCurrentError.userFunc0xd1fa30 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +eventsFunctionContext.returnValue = gdjs.evtTools.mqtt.lastError +}; +gdjs.evtsExt__MQTT__getCurrentError.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__MQTT__getCurrentError.userFunc0xd1fa30(runtimeScene, eventsFunctionContext); + +} + + +}; + +gdjs.evtsExt__MQTT__getCurrentError.func = function(runtimeScene, parentEventsFunctionContext) { +let scopeInstanceContainer = null; +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("MQTT"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("MQTT"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__MQTT__getCurrentError.eventsList0(runtimeScene, eventsFunctionContext); + + +return "" + eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__MQTT__getCurrentError.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/Export/gdjs-evtsext__mqtt__getlastmessage-func.js b/Export/gdjs-evtsext__mqtt__getlastmessage-func.js new file mode 100644 index 0000000..886ee93 --- /dev/null +++ b/Export/gdjs-evtsext__mqtt__getlastmessage-func.js @@ -0,0 +1,98 @@ + +if (typeof gdjs.evtsExt__MQTT__GetLastMessage !== "undefined") { + gdjs.evtsExt__MQTT__GetLastMessage.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__MQTT__GetLastMessage = {}; +gdjs.evtsExt__MQTT__GetLastMessage.idToCallbackMap = new Map(); + + +gdjs.evtsExt__MQTT__GetLastMessage.userFunc0xe51170 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const mqttEvent = gdjs.evtTools.mqtt.events[eventsFunctionContext.getArgument("topic")]; +if (typeof mqttEvent === "undefined") return; +eventsFunctionContext.returnValue = Array.isArray(mqttEvent.data) + ? mqttEvent.data[0] + : mqttEvent.data; + +}; +gdjs.evtsExt__MQTT__GetLastMessage.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__MQTT__GetLastMessage.userFunc0xe51170(runtimeScene, eventsFunctionContext); + +} + + +}; + +gdjs.evtsExt__MQTT__GetLastMessage.func = function(runtimeScene, topic, parentEventsFunctionContext) { +let scopeInstanceContainer = null; +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("MQTT"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("MQTT"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "topic") return topic; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__MQTT__GetLastMessage.eventsList0(runtimeScene, eventsFunctionContext); + + +return "" + eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__MQTT__GetLastMessage.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/Export/gdjs-evtsext__mqtt__isconnected-func.js b/Export/gdjs-evtsext__mqtt__isconnected-func.js new file mode 100644 index 0000000..dd40b94 --- /dev/null +++ b/Export/gdjs-evtsext__mqtt__isconnected-func.js @@ -0,0 +1,94 @@ + +if (typeof gdjs.evtsExt__MQTT__isConnected !== "undefined") { + gdjs.evtsExt__MQTT__isConnected.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__MQTT__isConnected = {}; +gdjs.evtsExt__MQTT__isConnected.idToCallbackMap = new Map(); + + +gdjs.evtsExt__MQTT__isConnected.userFunc0xd1e9b8 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +eventsFunctionContext.returnValue = + gdjs.evtTools.mqtt.connection && gdjs.evtTools.mqtt.connection.connected; + +}; +gdjs.evtsExt__MQTT__isConnected.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__MQTT__isConnected.userFunc0xd1e9b8(runtimeScene, eventsFunctionContext); + +} + + +}; + +gdjs.evtsExt__MQTT__isConnected.func = function(runtimeScene, parentEventsFunctionContext) { +let scopeInstanceContainer = null; +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("MQTT"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("MQTT"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__MQTT__isConnected.eventsList0(runtimeScene, eventsFunctionContext); + + +return !!eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__MQTT__isConnected.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/Export/gdjs-evtsext__mqtt__onfirstsceneloaded-func.js b/Export/gdjs-evtsext__mqtt__onfirstsceneloaded-func.js new file mode 100644 index 0000000..1943ec9 --- /dev/null +++ b/Export/gdjs-evtsext__mqtt__onfirstsceneloaded-func.js @@ -0,0 +1,128 @@ + +if (typeof gdjs.evtsExt__MQTT__onFirstSceneLoaded !== "undefined") { + gdjs.evtsExt__MQTT__onFirstSceneLoaded.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__MQTT__onFirstSceneLoaded = {}; +gdjs.evtsExt__MQTT__onFirstSceneLoaded.idToCallbackMap = new Map(); + + +gdjs.evtsExt__MQTT__onFirstSceneLoaded.userFunc0xe68b08 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** + * @typedef MQTTEvent Corresponds to a message coming from a subcribed topic. + * @property {boolean} loss Descibes how to handle multiple packages in one frame. + * @property {string || Array} data The last message received by that event. + */ + +/** + * The mqtt tools + * @namespace + */ +gdjs.evtTools.mqtt = { + /** The current connection to the MQTT broker server */ + connection: null, + /** + * The last error that occured + * @type {string} + */ + lastError: "", + /** + * A list of events triggered. + * @type {Object.} + */ + events: {}, + empty: Symbol("No event"), +}; + +// MQTT.js: https://github.com/mqttjs/MQTT.js (v5.10.3) +window.mqtt=(()=>{var ys=Object.defineProperty;var Kg=Object.getOwnPropertyDescriptor;var Gg=Object.getOwnPropertyNames;var Qg=Object.prototype.hasOwnProperty;var _e=(t,e)=>()=>(t&&(e=t(t=0)),e);var M=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Jt=(t,e)=>{for(var r in e)ys(t,r,{get:e[r],enumerable:!0})},Yg=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Gg(e))!Qg.call(t,n)&&n!==r&&ys(t,n,{get:()=>e[n],enumerable:!(i=Kg(e,n))||i.enumerable});return t};var X=t=>Yg(ys({},"__esModule",{value:!0}),t);var _=_e(()=>{});var B={};Jt(B,{_debugEnd:()=>yu,_debugProcess:()=>gu,_events:()=>Ou,_eventsCount:()=>xu,_exiting:()=>Yl,_fatalExceptions:()=>cu,_getActiveHandles:()=>eu,_getActiveRequests:()=>Zl,_kill:()=>ru,_linkedBinding:()=>Gl,_maxListeners:()=>ku,_preload_modules:()=>Cu,_rawDebug:()=>zl,_startProfilerIdleNotifier:()=>bu,_stopProfilerIdleNotifier:()=>wu,_tickCallback:()=>pu,abort:()=>Eu,addListener:()=>Mu,allowedNodeEnvironmentFlags:()=>lu,arch:()=>xl,argv:()=>Ul,argv0:()=>Ru,assert:()=>uu,binding:()=>Fl,chdir:()=>Hl,config:()=>Jl,cpuUsage:()=>$i,cwd:()=>$l,debugPort:()=>Tu,default:()=>$u,dlopen:()=>Xl,domain:()=>Ql,emit:()=>Du,emitWarning:()=>jl,env:()=>Ll,execArgv:()=>Nl,execPath:()=>Iu,exit:()=>ou,features:()=>fu,hasUncaughtExceptionCaptureCallback:()=>du,hrtime:()=>Wi,kill:()=>su,listeners:()=>Wu,memoryUsage:()=>nu,moduleLoadList:()=>Kl,nextTick:()=>Pl,off:()=>Uu,on:()=>wt,once:()=>Lu,openStdin:()=>au,pid:()=>Su,platform:()=>Ml,ppid:()=>Au,prependListener:()=>ju,prependOnceListener:()=>Fu,reallyExit:()=>tu,release:()=>Vl,removeAllListeners:()=>qu,removeListener:()=>Nu,resourceUsage:()=>iu,setSourceMapsEnabled:()=>Bu,setUncaughtExceptionCaptureCallback:()=>hu,stderr:()=>mu,stdin:()=>vu,stdout:()=>_u,title:()=>Ol,umask:()=>Wl,uptime:()=>Pu,version:()=>ql,versions:()=>Dl});function _s(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function Jg(){!Lr||!Xt||(Lr=!1,Xt.length?bt=Xt.concat(bt):Fi=-1,bt.length&&Bl())}function Bl(){if(!Lr){var t=setTimeout(Jg,0);Lr=!0;for(var e=bt.length;e;){for(Xt=bt,bt=[];++Fi1)for(var r=1;r{_();v();m();bt=[],Lr=!1,Fi=-1;kl.prototype.run=function(){this.fun.apply(null,this.array)};Ol="browser",xl="x64",Ml="browser",Ll={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},Ul=["/usr/bin/node"],Nl=[],ql="v16.8.0",Dl={},jl=function(t,e){console.warn((e?e+": ":"")+t)},Fl=function(t){_s("binding")},Wl=function(t){return 0},$l=function(){return"/"},Hl=function(t){},Vl={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};zl=Ee,Kl=[];Ql={},Yl=!1,Jl={};tu=Ee,ru=Ee,$i=function(){return{}},iu=$i,nu=$i,su=Ee,ou=Ee,au=Ee,lu={};fu={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},cu=Ee,hu=Ee;pu=Ee,gu=Ee,yu=Ee,bu=Ee,wu=Ee,_u=void 0,mu=void 0,vu=void 0,Eu=Ee,Su=2,Au=1,Iu="/bin/usr/node",Tu=9229,Ru="node",Cu=[],Bu=Ee,Lt={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Lt.now===void 0&&(bs=Date.now(),Lt.timing&&Lt.timing.navigationStart&&(bs=Lt.timing.navigationStart),Lt.now=()=>Date.now()-bs);ws=1e9;Wi.bigint=function(t){var e=Wi(t);return typeof BigInt>"u"?e[0]*ws+e[1]:BigInt(e[0]*ws)+BigInt(e[1])};ku=10,Ou={},xu=0;Mu=wt,Lu=wt,Uu=wt,Nu=wt,qu=wt,Du=Ee,ju=wt,Fu=wt;$u={version:ql,versions:Dl,arch:xl,platform:Ml,release:Vl,_rawDebug:zl,moduleLoadList:Kl,binding:Fl,_linkedBinding:Gl,_events:Ou,_eventsCount:xu,_maxListeners:ku,on:wt,addListener:Mu,once:Lu,off:Uu,removeListener:Nu,removeAllListeners:qu,emit:Du,prependListener:ju,prependOnceListener:Fu,listeners:Wu,domain:Ql,_exiting:Yl,config:Jl,dlopen:Xl,uptime:Pu,_getActiveRequests:Zl,_getActiveHandles:eu,reallyExit:tu,_kill:ru,cpuUsage:$i,resourceUsage:iu,memoryUsage:nu,kill:su,exit:ou,openStdin:au,allowedNodeEnvironmentFlags:lu,assert:uu,features:fu,_fatalExceptions:cu,setUncaughtExceptionCaptureCallback:hu,hasUncaughtExceptionCaptureCallback:du,emitWarning:jl,nextTick:Pl,_tickCallback:pu,_debugProcess:gu,_debugEnd:yu,_startProfilerIdleNotifier:bu,_stopProfilerIdleNotifier:wu,stdout:_u,stdin:vu,stderr:mu,abort:Eu,umask:Wl,chdir:Hl,cwd:$l,env:Ll,title:Ol,argv:Ul,execArgv:Nl,pid:Su,ppid:Au,execPath:Iu,debugPort:Tu,hrtime:Wi,argv0:Ru,_preload_modules:Cu,setSourceMapsEnabled:Bu}});var m=_e(()=>{Hu()});var me={};Jt(me,{Buffer:()=>x,INSPECT_MAX_BYTES:()=>ty,default:()=>Ut,kMaxLength:()=>ry});function Xg(){if(Vu)return ci;Vu=!0,ci.byteLength=a,ci.toByteArray=c,ci.fromByteArray=g;for(var t=[],e=[],r=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=i.length;n0)throw new Error("Invalid string. Length must be a multiple of 4");var S=y.indexOf("=");S===-1&&(S=w);var E=S===w?0:4-S%4;return[S,E]}function a(y){var w=s(y),S=w[0],E=w[1];return(S+E)*3/4-E}function l(y,w,S){return(w+S)*3/4-S}function c(y){var w,S=s(y),E=S[0],I=S[1],C=new r(l(y,E,I)),R=0,U=I>0?E-4:E,N;for(N=0;N>16&255,C[R++]=w>>8&255,C[R++]=w&255;return I===2&&(w=e[y.charCodeAt(N)]<<2|e[y.charCodeAt(N+1)]>>4,C[R++]=w&255),I===1&&(w=e[y.charCodeAt(N)]<<10|e[y.charCodeAt(N+1)]<<4|e[y.charCodeAt(N+2)]>>2,C[R++]=w>>8&255,C[R++]=w&255),C}function h(y){return t[y>>18&63]+t[y>>12&63]+t[y>>6&63]+t[y&63]}function d(y,w,S){for(var E,I=[],C=w;CU?U:R+C));return E===1?(w=y[S-1],I.push(t[w>>2]+t[w<<4&63]+"==")):E===2&&(w=(y[S-2]<<8)+y[S-1],I.push(t[w>>10]+t[w>>4&63]+t[w<<2&63]+"=")),I.join("")}return ci}function Zg(){if(zu)return Hi;zu=!0;return Hi.read=function(t,e,r,i,n){var o,s,a=n*8-i-1,l=(1<>1,h=-7,d=r?n-1:0,g=r?-1:1,y=t[e+d];for(d+=g,o=y&(1<<-h)-1,y>>=-h,h+=a;h>0;o=o*256+t[e+d],d+=g,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=i;h>0;s=s*256+t[e+d],d+=g,h-=8);if(o===0)o=1-c;else{if(o===l)return s?NaN:(y?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-c}return(y?-1:1)*s*Math.pow(2,o-i)},Hi.write=function(t,e,r,i,n,o){var s,a,l,c=o*8-n-1,h=(1<>1,g=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=i?0:o-1,w=i?1:-1,S=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+d>=1?e+=g/l:e+=g*Math.pow(2,1-d),e*l>=2&&(s++,l/=2),s+d>=h?(a=0,s=h):s+d>=1?(a=(e*l-1)*Math.pow(2,n),s=s+d):(a=e*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;t[r+y]=a&255,y+=w,a/=256,n-=8);for(s=s<0;t[r+y]=s&255,y+=w,s/=256,c-=8);t[r+y-w]|=S*128},Hi}function ey(){if(Ku)return Zt;Ku=!0;let t=Xg(),e=Zg(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Zt.Buffer=s,Zt.SlowBuffer=I,Zt.INSPECT_MAX_BYTES=50;let i=2147483647;Zt.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=n(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function n(){try{let p=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(p,u),p.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(p){if(p>i)throw new RangeError('The value "'+p+'" is invalid for option "size"');let u=new Uint8Array(p);return Object.setPrototypeOf(u,s.prototype),u}function s(p,u,f){if(typeof p=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(p)}return a(p,u,f)}s.poolSize=8192;function a(p,u,f){if(typeof p=="string")return d(p,u);if(ArrayBuffer.isView(p))return y(p);if(p==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof p);if(Ye(p,ArrayBuffer)||p&&Ye(p.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ye(p,SharedArrayBuffer)||p&&Ye(p.buffer,SharedArrayBuffer)))return w(p,u,f);if(typeof p=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let b=p.valueOf&&p.valueOf();if(b!=null&&b!==p)return s.from(b,u,f);let A=S(p);if(A)return A;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof p[Symbol.toPrimitive]=="function")return s.from(p[Symbol.toPrimitive]("string"),u,f);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof p)}s.from=function(p,u,f){return a(p,u,f)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(p){if(typeof p!="number")throw new TypeError('"size" argument must be of type number');if(p<0)throw new RangeError('The value "'+p+'" is invalid for option "size"')}function c(p,u,f){return l(p),p<=0?o(p):u!==void 0?typeof f=="string"?o(p).fill(u,f):o(p).fill(u):o(p)}s.alloc=function(p,u,f){return c(p,u,f)};function h(p){return l(p),o(p<0?0:E(p)|0)}s.allocUnsafe=function(p){return h(p)},s.allocUnsafeSlow=function(p){return h(p)};function d(p,u){if((typeof u!="string"||u==="")&&(u="utf8"),!s.isEncoding(u))throw new TypeError("Unknown encoding: "+u);let f=C(p,u)|0,b=o(f),A=b.write(p,u);return A!==f&&(b=b.slice(0,A)),b}function g(p){let u=p.length<0?0:E(p.length)|0,f=o(u);for(let b=0;b=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return p|0}function I(p){return+p!=p&&(p=0),s.alloc(+p)}s.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==s.prototype},s.compare=function(u,f){if(Ye(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),Ye(f,Uint8Array)&&(f=s.from(f,f.offset,f.byteLength)),!s.isBuffer(u)||!s.isBuffer(f))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===f)return 0;let b=u.length,A=f.length;for(let T=0,P=Math.min(b,A);TA.length?(s.isBuffer(P)||(P=s.from(P)),P.copy(A,T)):Uint8Array.prototype.set.call(A,P,T);else if(s.isBuffer(P))P.copy(A,T);else throw new TypeError('"list" argument must be an Array of Buffers');T+=P.length}return A};function C(p,u){if(s.isBuffer(p))return p.length;if(ArrayBuffer.isView(p)||Ye(p,ArrayBuffer))return p.byteLength;if(typeof p!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof p);let f=p.length,b=arguments.length>2&&arguments[2]===!0;if(!b&&f===0)return 0;let A=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return f;case"utf8":case"utf-8":return ps(p).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return f*2;case"hex":return f>>>1;case"base64":return Cl(p).length;default:if(A)return b?-1:ps(p).length;u=(""+u).toLowerCase(),A=!0}}s.byteLength=C;function R(p,u,f){let b=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((f===void 0||f>this.length)&&(f=this.length),f<=0)||(f>>>=0,u>>>=0,f<=u))return"";for(p||(p="utf8");;)switch(p){case"hex":return qg(this,u,f);case"utf8":case"utf-8":return Pr(this,u,f);case"ascii":return hs(this,u,f);case"latin1":case"binary":return Ng(this,u,f);case"base64":return ge(this,u,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Dg(this,u,f);default:if(b)throw new TypeError("Unknown encoding: "+p);p=(p+"").toLowerCase(),b=!0}}s.prototype._isBuffer=!0;function U(p,u,f){let b=p[u];p[u]=p[f],p[f]=b}s.prototype.swap16=function(){let u=this.length;if(u%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let f=0;ff&&(u+=" ... "),""},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(u,f,b,A,T){if(Ye(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),!s.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(f===void 0&&(f=0),b===void 0&&(b=u?u.length:0),A===void 0&&(A=0),T===void 0&&(T=this.length),f<0||b>u.length||A<0||T>this.length)throw new RangeError("out of range index");if(A>=T&&f>=b)return 0;if(A>=T)return-1;if(f>=b)return 1;if(f>>>=0,b>>>=0,A>>>=0,T>>>=0,this===u)return 0;let P=T-A,$=b-f,se=Math.min(P,$),te=this.slice(A,T),oe=u.slice(f,b);for(let J=0;J2147483647?f=2147483647:f<-2147483648&&(f=-2147483648),f=+f,gs(f)&&(f=A?0:p.length-1),f<0&&(f=p.length+f),f>=p.length){if(A)return-1;f=p.length-1}else if(f<0)if(A)f=0;else return-1;if(typeof u=="string"&&(u=s.from(u,b)),s.isBuffer(u))return u.length===0?-1:W(p,u,f,b,A);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?A?Uint8Array.prototype.indexOf.call(p,u,f):Uint8Array.prototype.lastIndexOf.call(p,u,f):W(p,[u],f,b,A);throw new TypeError("val must be string, number or Buffer")}function W(p,u,f,b,A){let T=1,P=p.length,$=u.length;if(b!==void 0&&(b=String(b).toLowerCase(),b==="ucs2"||b==="ucs-2"||b==="utf16le"||b==="utf-16le")){if(p.length<2||u.length<2)return-1;T=2,P/=2,$/=2,f/=2}function se(oe,J){return T===1?oe[J]:oe.readUInt16BE(J*T)}let te;if(A){let oe=-1;for(te=f;teP&&(f=P-$),te=f;te>=0;te--){let oe=!0;for(let J=0;J<$;J++)if(se(p,te+J)!==se(u,J)){oe=!1;break}if(oe)return te}return-1}s.prototype.includes=function(u,f,b){return this.indexOf(u,f,b)!==-1},s.prototype.indexOf=function(u,f,b){return N(this,u,f,b,!0)},s.prototype.lastIndexOf=function(u,f,b){return N(this,u,f,b,!1)};function K(p,u,f,b){f=Number(f)||0;let A=p.length-f;b?(b=Number(b),b>A&&(b=A)):b=A;let T=u.length;b>T/2&&(b=T/2);let P;for(P=0;P>>0,isFinite(b)?(b=b>>>0,A===void 0&&(A="utf8")):(A=b,b=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let T=this.length-f;if((b===void 0||b>T)&&(b=T),u.length>0&&(b<0||f<0)||f>this.length)throw new RangeError("Attempt to write outside buffer bounds");A||(A="utf8");let P=!1;for(;;)switch(A){case"hex":return K(this,u,f,b);case"utf8":case"utf-8":return z(this,u,f,b);case"ascii":case"latin1":case"binary":return Q(this,u,f,b);case"base64":return pe(this,u,f,b);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Yt(this,u,f,b);default:if(P)throw new TypeError("Unknown encoding: "+A);A=(""+A).toLowerCase(),P=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ge(p,u,f){return u===0&&f===p.length?t.fromByteArray(p):t.fromByteArray(p.slice(u,f))}function Pr(p,u,f){f=Math.min(p.length,f);let b=[],A=u;for(;A239?4:T>223?3:T>191?2:1;if(A+$<=f){let se,te,oe,J;switch($){case 1:T<128&&(P=T);break;case 2:se=p[A+1],(se&192)===128&&(J=(T&31)<<6|se&63,J>127&&(P=J));break;case 3:se=p[A+1],te=p[A+2],(se&192)===128&&(te&192)===128&&(J=(T&15)<<12|(se&63)<<6|te&63,J>2047&&(J<55296||J>57343)&&(P=J));break;case 4:se=p[A+1],te=p[A+2],oe=p[A+3],(se&192)===128&&(te&192)===128&&(oe&192)===128&&(J=(T&15)<<18|(se&63)<<12|(te&63)<<6|oe&63,J>65535&&J<1114112&&(P=J))}}P===null?(P=65533,$=1):P>65535&&(P-=65536,b.push(P>>>10&1023|55296),P=56320|P&1023),b.push(P),A+=$}return Or(b)}let kr=4096;function Or(p){let u=p.length;if(u<=kr)return String.fromCharCode.apply(String,p);let f="",b=0;for(;bb)&&(f=b);let A="";for(let T=u;Tb&&(u=b),f<0?(f+=b,f<0&&(f=0)):f>b&&(f=b),ff)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(u,f,b){u=u>>>0,f=f>>>0,b||ye(u,f,this.length);let A=this[u],T=1,P=0;for(;++P>>0,f=f>>>0,b||ye(u,f,this.length);let A=this[u+--f],T=1;for(;f>0&&(T*=256);)A+=this[u+--f]*T;return A},s.prototype.readUint8=s.prototype.readUInt8=function(u,f){return u=u>>>0,f||ye(u,1,this.length),this[u]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(u,f){return u=u>>>0,f||ye(u,2,this.length),this[u]|this[u+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(u,f){return u=u>>>0,f||ye(u,2,this.length),this[u]<<8|this[u+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(u,f){return u=u>>>0,f||ye(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(u,f){return u=u>>>0,f||ye(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},s.prototype.readBigUInt64LE=Mt(function(u){u=u>>>0,Mr(u,"offset");let f=this[u],b=this[u+7];(f===void 0||b===void 0)&&fi(u,this.length-8);let A=f+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24,T=this[++u]+this[++u]*2**8+this[++u]*2**16+b*2**24;return BigInt(A)+(BigInt(T)<>>0,Mr(u,"offset");let f=this[u],b=this[u+7];(f===void 0||b===void 0)&&fi(u,this.length-8);let A=f*2**24+this[++u]*2**16+this[++u]*2**8+this[++u],T=this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+b;return(BigInt(A)<>>0,f=f>>>0,b||ye(u,f,this.length);let A=this[u],T=1,P=0;for(;++P=T&&(A-=Math.pow(2,8*f)),A},s.prototype.readIntBE=function(u,f,b){u=u>>>0,f=f>>>0,b||ye(u,f,this.length);let A=f,T=1,P=this[u+--A];for(;A>0&&(T*=256);)P+=this[u+--A]*T;return T*=128,P>=T&&(P-=Math.pow(2,8*f)),P},s.prototype.readInt8=function(u,f){return u=u>>>0,f||ye(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},s.prototype.readInt16LE=function(u,f){u=u>>>0,f||ye(u,2,this.length);let b=this[u]|this[u+1]<<8;return b&32768?b|4294901760:b},s.prototype.readInt16BE=function(u,f){u=u>>>0,f||ye(u,2,this.length);let b=this[u+1]|this[u]<<8;return b&32768?b|4294901760:b},s.prototype.readInt32LE=function(u,f){return u=u>>>0,f||ye(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},s.prototype.readInt32BE=function(u,f){return u=u>>>0,f||ye(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},s.prototype.readBigInt64LE=Mt(function(u){u=u>>>0,Mr(u,"offset");let f=this[u],b=this[u+7];(f===void 0||b===void 0)&&fi(u,this.length-8);let A=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(b<<24);return(BigInt(A)<>>0,Mr(u,"offset");let f=this[u],b=this[u+7];(f===void 0||b===void 0)&&fi(u,this.length-8);let A=(f<<24)+this[++u]*2**16+this[++u]*2**8+this[++u];return(BigInt(A)<>>0,f||ye(u,4,this.length),e.read(this,u,!0,23,4)},s.prototype.readFloatBE=function(u,f){return u=u>>>0,f||ye(u,4,this.length),e.read(this,u,!1,23,4)},s.prototype.readDoubleLE=function(u,f){return u=u>>>0,f||ye(u,8,this.length),e.read(this,u,!0,52,8)},s.prototype.readDoubleBE=function(u,f){return u=u>>>0,f||ye(u,8,this.length),e.read(this,u,!1,52,8)};function Ce(p,u,f,b,A,T){if(!s.isBuffer(p))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>A||up.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(u,f,b,A){if(u=+u,f=f>>>0,b=b>>>0,!A){let $=Math.pow(2,8*b)-1;Ce(this,u,f,b,$,0)}let T=1,P=0;for(this[f]=u&255;++P>>0,b=b>>>0,!A){let $=Math.pow(2,8*b)-1;Ce(this,u,f,b,$,0)}let T=b-1,P=1;for(this[f+T]=u&255;--T>=0&&(P*=256);)this[f+T]=u/P&255;return f+b},s.prototype.writeUint8=s.prototype.writeUInt8=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,1,255,0),this[f]=u&255,f+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,2,65535,0),this[f]=u&255,this[f+1]=u>>>8,f+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,2,65535,0),this[f]=u>>>8,this[f+1]=u&255,f+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,4,4294967295,0),this[f+3]=u>>>24,this[f+2]=u>>>16,this[f+1]=u>>>8,this[f]=u&255,f+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,4,4294967295,0),this[f]=u>>>24,this[f+1]=u>>>16,this[f+2]=u>>>8,this[f+3]=u&255,f+4};function vl(p,u,f,b,A){Rl(u,b,A,p,f,7);let T=Number(u&BigInt(4294967295));p[f++]=T,T=T>>8,p[f++]=T,T=T>>8,p[f++]=T,T=T>>8,p[f++]=T;let P=Number(u>>BigInt(32)&BigInt(4294967295));return p[f++]=P,P=P>>8,p[f++]=P,P=P>>8,p[f++]=P,P=P>>8,p[f++]=P,f}function El(p,u,f,b,A){Rl(u,b,A,p,f,7);let T=Number(u&BigInt(4294967295));p[f+7]=T,T=T>>8,p[f+6]=T,T=T>>8,p[f+5]=T,T=T>>8,p[f+4]=T;let P=Number(u>>BigInt(32)&BigInt(4294967295));return p[f+3]=P,P=P>>8,p[f+2]=P,P=P>>8,p[f+1]=P,P=P>>8,p[f]=P,f+8}s.prototype.writeBigUInt64LE=Mt(function(u,f=0){return vl(this,u,f,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=Mt(function(u,f=0){return El(this,u,f,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeIntLE=function(u,f,b,A){if(u=+u,f=f>>>0,!A){let se=Math.pow(2,8*b-1);Ce(this,u,f,b,se-1,-se)}let T=0,P=1,$=0;for(this[f]=u&255;++T>0)-$&255;return f+b},s.prototype.writeIntBE=function(u,f,b,A){if(u=+u,f=f>>>0,!A){let se=Math.pow(2,8*b-1);Ce(this,u,f,b,se-1,-se)}let T=b-1,P=1,$=0;for(this[f+T]=u&255;--T>=0&&(P*=256);)u<0&&$===0&&this[f+T+1]!==0&&($=1),this[f+T]=(u/P>>0)-$&255;return f+b},s.prototype.writeInt8=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,1,127,-128),u<0&&(u=255+u+1),this[f]=u&255,f+1},s.prototype.writeInt16LE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,2,32767,-32768),this[f]=u&255,this[f+1]=u>>>8,f+2},s.prototype.writeInt16BE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,2,32767,-32768),this[f]=u>>>8,this[f+1]=u&255,f+2},s.prototype.writeInt32LE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,4,2147483647,-2147483648),this[f]=u&255,this[f+1]=u>>>8,this[f+2]=u>>>16,this[f+3]=u>>>24,f+4},s.prototype.writeInt32BE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[f]=u>>>24,this[f+1]=u>>>16,this[f+2]=u>>>8,this[f+3]=u&255,f+4},s.prototype.writeBigInt64LE=Mt(function(u,f=0){return vl(this,u,f,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=Mt(function(u,f=0){return El(this,u,f,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Sl(p,u,f,b,A,T){if(f+b>p.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("Index out of range")}function Al(p,u,f,b,A){return u=+u,f=f>>>0,A||Sl(p,u,f,4),e.write(p,u,f,b,23,4),f+4}s.prototype.writeFloatLE=function(u,f,b){return Al(this,u,f,!0,b)},s.prototype.writeFloatBE=function(u,f,b){return Al(this,u,f,!1,b)};function Il(p,u,f,b,A){return u=+u,f=f>>>0,A||Sl(p,u,f,8),e.write(p,u,f,b,52,8),f+8}s.prototype.writeDoubleLE=function(u,f,b){return Il(this,u,f,!0,b)},s.prototype.writeDoubleBE=function(u,f,b){return Il(this,u,f,!1,b)},s.prototype.copy=function(u,f,b,A){if(!s.isBuffer(u))throw new TypeError("argument should be a Buffer");if(b||(b=0),!A&&A!==0&&(A=this.length),f>=u.length&&(f=u.length),f||(f=0),A>0&&A=this.length)throw new RangeError("Index out of range");if(A<0)throw new RangeError("sourceEnd out of bounds");A>this.length&&(A=this.length),u.length-f>>0,b=b===void 0?this.length:b>>>0,u||(u=0);let T;if(typeof u=="number")for(T=f;T2**32?A=Tl(String(f)):typeof f=="bigint"&&(A=String(f),(f>BigInt(2)**BigInt(32)||f<-(BigInt(2)**BigInt(32)))&&(A=Tl(A)),A+="n"),b+=` It must be ${u}. Received ${A}`,b},RangeError);function Tl(p){let u="",f=p.length,b=p[0]==="-"?1:0;for(;f>=b+4;f-=3)u=`_${p.slice(f-3,f)}${u}`;return`${p.slice(0,f)}${u}`}function jg(p,u,f){Mr(u,"offset"),(p[u]===void 0||p[u+f]===void 0)&&fi(u,p.length-(f+1))}function Rl(p,u,f,b,A,T){if(p>f||p3?u===0||u===BigInt(0)?$=`>= 0${P} and < 2${P} ** ${(T+1)*8}${P}`:$=`>= -(2${P} ** ${(T+1)*8-1}${P}) and < 2 ** ${(T+1)*8-1}${P}`:$=`>= ${u}${P} and <= ${f}${P}`,new xr.ERR_OUT_OF_RANGE("value",$,p)}jg(b,A,T)}function Mr(p,u){if(typeof p!="number")throw new xr.ERR_INVALID_ARG_TYPE(u,"number",p)}function fi(p,u,f){throw Math.floor(p)!==p?(Mr(p,f),new xr.ERR_OUT_OF_RANGE(f||"offset","an integer",p)):u<0?new xr.ERR_BUFFER_OUT_OF_BOUNDS:new xr.ERR_OUT_OF_RANGE(f||"offset",`>= ${f?1:0} and <= ${u}`,p)}let Fg=/[^+/0-9A-Za-z-_]/g;function Wg(p){if(p=p.split("=")[0],p=p.trim().replace(Fg,""),p.length<2)return"";for(;p.length%4!==0;)p=p+"=";return p}function ps(p,u){u=u||1/0;let f,b=p.length,A=null,T=[];for(let P=0;P55295&&f<57344){if(!A){if(f>56319){(u-=3)>-1&&T.push(239,191,189);continue}else if(P+1===b){(u-=3)>-1&&T.push(239,191,189);continue}A=f;continue}if(f<56320){(u-=3)>-1&&T.push(239,191,189),A=f;continue}f=(A-55296<<10|f-56320)+65536}else A&&(u-=3)>-1&&T.push(239,191,189);if(A=null,f<128){if((u-=1)<0)break;T.push(f)}else if(f<2048){if((u-=2)<0)break;T.push(f>>6|192,f&63|128)}else if(f<65536){if((u-=3)<0)break;T.push(f>>12|224,f>>6&63|128,f&63|128)}else if(f<1114112){if((u-=4)<0)break;T.push(f>>18|240,f>>12&63|128,f>>6&63|128,f&63|128)}else throw new Error("Invalid code point")}return T}function $g(p){let u=[];for(let f=0;f>8,A=f%256,T.push(A),T.push(b);return T}function Cl(p){return t.toByteArray(Wg(p))}function ji(p,u,f,b){let A;for(A=0;A=u.length||A>=p.length);++A)u[A+f]=p[A];return A}function Ye(p,u){return p instanceof u||p!=null&&p.constructor!=null&&p.constructor.name!=null&&p.constructor.name===u.name}function gs(p){return p!==p}let Vg=function(){let p="0123456789abcdef",u=new Array(256);for(let f=0;f<16;++f){let b=f*16;for(let A=0;A<16;++A)u[b+A]=p[f]+p[A]}return u}();function Mt(p){return typeof BigInt>"u"?zg:p}function zg(){throw new Error("BigInt not supported")}return Zt}var ci,Vu,Hi,zu,Zt,Ku,Ut,x,ty,ry,be=_e(()=>{_();v();m();ci={},Vu=!1;Hi={},zu=!1;Zt={},Ku=!1;Ut=ey();Ut.Buffer;Ut.SlowBuffer;Ut.INSPECT_MAX_BYTES;Ut.kMaxLength;x=Ut.Buffer,ty=Ut.INSPECT_MAX_BYTES,ry=Ut.kMaxLength});var v=_e(()=>{be()});var Gu=M(vs=>{"use strict";_();v();m();Object.defineProperty(vs,"__esModule",{value:!0});var ms=class{constructor(e){this.aliasToTopic={},this.max=e}put(e,r){return r===0||r>this.max?!1:(this.aliasToTopic[r]=e,this.length=Object.keys(this.aliasToTopic).length,!0)}getTopicByAlias(e){return this.aliasToTopic[e]}clear(){this.aliasToTopic={}}};vs.default=ms});var ce=M((AA,Qu)=>{"use strict";_();v();m();Qu.exports={ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Uint8Array}});var Je=M((kA,Ss)=>{"use strict";_();v();m();var iy=(be(),X(me)),ny=Object.getPrototypeOf(async function(){}).constructor,Yu=globalThis.Blob||iy.Blob,sy=typeof Yu<"u"?function(e){return e instanceof Yu}:function(e){return!1},Es=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let i=0;i{t=i,e=n}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((i,...n)=>i?r(i):e(...n))})},debuglog(){return function(){}},format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,i]){let n=e.shift();return i==="f"?n.toFixed(6):i==="j"?JSON.stringify(n):i==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}},types:{isAsyncFunction(t){return t instanceof ny},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:sy};Ss.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var zi=M((qA,Vi)=>{"use strict";_();v();m();var{AbortController:Ju,AbortSignal:oy}=typeof self<"u"?self:typeof window<"u"?window:void 0;Vi.exports=Ju;Vi.exports.AbortSignal=oy;Vi.exports.default=Ju});var Ae=M((VA,ef)=>{"use strict";_();v();m();var{format:ay,inspect:Ki,AggregateError:ly}=Je(),uy=globalThis.AggregateError||ly,fy=Symbol("kIsNodeError"),cy=["string","function","number","object","Function","Object","boolean","bigint","symbol"],hy=/^([A-Z][a-z0-9]*)+$/,dy="__node_internal_",Gi={};function er(t,e){if(!t)throw new Gi.ERR_INTERNAL_ASSERTION(e)}function Xu(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function py(t,e,r){if(typeof e=="function")return er(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let i=(e.match(/%[dfijoOs]/g)||[]).length;return er(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:ay(e,...r)}function ve(t,e,r){r||(r=Error);class i extends r{constructor(...o){super(py(t,e,o))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=t,i.prototype[fy]=!0,Gi[t]=i}function Zu(t){let e=dy+t.name;return Object.defineProperty(t,"name",{value:e}),t}function gy(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new uy([e,t],e.message);return r.code=e.code,r}return t||e}var As=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new Gi.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};ve("ERR_ASSERTION","%s",Error);ve("ERR_INVALID_ARG_TYPE",(t,e,r)=>{er(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let i="The ";t.endsWith(" argument")?i+=`${t} `:i+=`"${t}" ${t.includes(".")?"property":"argument"} `,i+="must be ";let n=[],o=[],s=[];for(let l of e)er(typeof l=="string","All expected entries have to be of type string"),cy.includes(l)?n.push(l.toLowerCase()):hy.test(l)?o.push(l):(er(l!=="object",'The value "object" should be written as "Object"'),s.push(l));if(o.length>0){let l=n.indexOf("object");l!==-1&&(n.splice(n,l,1),o.push("Object"))}if(n.length>0){switch(n.length){case 1:i+=`of type ${n[0]}`;break;case 2:i+=`one of type ${n[0]} or ${n[1]}`;break;default:{let l=n.pop();i+=`one of type ${n.join(", ")}, or ${l}`}}(o.length>0||s.length>0)&&(i+=" or ")}if(o.length>0){switch(o.length){case 1:i+=`an instance of ${o[0]}`;break;case 2:i+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let l=o.pop();i+=`an instance of ${o.join(", ")}, or ${l}`}}s.length>0&&(i+=" or ")}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(i+="an "),i+=`${s[0]}`;break;case 2:i+=`one of ${s[0]} or ${s[1]}`;break;default:{let l=s.pop();i+=`one of ${s.join(", ")}, or ${l}`}}if(r==null)i+=`. Received ${r}`;else if(typeof r=="function"&&r.name)i+=`. Received function ${r.name}`;else if(typeof r=="object"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)i+=`. Received an instance of ${r.constructor.name}`;else{let l=Ki(r,{depth:-1});i+=`. Received ${l}`}}else{let l=Ki(r,{colors:!1});l.length>25&&(l=`${l.slice(0,25)}...`),i+=`. Received type ${typeof r} (${l})`}return i},TypeError);ve("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let i=Ki(e);return i.length>128&&(i=i.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${i}`},TypeError);ve("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var i;let n=r!=null&&(i=r.constructor)!==null&&i!==void 0&&i.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${n}.`},TypeError);ve("ERR_MISSING_ARGS",(...t)=>{er(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(i=>`"${i}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let i=t.pop();e+=`The ${t.join(", ")}, and ${i} arguments`}break}return`${e} must be specified`},TypeError);ve("ERR_OUT_OF_RANGE",(t,e,r)=>{er(e,'Missing "range" argument');let i;return Number.isInteger(r)&&Math.abs(r)>2**32?i=Xu(String(r)):typeof r=="bigint"?(i=String(r),(r>2n**32n||r<-(2n**32n))&&(i=Xu(i)),i+="n"):i=Ki(r),`The value of "${t}" is out of range. It must be ${e}. Received ${i}`},RangeError);ve("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);ve("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);ve("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);ve("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);ve("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);ve("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);ve("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);ve("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);ve("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);ve("ERR_STREAM_WRITE_AFTER_END","write after end",Error);ve("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);ef.exports={AbortError:As,aggregateTwoErrors:Zu(gy),hideStackFrames:Zu,codes:Gi}});var hi=M((XA,ff)=>{"use strict";_();v();m();var{ArrayIsArray:Ts,ArrayPrototypeIncludes:sf,ArrayPrototypeJoin:of,ArrayPrototypeMap:yy,NumberIsInteger:Rs,NumberIsNaN:by,NumberMAX_SAFE_INTEGER:wy,NumberMIN_SAFE_INTEGER:_y,NumberParseInt:my,ObjectPrototypeHasOwnProperty:vy,RegExpPrototypeExec:af,String:Ey,StringPrototypeToUpperCase:Sy,StringPrototypeTrim:Ay}=ce(),{hideStackFrames:Ue,codes:{ERR_SOCKET_BAD_PORT:Iy,ERR_INVALID_ARG_TYPE:Ie,ERR_INVALID_ARG_VALUE:Ur,ERR_OUT_OF_RANGE:tr,ERR_UNKNOWN_SIGNAL:tf}}=Ae(),{normalizeEncoding:Ty}=Je(),{isAsyncFunction:Ry,isArrayBufferView:Cy}=Je().types,rf={};function By(t){return t===(t|0)}function Py(t){return t===t>>>0}var ky=/^[0-7]+$/,Oy="must be a 32-bit unsigned integer or an octal string";function xy(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(af(ky,t)===null)throw new Ur(e,t,Oy);t=my(t,8)}return lf(t,e),t}var My=Ue((t,e,r=_y,i=wy)=>{if(typeof t!="number")throw new Ie(e,"number",t);if(!Rs(t))throw new tr(e,"an integer",t);if(ti)throw new tr(e,`>= ${r} && <= ${i}`,t)}),Ly=Ue((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!="number")throw new Ie(e,"number",t);if(!Rs(t))throw new tr(e,"an integer",t);if(ti)throw new tr(e,`>= ${r} && <= ${i}`,t)}),lf=Ue((t,e,r=!1)=>{if(typeof t!="number")throw new Ie(e,"number",t);if(!Rs(t))throw new tr(e,"an integer",t);let i=r?1:0,n=4294967295;if(tn)throw new tr(e,`>= ${i} && <= ${n}`,t)});function Cs(t,e){if(typeof t!="string")throw new Ie(e,"string",t)}function Uy(t,e,r=void 0,i){if(typeof t!="number")throw new Ie(e,"number",t);if(r!=null&&ti||(r!=null||i!=null)&&by(t))throw new tr(e,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,t)}var Ny=Ue((t,e,r)=>{if(!sf(r,t)){let n="must be one of: "+of(yy(r,o=>typeof o=="string"?`'${o}'`:Ey(o)),", ");throw new Ur(e,t,n)}});function uf(t,e){if(typeof t!="boolean")throw new Ie(e,"boolean",t)}function Is(t,e,r){return t==null||!vy(t,e)?r:t[e]}var qy=Ue((t,e,r=null)=>{let i=Is(r,"allowArray",!1),n=Is(r,"allowFunction",!1);if(!Is(r,"nullable",!1)&&t===null||!i&&Ts(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new Ie(e,"Object",t)}),Dy=Ue((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new Ie(e,"a dictionary",t)}),Bs=Ue((t,e,r=0)=>{if(!Ts(t))throw new Ie(e,"Array",t);if(t.length{if(!Cy(t))throw new Ie(e,["Buffer","TypedArray","DataView"],t)});function Hy(t,e){let r=Ty(e),i=t.length;if(r==="hex"&&i%2!==0)throw new Ur("encoding",e,`is invalid for data of length ${i}`)}function Vy(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&Ay(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new Iy(e,t,r);return t|0}var zy=Ue((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Ie(e,"AbortSignal",t)}),Ky=Ue((t,e)=>{if(typeof t!="function")throw new Ie(e,"Function",t)}),Gy=Ue((t,e)=>{if(typeof t!="function"||Ry(t))throw new Ie(e,"Function",t)}),Qy=Ue((t,e)=>{if(t!==void 0)throw new Ie(e,"undefined",t)});function Yy(t,e,r){if(!sf(r,t))throw new Ie(e,`('${of(r,"|")}')`,t)}var Jy=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function nf(t,e){if(typeof t>"u"||!af(Jy,t))throw new Ur(e,t,'must be an array or string of format "; rel=preload; as=style"')}function Xy(t){if(typeof t=="string")return nf(t,"hints"),t;if(Ts(t)){let e=t.length,r="";if(e===0)return r;for(let i=0;i; rel=preload; as=style"')}ff.exports={isInt32:By,isUint32:Py,parseFileMode:xy,validateArray:Bs,validateStringArray:jy,validateBooleanArray:Fy,validateBoolean:uf,validateBuffer:$y,validateDictionary:Dy,validateEncoding:Hy,validateFunction:Ky,validateInt32:Ly,validateInteger:My,validateNumber:Uy,validateObject:qy,validateOneOf:Ny,validatePlainFunction:Gy,validatePort:Vy,validateSignalName:Wy,validateString:Cs,validateUint32:lf,validateUndefined:Qy,validateUnion:Yy,validateAbortSignal:zy,validateLinkHeaderValue:Xy}});var Nt=M((sI,pf)=>{_();v();m();var ae=pf.exports={},Xe,Ze;function Ps(){throw new Error("setTimeout has not been defined")}function ks(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Xe=setTimeout:Xe=Ps}catch{Xe=Ps}try{typeof clearTimeout=="function"?Ze=clearTimeout:Ze=ks}catch{Ze=ks}})();function cf(t){if(Xe===setTimeout)return setTimeout(t,0);if((Xe===Ps||!Xe)&&setTimeout)return Xe=setTimeout,setTimeout(t,0);try{return Xe(t,0)}catch{try{return Xe.call(null,t,0)}catch{return Xe.call(this,t,0)}}}function Zy(t){if(Ze===clearTimeout)return clearTimeout(t);if((Ze===ks||!Ze)&&clearTimeout)return Ze=clearTimeout,clearTimeout(t);try{return Ze(t)}catch{try{return Ze.call(null,t)}catch{return Ze.call(this,t)}}}var _t=[],Nr=!1,rr,Qi=-1;function eb(){!Nr||!rr||(Nr=!1,rr.length?_t=rr.concat(_t):Qi=-1,_t.length&&hf())}function hf(){if(!Nr){var t=cf(eb);Nr=!0;for(var e=_t.length;e;){for(rr=_t,_t=[];++Qi1)for(var r=1;r{"use strict";_();v();m();var{Symbol:Yi,SymbolAsyncIterator:gf,SymbolIterator:yf,SymbolFor:bf}=ce(),wf=Yi("kDestroyed"),_f=Yi("kIsErrored"),Os=Yi("kIsReadable"),mf=Yi("kIsDisturbed"),tb=bf("nodejs.webstream.isClosedPromise"),rb=bf("nodejs.webstream.controllerErrorFunction");function Ji(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function Xi(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function ib(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function et(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function vf(t){return!!(t&&!et(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Ef(t){return!!(t&&!et(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Sf(t){return!!(t&&!et(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function nb(t){return vf(t)||Ef(t)||Sf(t)}function sb(t,e){return t==null?!1:e===!0?typeof t[gf]=="function":e===!1?typeof t[yf]=="function":typeof t[gf]=="function"||typeof t[yf]=="function"}function Zi(t){if(!et(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!!(t.destroyed||t[wf]||i!=null&&i.destroyed)}function Af(t){if(!Xi(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function ob(t,e){if(!Xi(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function ab(t){if(!Ji(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function If(t,e){if(!Ji(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function Tf(t){return t&&t[Os]!=null?t[Os]:typeof t?.readable!="boolean"?null:Zi(t)?!1:Ji(t)&&t.readable&&!If(t)}function Rf(t){return typeof t?.writable!="boolean"?null:Zi(t)?!1:Xi(t)&&t.writable&&!Af(t)}function lb(t,e){return et(t)?Zi(t)?!0:!(e?.readable!==!1&&Tf(t)||e?.writable!==!1&&Rf(t)):null}function ub(t){var e,r;return et(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function fb(t){var e,r;return et(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function cb(t){if(!et(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&Cf(t)?t._closed:null}function Cf(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Bf(t){return typeof t._sent100=="boolean"&&Cf(t)}function hb(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function db(t){if(!et(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!i&&Bf(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}function pb(t){var e;return!!(t&&((e=t[mf])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function gb(t){var e,r,i,n,o,s,a,l,c,h;return!!(t&&((e=(r=(i=(n=(o=(s=t[_f])!==null&&s!==void 0?s:t.readableErrored)!==null&&o!==void 0?o:t.writableErrored)!==null&&n!==void 0?n:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&i!==void 0?i:(l=t._writableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&r!==void 0?r:(c=t._readableState)===null||c===void 0?void 0:c.errored)!==null&&e!==void 0?e:!((h=t._writableState)===null||h===void 0)&&h.errored))}Pf.exports={kDestroyed:wf,isDisturbed:pb,kIsDisturbed:mf,isErrored:gb,kIsErrored:_f,isReadable:Tf,kIsReadable:Os,kIsClosedPromise:tb,kControllerErrorFunction:rb,isClosed:cb,isDestroyed:Zi,isDuplexNodeStream:ib,isFinished:lb,isIterable:sb,isReadableNodeStream:Ji,isReadableStream:vf,isReadableEnded:ab,isReadableFinished:If,isReadableErrored:fb,isNodeStream:et,isWebStream:nb,isWritable:Rf,isWritableNodeStream:Xi,isWritableStream:Ef,isWritableEnded:Af,isWritableFinished:ob,isWritableErrored:ub,isServerRequest:hb,isServerResponse:Bf,willEmitClose:db,isTransformStream:Sf}});var vt=M((_I,Ns)=>{_();v();m();var qt=Nt(),{AbortError:Df,codes:yb}=Ae(),{ERR_INVALID_ARG_TYPE:bb,ERR_STREAM_PREMATURE_CLOSE:kf}=yb,{kEmptyObject:Ms,once:Ls}=Je(),{validateAbortSignal:wb,validateFunction:_b,validateObject:mb,validateBoolean:vb}=hi(),{Promise:Eb,PromisePrototypeThen:Sb}=ce(),{isClosed:Ab,isReadable:Of,isReadableNodeStream:xs,isReadableStream:Ib,isReadableFinished:xf,isReadableErrored:Mf,isWritable:Lf,isWritableNodeStream:Uf,isWritableStream:Tb,isWritableFinished:Nf,isWritableErrored:qf,isNodeStream:Rb,willEmitClose:Cb,kIsClosedPromise:Bb}=tt();function Pb(t){return t.setHeader&&typeof t.abort=="function"}var Us=()=>{};function jf(t,e,r){var i,n;if(arguments.length===2?(r=e,e=Ms):e==null?e=Ms:mb(e,"options"),_b(r,"callback"),wb(e.signal,"options.signal"),r=Ls(r),Ib(t)||Tb(t))return kb(t,e,r);if(!Rb(t))throw new bb("stream",["ReadableStream","WritableStream","Stream"],t);let o=(i=e.readable)!==null&&i!==void 0?i:xs(t),s=(n=e.writable)!==null&&n!==void 0?n:Uf(t),a=t._writableState,l=t._readableState,c=()=>{t.writable||g()},h=Cb(t)&&xs(t)===o&&Uf(t)===s,d=Nf(t,!1),g=()=>{d=!0,t.destroyed&&(h=!1),!(h&&(!t.readable||o))&&(!o||y)&&r.call(t)},y=xf(t,!1),w=()=>{y=!0,t.destroyed&&(h=!1),!(h&&(!t.writable||s))&&(!s||d)&&r.call(t)},S=N=>{r.call(t,N)},E=Ab(t),I=()=>{E=!0;let N=qf(t)||Mf(t);if(N&&typeof N!="boolean")return r.call(t,N);if(o&&!y&&xs(t,!0)&&!xf(t,!1))return r.call(t,new kf);if(s&&!d&&!Nf(t,!1))return r.call(t,new kf);r.call(t)},C=()=>{E=!0;let N=qf(t)||Mf(t);if(N&&typeof N!="boolean")return r.call(t,N);r.call(t)},R=()=>{t.req.on("finish",g)};Pb(t)?(t.on("complete",g),h||t.on("abort",I),t.req?R():t.on("request",R)):s&&!a&&(t.on("end",c),t.on("close",c)),!h&&typeof t.aborted=="boolean"&&t.on("aborted",I),t.on("end",w),t.on("finish",g),e.error!==!1&&t.on("error",S),t.on("close",I),E?qt.nextTick(I):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?h||qt.nextTick(C):(!o&&(!h||Of(t))&&(d||Lf(t)===!1)||!s&&(!h||Lf(t))&&(y||Of(t)===!1)||l&&t.req&&t.aborted)&&qt.nextTick(C);let U=()=>{r=Us,t.removeListener("aborted",I),t.removeListener("complete",g),t.removeListener("abort",I),t.removeListener("request",R),t.req&&t.req.removeListener("finish",g),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",g),t.removeListener("end",w),t.removeListener("error",S),t.removeListener("close",I)};if(e.signal&&!E){let N=()=>{let W=r;U(),W.call(t,new Df(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)qt.nextTick(N);else{let W=r;r=Ls((...K)=>{e.signal.removeEventListener("abort",N),W.apply(t,K)}),e.signal.addEventListener("abort",N)}}return U}function kb(t,e,r){let i=!1,n=Us;if(e.signal)if(n=()=>{i=!0,r.call(t,new Df(void 0,{cause:e.signal.reason}))},e.signal.aborted)qt.nextTick(n);else{let s=r;r=Ls((...a)=>{e.signal.removeEventListener("abort",n),s.apply(t,a)}),e.signal.addEventListener("abort",n)}let o=(...s)=>{i||qt.nextTick(()=>r.apply(t,s))};return Sb(t[Bb].promise,o,o),Us}function Ob(t,e){var r;let i=!1;return e===null&&(e=Ms),(r=e)!==null&&r!==void 0&&r.cleanup&&(vb(e.cleanup,"cleanup"),i=e.cleanup),new Eb((n,o)=>{let s=jf(t,e,a=>{i&&s(),a?o(a):n()})})}Ns.exports=jf;Ns.exports.finished=Ob});var ir=M((TI,Gf)=>{"use strict";_();v();m();var rt=Nt(),{aggregateTwoErrors:xb,codes:{ERR_MULTIPLE_CALLBACK:Mb},AbortError:Lb}=Ae(),{Symbol:$f}=ce(),{kDestroyed:Ub,isDestroyed:Nb,isFinished:qb,isServerRequest:Db}=tt(),Hf=$f("kDestroy"),qs=$f("kConstruct");function Vf(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function jb(t,e){let r=this._readableState,i=this._writableState,n=i||r;return i!=null&&i.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(Vf(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?Ff(this,t,e):this.once(Hf,function(o){Ff(this,xb(o,t),e)}),this)}function Ff(t,e,r){let i=!1;function n(o){if(i)return;i=!0;let s=t._readableState,a=t._writableState;Vf(o,a,s),a&&(a.closed=!0),s&&(s.closed=!0),typeof r=="function"&&r(o),o?rt.nextTick(Fb,t,o):rt.nextTick(zf,t)}try{t._destroy(e||null,n)}catch(o){n(o)}}function Fb(t,e){Ds(t,e),zf(t)}function zf(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}function Ds(t,e){let r=t._readableState,i=t._writableState;i!=null&&i.errorEmitted||r!=null&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function Wb(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function js(t,e,r){let i=t._readableState,n=t._writableState;if(n!=null&&n.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||n!=null&&n.autoDestroy?t.destroy(e):e&&(e.stack,n&&!n.errored&&(n.errored=e),i&&!i.errored&&(i.errored=e),r?rt.nextTick(Ds,t,e):Ds(t,e))}function $b(t,e){if(typeof t._construct!="function")return;let r=t._readableState,i=t._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),t.once(qs,e),!(t.listenerCount(qs)>1)&&rt.nextTick(Hb,t)}function Hb(t){let e=!1;function r(i){if(e){js(t,i??new Mb);return}e=!0;let n=t._readableState,o=t._writableState,s=o||n;n&&(n.constructed=!0),o&&(o.constructed=!0),s.destroyed?t.emit(Hf,i):i?js(t,i,!0):rt.nextTick(Vb,t)}try{t._construct(i=>{rt.nextTick(r,i)})}catch(i){rt.nextTick(r,i)}}function Vb(t){t.emit(qs)}function Wf(t){return t?.setHeader&&typeof t.abort=="function"}function Kf(t){t.emit("close")}function zb(t,e){t.emit("error",e),rt.nextTick(Kf,t)}function Kb(t,e){!t||Nb(t)||(!e&&!qb(t)&&(e=new Lb),Db(t)?(t.socket=null,t.destroy(e)):Wf(t)?t.abort():Wf(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?rt.nextTick(zb,t,e):rt.nextTick(Kf,t),t.destroyed||(t[Ub]=!0))}Gf.exports={construct:$b,destroyer:Kb,destroy:jb,undestroy:Wb,errorOrDestroy:js}});function Y(){Y.init.call(this)}function en(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function nc(t){return t._maxListeners===void 0?Y.defaultMaxListeners:t._maxListeners}function Xf(t,e,r,i){var n,o,s,a;if(en(r),(o=t._events)===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),s===void 0)s=o[e]=r,++t._eventsCount;else if(typeof s=="function"?s=o[e]=i?[r,s]:[s,r]:i?s.unshift(r):s.push(r),(n=nc(t))>0&&s.length>n&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=s.length,a=l,console&&console.warn&&console.warn(a)}return t}function Gb(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Zf(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=Gb.bind(i);return n.listener=r,i.wrapFn=n,n}function ec(t,e,r){var i=t._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?r?[n.listener||n]:[n]:r?function(o){for(var s=new Array(o.length),a=0;a{_();v();m();qr=typeof Reflect=="object"?Reflect:null,Qf=qr&&typeof qr.apply=="function"?qr.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};ic=qr&&typeof qr.ownKeys=="function"?qr.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};Yf=Number.isNaN||function(t){return t!=t};rc=Y,Y.EventEmitter=Y,Y.prototype._events=void 0,Y.prototype._eventsCount=0,Y.prototype._maxListeners=void 0;Jf=10;Object.defineProperty(Y,"defaultMaxListeners",{enumerable:!0,get:function(){return Jf},set:function(t){if(typeof t!="number"||t<0||Yf(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Jf=t}}),Y.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Y.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Yf(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},Y.prototype.getMaxListeners=function(){return nc(this)},Y.prototype.emit=function(t){for(var e=[],r=1;r0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=n[t];if(a===void 0)return!1;if(typeof a=="function")Qf(a,this,e);else{var l=a.length,c=sc(a,l);for(r=0;r=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,n=o;break}if(n<0)return this;n===0?r.shift():function(a,l){for(;l+1=0;i--)this.removeListener(t,e[i]);return this},Y.prototype.listeners=function(t){return ec(this,t,!0)},Y.prototype.rawListeners=function(t){return ec(this,t,!1)},Y.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):tc.call(t,e)},Y.prototype.listenerCount=tc,Y.prototype.eventNames=function(){return this._eventsCount>0?ic(this._events):[]};Be=rc;Be.EventEmitter;Be.defaultMaxListeners;Be.init;Be.listenerCount;Be.EventEmitter;Be.defaultMaxListeners;Be.init;Be.listenerCount});var nr={};Jt(nr,{EventEmitter:()=>Qb,default:()=>Be,defaultMaxListeners:()=>Yb,init:()=>Jb,listenerCount:()=>Xb,on:()=>Zb,once:()=>ew});var Qb,Yb,Jb,Xb,Zb,ew,sr=_e(()=>{_();v();m();Fs();Fs();Be.once=function(t,e){return new Promise((r,i)=>{function n(...s){o!==void 0&&t.removeListener("error",o),r(s)}let o;e!=="error"&&(o=s=>{t.removeListener(name,n),i(s)},t.once("error",o)),t.once(e,n)})};Be.on=function(t,e){let r=[],i=[],n=null,o=!1,s={async next(){let c=r.shift();if(c)return createIterResult(c,!1);if(n){let h=Promise.reject(n);return n=null,h}return o?createIterResult(void 0,!0):new Promise((h,d)=>i.push({resolve:h,reject:d}))},async return(){t.removeListener(e,a),t.removeListener("error",l),o=!0;for(let c of i)c.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(c){n=c,t.removeListener(e,a),t.removeListener("error",l)},[Symbol.asyncIterator](){return this}};return t.on(e,a),t.on("error",l),s;function a(...c){let h=i.shift();h?h.resolve(createIterResult(c,!1)):r.push(c)}function l(c){o=!0;let h=i.shift();h?h.reject(c):n=c,s.return()}};({EventEmitter:Qb,defaultMaxListeners:Yb,init:Jb,listenerCount:Xb,on:Zb,once:ew}=Be)});var nn=M((GI,ac)=>{"use strict";_();v();m();var{ArrayIsArray:tw,ObjectSetPrototypeOf:oc}=ce(),{EventEmitter:tn}=(sr(),X(nr));function rn(t){tn.call(this,t)}oc(rn.prototype,tn.prototype);oc(rn,tn);rn.prototype.pipe=function(t,e){let r=this;function i(h){t.writable&&t.write(h)===!1&&r.pause&&r.pause()}r.on("data",i);function n(){r.readable&&r.resume&&r.resume()}t.on("drain",n),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",s),r.on("close",a));let o=!1;function s(){o||(o=!0,t.end())}function a(){o||(o=!0,typeof t.destroy=="function"&&t.destroy())}function l(h){c(),tn.listenerCount(this,"error")===0&&this.emit("error",h)}Ws(r,"error",l),Ws(t,"error",l);function c(){r.removeListener("data",i),t.removeListener("drain",n),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",l),t.removeListener("error",l),r.removeListener("end",c),r.removeListener("close",c),t.removeListener("close",c)}return r.on("end",c),r.on("close",c),t.on("close",c),t.emit("pipe",r),t};function Ws(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):tw(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}ac.exports={Stream:rn,prependListener:Ws}});var di=M((tT,sn)=>{"use strict";_();v();m();var{AbortError:lc,codes:rw}=Ae(),{isNodeStream:uc,isWebStream:iw,kControllerErrorFunction:nw}=tt(),sw=vt(),{ERR_INVALID_ARG_TYPE:fc}=rw,ow=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new fc(e,"AbortSignal",t)};sn.exports.addAbortSignal=function(e,r){if(ow(e,"signal"),!uc(r)&&!iw(r))throw new fc("stream",["ReadableStream","WritableStream","Stream"],r);return sn.exports.addAbortSignalNoValidate(e,r)};sn.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=uc(e)?()=>{e.destroy(new lc(void 0,{cause:t.reason}))}:()=>{e[nw](new lc(void 0,{cause:t.reason}))};return t.aborted?r():(t.addEventListener("abort",r),sw(e,()=>t.removeEventListener("abort",r))),e}});var dc=M((uT,hc)=>{"use strict";_();v();m();var{StringPrototypeSlice:cc,SymbolIterator:aw,TypedArrayPrototypeSet:on,Uint8Array:lw}=ce(),{Buffer:$s}=(be(),X(me)),{inspect:uw}=Je();hc.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let r=this.head,i=""+r.data;for(;(r=r.next)!==null;)i+=e+r.data;return i}concat(e){if(this.length===0)return $s.alloc(0);let r=$s.allocUnsafe(e>>>0),i=this.head,n=0;for(;i;)on(r,i.data,n),n+=i.data.length,i=i.next;return r}consume(e,r){let i=this.head.data;if(eo.length)r+=o,e-=o.length;else{e===o.length?(r+=o,++n,i.next?this.head=i.next:this.head=this.tail=null):(r+=cc(o,0,e),this.head=i,i.data=cc(o,e));break}++n}while((i=i.next)!==null);return this.length-=n,r}_getBuffer(e){let r=$s.allocUnsafe(e),i=e,n=this.head,o=0;do{let s=n.data;if(e>s.length)on(r,s,i-e),e-=s.length;else{e===s.length?(on(r,s,i-e),++o,n.next?this.head=n.next:this.head=this.tail=null):(on(r,new lw(s.buffer,s.byteOffset,e),i-e),this.head=n,n.data=s.slice(e));break}++o}while((n=n.next)!==null);return this.length-=o,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return uw(this,{...r,depth:0,customInspect:!1})}}});var an=M((yT,gc)=>{"use strict";_();v();m();var{MathFloor:fw,NumberIsInteger:cw}=ce(),{ERR_INVALID_ARG_VALUE:hw}=Ae().codes;function dw(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function pc(t){return t?16:16*1024}function pw(t,e,r,i){let n=dw(e,i,r);if(n!=null){if(!cw(n)||n<0){let o=i?`options.${r}`:"options.highWaterMark";throw new hw(o,n)}return fw(n)}return pc(t.objectMode)}gc.exports={getHighWaterMark:pw,getDefaultHighWaterMark:pc}});function wc(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return r===-1&&(r=e),[r,r===e?0:4-r%4]}function gw(t,e,r){for(var i,n,o=[],s=e;s>18&63]+$e[n>>12&63]+$e[n>>6&63]+$e[63&n]);return o.join("")}function Et(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,O.prototype),e}function O(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Ks(t)}return Cc(t,e,r)}function Cc(t,e,r){if(typeof t=="string")return function(o,s){if(typeof s=="string"&&s!==""||(s="utf8"),!O.isEncoding(s))throw new TypeError("Unknown encoding: "+s);var a=0|Pc(o,s),l=Et(a),c=l.write(o,s);return c!==a&&(l=l.slice(0,c)),l}(t,e);if(ArrayBuffer.isView(t))return Hs(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(St(t,ArrayBuffer)||t&&St(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(St(t,SharedArrayBuffer)||t&&St(t.buffer,SharedArrayBuffer)))return mc(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return O.from(i,e,r);var n=function(o){if(O.isBuffer(o)){var s=0|Ys(o.length),a=Et(s);return a.length===0||o.copy(a,0,0,s),a}if(o.length!==void 0)return typeof o.length!="number"||Js(o.length)?Et(0):Hs(o);if(o.type==="Buffer"&&Array.isArray(o.data))return Hs(o.data)}(t);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return O.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function Bc(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function Ks(t){return Bc(t),Et(t<0?0:0|Ys(t))}function Hs(t){for(var e=t.length<0?0:0|Ys(t.length),r=Et(e),i=0;i=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647 .toString(16)+" bytes");return 0|t}function Pc(t,e){if(O.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||St(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Gs(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Mc(t).length;default:if(n)return i?-1:Gs(t).length;e=(""+e).toLowerCase(),n=!0}}function bw(t,e,r){var i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return Tw(this,e,r);case"utf8":case"utf-8":return Oc(this,e,r);case"ascii":return Aw(this,e,r);case"latin1":case"binary":return Iw(this,e,r);case"base64":return Sw(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Rw(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function ar(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function vc(t,e,r,i,n){if(t.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Js(r=+r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if(typeof e=="string"&&(e=O.from(e,i)),O.isBuffer(e))return e.length===0?-1:Ec(t,e,r,i,n);if(typeof e=="number")return e&=255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Ec(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function Ec(t,e,r,i,n){var o,s=1,a=t.length,l=e.length;if(i!==void 0&&((i=String(i).toLowerCase())==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,a/=2,l/=2,r/=2}function c(y,w){return s===1?y[w]:y.readUInt16BE(w*s)}if(n){var h=-1;for(o=r;oa&&(r=a-l),o=r;o>=0;o--){for(var d=!0,g=0;gn&&(i=n):i=n;var o=e.length;i>o/2&&(i=o/2);for(var s=0;s>8,l=s%256,c.push(l),c.push(a);return c}(e,t.length-r),t,r,i)}function Sw(t,e,r){return e===0&&r===t.length?zs.fromByteArray(t):zs.fromByteArray(t.slice(e,r))}function Oc(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:c>223?3:c>191?2:1;if(n+d<=r)switch(d){case 1:c<128&&(h=c);break;case 2:(192&(o=t[n+1]))==128&&(l=(31&c)<<6|63&o)>127&&(h=l);break;case 3:o=t[n+1],s=t[n+2],(192&o)==128&&(192&s)==128&&(l=(15&c)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(h=l);break;case 4:o=t[n+1],s=t[n+2],a=t[n+3],(192&o)==128&&(192&s)==128&&(192&a)==128&&(l=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(h=l)}h===null?(h=65533,d=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h),n+=d}return function(g){var y=g.length;if(y<=4096)return String.fromCharCode.apply(String,g);for(var w="",S=0;Si)&&(r=i);for(var n="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function Pe(t,e,r,i,n,o){if(!O.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}function xc(t,e,r,i,n,o){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Sc(t,e,r,i,n){return e=+e,r>>>=0,n||xc(t,0,r,4),Dr.write(t,e,r,i,23,4),r+4}function Ac(t,e,r,i,n){return e=+e,r>>>=0,n||xc(t,0,r,8),Dr.write(t,e,r,i,52,8),r+8}function Gs(t,e){var r;e=e||1/0;for(var i=t.length,n=null,o=[],s=0;s55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Mc(t){return zs.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(Cw,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(t))}function cn(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function St(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Js(t){return t!=t}function Ic(t,e){for(var r in t)e[r]=t[r]}function lr(t,e,r){return it(t,e,r)}function pi(t){var e;switch(this.encoding=function(r){var i=function(n){if(!n)return"utf8";for(var o;;)switch(n){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return n;default:if(o)return;n=(""+n).toLowerCase(),o=!0}}(r);if(typeof i!="string"&&(Qs.isEncoding===Tc||!Tc(r)))throw new Error("Unknown encoding: "+r);return i||r}(t),this.encoding){case"utf16le":this.text=Ow,this.end=xw,e=4;break;case"utf8":this.fillLast=kw,e=4;break;case"base64":this.text=Mw,this.end=Lw,e=3;break;default:return this.write=Uw,this.end=Nw,void 0}this.lastNeed=0,this.lastTotal=0,this.lastChar=Qs.allocUnsafe(e)}function Vs(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function kw(t){var e=this.lastTotal-this.lastNeed,r=function(i,n,o){if((192&n[0])!=128)return i.lastNeed=0,"\uFFFD";if(i.lastNeed>1&&n.length>1){if((192&n[1])!=128)return i.lastNeed=1,"\uFFFD";if(i.lastNeed>2&&n.length>2&&(192&n[2])!=128)return i.lastNeed=2,"\uFFFD"}}(this,t);return r!==void 0?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length,void 0)}function Ow(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function xw(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function Mw(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function Lw(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Uw(t){return t.toString(this.encoding)}function Nw(t){return t&&t.length?this.write(t):""}var Rc,$e,Oe,yc,ln,or,bc,yw,At,zs,Dr,_c,Cw,Bw,un,fn,it,Pw,ur,Qs,Tc,Xs=_e(()=>{_();v();m();for(Rc={byteLength:function(t){var e=wc(t),r=e[0],i=e[1];return 3*(r+i)/4-i},toByteArray:function(t){var e,r,i=wc(t),n=i[0],o=i[1],s=new yc(function(c,h,d){return 3*(h+d)/4-d}(0,n,o)),a=0,l=o>0?n-4:n;for(r=0;r>16&255,s[a++]=e>>8&255,s[a++]=255&e;return o===2&&(e=Oe[t.charCodeAt(r)]<<2|Oe[t.charCodeAt(r+1)]>>4,s[a++]=255&e),o===1&&(e=Oe[t.charCodeAt(r)]<<10|Oe[t.charCodeAt(r+1)]<<4|Oe[t.charCodeAt(r+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s},fromByteArray:function(t){for(var e,r=t.length,i=r%3,n=[],o=0,s=r-i;os?s:o+16383));return i===1?(e=t[r-1],n.push($e[e>>2]+$e[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push($e[e>>10]+$e[e>>4&63]+$e[e<<2&63]+"=")),n.join("")}},$e=[],Oe=[],yc=typeof Uint8Array<"u"?Uint8Array:Array,ln="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",or=0,bc=ln.length;or>1,h=-7,d=r?n-1:0,g=r?-1:1,y=t[e+d];for(d+=g,o=y&(1<<-h)-1,y>>=-h,h+=a;h>0;o=256*o+t[e+d],d+=g,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=i;h>0;s=256*s+t[e+d],d+=g,h-=8);if(o===0)o=1-c;else{if(o===l)return s?NaN:1/0*(y?-1:1);s+=Math.pow(2,i),o-=c}return(y?-1:1)*s*Math.pow(2,o-i)},write:function(t,e,r,i,n,o){var s,a,l,c=8*o-n-1,h=(1<>1,g=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=i?0:o-1,w=i?1:-1,S=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+d>=1?g/l:g*Math.pow(2,1-d))*l>=2&&(s++,l/=2),s+d>=h?(a=0,s=h):s+d>=1?(a=(e*l-1)*Math.pow(2,n),s+=d):(a=e*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;t[r+y]=255&a,y+=w,a/=256,n-=8);for(s=s<0;t[r+y]=255&s,y+=w,s/=256,c-=8);t[r+y-w]|=128*S}},At={},zs=Rc,Dr=yw,_c=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;At.Buffer=O,At.SlowBuffer=function(t){return+t!=t&&(t=0),O.alloc(+t)},At.INSPECT_MAX_BYTES=50;At.kMaxLength=2147483647,O.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}(),O.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(O.prototype,"parent",{enumerable:!0,get:function(){if(O.isBuffer(this))return this.buffer}}),Object.defineProperty(O.prototype,"offset",{enumerable:!0,get:function(){if(O.isBuffer(this))return this.byteOffset}}),O.poolSize=8192,O.from=function(t,e,r){return Cc(t,e,r)},Object.setPrototypeOf(O.prototype,Uint8Array.prototype),Object.setPrototypeOf(O,Uint8Array),O.alloc=function(t,e,r){return function(i,n,o){return Bc(i),i<=0?Et(i):n!==void 0?typeof o=="string"?Et(i).fill(n,o):Et(i).fill(n):Et(i)}(t,e,r)},O.allocUnsafe=function(t){return Ks(t)},O.allocUnsafeSlow=function(t){return Ks(t)},O.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==O.prototype},O.compare=function(t,e){if(St(t,Uint8Array)&&(t=O.from(t,t.offset,t.byteLength)),St(e,Uint8Array)&&(e=O.from(e,e.offset,e.byteLength)),!O.isBuffer(t)||!O.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,i=e.length,n=0,o=Math.min(r,i);ne&&(t+=" ... "),""},_c&&(O.prototype[_c]=O.prototype.inspect),O.prototype.compare=function(t,e,r,i,n){if(St(t,Uint8Array)&&(t=O.from(t,t.offset,t.byteLength)),!O.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),n===void 0&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(n>>>=0)-(i>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),l=this.slice(i,n),c=t.slice(e,r),h=0;h>>=0,isFinite(r)?(r>>>=0,i===void 0&&(i="utf8")):(i=r,r=void 0)}var n=this.length-e;if((r===void 0||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return ww(this,t,e,r);case"utf8":case"utf-8":return _w(this,t,e,r);case"ascii":return kc(this,t,e,r);case"latin1":case"binary":return mw(this,t,e,r);case"base64":return vw(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ew(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},O.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};O.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=e===void 0?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||we(t,e,this.length);for(var i=this[t],n=1,o=0;++o>>=0,e>>>=0,r||we(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},O.prototype.readUInt8=function(t,e){return t>>>=0,e||we(t,1,this.length),this[t]},O.prototype.readUInt16LE=function(t,e){return t>>>=0,e||we(t,2,this.length),this[t]|this[t+1]<<8},O.prototype.readUInt16BE=function(t,e){return t>>>=0,e||we(t,2,this.length),this[t]<<8|this[t+1]},O.prototype.readUInt32LE=function(t,e){return t>>>=0,e||we(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},O.prototype.readUInt32BE=function(t,e){return t>>>=0,e||we(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},O.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||we(t,e,this.length);for(var i=this[t],n=1,o=0;++o=(n*=128)&&(i-=Math.pow(2,8*e)),i},O.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||we(t,e,this.length);for(var i=e,n=1,o=this[t+--i];i>0&&(n*=256);)o+=this[t+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*e)),o},O.prototype.readInt8=function(t,e){return t>>>=0,e||we(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},O.prototype.readInt16LE=function(t,e){t>>>=0,e||we(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},O.prototype.readInt16BE=function(t,e){t>>>=0,e||we(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},O.prototype.readInt32LE=function(t,e){return t>>>=0,e||we(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},O.prototype.readInt32BE=function(t,e){return t>>>=0,e||we(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},O.prototype.readFloatLE=function(t,e){return t>>>=0,e||we(t,4,this.length),Dr.read(this,t,!0,23,4)},O.prototype.readFloatBE=function(t,e){return t>>>=0,e||we(t,4,this.length),Dr.read(this,t,!1,23,4)},O.prototype.readDoubleLE=function(t,e){return t>>>=0,e||we(t,8,this.length),Dr.read(this,t,!0,52,8)},O.prototype.readDoubleBE=function(t,e){return t>>>=0,e||we(t,8,this.length),Dr.read(this,t,!1,52,8)},O.prototype.writeUIntLE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||Pe(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,i||Pe(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[e+n]=255&t;--n>=0&&(o*=256);)this[e+n]=t/o&255;return e+r},O.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,1,255,0),this[e]=255&t,e+1},O.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},O.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},O.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},O.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},O.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);Pe(this,t,e,r,n-1,-n)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+r},O.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);Pe(this,t,e,r,n-1,-n)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&a===0&&this[e+o+1]!==0&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},O.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},O.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},O.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},O.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},O.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},O.prototype.writeFloatLE=function(t,e,r){return Sc(this,t,e,!0,r)},O.prototype.writeFloatBE=function(t,e,r){return Sc(this,t,e,!1,r)},O.prototype.writeDoubleLE=function(t,e,r){return Ac(this,t,e,!0,r)},O.prototype.writeDoubleBE=function(t,e,r){return Ac(this,t,e,!1,r)},O.prototype.copy=function(t,e,r,i){if(!O.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||i===0||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,i),e);return n},O.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!O.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){var n=t.charCodeAt(0);(i==="utf8"&&n<128||i==="latin1")&&(t=n)}}else typeof t=="number"?t&=255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length>>=0,r=r===void 0?this.length:r>>>0,t||(t=0),typeof t=="number")for(o=e;o=0?(l>0&&(n.lastNeed=l-1),l):--a=0?(l>0&&(n.lastNeed=l-2),l):--a=0?(l>0&&(l===2?l=0:n.lastNeed=l-3),l):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},pi.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};ur.StringDecoder;ur.StringDecoder});var Lc={};Jt(Lc,{StringDecoder:()=>qw,default:()=>ur});var qw,Uc=_e(()=>{_();v();m();Xs();Xs();qw=ur.StringDecoder});var Zs=M((qT,jc)=>{"use strict";_();v();m();var Nc=Nt(),{PromisePrototypeThen:Dw,SymbolAsyncIterator:qc,SymbolIterator:Dc}=ce(),{Buffer:jw}=(be(),X(me)),{ERR_INVALID_ARG_TYPE:Fw,ERR_STREAM_NULL_VALUES:Ww}=Ae().codes;function $w(t,e,r){let i;if(typeof e=="string"||e instanceof jw)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let n;if(e&&e[qc])n=!0,i=e[qc]();else if(e&&e[Dc])n=!1,i=e[Dc]();else throw new Fw("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...r}),s=!1;o._read=function(){s||(s=!0,l())},o._destroy=function(c,h){Dw(a(c),()=>Nc.nextTick(h,c),d=>Nc.nextTick(h,d||c))};async function a(c){let h=c!=null,d=typeof i.throw=="function";if(h&&d){let{value:g,done:y}=await i.throw(c);if(await g,y)return}if(typeof i.return=="function"){let{value:g}=await i.return();await g}}async function l(){for(;;){try{let{value:c,done:h}=n?await i.next():i.next();if(h)o.push(null);else{let d=c&&typeof c.then=="function"?await c:c;if(d===null)throw s=!1,new Ww;if(o.push(d))continue;s=!1}}catch(c){o.destroy(c)}break}}return o}jc.exports=$w});var gi=M((VT,Zc)=>{_();v();m();var He=Nt(),{ArrayPrototypeIndexOf:Hw,NumberIsInteger:Vw,NumberIsNaN:zw,NumberParseInt:Kw,ObjectDefineProperties:$c,ObjectKeys:Gw,ObjectSetPrototypeOf:Hc,Promise:Qw,SafeSet:Yw,SymbolAsyncIterator:Jw,Symbol:Xw}=ce();Zc.exports=F;F.ReadableState=so;var{EventEmitter:Zw}=(sr(),X(nr)),{Stream:Dt,prependListener:e_}=nn(),{Buffer:eo}=(be(),X(me)),{addAbortSignal:t_}=di(),r_=vt(),H=Je().debuglog("stream",t=>{H=t}),i_=dc(),Fr=ir(),{getHighWaterMark:n_,getDefaultHighWaterMark:s_}=an(),{aggregateTwoErrors:Fc,codes:{ERR_INVALID_ARG_TYPE:o_,ERR_METHOD_NOT_IMPLEMENTED:a_,ERR_OUT_OF_RANGE:l_,ERR_STREAM_PUSH_AFTER_EOF:u_,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:f_}}=Ae(),{validateObject:c_}=hi(),fr=Xw("kPaused"),{StringDecoder:Vc}=(Uc(),X(Lc)),h_=Zs();Hc(F.prototype,Dt.prototype);Hc(F,Dt);var to=()=>{},{errorOrDestroy:jr}=Fr;function so(t,e,r){typeof r!="boolean"&&(r=e instanceof nt()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.readableObjectMode)),this.highWaterMark=t?n_(this,t,"readableHighWaterMark",r):s_(!1),this.buffer=new i_,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[fr]=null,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Vc(t.encoding),this.encoding=t.encoding)}function F(t){if(!(this instanceof F))return new F(t);let e=this instanceof nt();this._readableState=new so(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&t_(t.signal,this)),Dt.call(this,t),Fr.construct(this,()=>{this._readableState.needReadable&&hn(this,this._readableState)})}F.prototype.destroy=Fr.destroy;F.prototype._undestroy=Fr.undestroy;F.prototype._destroy=function(t,e){e(t)};F.prototype[Zw.captureRejectionSymbol]=function(t){this.destroy(t)};F.prototype.push=function(t,e){return zc(this,t,e,!1)};F.prototype.unshift=function(t,e){return zc(this,t,e,!0)};function zc(t,e,r,i){H("readableAddChunk",e);let n=t._readableState,o;if(n.objectMode||(typeof e=="string"?(r=r||n.defaultEncoding,n.encoding!==r&&(i&&n.encoding?e=eo.from(e,r).toString(n.encoding):(e=eo.from(e,r),r=""))):e instanceof eo?r="":Dt._isUint8Array(e)?(e=Dt._uint8ArrayToBuffer(e),r=""):e!=null&&(o=new o_("chunk",["string","Buffer","Uint8Array"],e))),o)jr(t,o);else if(e===null)n.reading=!1,g_(t,n);else if(n.objectMode||e&&e.length>0)if(i)if(n.endEmitted)jr(t,new f_);else{if(n.destroyed||n.errored)return!1;ro(t,n,e,!0)}else if(n.ended)jr(t,new u_);else{if(n.destroyed||n.errored)return!1;n.reading=!1,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?ro(t,n,e,!1):hn(t,n)):ro(t,n,e,!1)}else i||(n.reading=!1,hn(t,n));return!n.ended&&(n.length0?(e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&dn(t)),hn(t,e)}F.prototype.isPaused=function(){let t=this._readableState;return t[fr]===!0||t.flowing===!1};F.prototype.setEncoding=function(t){let e=new Vc(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,i="";for(let n of r)i+=e.write(n);return r.clear(),i!==""&&r.push(i),this._readableState.length=i.length,this};var d_=1073741824;function p_(t){if(t>d_)throw new l_("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Wc(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:zw(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}F.prototype.read=function(t){H("read",t),t===void 0?t=NaN:Vw(t)||(t=Kw(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=p_(t)),t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return H("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?io(this):dn(this),null;if(t=Wc(t,e),t===0&&e.ended)return e.length===0&&io(this),null;let i=e.needReadable;if(H("need readable",i),(e.length===0||e.length-t0?n=Jc(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&io(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function g_(t,e){if(H("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?dn(t):(e.needReadable=!1,e.emittedReadable=!0,Kc(t))}}function dn(t){let e=t._readableState;H("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(H("emitReadable",e.flowing),e.emittedReadable=!0,He.nextTick(Kc,t))}function Kc(t){let e=t._readableState;H("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Qc(t)}function hn(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,He.nextTick(y_,t,e))}function y_(t,e){for(;!e.reading&&!e.ended&&(e.length1&&i.pipes.includes(t)&&(H("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),r.pause()),l||(l=b_(r,t),t.on("drain",l))}r.on("data",g);function g(I){H("ondata");let C=t.write(I);H("dest.write",C),C===!1&&d()}function y(I){if(H("onerror",I),E(),t.removeListener("error",y),t.listenerCount("error")===0){let C=t._writableState||t._readableState;C&&!C.errorEmitted?jr(t,I):t.emit("error",I)}}e_(t,"error",y);function w(){t.removeListener("finish",S),E()}t.once("close",w);function S(){H("onfinish"),t.removeListener("close",w),E()}t.once("finish",S);function E(){H("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?i.flowing&&d():i.flowing||(H("pipe resume"),r.resume()),t};function b_(t,e){return function(){let i=t._readableState;i.awaitDrainWriters===e?(H("pipeOnDrain",1),i.awaitDrainWriters=null):i.multiAwaitDrain&&(H("pipeOnDrain",i.awaitDrainWriters.size),i.awaitDrainWriters.delete(e)),(!i.awaitDrainWriters||i.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}F.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let n=e.pipes;e.pipes=[],this.pause();for(let o=0;o0,i.flowing!==!1&&this.resume()):t==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,H("on readable",i.length,i.reading),i.length?dn(this):i.reading||He.nextTick(w_,this)),r};F.prototype.addListener=F.prototype.on;F.prototype.removeListener=function(t,e){let r=Dt.prototype.removeListener.call(this,t,e);return t==="readable"&&He.nextTick(Gc,this),r};F.prototype.off=F.prototype.removeListener;F.prototype.removeAllListeners=function(t){let e=Dt.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&He.nextTick(Gc,this),e};function Gc(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[fr]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function w_(t){H("readable nexttick read 0"),t.read(0)}F.prototype.resume=function(){let t=this._readableState;return t.flowing||(H("resume"),t.flowing=!t.readableListening,__(this,t)),t[fr]=!1,this};function __(t,e){e.resumeScheduled||(e.resumeScheduled=!0,He.nextTick(m_,t,e))}function m_(t,e){H("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Qc(t),e.flowing&&!e.reading&&t.read(0)}F.prototype.pause=function(){return H("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(H("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[fr]=!0,this};function Qc(t){let e=t._readableState;for(H("flow",e.flowing);e.flowing&&t.read()!==null;);}F.prototype.wrap=function(t){let e=!1;t.on("data",i=>{!this.push(i)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",i=>{jr(this,i)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=Gw(t);for(let i=1;i{n=s?Fc(n,s):null,r(),r=to});try{for(;;){let s=t.destroyed?null:t.read();if(s!==null)yield s;else{if(n)throw n;if(n===null)return;await new Qw(i)}}}catch(s){throw n=Fc(n,s),n}finally{(n||e?.destroyOnReturn!==!1)&&(n===void 0||t._readableState.autoDestroy)?Fr.destroyer(t,null):(t.off("readable",i),o())}}$c(F.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});$c(so.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[fr]!==!1},set(t){this[fr]=!!t}}});F._fromList=Jc;function Jc(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function io(t){let e=t._readableState;H("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,He.nextTick(E_,e,t))}function E_(t,e){if(H("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)He.nextTick(S_,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function S_(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}F.from=function(t,e){return h_(F,t,e)};var no;function Xc(){return no===void 0&&(no={}),no}F.fromWeb=function(t,e){return Xc().newStreamReadableFromReadableStream(t,e)};F.toWeb=function(t,e){return Xc().newReadableStreamFromStreamReadable(t,e)};F.wrap=function(t,e){var r,i;return new F({objectMode:(r=(i=t.readableObjectMode)!==null&&i!==void 0?i:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(n,o){Fr.destroyer(t,n),o(n)}}).wrap(t)}});var ho=M((XT,ch)=>{_();v();m();var cr=Nt(),{ArrayPrototypeSlice:rh,Error:A_,FunctionPrototypeSymbolHasInstance:ih,ObjectDefineProperty:nh,ObjectDefineProperties:I_,ObjectSetPrototypeOf:sh,StringPrototypeToLowerCase:T_,Symbol:R_,SymbolHasInstance:C_}=ce();ch.exports=ie;ie.WritableState=wi;var{EventEmitter:B_}=(sr(),X(nr)),yi=nn().Stream,{Buffer:pn}=(be(),X(me)),bn=ir(),{addAbortSignal:P_}=di(),{getHighWaterMark:k_,getDefaultHighWaterMark:O_}=an(),{ERR_INVALID_ARG_TYPE:x_,ERR_METHOD_NOT_IMPLEMENTED:M_,ERR_MULTIPLE_CALLBACK:oh,ERR_STREAM_CANNOT_PIPE:L_,ERR_STREAM_DESTROYED:bi,ERR_STREAM_ALREADY_FINISHED:U_,ERR_STREAM_NULL_VALUES:N_,ERR_STREAM_WRITE_AFTER_END:q_,ERR_UNKNOWN_ENCODING:ah}=Ae().codes,{errorOrDestroy:Wr}=bn;sh(ie.prototype,yi.prototype);sh(ie,yi);function lo(){}var $r=R_("kOnFinished");function wi(t,e,r){typeof r!="boolean"&&(r=e instanceof nt()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?k_(this,t,"writableHighWaterMark",r):O_(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let i=!!(t&&t.decodeStrings===!1);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=j_.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,yn(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[$r]=[]}function yn(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}wi.prototype.getBuffer=function(){return rh(this.buffered,this.bufferedIndex)};nh(wi.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function ie(t){let e=this instanceof nt();if(!e&&!ih(ie,this))return new ie(t);this._writableState=new wi(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&P_(t.signal,this)),yi.call(this,t),bn.construct(this,()=>{let r=this._writableState;r.writing||fo(this,r),co(this,r)})}nh(ie,C_,{__proto__:null,value:function(t){return ih(this,t)?!0:this!==ie?!1:t&&t._writableState instanceof wi}});ie.prototype.pipe=function(){Wr(this,new L_)};function lh(t,e,r,i){let n=t._writableState;if(typeof r=="function")i=r,r=n.defaultEncoding;else{if(!r)r=n.defaultEncoding;else if(r!=="buffer"&&!pn.isEncoding(r))throw new ah(r);typeof i!="function"&&(i=lo)}if(e===null)throw new N_;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=pn.from(e,r),r="buffer");else if(e instanceof pn)r="buffer";else if(yi._isUint8Array(e))e=yi._uint8ArrayToBuffer(e),r="buffer";else throw new x_("chunk",["string","Buffer","Uint8Array"],e);let o;return n.ending?o=new q_:n.destroyed&&(o=new bi("write")),o?(cr.nextTick(i,o),Wr(t,o,!0),o):(n.pendingcb++,D_(t,n,e,r,i))}ie.prototype.write=function(t,e,r){return lh(this,t,e,r)===!0};ie.prototype.cork=function(){this._writableState.corked++};ie.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||fo(this,t))};ie.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=T_(e)),!pn.isEncoding(e))throw new ah(e);return this._writableState.defaultEncoding=e,this};function D_(t,e,r,i,n){let o=e.objectMode?1:r.length;e.length+=o;let s=e.lengthr.bufferedIndex&&fo(t,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===n?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:n,stream:t,state:r},cr.nextTick(F_,r.afterWriteTickInfo)):uh(t,r,1,n))}function F_({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,uh(t,e,r,i)}function uh(t,e,r,i){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,i();e.destroyed&&uo(e),co(t,e)}function uo(t){if(t.writing)return;for(let n=t.bufferedIndex;n1&&t._writev){e.pendingcb-=o-1;let a=e.allNoop?lo:c=>{for(let h=s;h256?(r.splice(0,s),e.bufferedIndex=0):e.bufferedIndex=s}e.bufferProcessing=!1}ie.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new M_("_write()")};ie.prototype._writev=null;ie.prototype.end=function(t,e,r){let i=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let n;if(t!=null){let o=lh(this,t,e);o instanceof A_&&(n=o)}return i.corked&&(i.corked=1,this.uncork()),n||(!i.errored&&!i.ending?(i.ending=!0,co(this,i,!0),i.ended=!0):i.finished?n=new U_("end"):i.destroyed&&(n=new bi("end"))),typeof r=="function"&&(n||i.finished?cr.nextTick(r,n):i[$r].push(r)),this};function gn(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function W_(t,e){let r=!1;function i(n){if(r){Wr(t,n??oh());return}if(r=!0,e.pendingcb--,n){let o=e[$r].splice(0);for(let s=0;s{gn(n)?ao(i,n):n.pendingcb--},t,e)):gn(e)&&(e.pendingcb++,ao(t,e))))}function ao(t,e){e.pendingcb--,e.finished=!0;let r=e[$r].splice(0);for(let i=0;i{_();v();m();var po=Nt(),V_=(be(),X(me)),{isReadable:z_,isWritable:K_,isIterable:hh,isNodeStream:G_,isReadableNodeStream:dh,isWritableNodeStream:ph,isDuplexNodeStream:Q_}=tt(),gh=vt(),{AbortError:vh,codes:{ERR_INVALID_ARG_TYPE:Y_,ERR_INVALID_RETURN_VALUE:yh}}=Ae(),{destroyer:Hr}=ir(),J_=nt(),X_=gi(),{createDeferredPromise:bh}=Je(),wh=Zs(),_h=globalThis.Blob||V_.Blob,Z_=typeof _h<"u"?function(e){return e instanceof _h}:function(e){return!1},e0=globalThis.AbortController||zi().AbortController,{FunctionPrototypeCall:mh}=ce(),hr=class extends J_{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};Eh.exports=function t(e,r){if(Q_(e))return e;if(dh(e))return wn({readable:e});if(ph(e))return wn({writable:e});if(G_(e))return wn({writable:!1,readable:!1});if(typeof e=="function"){let{value:n,write:o,final:s,destroy:a}=t0(e);if(hh(n))return wh(hr,n,{objectMode:!0,write:o,final:s,destroy:a});let l=n?.then;if(typeof l=="function"){let c,h=mh(l,n,d=>{if(d!=null)throw new yh("nully","body",d)},d=>{Hr(c,d)});return c=new hr({objectMode:!0,readable:!1,write:o,final(d){s(async()=>{try{await h,po.nextTick(d,null)}catch(g){po.nextTick(d,g)}})},destroy:a})}throw new yh("Iterable, AsyncIterable or AsyncFunction",r,n)}if(Z_(e))return t(e.arrayBuffer());if(hh(e))return wh(hr,e,{objectMode:!0,writable:!1});if(typeof e?.writable=="object"||typeof e?.readable=="object"){let n=e!=null&&e.readable?dh(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?ph(e?.writable)?e?.writable:t(e.writable):void 0;return wn({readable:n,writable:o})}let i=e?.then;if(typeof i=="function"){let n;return mh(i,e,o=>{o!=null&&n.push(o),n.push(null)},o=>{Hr(n,o)}),n=new hr({objectMode:!0,writable:!1,read(){}})}throw new Y_(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function t0(t){let{promise:e,resolve:r}=bh(),i=new e0,n=i.signal;return{value:t(async function*(){for(;;){let s=e;e=null;let{chunk:a,done:l,cb:c}=await s;if(po.nextTick(c),l)return;if(n.aborted)throw new vh(void 0,{cause:n.reason});({promise:e,resolve:r}=bh()),yield a}}(),{signal:n}),write(s,a,l){let c=r;r=null,c({chunk:s,done:!1,cb:l})},final(s){let a=r;r=null,a({done:!0,cb:s})},destroy(s,a){i.abort(),a(s)}}}function wn(t){let e=t.readable&&typeof t.readable.read!="function"?X_.wrap(t.readable):t.readable,r=t.writable,i=!!z_(e),n=!!K_(r),o,s,a,l,c;function h(d){let g=l;l=null,g?g(d):d&&c.destroy(d)}return c=new hr({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&(gh(r,d=>{n=!1,d&&Hr(e,d),h(d)}),c._write=function(d,g,y){r.write(d,g)?y():o=y},c._final=function(d){r.end(),s=d},r.on("drain",function(){if(o){let d=o;o=null,d()}}),r.on("finish",function(){if(s){let d=s;s=null,d()}})),i&&(gh(e,d=>{i=!1,d&&Hr(e,d),h(d)}),e.on("readable",function(){if(a){let d=a;a=null,d()}}),e.on("end",function(){c.push(null)}),c._read=function(){for(;;){let d=e.read();if(d===null){a=c._read;return}if(!c.push(d))return}}),c._destroy=function(d,g){!d&&l!==null&&(d=new vh),a=null,o=null,s=null,l===null?g(d):(l=g,Hr(r,d),Hr(e,d))},c}});var nt=M((h2,Th)=>{"use strict";_();v();m();var{ObjectDefineProperties:r0,ObjectGetOwnPropertyDescriptor:It,ObjectKeys:i0,ObjectSetPrototypeOf:Ah}=ce();Th.exports=Ve;var bo=gi(),Ne=ho();Ah(Ve.prototype,bo.prototype);Ah(Ve,bo);{let t=i0(Ne.prototype);for(let e=0;e{"use strict";_();v();m();var{ObjectSetPrototypeOf:Rh,Symbol:n0}=ce();Ch.exports=Tt;var{ERR_METHOD_NOT_IMPLEMENTED:s0}=Ae().codes,_o=nt(),{getHighWaterMark:o0}=an();Rh(Tt.prototype,_o.prototype);Rh(Tt,_o);var _i=n0("kCallback");function Tt(t){if(!(this instanceof Tt))return new Tt(t);let e=t?o0(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),_o.call(this,t),this._readableState.sync=!1,this[_i]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",a0)}function wo(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}function a0(){this._final!==wo&&wo.call(this)}Tt.prototype._final=wo;Tt.prototype._transform=function(t,e,r){throw new s0("_transform()")};Tt.prototype._write=function(t,e,r){let i=this._readableState,n=this._writableState,o=i.length;this._transform(t,e,(s,a)=>{if(s){r(s);return}a!=null&&this.push(a),n.ended||o===i.length||i.length{"use strict";_();v();m();var{ObjectSetPrototypeOf:Bh}=ce();Ph.exports=Vr;var vo=mo();Bh(Vr.prototype,vo.prototype);Bh(Vr,vo);function Vr(t){if(!(this instanceof Vr))return new Vr(t);vo.call(this,t)}Vr.prototype._transform=function(t,e,r){r(null,t)}});var En=M((x2,Lh)=>{_();v();m();var mi=Nt(),{ArrayIsArray:l0,Promise:u0,SymbolAsyncIterator:f0}=ce(),vn=vt(),{once:c0}=Je(),h0=ir(),kh=nt(),{aggregateTwoErrors:d0,codes:{ERR_INVALID_ARG_TYPE:Po,ERR_INVALID_RETURN_VALUE:So,ERR_MISSING_ARGS:p0,ERR_STREAM_DESTROYED:g0,ERR_STREAM_PREMATURE_CLOSE:y0},AbortError:b0}=Ae(),{validateFunction:w0,validateAbortSignal:_0}=hi(),{isIterable:dr,isReadable:Ao,isReadableNodeStream:mn,isNodeStream:Oh,isTransformStream:zr,isWebStream:m0,isReadableStream:Io,isReadableEnded:v0}=tt(),E0=globalThis.AbortController||zi().AbortController,To,Ro;function xh(t,e,r){let i=!1;t.on("close",()=>{i=!0});let n=vn(t,{readable:e,writable:r},o=>{i=!o});return{destroy:o=>{i||(i=!0,h0.destroyer(t,o||new g0("pipe")))},cleanup:n}}function S0(t){return w0(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function Co(t){if(dr(t))return t;if(mn(t))return A0(t);throw new Po("val",["Readable","Iterable","AsyncIterable"],t)}async function*A0(t){Ro||(Ro=gi()),yield*Ro.prototype[f0].call(t)}async function _n(t,e,r,{end:i}){let n,o=null,s=c=>{if(c&&(n=c),o){let h=o;o=null,h()}},a=()=>new u0((c,h)=>{n?h(n):o=()=>{n?h(n):c()}});e.on("drain",s);let l=vn(e,{readable:!1},s);try{e.writableNeedDrain&&await a();for await(let c of t)e.write(c)||await a();i&&e.end(),await a(),r()}catch(c){r(n!==c?d0(n,c):c)}finally{l(),e.off("drain",s)}}async function Bo(t,e,r,{end:i}){zr(e)&&(e=e.writable);let n=e.getWriter();try{for await(let o of t)await n.ready,n.write(o).catch(()=>{});await n.ready,i&&await n.close(),r()}catch(o){try{await n.abort(o),r(o)}catch(s){r(s)}}}function I0(...t){return Mh(t,c0(S0(t)))}function Mh(t,e,r){if(t.length===1&&l0(t[0])&&(t=t[0]),t.length<2)throw new p0("streams");let i=new E0,n=i.signal,o=r?.signal,s=[];_0(o,"options.signal");function a(){y(new b0)}o?.addEventListener("abort",a);let l,c,h=[],d=0;function g(C){y(C,--d===0)}function y(C,R){if(C&&(!l||l.code==="ERR_STREAM_PREMATURE_CLOSE")&&(l=C),!(!l&&!R)){for(;h.length;)h.shift()(l);o?.removeEventListener("abort",a),i.abort(),R&&(l||s.forEach(U=>U()),mi.nextTick(e,l,c))}}let w;for(let C=0;C0,W=U||r?.end!==!1,K=C===t.length-1;if(Oh(R)){let z=function(Q){Q&&Q.name!=="AbortError"&&Q.code!=="ERR_STREAM_PREMATURE_CLOSE"&&g(Q)};var I=z;if(W){let{destroy:Q,cleanup:pe}=xh(R,U,N);h.push(Q),Ao(R)&&K&&s.push(pe)}R.on("error",z),Ao(R)&&K&&s.push(()=>{R.removeListener("error",z)})}if(C===0)if(typeof R=="function"){if(w=R({signal:n}),!dr(w))throw new So("Iterable, AsyncIterable or Stream","source",w)}else dr(R)||mn(R)||zr(R)?w=R:w=kh.from(R);else if(typeof R=="function"){if(zr(w)){var S;w=Co((S=w)===null||S===void 0?void 0:S.readable)}else w=Co(w);if(w=R(w,{signal:n}),U){if(!dr(w,!0))throw new So("AsyncIterable",`transform[${C-1}]`,w)}else{var E;To||(To=Eo());let z=new To({objectMode:!0}),Q=(E=w)===null||E===void 0?void 0:E.then;if(typeof Q=="function")d++,Q.call(w,ge=>{c=ge,ge!=null&&z.write(ge),W&&z.end(),mi.nextTick(g)},ge=>{z.destroy(ge),mi.nextTick(g,ge)});else if(dr(w,!0))d++,_n(w,z,g,{end:W});else if(Io(w)||zr(w)){let ge=w.readable||w;d++,_n(ge,z,g,{end:W})}else throw new So("AsyncIterable or Promise","destination",w);w=z;let{destroy:pe,cleanup:Yt}=xh(w,!1,!0);h.push(pe),K&&s.push(Yt)}}else if(Oh(R)){if(mn(w)){d+=2;let z=T0(w,R,g,{end:W});Ao(R)&&K&&s.push(z)}else if(zr(w)||Io(w)){let z=w.readable||w;d++,_n(z,R,g,{end:W})}else if(dr(w))d++,_n(w,R,g,{end:W});else throw new Po("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=R}else if(m0(R)){if(mn(w))d++,Bo(Co(w),R,g,{end:W});else if(Io(w)||dr(w))d++,Bo(w,R,g,{end:W});else if(zr(w))d++,Bo(w.readable,R,g,{end:W});else throw new Po("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=R}else w=kh.from(R)}return(n!=null&&n.aborted||o!=null&&o.aborted)&&mi.nextTick(a),w}function T0(t,e,r,{end:i}){let n=!1;if(e.on("close",()=>{n||r(new y0)}),t.pipe(e,{end:!1}),i){let s=function(){n=!0,e.end()};var o=s;v0(t)?mi.nextTick(s):t.once("end",s)}else r();return vn(t,{readable:!0,writable:!1},s=>{let a=t._readableState;s&&s.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted?t.once("end",r).once("error",r):r(s)}),vn(e,{readable:!1,writable:!0},r)}Lh.exports={pipelineImpl:Mh,pipeline:I0}});var Oo=M((j2,Fh)=>{"use strict";_();v();m();var{pipeline:R0}=En(),Sn=nt(),{destroyer:C0}=ir(),{isNodeStream:An,isReadable:Uh,isWritable:Nh,isWebStream:ko,isTransformStream:pr,isWritableStream:qh,isReadableStream:Dh}=tt(),{AbortError:B0,codes:{ERR_INVALID_ARG_VALUE:jh,ERR_MISSING_ARGS:P0}}=Ae(),k0=vt();Fh.exports=function(...e){if(e.length===0)throw new P0("streams");if(e.length===1)return Sn.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=Sn.from(e[0])),typeof e[e.length-1]=="function"){let y=e.length-1;e[y]=Sn.from(e[y])}for(let y=0;y0&&!(Nh(e[y])||qh(e[y])||pr(e[y])))throw new jh(`streams[${y}]`,r[y],"must be writable")}let i,n,o,s,a;function l(y){let w=s;s=null,w?w(y):y?a.destroy(y):!g&&!d&&a.destroy()}let c=e[0],h=R0(e,l),d=!!(Nh(c)||qh(c)||pr(c)),g=!!(Uh(h)||Dh(h)||pr(h));if(a=new Sn({writableObjectMode:!!(c!=null&&c.writableObjectMode),readableObjectMode:!!(h!=null&&h.writableObjectMode),writable:d,readable:g}),d){if(An(c))a._write=function(w,S,E){c.write(w,S)?E():i=E},a._final=function(w){c.end(),n=w},c.on("drain",function(){if(i){let w=i;i=null,w()}});else if(ko(c)){let S=(pr(c)?c.writable:c).getWriter();a._write=async function(E,I,C){try{await S.ready,S.write(E).catch(()=>{}),C()}catch(R){C(R)}},a._final=async function(E){try{await S.ready,S.close().catch(()=>{}),n=E}catch(I){E(I)}}}let y=pr(h)?h.readable:h;k0(y,()=>{if(n){let w=n;n=null,w()}})}if(g){if(An(h))h.on("readable",function(){if(o){let y=o;o=null,y()}}),h.on("end",function(){a.push(null)}),a._read=function(){for(;;){let y=h.read();if(y===null){o=a._read;return}if(!a.push(y))return}};else if(ko(h)){let w=(pr(h)?h.readable:h).getReader();a._read=async function(){for(;;)try{let{value:S,done:E}=await w.read();if(!a.push(S))return;if(E){a.push(null);return}}catch{return}}}}return a._destroy=function(y,w){!y&&s!==null&&(y=new B0),o=null,i=null,n=null,s===null?w(y):(s=w,An(h)&&C0(h,y))},a}});var Qh=M((K2,Lo)=>{"use strict";_();v();m();var Vh=globalThis.AbortController||zi().AbortController,{codes:{ERR_INVALID_ARG_VALUE:O0,ERR_INVALID_ARG_TYPE:vi,ERR_MISSING_ARGS:x0,ERR_OUT_OF_RANGE:M0},AbortError:st}=Ae(),{validateAbortSignal:gr,validateInteger:L0,validateObject:yr}=hi(),U0=ce().Symbol("kWeak"),{finished:N0}=vt(),q0=Oo(),{addAbortSignalNoValidate:D0}=di(),{isWritable:j0,isNodeStream:F0}=tt(),{ArrayPrototypePush:W0,MathFloor:$0,Number:H0,NumberIsNaN:V0,Promise:Wh,PromiseReject:$h,PromisePrototypeThen:z0,Symbol:zh}=ce(),In=zh("kEmpty"),Hh=zh("kEof");function K0(t,e){if(e!=null&&yr(e,"options"),e?.signal!=null&&gr(e.signal,"options.signal"),F0(t)&&!j0(t))throw new O0("stream",t,"must be writable");let r=q0(this,t);return e!=null&&e.signal&&D0(e.signal,r),r}function Tn(t,e){if(typeof t!="function")throw new vi("fn",["Function","AsyncFunction"],t);e!=null&&yr(e,"options"),e?.signal!=null&&gr(e.signal,"options.signal");let r=1;return e?.concurrency!=null&&(r=$0(e.concurrency)),L0(r,"concurrency",1),async function*(){var n,o;let s=new Vh,a=this,l=[],c=s.signal,h={signal:c},d=()=>s.abort();e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted&&d(),e==null||(o=e.signal)===null||o===void 0||o.addEventListener("abort",d);let g,y,w=!1;function S(){w=!0}async function E(){try{for await(let R of a){var I;if(w)return;if(c.aborted)throw new st;try{R=t(R,h)}catch(U){R=$h(U)}R!==In&&(typeof((I=R)===null||I===void 0?void 0:I.catch)=="function"&&R.catch(S),l.push(R),g&&(g(),g=null),!w&&l.length&&l.length>=r&&await new Wh(U=>{y=U}))}l.push(Hh)}catch(R){let U=$h(R);z0(U,void 0,S),l.push(U)}finally{var C;w=!0,g&&(g(),g=null),e==null||(C=e.signal)===null||C===void 0||C.removeEventListener("abort",d)}}E();try{for(;;){for(;l.length>0;){let I=await l[0];if(I===Hh)return;if(c.aborted)throw new st;I!==In&&(yield I),l.shift(),y&&(y(),y=null)}await new Wh(I=>{g=I})}}finally{s.abort(),w=!0,y&&(y(),y=null)}}.call(this)}function G0(t=void 0){return t!=null&&yr(t,"options"),t?.signal!=null&&gr(t.signal,"options.signal"),async function*(){let r=0;for await(let n of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new st({cause:t.signal.reason});yield[r++,n]}}.call(this)}async function Kh(t,e=void 0){for await(let r of Mo.call(this,t,e))return!0;return!1}async function Q0(t,e=void 0){if(typeof t!="function")throw new vi("fn",["Function","AsyncFunction"],t);return!await Kh.call(this,async(...r)=>!await t(...r),e)}async function Y0(t,e){for await(let r of Mo.call(this,t,e))return r}async function J0(t,e){if(typeof t!="function")throw new vi("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n),In}for await(let i of Tn.call(this,r,e));}function Mo(t,e){if(typeof t!="function")throw new vi("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n)?i:In}return Tn.call(this,r,e)}var xo=class extends x0{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function X0(t,e,r){var i;if(typeof t!="function")throw new vi("reducer",["Function","AsyncFunction"],t);r!=null&&yr(r,"options"),r?.signal!=null&&gr(r.signal,"options.signal");let n=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){let c=new st(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await N0(this.destroy(c)),c}let o=new Vh,s=o.signal;if(r!=null&&r.signal){let c={once:!0,[U0]:this};r.signal.addEventListener("abort",()=>o.abort(),c)}let a=!1;try{for await(let c of this){var l;if(a=!0,r!=null&&(l=r.signal)!==null&&l!==void 0&&l.aborted)throw new st;n?e=await t(e,c,{signal:s}):(e=c,n=!0)}if(!a&&!n)throw new xo}finally{o.abort()}return e}async function Z0(t){t!=null&&yr(t,"options"),t?.signal!=null&&gr(t.signal,"options.signal");let e=[];for await(let i of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new st(void 0,{cause:t.signal.reason});W0(e,i)}return e}function em(t,e){let r=Tn.call(this,t,e);return async function*(){for await(let n of r)yield*n}.call(this)}function Gh(t){if(t=H0(t),V0(t))return 0;if(t<0)throw new M0("number",">= 0",t);return t}function tm(t,e=void 0){return e!=null&&yr(e,"options"),e?.signal!=null&&gr(e.signal,"options.signal"),t=Gh(t),async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new st;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new st;t--<=0&&(yield o)}}.call(this)}function rm(t,e=void 0){return e!=null&&yr(e,"options"),e?.signal!=null&&gr(e.signal,"options.signal"),t=Gh(t),async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new st;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new st;if(t-- >0)yield o;else return}}.call(this)}Lo.exports.streamReturningOperators={asIndexedPairs:G0,drop:tm,filter:Mo,flatMap:em,map:Tn,take:rm,compose:K0};Lo.exports.promiseReturningOperators={every:Q0,forEach:J0,reduce:X0,toArray:Z0,some:Kh,find:Y0}});var Uo=M((eR,Yh)=>{"use strict";_();v();m();var{ArrayPrototypePop:im,Promise:nm}=ce(),{isIterable:sm,isNodeStream:om,isWebStream:am}=tt(),{pipelineImpl:lm}=En(),{finished:um}=vt();No();function fm(...t){return new nm((e,r)=>{let i,n,o=t[t.length-1];if(o&&typeof o=="object"&&!om(o)&&!sm(o)&&!am(o)){let s=im(t);i=s.signal,n=s.end}lm(t,(s,a)=>{s?r(s):e(a)},{signal:i,end:n})})}Yh.exports={finished:um,pipeline:fm}});var No=M((aR,sd)=>{_();v();m();var{Buffer:cm}=(be(),X(me)),{ObjectDefineProperty:Rt,ObjectKeys:Zh,ReflectApply:ed}=ce(),{promisify:{custom:td}}=Je(),{streamReturningOperators:Jh,promiseReturningOperators:Xh}=Qh(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:rd}}=Ae(),hm=Oo(),{pipeline:id}=En(),{destroyer:dm}=ir(),nd=vt(),qo=Uo(),Do=tt(),le=sd.exports=nn().Stream;le.isDisturbed=Do.isDisturbed;le.isErrored=Do.isErrored;le.isReadable=Do.isReadable;le.Readable=gi();for(let t of Zh(Jh)){let r=function(...i){if(new.target)throw rd();return le.Readable.from(ed(e,this,i))};jo=r;let e=Jh[t];Rt(r,"name",{__proto__:null,value:e.name}),Rt(r,"length",{__proto__:null,value:e.length}),Rt(le.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var jo;for(let t of Zh(Xh)){let r=function(...n){if(new.target)throw rd();return ed(e,this,n)};jo=r;let e=Xh[t];Rt(r,"name",{__proto__:null,value:e.name}),Rt(r,"length",{__proto__:null,value:e.length}),Rt(le.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var jo;le.Writable=ho();le.Duplex=nt();le.Transform=mo();le.PassThrough=Eo();le.pipeline=id;var{addAbortSignal:pm}=di();le.addAbortSignal=pm;le.finished=nd;le.destroy=dm;le.compose=hm;Rt(le,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return qo}});Rt(id,td,{__proto__:null,enumerable:!0,get(){return qo.pipeline}});Rt(nd,td,{__proto__:null,enumerable:!0,get(){return qo.finished}});le.Stream=le;le._isUint8Array=function(e){return e instanceof Uint8Array};le._uint8ArrayToBuffer=function(e){return cm.from(e.buffer,e.byteOffset,e.byteLength)}});var jt=M((pR,ue)=>{"use strict";_();v();m();var he=No(),gm=Uo(),ym=he.Readable.destroy;ue.exports=he.Readable;ue.exports._uint8ArrayToBuffer=he._uint8ArrayToBuffer;ue.exports._isUint8Array=he._isUint8Array;ue.exports.isDisturbed=he.isDisturbed;ue.exports.isErrored=he.isErrored;ue.exports.isReadable=he.isReadable;ue.exports.Readable=he.Readable;ue.exports.Writable=he.Writable;ue.exports.Duplex=he.Duplex;ue.exports.Transform=he.Transform;ue.exports.PassThrough=he.PassThrough;ue.exports.addAbortSignal=he.addAbortSignal;ue.exports.finished=he.finished;ue.exports.destroy=he.destroy;ue.exports.destroy=ym;ue.exports.pipeline=he.pipeline;ue.exports.compose=he.compose;Object.defineProperty(he,"promises",{configurable:!0,enumerable:!0,get(){return gm}});ue.exports.Stream=he.Stream;ue.exports.default=ue.exports});var od=M((vR,Fo)=>{_();v();m();typeof Object.create=="function"?Fo.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Fo.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}});var ud=M((CR,ld)=>{"use strict";_();v();m();var{Buffer:ze}=(be(),X(me)),ad=Symbol.for("BufferList");function ee(t){if(!(this instanceof ee))return new ee(t);ee._init.call(this,t)}ee._init=function(e){Object.defineProperty(this,ad,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)};ee.prototype._new=function(e){return new ee(e)};ee.prototype._offset=function(e){if(e===0)return[0,0];let r=0;for(let i=0;ithis.length||e<0)return;let r=this._offset(e);return this._bufs[r[0]][r[1]]};ee.prototype.slice=function(e,r){return typeof e=="number"&&e<0&&(e+=this.length),typeof r=="number"&&r<0&&(r+=this.length),this.copy(null,0,e,r)};ee.prototype.copy=function(e,r,i,n){if((typeof i!="number"||i<0)&&(i=0),(typeof n!="number"||n>this.length)&&(n=this.length),i>=this.length||n<=0)return e||ze.alloc(0);let o=!!e,s=this._offset(i),a=n-i,l=a,c=o&&r||0,h=s[1];if(i===0&&n===this.length){if(!o)return this._bufs.length===1?this._bufs[0]:ze.concat(this._bufs,this.length);for(let d=0;dg)this._bufs[d].copy(e,c,h),c+=g;else{this._bufs[d].copy(e,c,h,h+l),c+=g;break}l-=g,h&&(h=0)}return e.length>c?e.slice(0,c):e};ee.prototype.shallowSlice=function(e,r){if(e=e||0,r=typeof r!="number"?this.length:r,e<0&&(e+=this.length),r<0&&(r+=this.length),e===r)return this._new();let i=this._offset(e),n=this._offset(r),o=this._bufs.slice(i[0],n[0]+1);return n[1]===0?o.pop():o[o.length-1]=o[o.length-1].slice(0,n[1]),i[1]!==0&&(o[0]=o[0].slice(i[1])),this._new(o)};ee.prototype.toString=function(e,r,i){return this.slice(r,i).toString(e)};ee.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;)if(e>=this._bufs[0].length)e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}return this};ee.prototype.duplicate=function(){let e=this._new();for(let r=0;rthis.length?this.length:e;let i=this._offset(e),n=i[0],o=i[1];for(;n=t.length){let l=s.indexOf(t,o);if(l!==-1)return this._reverseOffset([n,l]);o=s.length-t.length+1}else{let l=this._reverseOffset([n,o]);if(this._match(l,t))return l;o++}o=0}return-1};ee.prototype._match=function(t,e){if(this.length-t{"use strict";_();v();m();var Wo=jt().Duplex,bm=od(),Ei=ud();function Se(t){if(!(this instanceof Se))return new Se(t);if(typeof t=="function"){this._callback=t;let e=function(i){this._callback&&(this._callback(i),this._callback=null)}.bind(this);this.on("pipe",function(i){i.on("error",e)}),this.on("unpipe",function(i){i.removeListener("error",e)}),t=null}Ei._init.call(this,t),Wo.call(this)}bm(Se,Wo);Object.assign(Se.prototype,Ei.prototype);Se.prototype._new=function(e){return new Se(e)};Se.prototype._write=function(e,r,i){this._appendBuffer(e),typeof i=="function"&&i()};Se.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)};Se.prototype.end=function(e){Wo.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)};Se.prototype._destroy=function(e,r){this._bufs.length=0,this.length=0,r(e)};Se.prototype._isBufferList=function(e){return e instanceof Se||e instanceof Ei||Se.isBufferList(e)};Se.isBufferList=Ei.isBufferList;Rn.exports=Se;Rn.exports.BufferListStream=Se;Rn.exports.BufferList=Ei});var hd=M((WR,cd)=>{_();v();m();var $o=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}};cd.exports=$o});var Ho=M((QR,dd)=>{_();v();m();var L=dd.exports,{Buffer:ke}=(be(),X(me));L.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"};L.requiredHeaderFlags={1:0,2:0,4:0,5:0,6:2,7:0,8:2,9:0,10:2,11:0,12:0,13:0,14:0,15:0};L.requiredHeaderFlagsErrors={};for(let t in L.requiredHeaderFlags){let e=L.requiredHeaderFlags[t];L.requiredHeaderFlagsErrors[t]="Invalid header flag bits, must be 0x"+e.toString(16)+" for "+L.types[t]+" packet"}L.codes={};for(let t in L.types){let e=L.types[t];L.codes[e]=t}L.CMD_SHIFT=4;L.CMD_MASK=240;L.DUP_MASK=8;L.QOS_MASK=3;L.QOS_SHIFT=1;L.RETAIN_MASK=1;L.VARBYTEINT_MASK=127;L.VARBYTEINT_FIN_MASK=128;L.VARBYTEINT_MAX=268435455;L.SESSIONPRESENT_MASK=1;L.SESSIONPRESENT_HEADER=ke.from([L.SESSIONPRESENT_MASK]);L.CONNACK_HEADER=ke.from([L.codes.connack<[0,1].map(r=>[0,1].map(i=>{let n=ke.alloc(1);return n.writeUInt8(L.codes[t]<ke.from([t]));L.EMPTY={pingreq:ke.from([L.codes.pingreq<<4,0]),pingresp:ke.from([L.codes.pingresp<<4,0]),disconnect:ke.from([L.codes.disconnect<<4,0])};L.MQTT5_PUBACK_PUBREC_CODES={0:"Success",16:"No matching subscribers",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",144:"Topic Name invalid",145:"Packet identifier in use",151:"Quota exceeded",153:"Payload format invalid"};L.MQTT5_PUBREL_PUBCOMP_CODES={0:"Success",146:"Packet Identifier not found"};L.MQTT5_SUBACK_CODES={0:"Granted QoS 0",1:"Granted QoS 1",2:"Granted QoS 2",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",143:"Topic Filter invalid",145:"Packet Identifier in use",151:"Quota exceeded",158:"Shared Subscriptions not supported",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};L.MQTT5_UNSUBACK_CODES={0:"Success",17:"No subscription existed",128:"Unspecified error",131:"Implementation specific error",135:"Not authorized",143:"Topic Filter invalid",145:"Packet Identifier in use"};L.MQTT5_DISCONNECT_CODES={0:"Normal disconnection",4:"Disconnect with Will Message",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",135:"Not authorized",137:"Server busy",139:"Server shutting down",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};L.MQTT5_AUTH_CODES={0:"Success",24:"Continue authentication",25:"Re-authenticate"}});var gd=M((rC,pd)=>{_();v();m();var Kr=1e3,Gr=Kr*60,Qr=Gr*60,br=Qr*24,wm=br*7,_m=br*365.25;pd.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return mm(t);if(r==="number"&&isFinite(t))return e.long?Em(t):vm(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function mm(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),i=(e[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return r*_m;case"weeks":case"week":case"w":return r*wm;case"days":case"day":case"d":return r*br;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Qr;case"minutes":case"minute":case"mins":case"min":case"m":return r*Gr;case"seconds":case"second":case"secs":case"sec":case"s":return r*Kr;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function vm(t){var e=Math.abs(t);return e>=br?Math.round(t/br)+"d":e>=Qr?Math.round(t/Qr)+"h":e>=Gr?Math.round(t/Gr)+"m":e>=Kr?Math.round(t/Kr)+"s":t+"ms"}function Em(t){var e=Math.abs(t);return e>=br?Cn(t,e,br,"day"):e>=Qr?Cn(t,e,Qr,"hour"):e>=Gr?Cn(t,e,Gr,"minute"):e>=Kr?Cn(t,e,Kr,"second"):t+" ms"}function Cn(t,e,r,i){var n=e>=r*1.5;return Math.round(t/r)+" "+i+(n?"s":"")}});var bd=M((uC,yd)=>{_();v();m();function Sm(t){r.debug=r,r.default=r,r.coerce=l,r.disable=o,r.enable=n,r.enabled=s,r.humanize=gd(),r.destroy=c,Object.keys(t).forEach(h=>{r[h]=t[h]}),r.names=[],r.skips=[],r.formatters={};function e(h){let d=0;for(let g=0;g{if(W==="%%")return"%";U++;let z=r.formatters[K];if(typeof z=="function"){let Q=E[U];W=z.call(I,Q),E.splice(U,1),U--}return W}),r.formatArgs.call(I,E),(I.log||r.log).apply(I,E)}return S.namespace=h,S.useColors=r.useColors(),S.color=r.selectColor(h),S.extend=i,S.destroy=r.destroy,Object.defineProperty(S,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(y!==r.namespaces&&(y=r.namespaces,w=r.enabled(h)),w),set:E=>{g=E}}),typeof r.init=="function"&&r.init(S),S}function i(h,d){let g=r(this.namespace+(typeof d>"u"?":":d)+h);return g.log=this.log,g}function n(h){r.save(h),r.namespaces=h,r.names=[],r.skips=[];let d,g=(typeof h=="string"?h:"").split(/[\s,]+/),y=g.length;for(d=0;d"-"+d)].join(",");return r.enable(""),h}function s(h){if(h[h.length-1]==="*")return!0;let d,g;for(d=0,g=r.skips.length;d{_();v();m();xe.formatArgs=Im;xe.save=Tm;xe.load=Rm;xe.useColors=Am;xe.storage=Cm();xe.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();xe.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Am(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Im(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Bn.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(r++,n==="%c"&&(i=r))}),t.splice(i,0,e)}xe.log=console.debug||console.log||(()=>{});function Tm(t){try{t?xe.storage.setItem("debug",t):xe.storage.removeItem("debug")}catch{}}function Rm(){let t;try{t=xe.storage.getItem("debug")}catch{}return!t&&typeof B<"u"&&"env"in B&&(t=B.env.DEBUG),t}function Cm(){try{return localStorage}catch{}}Bn.exports=bd()(xe);var{formatters:Bm}=Bn.exports;Bm.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var md=M((EC,_d)=>{_();v();m();var Pm=fd(),{EventEmitter:km}=(sr(),X(nr)),wd=hd(),V=Ho(),D=ot()("mqtt-packet:parser"),Vo=class t extends km{constructor(){super(),this.parser=this.constructor.parser}static parser(e){return this instanceof t?(this.settings=e||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new t().parser(e)}_resetState(){D("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new wd,this.error=null,this._list=Pm(),this._stateCounter=0}parse(e){for(this.error&&this._resetState(),this._list.append(e),D("parse: current state: %s",this._states[this._stateCounter]);(this.packet.length!==-1||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,D("parse: state complete. _stateCounter is now: %d",this._stateCounter),D("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return D("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){let e=this._list.readUInt8(0),r=e>>V.CMD_SHIFT;this.packet.cmd=V.types[r];let i=e&15,n=V.requiredHeaderFlags[r];return n!=null&&i!==n?this._emitError(new Error(V.requiredHeaderFlagsErrors[r])):(this.packet.retain=(e&V.RETAIN_MASK)!==0,this.packet.qos=e>>V.QOS_SHIFT&V.QOS_MASK,this.packet.qos>2?this._emitError(new Error("Packet must not have both QoS bits set to 1")):(this.packet.dup=(e&V.DUP_MASK)!==0,D("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0))}_parseLength(){let e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),D("_parseLength %d",e.value),!!e}_parsePayload(){D("_parsePayload: payload %O",this._list);let e=!1;if(this.packet.length===0||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}e=!0}return D("_parsePayload complete result: %s",e),e}_parseConnect(){D("_parseConnect");let e,r,i,n,o={},s=this.packet,a=this._parseString();if(a===null)return this._emitError(new Error("Cannot parse protocolId"));if(a!=="MQTT"&&a!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(s.protocolId=a,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(s.protocolVersion=this._list.readUInt8(this._pos),s.protocolVersion>=128&&(s.bridgeMode=!0,s.protocolVersion=s.protocolVersion-128),s.protocolVersion!==3&&s.protocolVersion!==4&&s.protocolVersion!==5)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(this._list.readUInt8(this._pos)&1)return this._emitError(new Error("Connect flag bit 0 must be 0, but got 1"));o.username=this._list.readUInt8(this._pos)&V.USERNAME_MASK,o.password=this._list.readUInt8(this._pos)&V.PASSWORD_MASK,o.will=this._list.readUInt8(this._pos)&V.WILL_FLAG_MASK;let l=!!(this._list.readUInt8(this._pos)&V.WILL_RETAIN_MASK),c=(this._list.readUInt8(this._pos)&V.WILL_QOS_MASK)>>V.WILL_QOS_SHIFT;if(o.will)s.will={},s.will.retain=l,s.will.qos=c;else{if(l)return this._emitError(new Error("Will Retain Flag must be set to zero when Will Flag is set to 0"));if(c)return this._emitError(new Error("Will QoS must be set to zero when Will Flag is set to 0"))}if(s.clean=(this._list.readUInt8(this._pos)&V.CLEAN_SESSION_MASK)!==0,this._pos++,s.keepalive=this._parseNum(),s.keepalive===-1)return this._emitError(new Error("Packet too short"));if(s.protocolVersion===5){let d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(s.properties=d)}let h=this._parseString();if(h===null)return this._emitError(new Error("Packet too short"));if(s.clientId=h,D("_parseConnect: packet.clientId: %s",s.clientId),o.will){if(s.protocolVersion===5){let d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(s.will.properties=d)}if(e=this._parseString(),e===null)return this._emitError(new Error("Cannot parse will topic"));if(s.will.topic=e,D("_parseConnect: packet.will.topic: %s",s.will.topic),r=this._parseBuffer(),r===null)return this._emitError(new Error("Cannot parse will payload"));s.will.payload=r,D("_parseConnect: packet.will.paylaod: %s",s.will.payload)}if(o.username){if(n=this._parseString(),n===null)return this._emitError(new Error("Cannot parse username"));s.username=n,D("_parseConnect: packet.username: %s",s.username)}if(o.password){if(i=this._parseBuffer(),i===null)return this._emitError(new Error("Cannot parse password"));s.password=i}return this.settings=s,D("_parseConnect: complete"),s}_parseConnack(){D("_parseConnack");let e=this.packet;if(this._list.length<1)return null;let r=this._list.readUInt8(this._pos++);if(r>1)return this._emitError(new Error("Invalid connack flags, bits 7-1 must be set to 0"));if(e.sessionPresent=!!(r&V.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?e.reasonCode=this._list.readUInt8(this._pos++):e.reasonCode=0;else{if(this._list.length<2)return null;e.returnCode=this._list.readUInt8(this._pos++)}if(e.returnCode===-1||e.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){let i=this._parseProperties();Object.getOwnPropertyNames(i).length&&(e.properties=i)}D("_parseConnack: complete")}_parsePublish(){D("_parsePublish");let e=this.packet;if(e.topic=this._parseString(),e.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(e.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}e.payload=this._list.slice(this._pos,e.length),D("_parsePublish: payload from buffer list: %o",e.payload)}}_parseSubscribe(){D("_parseSubscribe");let e=this.packet,r,i,n,o,s,a,l;if(e.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(e.properties=c)}if(e.length<=0)return this._emitError(new Error("Malformed subscribe, no payload specified"));for(;this._pos=e.length)return this._emitError(new Error("Malformed Subscribe Payload"));if(i=this._parseByte(),this.settings.protocolVersion===5){if(i&192)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-6 must be 0"))}else if(i&252)return this._emitError(new Error("Invalid subscribe topic flag bits, bits 7-2 must be 0"));if(n=i&V.SUBSCRIBE_OPTIONS_QOS_MASK,n>2)return this._emitError(new Error("Invalid subscribe QoS, must be <= 2"));if(a=(i>>V.SUBSCRIBE_OPTIONS_NL_SHIFT&V.SUBSCRIBE_OPTIONS_NL_MASK)!==0,s=(i>>V.SUBSCRIBE_OPTIONS_RAP_SHIFT&V.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,o=i>>V.SUBSCRIBE_OPTIONS_RH_SHIFT&V.SUBSCRIBE_OPTIONS_RH_MASK,o>2)return this._emitError(new Error("Invalid retain handling, must be <= 2"));l={topic:r,qos:n},this.settings.protocolVersion===5?(l.nl=a,l.rap=s,l.rh=o):this.settings.bridgeMode&&(l.rh=0,l.rap=!0,l.nl=!0),D("_parseSubscribe: push subscription `%s` to subscription",l),e.subscriptions.push(l)}}}_parseSuback(){D("_parseSuback");let e=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}if(e.length<=0)return this._emitError(new Error("Malformed suback, no payload specified"));for(;this._pos2&&r!==128)return this._emitError(new Error("Invalid suback QoS, must be 0, 1, 2 or 128"));this.packet.granted.push(r)}}}_parseUnsubscribe(){D("_parseUnsubscribe");let e=this.packet;if(e.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}if(e.length<=0)return this._emitError(new Error("Malformed unsubscribe, no payload specified"));for(;this._pos2){switch(e.reasonCode=this._parseByte(),this.packet.cmd){case"puback":case"pubrec":if(!V.MQTT5_PUBACK_PUBREC_CODES[e.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break;case"pubrel":case"pubcomp":if(!V.MQTT5_PUBREL_PUBCOMP_CODES[e.reasonCode])return this._emitError(new Error("Invalid "+this.packet.cmd+" reason code"));break}D("_parseConfirmation: packet.reasonCode `%d`",e.reasonCode)}else e.reasonCode=0;if(e.length>3){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}}return!0}_parseDisconnect(){let e=this.packet;if(D("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?(e.reasonCode=this._parseByte(),V.MQTT5_DISCONNECT_CODES[e.reasonCode]||this._emitError(new Error("Invalid disconnect reason code"))):e.reasonCode=0;let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}return D("_parseDisconnect result: true"),!0}_parseAuth(){D("_parseAuth");let e=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));if(e.reasonCode=this._parseByte(),!V.MQTT5_AUTH_CODES[e.reasonCode])return this._emitError(new Error("Invalid auth reason code"));let r=this._parseProperties();return Object.getOwnPropertyNames(r).length&&(e.properties=r),D("_parseAuth: result: true"),!0}_parseMessageId(){let e=this.packet;return e.messageId=this._parseNum(),e.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(D("_parseMessageId: packet.messageId %d",e.messageId),!0)}_parseString(e){let r=this._parseNum(),i=r+this._pos;if(r===-1||i>this._list.length||i>this.packet.length)return null;let n=this._list.toString("utf8",this._pos,i);return this._pos+=r,D("_parseString: result: %s",n),n}_parseStringPair(){return D("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){let e=this._parseNum(),r=e+this._pos;if(e===-1||r>this._list.length||r>this.packet.length)return null;let i=this._list.slice(this._pos,r);return this._pos+=e,D("_parseBuffer: result: %o",i),i}_parseNum(){if(this._list.length-this._pos<2)return-1;let e=this._list.readUInt16BE(this._pos);return this._pos+=2,D("_parseNum: result: %s",e),e}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;let e=this._list.readUInt32BE(this._pos);return this._pos+=4,D("_parse4ByteNum: result: %s",e),e}_parseVarByteNum(e){D("_parseVarByteNum");let r=4,i=0,n=1,o=0,s=!1,a,l=this._pos?this._pos:0;for(;i=i&&this._emitError(new Error("Invalid variable byte integer")),l&&(this._pos+=i),s?e?s={bytes:i,value:o}:s=o:s=!1,D("_parseVarByteNum: result: %o",s),s}_parseByte(){let e;return this._pos{_();v();m();var{Buffer:Si}=(be(),X(me)),Om=65536,vd={},xm=Si.isBuffer(Si.from([1,2]).subarray(0,1));function Ed(t){let e=Si.allocUnsafe(2);return e.writeUInt8(t>>8,0),e.writeUInt8(t&255,0+1),e}function Mm(){for(let t=0;t0&&(r=r|128),n.writeUInt8(r,i++);while(t>0&&i<4);return t>0&&(i=0),xm?n.subarray(0,i):n.slice(0,i)}function Um(t){let e=Si.allocUnsafe(4);return e.writeUInt32BE(t,0),e}Sd.exports={cache:vd,generateCache:Mm,generateNumber:Ed,genBufVariableByteInt:Lm,generate4ByteBuffer:Um}});var Id=M((UC,zo)=>{"use strict";_();v();m();typeof B>"u"||!B.version||B.version.indexOf("v0.")===0||B.version.indexOf("v1.")===0&&B.version.indexOf("v1.8.")!==0?zo.exports={nextTick:Nm}:zo.exports=B;function Nm(t,e,r,i){if(typeof t!="function")throw new TypeError('"callback" argument must be a function');var n=arguments.length,o,s;switch(n){case 0:case 1:return B.nextTick(t);case 2:return B.nextTick(function(){t.call(null,e)});case 3:return B.nextTick(function(){t.call(null,e,r)});case 4:return B.nextTick(function(){t.call(null,e,r,i)});default:for(o=new Array(n-1),s=0;s{_();v();m();var j=Ho(),{Buffer:q}=(be(),X(me)),qm=q.allocUnsafe(0),Dm=q.from([0]),Ai=Ad(),jm=Id().nextTick,qe=ot()("mqtt-packet:writeToStream"),Pn=Ai.cache,Fm=Ai.generateNumber,Wm=Ai.generateCache,Ko=Ai.genBufVariableByteInt,$m=Ai.generate4ByteBuffer,Te=Go,kn=!0;function kd(t,e,r){switch(qe("generate called"),e.cork&&(e.cork(),jm(Hm,e)),kn&&(kn=!1,Wm()),qe("generate: packet.cmd: %s",t.cmd),t.cmd){case"connect":return Vm(t,e,r);case"connack":return zm(t,e,r);case"publish":return Km(t,e,r);case"puback":case"pubrec":case"pubrel":case"pubcomp":return Gm(t,e,r);case"subscribe":return Qm(t,e,r);case"suback":return Ym(t,e,r);case"unsubscribe":return Jm(t,e,r);case"unsuback":return Xm(t,e,r);case"pingreq":case"pingresp":return Zm(t,e,r);case"disconnect":return e1(t,e,r);case"auth":return t1(t,e,r);default:return e.destroy(new Error("Unknown command")),!1}}Object.defineProperty(kd,"cacheNumbers",{get(){return Te===Go},set(t){t?((!Pn||Object.keys(Pn).length===0)&&(kn=!0),Te=Go):(kn=!1,Te=r1)}});function Hm(t){t.uncork()}function Vm(t,e,r){let i=t||{},n=i.protocolId||"MQTT",o=i.protocolVersion||4,s=i.will,a=i.clean,l=i.keepalive||0,c=i.clientId||"",h=i.username,d=i.password,g=i.properties;a===void 0&&(a=!0);let y=0;if(!n||typeof n!="string"&&!q.isBuffer(n))return e.destroy(new Error("Invalid protocolId")),!1;if(y+=n.length+2,o!==3&&o!==4&&o!==5)return e.destroy(new Error("Invalid protocol version")),!1;if(y+=1,(typeof c=="string"||q.isBuffer(c))&&(c||o>=4)&&(c||a))y+=q.byteLength(c)+2;else{if(o<4)return e.destroy(new Error("clientId must be supplied before 3.1.1")),!1;if(a*1===0)return e.destroy(new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof l!="number"||l<0||l>65535||l%1!==0)return e.destroy(new Error("Invalid keepalive")),!1;y+=2,y+=1;let w,S;if(o===5){if(w=Wt(e,g),!w)return!1;y+=w.length}if(s){if(typeof s!="object")return e.destroy(new Error("Invalid will")),!1;if(!s.topic||typeof s.topic!="string")return e.destroy(new Error("Invalid will topic")),!1;if(y+=q.byteLength(s.topic)+2,y+=2,s.payload)if(s.payload.length>=0)typeof s.payload=="string"?y+=q.byteLength(s.payload):y+=s.payload.length;else return e.destroy(new Error("Invalid will payload")),!1;if(S={},o===5){if(S=Wt(e,s.properties),!S)return!1;y+=S.length}}let E=!1;if(h!=null)if(Pd(h))E=!0,y+=q.byteLength(h)+2;else return e.destroy(new Error("Invalid username")),!1;if(d!=null){if(!E)return e.destroy(new Error("Username is required to use password")),!1;if(Pd(d))y+=Od(d)+2;else return e.destroy(new Error("Invalid password")),!1}e.write(j.CONNECT_HEADER),De(e,y),Yr(e,n),i.bridgeMode&&(o+=128),e.write(o===131?j.VERSION131:o===132?j.VERSION132:o===4?j.VERSION4:o===5?j.VERSION5:j.VERSION3);let I=0;return I|=h!=null?j.USERNAME_MASK:0,I|=d!=null?j.PASSWORD_MASK:0,I|=s&&s.retain?j.WILL_RETAIN_MASK:0,I|=s&&s.qos?s.qos<0&&Te(e,c),g?.write(),qe("publish: payload: %o",l),e.write(l)}function Gm(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.cmd||"puback",s=n.messageId,a=n.dup&&o==="pubrel"?j.DUP_MASK:0,l=0,c=n.reasonCode,h=n.properties,d=i===5?3:2;if(o==="pubrel"&&(l=1),typeof s!="number")return e.destroy(new Error("Invalid messageId")),!1;let g=null;if(i===5&&typeof h=="object"){if(g=Ii(e,h,r,d),!g)return!1;d+=g.length}return e.write(j.ACKS[o][l][a][0]),d===3&&(d+=c!==0?1:-1),De(e,d),Te(e,s),i===5&&d!==2&&e.write(q.from([c])),g!==null?g.write():d===4&&e.write(q.from([0])),!0}function Qm(t,e,r){qe("subscribe: packet: ");let i=r?r.protocolVersion:4,n=t||{},o=n.dup?j.DUP_MASK:0,s=n.messageId,a=n.subscriptions,l=n.properties,c=0;if(typeof s!="number")return e.destroy(new Error("Invalid messageId")),!1;c+=2;let h=null;if(i===5){if(h=Wt(e,l),!h)return!1;c+=h.length}if(typeof a=="object"&&a.length)for(let g=0;g2)return e.destroy(new Error("Invalid subscriptions - invalid Retain Handling")),!1}c+=q.byteLength(y)+2+1}else return e.destroy(new Error("Invalid subscriptions")),!1;qe("subscribe: writing to stream: %o",j.SUBSCRIBE_HEADER),e.write(j.SUBSCRIBE_HEADER[1][o?1:0][0]),De(e,c),Te(e,s),h!==null&&h.write();let d=!0;for(let g of a){let y=g.topic,w=g.qos,S=+g.nl,E=+g.rap,I=g.rh,C;wr(e,y),C=j.SUBSCRIBE_OPTIONS_QOS[w],i===5&&(C|=S?j.SUBSCRIBE_OPTIONS_NL:0,C|=E?j.SUBSCRIBE_OPTIONS_RAP:0,C|=I?j.SUBSCRIBE_OPTIONS_RH[I]:0),d=e.write(q.from([C]))}return d}function Ym(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.messageId,s=n.granted,a=n.properties,l=0;if(typeof o!="number")return e.destroy(new Error("Invalid messageId")),!1;if(l+=2,typeof s=="object"&&s.length)for(let h=0;hj.VARBYTEINT_MAX)return t.destroy(new Error(`Invalid variable byte integer: ${e}`)),!1;let r=Td[e];return r||(r=Ko(e),e<16384&&(Td[e]=r)),qe("writeVarByteInt: writing to stream: %o",r),t.write(r)}function wr(t,e){let r=q.byteLength(e);return Te(t,r),qe("writeString: %s",e),t.write(e,"utf8")}function Rd(t,e,r){wr(t,e),wr(t,r)}function Go(t,e){return qe("writeNumberCached: number: %d",e),qe("writeNumberCached: %o",Pn[e]),t.write(Pn[e])}function r1(t,e){let r=Fm(e);return qe("writeNumberGenerated: %o",r),t.write(r)}function i1(t,e){let r=$m(e);return qe("write4ByteNumber: %o",r),t.write(r)}function Yr(t,e){typeof e=="string"?wr(t,e):e?(Te(t,e.length),t.write(e)):Te(t,0)}function Wt(t,e){if(typeof e!="object"||e.length!=null)return{length:1,write(){Bd(t,{},0)}};let r=0;function i(o,s){let a=j.propertiesTypes[o],l=0;switch(a){case"byte":{if(typeof s!="boolean")return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+1;break}case"int8":{if(typeof s!="number"||s<0||s>255)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+1;break}case"binary":{if(s&&s===null)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+q.byteLength(s)+2;break}case"int16":{if(typeof s!="number"||s<0||s>65535)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+2;break}case"int32":{if(typeof s!="number"||s<0||s>4294967295)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+4;break}case"var":{if(typeof s!="number"||s<0||s>268435455)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+q.byteLength(Ko(s));break}case"string":{if(typeof s!="string")return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+2+q.byteLength(s.toString());break}case"pair":{if(typeof s!="object")return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=Object.getOwnPropertyNames(s).reduce((c,h)=>{let d=s[h];return Array.isArray(d)?c+=d.reduce((g,y)=>(g+=1+2+q.byteLength(h.toString())+2+q.byteLength(y.toString()),g),0):c+=1+2+q.byteLength(h.toString())+2+q.byteLength(s[h].toString()),c},0);break}default:return t.destroy(new Error(`Invalid property ${o}: ${s}`)),!1}return l}if(e)for(let o in e){let s=0,a=0,l=e[o];if(Array.isArray(l))for(let c=0;co;){let a=n.shift();if(a&&e[a])delete e[a],s=Wt(t,e);else return!1}return s}function Cd(t,e,r){switch(j.propertiesTypes[e]){case"byte":{t.write(q.from([j.properties[e]])),t.write(q.from([+r]));break}case"int8":{t.write(q.from([j.properties[e]])),t.write(q.from([r]));break}case"binary":{t.write(q.from([j.properties[e]])),Yr(t,r);break}case"int16":{t.write(q.from([j.properties[e]])),Te(t,r);break}case"int32":{t.write(q.from([j.properties[e]])),i1(t,r);break}case"var":{t.write(q.from([j.properties[e]])),De(t,r);break}case"string":{t.write(q.from([j.properties[e]])),wr(t,r);break}case"pair":{Object.getOwnPropertyNames(r).forEach(n=>{let o=r[n];Array.isArray(o)?o.forEach(s=>{t.write(q.from([j.properties[e]])),Rd(t,n.toString(),s.toString())}):(t.write(q.from([j.properties[e]])),Rd(t,n.toString(),o.toString()))});break}default:return t.destroy(new Error(`Invalid property ${e} value: ${r}`)),!1}}function Bd(t,e,r){De(t,r);for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!==null){let n=e[i];if(Array.isArray(n))for(let o=0;o{_();v();m();var n1=Qo(),{EventEmitter:s1}=(sr(),X(nr)),{Buffer:Md}=(be(),X(me));function o1(t,e){let r=new Yo;return n1(t,r,e),r.concat()}var Yo=class extends s1{constructor(){super(),this._array=new Array(20),this._i=0}write(e){return this._array[this._i++]=e,!0}concat(){let e=0,r=new Array(this._array.length),i=this._array,n=0,o;for(o=0;o{_();v();m();On.parser=md().parser;On.generate=Ud();On.writeToStream=Qo()});var Zo=M(Xo=>{"use strict";_();v();m();Object.defineProperty(Xo,"__esModule",{value:!0});var Jo=class{constructor(){this.nextId=Math.max(1,Math.floor(Math.random()*65535))}allocate(){let e=this.nextId++;return this.nextId===65536&&(this.nextId=1),e}getLastAllocated(){return this.nextId===1?65535:this.nextId-1}register(e){return!0}deallocate(e){}clear(){}};Xo.default=Jo});var Dd=M((bB,qd)=>{"use strict";_();v();m();qd.exports=a1;function Jr(t){return t instanceof x?x.from(t):new t.constructor(t.buffer.slice(),t.byteOffset,t.length)}function a1(t){if(t=t||{},t.circles)return l1(t);return t.proto?i:r;function e(n,o){for(var s=Object.keys(n),a=new Array(s.length),l=0;l{"use strict";_();v();m();jd.exports=Dd()()});var $d=M(Xr=>{"use strict";_();v();m();Object.defineProperty(Xr,"__esModule",{value:!0});Xr.validateTopics=Xr.validateTopic=void 0;function Wd(t){let e=t.split("/");for(let r=0;r{"use strict";_();v();m();Object.defineProperty(ta,"__esModule",{value:!0});var f1=jt(),c1={objectMode:!0},h1={clean:!0},ea=class{constructor(e){this.options=e||{},this.options=Object.assign(Object.assign({},h1),e),this._inflights=new Map}put(e,r){return this._inflights.set(e.messageId,e),r&&r(),this}createStream(){let e=new f1.Readable(c1),r=[],i=!1,n=0;return this._inflights.forEach((o,s)=>{r.push(o)}),e._read=()=>{!i&&n{if(!i)return i=!0,setTimeout(()=>{e.emit("close")},0),e},e}del(e,r){let i=this._inflights.get(e.messageId);return i?(this._inflights.delete(e.messageId),r(null,i)):r&&r(new Error("missing packet")),this}get(e,r){let i=this._inflights.get(e.messageId);return i?r(null,i):r&&r(new Error("missing packet")),this}close(e){this.options.clean&&(this._inflights=null),e&&e()}};ta.default=ea});var Vd=M(ia=>{"use strict";_();v();m();Object.defineProperty(ia,"__esModule",{value:!0});var Hd=[0,16,128,131,135,144,145,151,153],d1=(t,e,r)=>{t.log("handlePublish: packet %o",e),r=typeof r<"u"?r:t.noop;let i=e.topic.toString(),n=e.payload,{qos:o}=e,{messageId:s}=e,{options:a}=t;if(t.options.protocolVersion===5){let l;if(e.properties&&(l=e.properties.topicAlias),typeof l<"u")if(i.length===0)if(l>0&&l<=65535){let c=t.topicAliasRecv.getTopicByAlias(l);if(c)i=c,t.log("handlePublish :: topic complemented by alias. topic: %s - alias: %d",i,l);else{t.log("handlePublish :: unregistered topic alias. alias: %d",l),t.emit("error",new Error("Received unregistered Topic Alias"));return}}else{t.log("handlePublish :: topic alias out of range. alias: %d",l),t.emit("error",new Error("Received Topic Alias is out of range"));return}else if(t.topicAliasRecv.put(i,l))t.log("handlePublish :: registered topic: %s - alias: %d",i,l);else{t.log("handlePublish :: topic alias out of range. alias: %d",l),t.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(t.log("handlePublish: qos %d",o),o){case 2:{a.customHandleAcks(i,n,e,(l,c)=>{if(typeof l=="number"&&(c=l,l=null),l)return t.emit("error",l);if(Hd.indexOf(c)===-1)return t.emit("error",new Error("Wrong reason code for pubrec"));c?t._sendPacket({cmd:"pubrec",messageId:s,reasonCode:c},r):t.incomingStore.put(e,()=>{t._sendPacket({cmd:"pubrec",messageId:s},r)})});break}case 1:{a.customHandleAcks(i,n,e,(l,c)=>{if(typeof l=="number"&&(c=l,l=null),l)return t.emit("error",l);if(Hd.indexOf(c)===-1)return t.emit("error",new Error("Wrong reason code for puback"));c||t.emit("message",i,n,e),t.handleMessage(e,h=>{if(h)return r&&r(h);t._sendPacket({cmd:"puback",messageId:s,reasonCode:c},r)})});break}case 0:t.emit("message",i,n,e),t.handleMessage(e,r);break;default:t.log("handlePublish: unknown QoS. Doing nothing.");break}};ia.default=d1});var zd=M((XB,p1)=>{p1.exports={version:"5.10.3"}});var _r=M(at=>{"use strict";_();v();m();Object.defineProperty(at,"__esModule",{value:!0});at.MQTTJS_VERSION=at.nextTick=at.applyMixin=at.ErrorWithReasonCode=void 0;var na=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype),Object.getPrototypeOf(this).name="ErrorWithReasonCode"}};at.ErrorWithReasonCode=na;function g1(t,e,r=!1){var i;let n=[e];for(;;){let o=n[0],s=Object.getPrototypeOf(o);if(s?.prototype)n.unshift(s);else break}for(let o of n)for(let s of Object.getOwnPropertyNames(o.prototype))(r||s!=="constructor")&&Object.defineProperty(t.prototype,s,(i=Object.getOwnPropertyDescriptor(o.prototype,s))!==null&&i!==void 0?i:Object.create(null))}at.applyMixin=g1;at.nextTick=typeof(B===null||B===void 0?void 0:B.nextTick)=="function"?B.nextTick:t=>{setTimeout(t,0)};at.MQTTJS_VERSION=zd().version});var Ti=M($t=>{"use strict";_();v();m();Object.defineProperty($t,"__esModule",{value:!0});$t.ReasonCodes=void 0;var Kd=_r();$t.ReasonCodes={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};var y1=(t,e)=>{let{messageId:r}=e,i=e.cmd,n=null,o=t.outgoing[r]?t.outgoing[r].cb:null,s=null;if(!o){t.log("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(t.log("_handleAck :: packet type",i),i){case"pubcomp":case"puback":{let a=e.reasonCode;a&&a>0&&a!==16?(s=new Kd.ErrorWithReasonCode(`Publish error: ${$t.ReasonCodes[a]}`,a),t._removeOutgoingAndStoreMessage(r,()=>{o(s,e)})):t._removeOutgoingAndStoreMessage(r,o);break}case"pubrec":{n={cmd:"pubrel",qos:2,messageId:r};let a=e.reasonCode;a&&a>0&&a!==16?(s=new Kd.ErrorWithReasonCode(`Publish error: ${$t.ReasonCodes[a]}`,a),t._removeOutgoingAndStoreMessage(r,()=>{o(s,e)})):t._sendPacket(n);break}case"suback":{delete t.outgoing[r],t.messageIdProvider.deallocate(r);let a=e.granted;for(let l=0;l{delete t._resubscribeTopics[d]})}}delete t.messageIdToTopic[r],t._invokeStoreProcessingQueue(),o(s,e);break}case"unsuback":{delete t.outgoing[r],t.messageIdProvider.deallocate(r),t._invokeStoreProcessingQueue(),o(null,e);break}default:t.emit("error",new Error("unrecognized packet type"))}t.disconnecting&&Object.keys(t.outgoing).length===0&&t.emit("outgoingEmpty")};$t.default=y1});var Qd=M(sa=>{"use strict";_();v();m();Object.defineProperty(sa,"__esModule",{value:!0});var Gd=_r(),b1=Ti(),w1=(t,e)=>{let{options:r}=t,i=r.protocolVersion,n=i===5?e.reasonCode:e.returnCode;if(i!==5){let o=new Gd.ErrorWithReasonCode(`Protocol error: Auth packets are only supported in MQTT 5. Your version:${i}`,n);t.emit("error",o);return}t.handleAuth(e,(o,s)=>{if(o){t.emit("error",o);return}if(n===24)t.reconnecting=!1,t._sendPacket(s);else{let a=new Gd.ErrorWithReasonCode(`Connection refused: ${b1.ReasonCodes[n]}`,n);t.emit("error",a)}})};sa.default=w1});var ep=M(Mn=>{"use strict";_();v();m();Object.defineProperty(Mn,"__esModule",{value:!0});Mn.LRUCache=void 0;var Ri=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Jd=new Set,oa=typeof B=="object"&&B?B:{},Xd=(t,e,r,i)=>{typeof oa.emitWarning=="function"?oa.emitWarning(t,e,r,i):console.error(`[${r}] ${e}: ${t}`)},xn=globalThis.AbortController,Yd=globalThis.AbortSignal;if(typeof xn>"u"){Yd=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(i,n){this._onabort.push(n)}},xn=class{constructor(){e()}signal=new Yd;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=!0;for(let n of this.signal._onabort)n(i);this.signal.onabort?.(i)}}};let t=oa.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,Xd("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var _1=t=>!Jd.has(t),EP=Symbol("type"),Ht=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Zd=t=>Ht(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?Zr:null:null,Zr=class extends Array{constructor(e){super(e),this.fill(0)}},aa=class t{heap;length;static#l=!1;static create(e){let r=Zd(e);if(!r)return[];t.#l=!0;let i=new t(e,r);return t.#l=!1,i}constructor(e,r){if(!t.#l)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},la=class t{#l;#c;#p;#g;#B;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#y;#n;#r;#e;#u;#h;#a;#s;#b;#o;#E;#S;#w;#_;#I;#f;static unsafeExposeInternals(e){return{starts:e.#S,ttls:e.#w,sizes:e.#E,keyMap:e.#n,keyList:e.#r,valList:e.#e,next:e.#u,prev:e.#h,get head(){return e.#a},get tail(){return e.#s},free:e.#b,isBackgroundFetch:r=>e.#t(r),backgroundFetch:(r,i,n,o)=>e.#O(r,i,n,o),moveToTail:r=>e.#C(r),indexes:r=>e.#m(r),rindexes:r=>e.#v(r),isStale:r=>e.#d(r)}}get max(){return this.#l}get maxSize(){return this.#c}get calculatedSize(){return this.#y}get size(){return this.#i}get fetchMethod(){return this.#B}get dispose(){return this.#p}get disposeAfter(){return this.#g}constructor(e){let{max:r=0,ttl:i,ttlResolution:n=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:a,allowStale:l,dispose:c,disposeAfter:h,noDisposeOnSet:d,noUpdateTTL:g,maxSize:y=0,maxEntrySize:w=0,sizeCalculation:S,fetchMethod:E,noDeleteOnFetchRejection:I,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:R,allowStaleOnFetchAbort:U,ignoreFetchAbort:N}=e;if(r!==0&&!Ht(r))throw new TypeError("max option must be a nonnegative integer");let W=r?Zd(r):Array;if(!W)throw new Error("invalid max value: "+r);if(this.#l=r,this.#c=y,this.maxEntrySize=w||this.#c,this.sizeCalculation=S,this.sizeCalculation){if(!this.#c&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(E!==void 0&&typeof E!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#B=E,this.#I=!!E,this.#n=new Map,this.#r=new Array(r).fill(void 0),this.#e=new Array(r).fill(void 0),this.#u=new W(r),this.#h=new W(r),this.#a=0,this.#s=0,this.#b=aa.create(r),this.#i=0,this.#y=0,typeof c=="function"&&(this.#p=c),typeof h=="function"?(this.#g=h,this.#o=[]):(this.#g=void 0,this.#o=void 0),this.#_=!!this.#p,this.#f=!!this.#g,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!g,this.noDeleteOnFetchRejection=!!I,this.allowStaleOnFetchRejection=!!R,this.allowStaleOnFetchAbort=!!U,this.ignoreFetchAbort=!!N,this.maxEntrySize!==0){if(this.#c!==0&&!Ht(this.#c))throw new TypeError("maxSize must be a positive integer if specified");if(!Ht(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#q()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!a,this.ttlResolution=Ht(n)||n===0?n:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!Ht(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#x()}if(this.#l===0&&this.ttl===0&&this.#c===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#l&&!this.#c){let K="LRU_CACHE_UNBOUNDED";_1(K)&&(Jd.add(K),Xd("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",K,t))}}getRemainingTTL(e){return this.#n.has(e)?1/0:0}#x(){let e=new Zr(this.#l),r=new Zr(this.#l);this.#w=e,this.#S=r,this.#M=(o,s,a=Ri.now())=>{if(r[o]=s!==0?a:0,e[o]=s,s!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#d(o)&&this.delete(this.#r[o])},s+1);l.unref&&l.unref()}},this.#T=o=>{r[o]=e[o]!==0?Ri.now():0},this.#A=(o,s)=>{if(e[s]){let a=e[s],l=r[s];o.ttl=a,o.start=l,o.now=i||n();let c=o.now-l;o.remainingTTL=a-c}};let i=0,n=()=>{let o=Ri.now();if(this.ttlResolution>0){i=o;let s=setTimeout(()=>i=0,this.ttlResolution);s.unref&&s.unref()}return o};this.getRemainingTTL=o=>{let s=this.#n.get(o);if(s===void 0)return 0;let a=e[s],l=r[s];if(a===0||l===0)return 1/0;let c=(i||n())-l;return a-c},this.#d=o=>e[o]!==0&&r[o]!==0&&(i||n())-r[o]>e[o]}#T=()=>{};#A=()=>{};#M=()=>{};#d=()=>!1;#q(){let e=new Zr(this.#l);this.#y=0,this.#E=e,this.#R=r=>{this.#y-=e[r],e[r]=0},this.#L=(r,i,n,o)=>{if(this.#t(i))return 0;if(!Ht(n))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(n=o(i,r),!Ht(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n},this.#P=(r,i,n)=>{if(e[r]=i,this.#c){let o=this.#c-e[r];for(;this.#y>o;)this.#k(!0)}this.#y+=e[r],n&&(n.entrySize=i,n.totalCalculatedSize=this.#y)}}#R=e=>{};#P=(e,r,i)=>{};#L=(e,r,i,n)=>{if(i||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#m({allowStale:e=this.allowStale}={}){if(this.#i)for(let r=this.#s;!(!this.#U(r)||((e||!this.#d(r))&&(yield r),r===this.#a));)r=this.#h[r]}*#v({allowStale:e=this.allowStale}={}){if(this.#i)for(let r=this.#a;!(!this.#U(r)||((e||!this.#d(r))&&(yield r),r===this.#s));)r=this.#u[r]}#U(e){return e!==void 0&&this.#n.get(this.#r[e])===e}*entries(){for(let e of this.#m())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*rentries(){for(let e of this.#v())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*keys(){for(let e of this.#m()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r)}}*rkeys(){for(let e of this.#v()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r)}}*values(){for(let e of this.#m())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}*rvalues(){for(let e of this.#v())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}[Symbol.iterator](){return this.entries()}find(e,r={}){for(let i of this.#m()){let n=this.#e[i],o=this.#t(n)?n.__staleWhileFetching:n;if(o!==void 0&&e(o,this.#r[i],this))return this.get(this.#r[i],r)}}forEach(e,r=this){for(let i of this.#m()){let n=this.#e[i],o=this.#t(n)?n.__staleWhileFetching:n;o!==void 0&&e.call(r,o,this.#r[i],this)}}rforEach(e,r=this){for(let i of this.#v()){let n=this.#e[i],o=this.#t(n)?n.__staleWhileFetching:n;o!==void 0&&e.call(r,o,this.#r[i],this)}}purgeStale(){let e=!1;for(let r of this.#v({allowStale:!0}))this.#d(r)&&(this.delete(this.#r[r]),e=!0);return e}dump(){let e=[];for(let r of this.#m({allowStale:!0})){let i=this.#r[r],n=this.#e[r],o=this.#t(n)?n.__staleWhileFetching:n;if(o===void 0||i===void 0)continue;let s={value:o};if(this.#w&&this.#S){s.ttl=this.#w[r];let a=Ri.now()-this.#S[r];s.start=Math.floor(Date.now()-a)}this.#E&&(s.size=this.#E[r]),e.unshift([i,s])}return e}load(e){this.clear();for(let[r,i]of e){if(i.start){let n=Date.now()-i.start;i.start=Ri.now()-n}this.set(r,i.value,i)}}set(e,r,i={}){if(r===void 0)return this.delete(e),this;let{ttl:n=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=i,{noUpdateTTL:c=this.noUpdateTTL}=i,h=this.#L(e,r,i.size||0,a);if(this.maxEntrySize&&h>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.delete(e),this;let d=this.#i===0?void 0:this.#n.get(e);if(d===void 0)d=this.#i===0?this.#s:this.#b.length!==0?this.#b.pop():this.#i===this.#l?this.#k(!1):this.#i,this.#r[d]=e,this.#e[d]=r,this.#n.set(e,d),this.#u[this.#s]=d,this.#h[d]=this.#s,this.#s=d,this.#i++,this.#P(d,h,l),l&&(l.set="add"),c=!1;else{this.#C(d);let g=this.#e[d];if(r!==g){if(this.#I&&this.#t(g)){g.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:y}=g;y!==void 0&&!s&&(this.#_&&this.#p?.(y,e,"set"),this.#f&&this.#o?.push([y,e,"set"]))}else s||(this.#_&&this.#p?.(g,e,"set"),this.#f&&this.#o?.push([g,e,"set"]));if(this.#R(d),this.#P(d,h,l),this.#e[d]=r,l){l.set="replace";let y=g&&this.#t(g)?g.__staleWhileFetching:g;y!==void 0&&(l.oldValue=y)}}else l&&(l.set="update")}if(n!==0&&!this.#w&&this.#x(),this.#w&&(c||this.#M(d,n,o),l&&this.#A(l,d)),!s&&this.#f&&this.#o){let g=this.#o,y;for(;y=g?.shift();)this.#g?.(...y)}return this}pop(){try{for(;this.#i;){let e=this.#e[this.#a];if(this.#k(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#o){let e=this.#o,r;for(;r=e?.shift();)this.#g?.(...r)}}}#k(e){let r=this.#a,i=this.#r[r],n=this.#e[r];return this.#I&&this.#t(n)?n.__abortController.abort(new Error("evicted")):(this.#_||this.#f)&&(this.#_&&this.#p?.(n,i,"evict"),this.#f&&this.#o?.push([n,i,"evict"])),this.#R(r),e&&(this.#r[r]=void 0,this.#e[r]=void 0,this.#b.push(r)),this.#i===1?(this.#a=this.#s=0,this.#b.length=0):this.#a=this.#u[r],this.#n.delete(i),this.#i--,r}has(e,r={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:n}=r,o=this.#n.get(e);if(o!==void 0){let s=this.#e[o];if(this.#t(s)&&s.__staleWhileFetching===void 0)return!1;if(this.#d(o))n&&(n.has="stale",this.#A(n,o));else return i&&this.#T(o),n&&(n.has="hit",this.#A(n,o)),!0}else n&&(n.has="miss");return!1}peek(e,r={}){let{allowStale:i=this.allowStale}=r,n=this.#n.get(e);if(n!==void 0&&(i||!this.#d(n))){let o=this.#e[n];return this.#t(o)?o.__staleWhileFetching:o}}#O(e,r,i,n){let o=r===void 0?void 0:this.#e[r];if(this.#t(o))return o;let s=new xn,{signal:a}=i;a?.addEventListener("abort",()=>s.abort(a.reason),{signal:s.signal});let l={signal:s.signal,options:i,context:n},c=(S,E=!1)=>{let{aborted:I}=s.signal,C=i.ignoreFetchAbort&&S!==void 0;if(i.status&&(I&&!E?(i.status.fetchAborted=!0,i.status.fetchError=s.signal.reason,C&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),I&&!C&&!E)return d(s.signal.reason);let R=y;return this.#e[r]===y&&(S===void 0?R.__staleWhileFetching?this.#e[r]=R.__staleWhileFetching:this.delete(e):(i.status&&(i.status.fetchUpdated=!0),this.set(e,S,l.options))),S},h=S=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=S),d(S)),d=S=>{let{aborted:E}=s.signal,I=E&&i.allowStaleOnFetchAbort,C=I||i.allowStaleOnFetchRejection,R=C||i.noDeleteOnFetchRejection,U=y;if(this.#e[r]===y&&(!R||U.__staleWhileFetching===void 0?this.delete(e):I||(this.#e[r]=U.__staleWhileFetching)),C)return i.status&&U.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),U.__staleWhileFetching;if(U.__returned===U)throw S},g=(S,E)=>{let I=this.#B?.(e,o,l);I&&I instanceof Promise&&I.then(C=>S(C===void 0?void 0:C),E),s.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(S(void 0),i.allowStaleOnFetchAbort&&(S=C=>c(C,!0)))})};i.status&&(i.status.fetchDispatched=!0);let y=new Promise(g).then(c,h),w=Object.assign(y,{__abortController:s,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(e,w,{...l.options,status:void 0}),r=this.#n.get(e)):this.#e[r]=w,w}#t(e){if(!this.#I)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof xn}async fetch(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:l=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:h=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:g=this.allowStaleOnFetchRejection,ignoreFetchAbort:y=this.ignoreFetchAbort,allowStaleOnFetchAbort:w=this.allowStaleOnFetchAbort,context:S,forceRefresh:E=!1,status:I,signal:C}=r;if(!this.#I)return I&&(I.fetch="get"),this.get(e,{allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:o,status:I});let R={allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:a,size:l,sizeCalculation:c,noUpdateTTL:h,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:w,ignoreFetchAbort:y,status:I,signal:C},U=this.#n.get(e);if(U===void 0){I&&(I.fetch="miss");let N=this.#O(e,U,R,S);return N.__returned=N}else{let N=this.#e[U];if(this.#t(N)){let pe=i&&N.__staleWhileFetching!==void 0;return I&&(I.fetch="inflight",pe&&(I.returnedStale=!0)),pe?N.__staleWhileFetching:N.__returned=N}let W=this.#d(U);if(!E&&!W)return I&&(I.fetch="hit"),this.#C(U),n&&this.#T(U),I&&this.#A(I,U),N;let K=this.#O(e,U,R,S),Q=K.__staleWhileFetching!==void 0&&i;return I&&(I.fetch=W?"stale":"refresh",Q&&W&&(I.returnedStale=!0)),Q?K.__staleWhileFetching:K.__returned=K}}get(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=r,a=this.#n.get(e);if(a!==void 0){let l=this.#e[a],c=this.#t(l);return s&&this.#A(s,a),this.#d(a)?(s&&(s.get="stale"),c?(s&&i&&l.__staleWhileFetching!==void 0&&(s.returnedStale=!0),i?l.__staleWhileFetching:void 0):(o||this.delete(e),s&&i&&(s.returnedStale=!0),i?l:void 0)):(s&&(s.get="hit"),c?l.__staleWhileFetching:(this.#C(a),n&&this.#T(a),l))}else s&&(s.get="miss")}#N(e,r){this.#h[r]=e,this.#u[e]=r}#C(e){e!==this.#s&&(e===this.#a?this.#a=this.#u[e]:this.#N(this.#h[e],this.#u[e]),this.#N(this.#s,e),this.#s=e)}delete(e){let r=!1;if(this.#i!==0){let i=this.#n.get(e);if(i!==void 0)if(r=!0,this.#i===1)this.clear();else{this.#R(i);let n=this.#e[i];this.#t(n)?n.__abortController.abort(new Error("deleted")):(this.#_||this.#f)&&(this.#_&&this.#p?.(n,e,"delete"),this.#f&&this.#o?.push([n,e,"delete"])),this.#n.delete(e),this.#r[i]=void 0,this.#e[i]=void 0,i===this.#s?this.#s=this.#h[i]:i===this.#a?this.#a=this.#u[i]:(this.#u[this.#h[i]]=this.#u[i],this.#h[this.#u[i]]=this.#h[i]),this.#i--,this.#b.push(i)}}if(this.#f&&this.#o?.length){let i=this.#o,n;for(;n=i?.shift();)this.#g?.(...n)}return r}clear(){for(let e of this.#v({allowStale:!0})){let r=this.#e[e];if(this.#t(r))r.__abortController.abort(new Error("deleted"));else{let i=this.#r[e];this.#_&&this.#p?.(r,i,"delete"),this.#f&&this.#o?.push([r,i,"delete"])}}if(this.#n.clear(),this.#e.fill(void 0),this.#r.fill(void 0),this.#w&&this.#S&&(this.#w.fill(0),this.#S.fill(0)),this.#E&&this.#E.fill(0),this.#a=0,this.#s=0,this.#b.length=0,this.#y=0,this.#i=0,this.#f&&this.#o){let e=this.#o,r;for(;r=e?.shift();)this.#g?.(...r)}}};Mn.LRUCache=la});var lt=M(Vt=>{"use strict";_();v();m();Object.defineProperty(Vt,"t",{value:!0});Vt.ContainerIterator=Vt.Container=Vt.Base=void 0;var ua=class{constructor(e=0){this.iteratorType=e}equals(e){return this.o===e.o}};Vt.ContainerIterator=ua;var Ln=class{constructor(){this.i=0}get length(){return this.i}size(){return this.i}empty(){return this.i===0}};Vt.Base=Ln;var fa=class extends Ln{};Vt.Container=fa});var tp=M(Un=>{"use strict";_();v();m();Object.defineProperty(Un,"t",{value:!0});Un.default=void 0;var m1=lt(),ca=class extends m1.Base{constructor(e=[]){super(),this.S=[];let r=this;e.forEach(function(i){r.push(i)})}clear(){this.i=0,this.S=[]}push(e){return this.S.push(e),this.i+=1,this.i}pop(){if(this.i!==0)return this.i-=1,this.S.pop()}top(){return this.S[this.i-1]}},v1=ca;Un.default=v1});var rp=M(Nn=>{"use strict";_();v();m();Object.defineProperty(Nn,"t",{value:!0});Nn.default=void 0;var E1=lt(),ha=class extends E1.Base{constructor(e=[]){super(),this.j=0,this.q=[];let r=this;e.forEach(function(i){r.push(i)})}clear(){this.q=[],this.i=this.j=0}push(e){let r=this.q.length;if(this.j/r>.5&&this.j+this.i>=r&&r>4096){let i=this.i;for(let n=0;n{"use strict";_();v();m();Object.defineProperty(qn,"t",{value:!0});qn.default=void 0;var A1=lt(),da=class extends A1.Base{constructor(e=[],r=function(n,o){return n>o?-1:n>1;for(let o=this.i-1>>1;o>=0;--o)this.k(o,n)}m(e){let r=this.C[e];for(;e>0;){let i=e-1>>1,n=this.C[i];if(this.v(n,r)<=0)break;this.C[e]=n,e=i}this.C[e]=r}k(e,r){let i=this.C[e];for(;e0&&(n=o,s=this.C[o]),this.v(s,i)>=0)break;this.C[e]=s,e=n}this.C[e]=i}clear(){this.i=0,this.C.length=0}push(e){this.C.push(e),this.m(this.i),this.i+=1}pop(){if(this.i===0)return;let e=this.C[0],r=this.C.pop();return this.i-=1,this.i&&(this.C[0]=r,this.k(0,this.i>>1)),e}top(){return this.C[0]}find(e){return this.C.indexOf(e)>=0}remove(e){let r=this.C.indexOf(e);return r<0?!1:(r===0?this.pop():r===this.i-1?(this.C.pop(),this.i-=1):(this.C.splice(r,1,this.C.pop()),this.i-=1,this.m(r),this.k(r,this.i>>1)),!0)}updateItem(e){let r=this.C.indexOf(e);return r<0?!1:(this.m(r),this.k(r,this.i>>1),!0)}toArray(){return[...this.C]}},I1=da;qn.default=I1});var jn=M(Dn=>{"use strict";_();v();m();Object.defineProperty(Dn,"t",{value:!0});Dn.default=void 0;var T1=lt(),pa=class extends T1.Container{},R1=pa;Dn.default=R1});var ut=M(ga=>{"use strict";_();v();m();Object.defineProperty(ga,"t",{value:!0});ga.throwIteratorAccessError=C1;function C1(){throw new RangeError("Iterator access denied!")}});var ba=M(Wn=>{"use strict";_();v();m();Object.defineProperty(Wn,"t",{value:!0});Wn.RandomIterator=void 0;var B1=lt(),Fn=ut(),ya=class extends B1.ContainerIterator{constructor(e,r){super(r),this.o=e,this.iteratorType===0?(this.pre=function(){return this.o===0&&(0,Fn.throwIteratorAccessError)(),this.o-=1,this},this.next=function(){return this.o===this.container.size()&&(0,Fn.throwIteratorAccessError)(),this.o+=1,this}):(this.pre=function(){return this.o===this.container.size()-1&&(0,Fn.throwIteratorAccessError)(),this.o+=1,this},this.next=function(){return this.o===-1&&(0,Fn.throwIteratorAccessError)(),this.o-=1,this})}get pointer(){return this.container.getElementByPos(this.o)}set pointer(e){this.container.setElementByPos(this.o,e)}};Wn.RandomIterator=ya});var np=M($n=>{"use strict";_();v();m();Object.defineProperty($n,"t",{value:!0});$n.default=void 0;var P1=O1(jn()),k1=ba();function O1(t){return t&&t.t?t:{default:t}}var mr=class t extends k1.RandomIterator{constructor(e,r,i){super(e,i),this.container=r}copy(){return new t(this.o,this.container,this.iteratorType)}},wa=class extends P1.default{constructor(e=[],r=!0){if(super(),Array.isArray(e))this.J=r?[...e]:e,this.i=e.length;else{this.J=[];let i=this;e.forEach(function(n){i.pushBack(n)})}}clear(){this.i=0,this.J.length=0}begin(){return new mr(0,this)}end(){return new mr(this.i,this)}rBegin(){return new mr(this.i-1,this,1)}rEnd(){return new mr(-1,this,1)}front(){return this.J[0]}back(){return this.J[this.i-1]}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;return this.J[e]}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;return this.J.splice(e,1),this.i-=1,this.i}eraseElementByValue(e){let r=0;for(let i=0;ithis.i-1)throw new RangeError;this.J[e]=r}insert(e,r,i=1){if(e<0||e>this.i)throw new RangeError;return this.J.splice(e,0,...new Array(i).fill(r)),this.i+=i,this.i}find(e){for(let r=0;r{"use strict";_();v();m();Object.defineProperty(Hn,"t",{value:!0});Hn.default=void 0;var M1=U1(jn()),L1=lt(),vr=ut();function U1(t){return t&&t.t?t:{default:t}}var Er=class t extends L1.ContainerIterator{constructor(e,r,i,n){super(n),this.o=e,this.h=r,this.container=i,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,vr.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,vr.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,vr.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,vr.throwIteratorAccessError)(),this.o=this.o.L,this})}get pointer(){return this.o===this.h&&(0,vr.throwIteratorAccessError)(),this.o.l}set pointer(e){this.o===this.h&&(0,vr.throwIteratorAccessError)(),this.o.l=e}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},_a=class extends M1.default{constructor(e=[]){super(),this.h={},this.p=this._=this.h.L=this.h.B=this.h;let r=this;e.forEach(function(i){r.pushBack(i)})}V(e){let{L:r,B:i}=e;r.B=i,i.L=r,e===this.p&&(this.p=i),e===this._&&(this._=r),this.i-=1}G(e,r){let i=r.B,n={l:e,L:r,B:i};r.B=n,i.L=n,r===this.h&&(this.p=n),i===this.h&&(this._=n),this.i+=1}clear(){this.i=0,this.p=this._=this.h.L=this.h.B=this.h}begin(){return new Er(this.p,this.h,this)}end(){return new Er(this.h,this.h,this)}rBegin(){return new Er(this._,this.h,this,1)}rEnd(){return new Er(this.h,this.h,this,1)}front(){return this.p.l}back(){return this._.l}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return r.l}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return this.V(r),this.i}eraseElementByValue(e){let r=this.p;for(;r!==this.h;)r.l===e&&this.V(r),r=r.B;return this.i}eraseElementByIterator(e){let r=e.o;return r===this.h&&(0,vr.throwIteratorAccessError)(),e=e.next(),this.V(r),e}pushBack(e){return this.G(e,this._),this.i}popBack(){if(this.i===0)return;let e=this._.l;return this.V(this._),e}pushFront(e){return this.G(e,this.h),this.i}popFront(){if(this.i===0)return;let e=this.p.l;return this.V(this.p),e}setElementByPos(e,r){if(e<0||e>this.i-1)throw new RangeError;let i=this.p;for(;e--;)i=i.B;i.l=r}insert(e,r,i=1){if(e<0||e>this.i)throw new RangeError;if(i<=0)return this.i;if(e===0)for(;i--;)this.pushFront(r);else if(e===this.i)for(;i--;)this.pushBack(r);else{let n=this.p;for(let s=1;s{"use strict";_();v();m();Object.defineProperty(Vn,"t",{value:!0});Vn.default=void 0;var q1=j1(jn()),D1=ba();function j1(t){return t&&t.t?t:{default:t}}var Sr=class t extends D1.RandomIterator{constructor(e,r,i){super(e,i),this.container=r}copy(){return new t(this.o,this.container,this.iteratorType)}},ma=class extends q1.default{constructor(e=[],r=4096){super(),this.j=0,this.D=0,this.R=0,this.N=0,this.P=0,this.A=[];let i=(()=>{if(typeof e.length=="number")return e.length;if(typeof e.size=="number")return e.size;if(typeof e.size=="function")return e.size();throw new TypeError("Cannot get the length or size of the container")})();this.F=r,this.P=Math.max(Math.ceil(i/this.F),1);for(let s=0;s>1)-(n>>1),this.D=this.N=this.F-i%this.F>>1;let o=this;e.forEach(function(s){o.pushBack(s)})}T(){let e=[],r=Math.max(this.P>>1,1);for(let i=0;i>1}begin(){return new Sr(0,this)}end(){return new Sr(this.i,this)}rBegin(){return new Sr(this.i-1,this,1)}rEnd(){return new Sr(-1,this,1)}front(){if(this.i!==0)return this.A[this.j][this.D]}back(){if(this.i!==0)return this.A[this.R][this.N]}pushBack(e){return this.i&&(this.N0?this.N-=1:this.R>0?(this.R-=1,this.N=this.F-1):(this.R=this.P-1,this.N=this.F-1)),this.i-=1,e}pushFront(e){return this.i&&(this.D>0?this.D-=1:this.j>0?(this.j-=1,this.D=this.F-1):(this.j=this.P-1,this.D=this.F-1),this.j===this.R&&this.D===this.N&&this.T()),this.i+=1,this.A[this.j][this.D]=e,this.i}popFront(){if(this.i===0)return;let e=this.A[this.j][this.D];return this.i!==1&&(this.Dthis.i-1)throw new RangeError;let{curNodeBucketIndex:r,curNodePointerIndex:i}=this.O(e);return this.A[r][i]}setElementByPos(e,r){if(e<0||e>this.i-1)throw new RangeError;let{curNodeBucketIndex:i,curNodePointerIndex:n}=this.O(e);this.A[i][n]=r}insert(e,r,i=1){if(e<0||e>this.i)throw new RangeError;if(e===0)for(;i--;)this.pushFront(r);else if(e===this.i)for(;i--;)this.pushBack(r);else{let n=[];for(let o=e;othis.i-1)throw new RangeError;if(e===0)this.popFront();else if(e===this.i-1)this.popBack();else{let r=[];for(let n=e+1;ne;)this.popBack();return this.i}sort(e){let r=[];for(let i=0;i{"use strict";_();v();m();Object.defineProperty(ei,"t",{value:!0});ei.TreeNodeEnableIndex=ei.TreeNode=void 0;var zn=class{constructor(e,r){this.ee=1,this.u=void 0,this.l=void 0,this.U=void 0,this.W=void 0,this.tt=void 0,this.u=e,this.l=r}L(){let e=this;if(e.ee===1&&e.tt.tt===e)e=e.W;else if(e.U)for(e=e.U;e.W;)e=e.W;else{let r=e.tt;for(;r.U===e;)e=r,r=e.tt;e=r}return e}B(){let e=this;if(e.W){for(e=e.W;e.U;)e=e.U;return e}else{let r=e.tt;for(;r.W===e;)e=r,r=e.tt;return e.W!==r?r:e}}te(){let e=this.tt,r=this.W,i=r.U;return e.tt===this?e.tt=r:e.U===this?e.U=r:e.W=r,r.tt=e,r.U=this,this.tt=r,this.W=i,i&&(i.tt=this),r}se(){let e=this.tt,r=this.U,i=r.W;return e.tt===this?e.tt=r:e.U===this?e.U=r:e.W=r,r.tt=e,r.W=this,this.tt=r,this.U=i,i&&(i.tt=this),r}};ei.TreeNode=zn;var va=class extends zn{constructor(){super(...arguments),this.rt=1}te(){let e=super.te();return this.ie(),e.ie(),e}se(){let e=super.se();return this.ie(),e.ie(),e}ie(){this.rt=1,this.U&&(this.rt+=this.U.rt),this.W&&(this.rt+=this.W.rt)}};ei.TreeNodeEnableIndex=va});var Sa=M(Kn=>{"use strict";_();v();m();Object.defineProperty(Kn,"t",{value:!0});Kn.default=void 0;var lp=ap(),W1=lt(),up=ut(),Ea=class extends W1.Container{constructor(e=function(i,n){return in?1:0},r=!1){super(),this.Y=void 0,this.v=e,r?(this.re=lp.TreeNodeEnableIndex,this.M=function(i,n,o){let s=this.ne(i,n,o);if(s){let a=s.tt;for(;a!==this.h;)a.rt+=1,a=a.tt;let l=this.he(s);if(l){let{parentNode:c,grandParent:h,curNode:d}=l;c.ie(),h.ie(),d.ie()}}return this.i},this.V=function(i){let n=this.fe(i);for(;n!==this.h;)n.rt-=1,n=n.tt}):(this.re=lp.TreeNode,this.M=function(i,n,o){let s=this.ne(i,n,o);return s&&this.he(s),this.i},this.V=this.fe),this.h=new this.re}X(e,r){let i=this.h;for(;e;){let n=this.v(e.u,r);if(n<0)e=e.W;else if(n>0)i=e,e=e.U;else return e}return i}Z(e,r){let i=this.h;for(;e;)this.v(e.u,r)<=0?e=e.W:(i=e,e=e.U);return i}$(e,r){let i=this.h;for(;e;){let n=this.v(e.u,r);if(n<0)i=e,e=e.W;else if(n>0)e=e.U;else return e}return i}rr(e,r){let i=this.h;for(;e;)this.v(e.u,r)<0?(i=e,e=e.W):e=e.U;return i}ue(e){for(;;){let r=e.tt;if(r===this.h)return;if(e.ee===1){e.ee=0;return}if(e===r.U){let i=r.W;if(i.ee===1)i.ee=0,r.ee=1,r===this.Y?this.Y=r.te():r.te();else if(i.W&&i.W.ee===1){i.ee=r.ee,r.ee=0,i.W.ee=0,r===this.Y?this.Y=r.te():r.te();return}else i.U&&i.U.ee===1?(i.ee=1,i.U.ee=0,i.se()):(i.ee=1,e=r)}else{let i=r.U;if(i.ee===1)i.ee=0,r.ee=1,r===this.Y?this.Y=r.se():r.se();else if(i.U&&i.U.ee===1){i.ee=r.ee,r.ee=0,i.U.ee=0,r===this.Y?this.Y=r.se():r.se();return}else i.W&&i.W.ee===1?(i.ee=1,i.W.ee=0,i.te()):(i.ee=1,e=r)}}}fe(e){if(this.i===1)return this.clear(),this.h;let r=e;for(;r.U||r.W;){if(r.W)for(r=r.W;r.U;)r=r.U;else r=r.U;[e.u,r.u]=[r.u,e.u],[e.l,r.l]=[r.l,e.l],e=r}this.h.U===r?this.h.U=r.tt:this.h.W===r&&(this.h.W=r.tt),this.ue(r);let i=r.tt;return r===i.U?i.U=void 0:i.W=void 0,this.i-=1,this.Y.ee=0,i}oe(e,r){return e===void 0?!1:this.oe(e.U,r)||r(e)?!0:this.oe(e.W,r)}he(e){for(;;){let r=e.tt;if(r.ee===0)return;let i=r.tt;if(r===i.U){let n=i.W;if(n&&n.ee===1){if(n.ee=r.ee=0,i===this.Y)return;i.ee=1,e=i;continue}else if(e===r.W){if(e.ee=0,e.U&&(e.U.tt=r),e.W&&(e.W.tt=i),r.W=e.U,i.U=e.W,e.U=r,e.W=i,i===this.Y)this.Y=e,this.h.tt=e;else{let o=i.tt;o.U===i?o.U=e:o.W=e}return e.tt=i.tt,r.tt=e,i.tt=e,i.ee=1,{parentNode:r,grandParent:i,curNode:e}}else r.ee=0,i===this.Y?this.Y=i.se():i.se(),i.ee=1}else{let n=i.U;if(n&&n.ee===1){if(n.ee=r.ee=0,i===this.Y)return;i.ee=1,e=i;continue}else if(e===r.U){if(e.ee=0,e.U&&(e.U.tt=i),e.W&&(e.W.tt=r),i.W=e.U,r.U=e.W,e.U=i,e.W=r,i===this.Y)this.Y=e,this.h.tt=e;else{let o=i.tt;o.U===i?o.U=e:o.W=e}return e.tt=i.tt,r.tt=e,i.tt=e,i.ee=1,{parentNode:r,grandParent:i,curNode:e}}else r.ee=0,i===this.Y?this.Y=i.te():i.te(),i.ee=1}return}}ne(e,r,i){if(this.Y===void 0){this.i+=1,this.Y=new this.re(e,r),this.Y.ee=0,this.Y.tt=this.h,this.h.tt=this.Y,this.h.U=this.Y,this.h.W=this.Y;return}let n,o=this.h.U,s=this.v(o.u,e);if(s===0){o.l=r;return}else if(s>0)o.U=new this.re(e,r),o.U.tt=o,n=o.U,this.h.U=n;else{let a=this.h.W,l=this.v(a.u,e);if(l===0){a.l=r;return}else if(l<0)a.W=new this.re(e,r),a.W.tt=a,n=a.W,this.h.W=n;else{if(i!==void 0){let c=i.o;if(c!==this.h){let h=this.v(c.u,e);if(h===0){c.l=r;return}else if(h>0){let d=c.L(),g=this.v(d.u,e);if(g===0){d.l=r;return}else g<0&&(n=new this.re(e,r),d.W===void 0?(d.W=n,n.tt=d):(c.U=n,n.tt=c))}}}if(n===void 0)for(n=this.Y;;){let c=this.v(n.u,e);if(c>0){if(n.U===void 0){n.U=new this.re(e,r),n.U.tt=n,n=n.U;break}n=n.U}else if(c<0){if(n.W===void 0){n.W=new this.re(e,r),n.W.tt=n,n=n.W;break}n=n.W}else{n.l=r;return}}}}return this.i+=1,n}I(e,r){for(;e;){let i=this.v(e.u,r);if(i<0)e=e.W;else if(i>0)e=e.U;else return e}return e||this.h}clear(){this.i=0,this.Y=void 0,this.h.tt=void 0,this.h.U=this.h.W=void 0}updateKeyByIterator(e,r){let i=e.o;if(i===this.h&&(0,up.throwIteratorAccessError)(),this.i===1)return i.u=r,!0;if(i===this.h.U)return this.v(i.B().u,r)>0?(i.u=r,!0):!1;if(i===this.h.W)return this.v(i.L().u,r)<0?(i.u=r,!0):!1;let n=i.L().u;if(this.v(n,r)>=0)return!1;let o=i.B().u;return this.v(o,r)<=0?!1:(i.u=r,!0)}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=0,i=this;return this.oe(this.Y,function(n){return e===r?(i.V(n),!0):(r+=1,!1)}),this.i}eraseElementByKey(e){if(this.i===0)return!1;let r=this.I(this.Y,e);return r===this.h?!1:(this.V(r),!0)}eraseElementByIterator(e){let r=e.o;r===this.h&&(0,up.throwIteratorAccessError)();let i=r.W===void 0;return e.iteratorType===0?i&&e.next():(!i||r.U===void 0)&&e.next(),this.V(r),e}forEach(e){let r=0;for(let i of this)e(i,r++,this)}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r,i=0;for(let n of this){if(i===e){r=n;break}i+=1}return r}getHeight(){if(this.i===0)return 0;let e=function(r){return r?Math.max(e(r.U),e(r.W))+1:0};return e(this.Y)}},$1=Ea;Kn.default=$1});var Ia=M(Qn=>{"use strict";_();v();m();Object.defineProperty(Qn,"t",{value:!0});Qn.default=void 0;var H1=lt(),Gn=ut(),Aa=class extends H1.ContainerIterator{constructor(e,r,i){super(i),this.o=e,this.h=r,this.iteratorType===0?(this.pre=function(){return this.o===this.h.U&&(0,Gn.throwIteratorAccessError)(),this.o=this.o.L(),this},this.next=function(){return this.o===this.h&&(0,Gn.throwIteratorAccessError)(),this.o=this.o.B(),this}):(this.pre=function(){return this.o===this.h.W&&(0,Gn.throwIteratorAccessError)(),this.o=this.o.B(),this},this.next=function(){return this.o===this.h&&(0,Gn.throwIteratorAccessError)(),this.o=this.o.L(),this})}get index(){let e=this.o,r=this.h.tt;if(e===this.h)return r?r.rt-1:0;let i=0;for(e.U&&(i+=e.U.rt);e!==r;){let n=e.tt;e===n.W&&(i+=1,n.U&&(i+=n.U.rt)),e=n}return i}},V1=Aa;Qn.default=V1});var cp=M(Yn=>{"use strict";_();v();m();Object.defineProperty(Yn,"t",{value:!0});Yn.default=void 0;var z1=fp(Sa()),K1=fp(Ia()),G1=ut();function fp(t){return t&&t.t?t:{default:t}}var Ke=class t extends K1.default{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){return this.o===this.h&&(0,G1.throwIteratorAccessError)(),this.o.u}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},Ta=class extends z1.default{constructor(e=[],r,i){super(r,i);let n=this;e.forEach(function(o){n.insert(o)})}*K(e){e!==void 0&&(yield*this.K(e.U),yield e.u,yield*this.K(e.W))}begin(){return new Ke(this.h.U||this.h,this.h,this)}end(){return new Ke(this.h,this.h,this)}rBegin(){return new Ke(this.h.W||this.h,this.h,this,1)}rEnd(){return new Ke(this.h,this.h,this,1)}front(){return this.h.U?this.h.U.u:void 0}back(){return this.h.W?this.h.W.u:void 0}insert(e,r){return this.M(e,void 0,r)}find(e){let r=this.I(this.Y,e);return new Ke(r,this.h,this)}lowerBound(e){let r=this.X(this.Y,e);return new Ke(r,this.h,this)}upperBound(e){let r=this.Z(this.Y,e);return new Ke(r,this.h,this)}reverseLowerBound(e){let r=this.$(this.Y,e);return new Ke(r,this.h,this)}reverseUpperBound(e){let r=this.rr(this.Y,e);return new Ke(r,this.h,this)}union(e){let r=this;return e.forEach(function(i){r.insert(i)}),this.i}[Symbol.iterator](){return this.K(this.Y)}},Q1=Ta;Yn.default=Q1});var dp=M(Jn=>{"use strict";_();v();m();Object.defineProperty(Jn,"t",{value:!0});Jn.default=void 0;var Y1=hp(Sa()),J1=hp(Ia()),X1=ut();function hp(t){return t&&t.t?t:{default:t}}var Ge=class t extends J1.default{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){this.o===this.h&&(0,X1.throwIteratorAccessError)();let e=this;return new Proxy([],{get(r,i){if(i==="0")return e.o.u;if(i==="1")return e.o.l},set(r,i,n){if(i!=="1")throw new TypeError("props must be 1");return e.o.l=n,!0}})}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},Ra=class extends Y1.default{constructor(e=[],r,i){super(r,i);let n=this;e.forEach(function(o){n.setElement(o[0],o[1])})}*K(e){e!==void 0&&(yield*this.K(e.U),yield[e.u,e.l],yield*this.K(e.W))}begin(){return new Ge(this.h.U||this.h,this.h,this)}end(){return new Ge(this.h,this.h,this)}rBegin(){return new Ge(this.h.W||this.h,this.h,this,1)}rEnd(){return new Ge(this.h,this.h,this,1)}front(){if(this.i===0)return;let e=this.h.U;return[e.u,e.l]}back(){if(this.i===0)return;let e=this.h.W;return[e.u,e.l]}lowerBound(e){let r=this.X(this.Y,e);return new Ge(r,this.h,this)}upperBound(e){let r=this.Z(this.Y,e);return new Ge(r,this.h,this)}reverseLowerBound(e){let r=this.$(this.Y,e);return new Ge(r,this.h,this)}reverseUpperBound(e){let r=this.rr(this.Y,e);return new Ge(r,this.h,this)}setElement(e,r,i){return this.M(e,r,i)}find(e){let r=this.I(this.Y,e);return new Ge(r,this.h,this)}getElementByKey(e){return this.I(this.Y,e).l}union(e){let r=this;return e.forEach(function(i){r.setElement(i[0],i[1])}),this.i}[Symbol.iterator](){return this.K(this.Y)}},Z1=Ra;Jn.default=Z1});var Ba=M(Ca=>{"use strict";_();v();m();Object.defineProperty(Ca,"t",{value:!0});Ca.default=ev;function ev(t){let e=typeof t;return e==="object"&&t!==null||e==="function"}});var xa=M(ti=>{"use strict";_();v();m();Object.defineProperty(ti,"t",{value:!0});ti.HashContainerIterator=ti.HashContainer=void 0;var pp=lt(),Pa=tv(Ba()),Ci=ut();function tv(t){return t&&t.t?t:{default:t}}var ka=class extends pp.ContainerIterator{constructor(e,r,i){super(i),this.o=e,this.h=r,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,Ci.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,Ci.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,Ci.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,Ci.throwIteratorAccessError)(),this.o=this.o.L,this})}};ti.HashContainerIterator=ka;var Oa=class extends pp.Container{constructor(){super(),this.H=[],this.g={},this.HASH_TAG=Symbol("@@HASH_TAG"),Object.setPrototypeOf(this.g,null),this.h={},this.h.L=this.h.B=this.p=this._=this.h}V(e){let{L:r,B:i}=e;r.B=i,i.L=r,e===this.p&&(this.p=i),e===this._&&(this._=r),this.i-=1}M(e,r,i){i===void 0&&(i=(0,Pa.default)(e));let n;if(i){let o=e[this.HASH_TAG];if(o!==void 0)return this.H[o].l=r,this.i;Object.defineProperty(e,this.HASH_TAG,{value:this.H.length,configurable:!0}),n={u:e,l:r,L:this._,B:this.h},this.H.push(n)}else{let o=this.g[e];if(o)return o.l=r,this.i;n={u:e,l:r,L:this._,B:this.h},this.g[e]=n}return this.i===0?(this.p=n,this.h.B=n):this._.B=n,this._=n,this.h.L=n,++this.i}I(e,r){if(r===void 0&&(r=(0,Pa.default)(e)),r){let i=e[this.HASH_TAG];return i===void 0?this.h:this.H[i]}else return this.g[e]||this.h}clear(){let e=this.HASH_TAG;this.H.forEach(function(r){delete r.u[e]}),this.H=[],this.g={},Object.setPrototypeOf(this.g,null),this.i=0,this.p=this._=this.h.L=this.h.B=this.h}eraseElementByKey(e,r){let i;if(r===void 0&&(r=(0,Pa.default)(e)),r){let n=e[this.HASH_TAG];if(n===void 0)return!1;delete e[this.HASH_TAG],i=this.H[n],delete this.H[n]}else{if(i=this.g[e],i===void 0)return!1;delete this.g[e]}return this.V(i),!0}eraseElementByIterator(e){let r=e.o;return r===this.h&&(0,Ci.throwIteratorAccessError)(),this.V(r),e.next()}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return this.V(r),this.i}};ti.HashContainer=Oa});var yp=M(Xn=>{"use strict";_();v();m();Object.defineProperty(Xn,"t",{value:!0});Xn.default=void 0;var gp=xa(),rv=ut(),Ar=class t extends gp.HashContainerIterator{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){return this.o===this.h&&(0,rv.throwIteratorAccessError)(),this.o.u}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},Ma=class extends gp.HashContainer{constructor(e=[]){super();let r=this;e.forEach(function(i){r.insert(i)})}begin(){return new Ar(this.p,this.h,this)}end(){return new Ar(this.h,this.h,this)}rBegin(){return new Ar(this._,this.h,this,1)}rEnd(){return new Ar(this.h,this.h,this,1)}front(){return this.p.u}back(){return this._.u}insert(e,r){return this.M(e,void 0,r)}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return r.u}find(e,r){let i=this.I(e,r);return new Ar(i,this.h,this)}forEach(e){let r=0,i=this.p;for(;i!==this.h;)e(i.u,r++,this),i=i.B}[Symbol.iterator](){return function*(){let e=this.p;for(;e!==this.h;)yield e.u,e=e.B}.bind(this)()}},iv=Ma;Xn.default=iv});var wp=M(Zn=>{"use strict";_();v();m();Object.defineProperty(Zn,"t",{value:!0});Zn.default=void 0;var bp=xa(),nv=ov(Ba()),sv=ut();function ov(t){return t&&t.t?t:{default:t}}var Ir=class t extends bp.HashContainerIterator{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){this.o===this.h&&(0,sv.throwIteratorAccessError)();let e=this;return new Proxy([],{get(r,i){if(i==="0")return e.o.u;if(i==="1")return e.o.l},set(r,i,n){if(i!=="1")throw new TypeError("props must be 1");return e.o.l=n,!0}})}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},La=class extends bp.HashContainer{constructor(e=[]){super();let r=this;e.forEach(function(i){r.setElement(i[0],i[1])})}begin(){return new Ir(this.p,this.h,this)}end(){return new Ir(this.h,this.h,this)}rBegin(){return new Ir(this._,this.h,this,1)}rEnd(){return new Ir(this.h,this.h,this,1)}front(){if(this.i!==0)return[this.p.u,this.p.l]}back(){if(this.i!==0)return[this._.u,this._.l]}setElement(e,r,i){return this.M(e,r,i)}getElementByKey(e,r){if(r===void 0&&(r=(0,nv.default)(e)),r){let n=e[this.HASH_TAG];return n!==void 0?this.H[n].l:void 0}let i=this.g[e];return i?i.l:void 0}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return[r.u,r.l]}find(e,r){let i=this.I(e,r);return new Ir(i,this.h,this)}forEach(e){let r=0,i=this.p;for(;i!==this.h;)e([i.u,i.l],r++,this),i=i.B}[Symbol.iterator](){return function*(){let e=this.p;for(;e!==this.h;)yield[e.u,e.l],e=e.B}.bind(this)()}},av=La;Zn.default=av});var _p=M(je=>{"use strict";_();v();m();Object.defineProperty(je,"t",{value:!0});Object.defineProperty(je,"Deque",{enumerable:!0,get:function(){return dv.default}});Object.defineProperty(je,"HashMap",{enumerable:!0,get:function(){return bv.default}});Object.defineProperty(je,"HashSet",{enumerable:!0,get:function(){return yv.default}});Object.defineProperty(je,"LinkList",{enumerable:!0,get:function(){return hv.default}});Object.defineProperty(je,"OrderedMap",{enumerable:!0,get:function(){return gv.default}});Object.defineProperty(je,"OrderedSet",{enumerable:!0,get:function(){return pv.default}});Object.defineProperty(je,"PriorityQueue",{enumerable:!0,get:function(){return fv.default}});Object.defineProperty(je,"Queue",{enumerable:!0,get:function(){return uv.default}});Object.defineProperty(je,"Stack",{enumerable:!0,get:function(){return lv.default}});Object.defineProperty(je,"Vector",{enumerable:!0,get:function(){return cv.default}});var lv=ft(tp()),uv=ft(rp()),fv=ft(ip()),cv=ft(np()),hv=ft(sp()),dv=ft(op()),pv=ft(cp()),gv=ft(dp()),yv=ft(yp()),bv=ft(wp());function ft(t){return t&&t.t?t:{default:t}}});var vp=M((lx,mp)=>{"use strict";_();v();m();var wv=_p().OrderedSet,ct=ot()("number-allocator:trace"),_v=ot()("number-allocator:error");function Re(t,e){this.low=t,this.high=e}Re.prototype.equals=function(t){return this.low===t.low&&this.high===t.high};Re.prototype.compare=function(t){return this.lowr.compare(i)),ct("Create"),this.clear()}ht.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low};ht.prototype.alloc=function(){if(this.ss.size()===0)return ct("alloc():empty"),null;let t=this.ss.begin(),e=t.pointer.low,r=t.pointer.high,i=e;return i+1<=r?this.ss.updateKeyByIterator(t,new Re(e+1,r)):this.ss.eraseElementByPos(0),ct("alloc():"+i),i};ht.prototype.use=function(t){let e=new Re(t,t),r=this.ss.lowerBound(e);if(!r.equals(this.ss.end())){let i=r.pointer.low,n=r.pointer.high;return r.pointer.equals(e)?(this.ss.eraseElementByIterator(r),ct("use():"+t),!0):i>t?!1:i===t?(this.ss.updateKeyByIterator(r,new Re(i+1,n)),ct("use():"+t),!0):n===t?(this.ss.updateKeyByIterator(r,new Re(i,n-1)),ct("use():"+t),!0):(this.ss.updateKeyByIterator(r,new Re(t+1,n)),this.ss.insert(new Re(i,t-1)),ct("use():"+t),!0)}return ct("use():failed"),!1};ht.prototype.free=function(t){if(tthis.max){_v("free():"+t+" is out of range");return}let e=new Re(t,t),r=this.ss.upperBound(e);if(r.equals(this.ss.end())){if(r.equals(this.ss.begin())){this.ss.insert(e);return}r.pre();let i=r.pointer.high;r.pointer.high+1===t?this.ss.updateKeyByIterator(r,new Re(i,t)):this.ss.insert(e)}else if(r.equals(this.ss.begin()))if(t+1===r.pointer.low){let i=r.pointer.high;this.ss.updateKeyByIterator(r,new Re(t,i))}else this.ss.insert(e);else{let i=r.pointer.low,n=r.pointer.high;r.pre();let o=r.pointer.low;r.pointer.high+1===t?t+1===i?(this.ss.eraseElementByIterator(r),this.ss.updateKeyByIterator(r,new Re(o,n))):this.ss.updateKeyByIterator(r,new Re(o,t)):t+1===i?(this.ss.eraseElementByIterator(r.next()),this.ss.insert(new Re(t,n))):this.ss.insert(e)}ct("free():"+t)};ht.prototype.clear=function(){ct("clear()"),this.ss.clear(),this.ss.insert(new Re(this.min,this.max))};ht.prototype.intervalCount=function(){return this.ss.size()};ht.prototype.dump=function(){console.log("length:"+this.ss.size());for(let t of this.ss)console.log(t)};mp.exports=ht});var Ua=M((gx,Ep)=>{_();v();m();var mv=vp();Ep.exports.NumberAllocator=mv});var Sp=M(qa=>{"use strict";_();v();m();Object.defineProperty(qa,"__esModule",{value:!0});var vv=ep(),Ev=Ua(),Na=class{constructor(e){e>0&&(this.aliasToTopic=new vv.LRUCache({max:e}),this.topicToAlias={},this.numberAllocator=new Ev.NumberAllocator(1,e),this.max=e,this.length=0)}put(e,r){if(r===0||r>this.max)return!1;let i=this.aliasToTopic.get(r);return i&&delete this.topicToAlias[i],this.aliasToTopic.set(r,e),this.topicToAlias[e]=r,this.numberAllocator.use(r),this.length=this.aliasToTopic.size,!0}getTopicByAlias(e){return this.aliasToTopic.get(e)}getAliasByTopic(e){let r=this.topicToAlias[e];return typeof r<"u"&&this.aliasToTopic.get(r),r}clear(){this.aliasToTopic.clear(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0}getLruAlias(){let e=this.numberAllocator.firstVacant();return e||[...this.aliasToTopic.keys()][this.aliasToTopic.size-1]}};qa.default=Na});var Ap=M(Bi=>{"use strict";_();v();m();var Sv=Bi&&Bi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Bi,"__esModule",{value:!0});var Av=Ti(),Iv=Sv(Sp()),Tv=_r(),Rv=(t,e)=>{t.log("_handleConnack");let{options:r}=t,n=r.protocolVersion===5?e.reasonCode:e.returnCode;if(clearTimeout(t.connackTimer),delete t.topicAliasSend,e.properties){if(e.properties.topicAliasMaximum){if(e.properties.topicAliasMaximum>65535){t.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}e.properties.topicAliasMaximum>0&&(t.topicAliasSend=new Iv.default(e.properties.topicAliasMaximum))}e.properties.serverKeepAlive&&r.keepalive&&(r.keepalive=e.properties.serverKeepAlive),e.properties.maximumPacketSize&&(r.properties||(r.properties={}),r.properties.maximumPacketSize=e.properties.maximumPacketSize)}if(n===0)t.reconnecting=!1,t._onConnect(e);else if(n>0){let o=new Tv.ErrorWithReasonCode(`Connection refused: ${Av.ReasonCodes[n]}`,n);t.emit("error",o),t.options.reconnectOnConnackError&&t._cleanUp(!0)}};Bi.default=Rv});var Ip=M(Da=>{"use strict";_();v();m();Object.defineProperty(Da,"__esModule",{value:!0});var Cv=(t,e,r)=>{t.log("handling pubrel packet");let i=typeof r<"u"?r:t.noop,{messageId:n}=e,o={cmd:"pubcomp",messageId:n};t.incomingStore.get(e,(s,a)=>{s?t._sendPacket(o,i):(t.emit("message",a.topic,a.payload,a),t.handleMessage(a,l=>{if(l)return i(l);t.incomingStore.del(a,t.noop),t._sendPacket(o,i)}))})};Da.default=Cv});var Tp=M(Pi=>{"use strict";_();v();m();var ki=Pi&&Pi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Pi,"__esModule",{value:!0});var Bv=ki(Vd()),Pv=ki(Qd()),kv=ki(Ap()),Ov=ki(Ti()),xv=ki(Ip()),Mv=(t,e,r)=>{let{options:i}=t;if(i.protocolVersion===5&&i.properties&&i.properties.maximumPacketSize&&i.properties.maximumPacketSize{"use strict";_();v();m();var Lv=ri&&ri.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ri,"__esModule",{value:!0});ri.TypedEventEmitter=void 0;var Uv=Lv((sr(),X(nr))),Nv=_r(),es=class{};ri.TypedEventEmitter=es;(0,Nv.applyMixin)(es,Uv.default)});var Oi=M(Tr=>{"use strict";_();v();m();Object.defineProperty(Tr,"__esModule",{value:!0});Tr.isReactNativeBrowser=Tr.isWebWorker=void 0;var qv=()=>{var t;return typeof window<"u"?typeof navigator<"u"&&((t=navigator.userAgent)===null||t===void 0?void 0:t.toLowerCase().indexOf(" electron/"))>-1&&(!(B===null||B===void 0)&&B.versions)?!Object.prototype.hasOwnProperty.call(B.versions,"electron"):typeof window.document<"u":!1},Cp=()=>{var t,e;return!!(typeof self=="object"&&(!((e=(t=self?.constructor)===null||t===void 0?void 0:t.name)===null||e===void 0)&&e.includes("WorkerGlobalScope")))},Bp=()=>typeof navigator<"u"&&navigator.product==="ReactNative",Dv=qv()||Cp()||Bp();Tr.isWebWorker=Cp();Tr.isReactNativeBrowser=Bp();Tr.default=Dv});var kp=M((ts,Pp)=>{_();v();m();(function(t,e){typeof ts=="object"&&typeof Pp<"u"?e(ts):typeof define=="function"&&define.amd?define(["exports"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.fastUniqueNumbers={}))})(ts,function(t){"use strict";var e=function(g){return function(y){var w=g(y);return y.add(w),w}},r=function(g){return function(y,w){return g.set(y,w),w}},i=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,n=536870912,o=n*2,s=function(g,y){return function(w){var S=y.get(w),E=S===void 0?w.size:Si)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;w.has(E);)E=Math.floor(Math.random()*i);return g(w,E)}},a=new WeakMap,l=r(a),c=s(l,a),h=e(c);t.addUniqueNumber=h,t.generateUniqueNumber=c})});var xp=M((rs,Op)=>{_();v();m();(function(t,e){typeof rs=="object"&&typeof Op<"u"?e(rs,kp()):typeof define=="function"&&define.amd?define(["exports","fast-unique-numbers"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.workerTimersBroker={},t.fastUniqueNumbers))})(rs,function(t,e){"use strict";var r=function(s){return s.method!==void 0&&s.method==="call"},i=function(s){return s.error===null&&typeof s.id=="number"},n=function(s){var a=new Map([[0,function(){}]]),l=new Map([[0,function(){}]]),c=new Map,h=new Worker(s);h.addEventListener("message",function(S){var E=S.data;if(r(E)){var I=E.params,C=I.timerId,R=I.timerType;if(R==="interval"){var U=a.get(C);if(typeof U=="number"){var N=c.get(U);if(N===void 0||N.timerId!==C||N.timerType!==R)throw new Error("The timer is in an undefined state.")}else if(typeof U<"u")U();else throw new Error("The timer is in an undefined state.")}else if(R==="timeout"){var W=l.get(C);if(typeof W=="number"){var K=c.get(W);if(K===void 0||K.timerId!==C||K.timerType!==R)throw new Error("The timer is in an undefined state.")}else if(typeof W<"u")W(),l.delete(C);else throw new Error("The timer is in an undefined state.")}}else if(i(E)){var z=E.id,Q=c.get(z);if(Q===void 0)throw new Error("The timer is in an undefined state.");var pe=Q.timerId,Yt=Q.timerType;c.delete(z),Yt==="interval"?a.delete(pe):l.delete(pe)}else{var ge=E.error.message;throw new Error(ge)}});var d=function(E){var I=e.generateUniqueNumber(c);c.set(I,{timerId:E,timerType:"interval"}),a.set(E,I),h.postMessage({id:I,method:"clear",params:{timerId:E,timerType:"interval"}})},g=function(E){var I=e.generateUniqueNumber(c);c.set(I,{timerId:E,timerType:"timeout"}),l.set(E,I),h.postMessage({id:I,method:"clear",params:{timerId:E,timerType:"timeout"}})},y=function(E){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,C=e.generateUniqueNumber(a);return a.set(C,function(){E(),typeof a.get(C)=="function"&&h.postMessage({id:null,method:"set",params:{delay:I,now:performance.now(),timerId:C,timerType:"interval"}})}),h.postMessage({id:null,method:"set",params:{delay:I,now:performance.now(),timerId:C,timerType:"interval"}}),C},w=function(E){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,C=e.generateUniqueNumber(l);return l.set(C,E),h.postMessage({id:null,method:"set",params:{delay:I,now:performance.now(),timerId:C,timerType:"timeout"}}),C};return{clearInterval:d,clearTimeout:g,setInterval:y,setTimeout:w}};t.load=n})});var Lp=M((is,Mp)=>{_();v();m();(function(t,e){typeof is=="object"&&typeof Mp<"u"?e(is,xp()):typeof define=="function"&&define.amd?define(["exports","worker-timers-broker"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t.workerTimers={},t.workerTimersBroker))})(is,function(t,e){"use strict";var r=function(h,d){var g=null;return function(){if(g!==null)return g;var y=new Blob([d],{type:"application/javascript; charset=utf-8"}),w=URL.createObjectURL(y);return g=h(w),setTimeout(function(){return URL.revokeObjectURL(w)}),g}},i=`(()=>{var e={472:(e,t,r)=>{var o,i;void 0===(i="function"==typeof(o=function(){"use strict";var e=new Map,t=new Map,r=function(t){var r=e.get(t);if(void 0===r)throw new Error('There is no interval scheduled with the given id "'.concat(t,'".'));clearTimeout(r),e.delete(t)},o=function(e){var r=t.get(e);if(void 0===r)throw new Error('There is no timeout scheduled with the given id "'.concat(e,'".'));clearTimeout(r),t.delete(e)},i=function(e,t){var r,o=performance.now();return{expected:o+(r=e-Math.max(0,o-t)),remainingDelay:r}},n=function e(t,r,o,i){var n=performance.now();n>o?postMessage({id:null,method:"call",params:{timerId:r,timerType:i}}):t.set(r,setTimeout(e,o-n,t,r,o,i))},a=function(t,r,o){var a=i(t,o),s=a.expected,d=a.remainingDelay;e.set(r,setTimeout(n,d,e,r,s,"interval"))},s=function(e,r,o){var a=i(e,o),s=a.expected,d=a.remainingDelay;t.set(r,setTimeout(n,d,t,r,s,"timeout"))};addEventListener("message",(function(e){var t=e.data;try{if("clear"===t.method){var i=t.id,n=t.params,d=n.timerId,c=n.timerType;if("interval"===c)r(d),postMessage({error:null,id:i});else{if("timeout"!==c)throw new Error('The given type "'.concat(c,'" is not supported'));o(d),postMessage({error:null,id:i})}}else{if("set"!==t.method)throw new Error('The given method "'.concat(t.method,'" is not supported'));var u=t.params,l=u.delay,p=u.now,m=u.timerId,v=u.timerType;if("interval"===v)a(l,m,p);else{if("timeout"!==v)throw new Error('The given type "'.concat(v,'" is not supported'));s(l,m,p)}}}catch(e){postMessage({error:{message:e.message},id:t.id,result:null})}}))})?o.call(t,r,t,e):o)||(e.exports=i)}},t={};function r(o){var i=t[o];if(void 0!==i)return i.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";r(472)})()})();`,n=r(e.load,i),o=function(h){return n().clearInterval(h)},s=function(h){return n().clearTimeout(h)},a=function(){var h;return(h=n()).setInterval.apply(h,arguments)},l=function(){var h;return(h=n()).setTimeout.apply(h,arguments)};t.clearInterval=o,t.clearTimeout=s,t.setInterval=a,t.setTimeout=l})});var Dp=M(Ct=>{"use strict";_();v();m();var jv=Ct&&Ct.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),Fv=Ct&&Ct.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wv=Ct&&Ct.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&jv(e,t,r);return Fv(e,t),e};Object.defineProperty(Ct,"__esModule",{value:!0});var ja=Wv(Oi()),Up=Lp(),Np={set:Up.setInterval,clear:Up.clearInterval},qp={set:(t,e)=>setInterval(t,e),clear:t=>clearInterval(t)},$v=t=>{switch(t){case"native":return qp;case"worker":return Np;case"auto":default:return ja.default&&!ja.isWebWorker&&!ja.isReactNativeBrowser?Np:qp}};Ct.default=$v});var Wa=M(xi=>{"use strict";_();v();m();var Hv=xi&&xi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xi,"__esModule",{value:!0});var Vv=Hv(Dp()),Fa=class{get keepaliveTimeoutTimestamp(){return this._keepaliveTimeoutTimestamp}get intervalEvery(){return this._intervalEvery}get keepalive(){return this._keepalive}constructor(e,r){this.destroyed=!1,this.client=e,this.timer=typeof r=="object"&&"set"in r&&"clear"in r?r:(0,Vv.default)(r),this.setKeepalive(e.options.keepalive)}clear(){this.timerId&&(this.timer.clear(this.timerId),this.timerId=null)}setKeepalive(e){if(e*=1e3,isNaN(e)||e<=0||e>2147483647)throw new Error(`Keepalive value must be an integer between 0 and 2147483647. Provided value is ${e}`);this._keepalive=e,this.reschedule(),this.client.log(`KeepaliveManager: set keepalive to ${e}ms`)}destroy(){this.clear(),this.destroyed=!0}reschedule(){if(this.destroyed)return;this.clear(),this.counter=0;let e=Math.ceil(this._keepalive*1.5);this._keepaliveTimeoutTimestamp=Date.now()+e,this._intervalEvery=Math.ceil(this._keepalive/2),this.timerId=this.timer.set(()=>{this.destroyed||(this.counter+=1,this.counter===2?this.client.sendPing():this.counter>2&&this.client.onKeepaliveTimeout())},this._intervalEvery)}};xi.default=Fa});var os=M(Qe=>{"use strict";_();v();m();var zv=Qe&&Qe.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),Kv=Qe&&Qe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hp=Qe&&Qe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&zv(e,t,r);return Kv(e,t),e},zt=Qe&&Qe.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qe,"__esModule",{value:!0});var Gv=zt(Gu()),$a=zt(Nd()),Qv=zt(Zo()),Yv=jt(),jp=zt(Fd()),Fp=Hp($d()),Jv=zt(ot()),ii=zt(ra()),Xv=zt(Tp()),ns=_r(),Zv=Rp(),eE=zt(Wa()),Wp=Hp(Oi()),Ha=globalThis.setImmediate||((...t)=>{let e=t.shift();(0,ns.nextTick)(()=>{e(...t)})}),$p={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0,writeCache:!0,timerVariant:"auto"},ss=class t extends Zv.TypedEventEmitter{static defaultId(){return`mqttjs_${Math.random().toString(16).substr(2,8)}`}constructor(e,r){super(),this.options=r||{};for(let i in $p)typeof this.options[i]>"u"?this.options[i]=$p[i]:this.options[i]=r[i];this.log=this.options.log||(0,Jv.default)("mqttjs:client"),this.noop=this._noop.bind(this),this.log("MqttClient :: version:",t.VERSION),Wp.isWebWorker?this.log("MqttClient :: environment","webworker"):this.log("MqttClient :: environment",Wp.default?"browser":"node"),this.log("MqttClient :: options.protocol",r.protocol),this.log("MqttClient :: options.protocolVersion",r.protocolVersion),this.log("MqttClient :: options.username",r.username),this.log("MqttClient :: options.keepalive",r.keepalive),this.log("MqttClient :: options.reconnectPeriod",r.reconnectPeriod),this.log("MqttClient :: options.rejectUnauthorized",r.rejectUnauthorized),this.log("MqttClient :: options.properties.topicAliasMaximum",r.properties?r.properties.topicAliasMaximum:void 0),this.options.clientId=typeof r.clientId=="string"?r.clientId:t.defaultId(),this.log("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=r.protocolVersion===5&&r.customHandleAcks?r.customHandleAcks:(...i)=>{i[3](null,0)},this.options.writeCache||($a.default.writeToStream.cacheNumbers=!1),this.streamBuilder=e,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new Qv.default:this.options.messageIdProvider,this.outgoingStore=r.outgoingStore||new ii.default,this.incomingStore=r.incomingStore||new ii.default,this.queueQoSZero=r.queueQoSZero===void 0?!0:r.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.keepaliveManager=null,this.connected=!1,this.disconnecting=!1,this.reconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,r.properties&&r.properties.topicAliasMaximum>0&&(r.properties.topicAliasMaximum>65535?this.log("MqttClient :: options.properties.topicAliasMaximum is out of range"):this.topicAliasRecv=new Gv.default(r.properties.topicAliasMaximum)),this.on("connect",()=>{let{queue:i}=this,n=()=>{let o=i.shift();this.log("deliver :: entry %o",o);let s=null;if(!o){this._resubscribe();return}s=o.packet,this.log("deliver :: call _sendPacket for %o",s);let a=!0;s.messageId&&s.messageId!==0&&(this.messageIdProvider.register(s.messageId)||(a=!1)),a?this._sendPacket(s,l=>{o.cb&&o.cb(l),n()}):(this.log("messageId: %d has already used. The message is skipped and removed.",s.messageId),n())};this.log("connect :: sending queued packets"),n()}),this.on("close",()=>{this.log("close :: connected set to `false`"),this.connected=!1,this.log("close :: clearing connackTimer"),clearTimeout(this.connackTimer),this._destroyKeepaliveManager(),this.topicAliasRecv&&this.topicAliasRecv.clear(),this.log("close :: calling _setupReconnect"),this._setupReconnect()}),this.options.manualConnect||(this.log("MqttClient :: setting up stream"),this.connect())}handleAuth(e,r){r()}handleMessage(e,r){r()}_nextId(){return this.messageIdProvider.allocate()}getLastMessageId(){return this.messageIdProvider.getLastAllocated()}connect(){var e;let r=new Yv.Writable,i=$a.default.parser(this.options),n=null,o=[];this.log("connect :: calling method to clear reconnect"),this._clearReconnect(),this.disconnected&&!this.reconnecting&&(this.incomingStore=this.options.incomingStore||new ii.default,this.outgoingStore=this.options.outgoingStore||new ii.default,this.disconnecting=!1,this.disconnected=!1),this.log("connect :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),i.on("packet",h=>{this.log("parser :: on packet push to packets array."),o.push(h)});let s=()=>{this.log("work :: getting next packet in queue");let h=o.shift();if(h)this.log("work :: packet pulled from queue"),(0,Xv.default)(this,h,a);else{this.log("work :: no packets in queue");let d=n;n=null,this.log("work :: done flag is %s",!!d),d&&d()}},a=()=>{if(o.length)(0,ns.nextTick)(s);else{let h=n;n=null,h()}};r._write=(h,d,g)=>{n=g,this.log("writable stream :: parsing buffer"),i.parse(h),s()};let l=h=>{this.log("streamErrorHandler :: error",h.message),h.code?(this.log("streamErrorHandler :: emitting error"),this.emit("error",h)):this.noop(h)};this.log("connect :: pipe stream to writable stream"),this.stream.pipe(r),this.stream.on("error",l),this.stream.on("close",()=>{this.log("(%s)stream :: on close",this.options.clientId),this._flushVolatile(),this.log("stream: emit close to MqttClient"),this.emit("close")}),this.log("connect: sending packet `connect`");let c={cmd:"connect",protocolId:this.options.protocolId,protocolVersion:this.options.protocolVersion,clean:this.options.clean,clientId:this.options.clientId,keepalive:this.options.keepalive,username:this.options.username,password:this.options.password,properties:this.options.properties};if(this.options.will&&(c.will=Object.assign(Object.assign({},this.options.will),{payload:(e=this.options.will)===null||e===void 0?void 0:e.payload})),this.topicAliasRecv&&(c.properties||(c.properties={}),this.topicAliasRecv&&(c.properties.topicAliasMaximum=this.topicAliasRecv.max)),this._writePacket(c),i.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return this.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"){let h=Object.assign({cmd:"auth",reasonCode:0},this.options.authPacket);this._writePacket(h)}}return this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(()=>{this.log("!!connectTimeout hit!! Calling _cleanUp with force `true`"),this.emit("error",new Error("connack timeout")),this._cleanUp(!0)},this.options.connectTimeout),this}publish(e,r,i,n){this.log("publish :: message `%s` to topic `%s`",r,e);let{options:o}=this;typeof i=="function"&&(n=i,i=null),i=i||{},i=Object.assign(Object.assign({},{qos:0,retain:!1,dup:!1}),i);let{qos:a,retain:l,dup:c,properties:h,cbStorePut:d}=i;if(this._checkDisconnecting(n))return this;let g=()=>{let y=0;if((a===1||a===2)&&(y=this._nextId(),y===null))return this.log("No messageId left"),!1;let w={cmd:"publish",topic:e,payload:r,qos:a,retain:l,messageId:y,dup:c};switch(o.protocolVersion===5&&(w.properties=h),this.log("publish :: qos",a),a){case 1:case 2:this.outgoing[w.messageId]={volatile:!1,cb:n||this.noop},this.log("MqttClient:publish: packet cmd: %s",w.cmd),this._sendPacket(w,void 0,d);break;default:this.log("MqttClient:publish: packet cmd: %s",w.cmd),this._sendPacket(w,n,d);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!g())&&this._storeProcessingQueue.push({invoke:g,cbStorePut:i.cbStorePut,callback:n}),this}publishAsync(e,r,i){return new Promise((n,o)=>{this.publish(e,r,i,(s,a)=>{s?o(s):n(a)})})}subscribe(e,r,i){let n=this.options.protocolVersion;typeof r=="function"&&(i=r),i=i||this.noop;let o=!1,s=[];typeof e=="string"?(e=[e],s=e):Array.isArray(e)?s=e:typeof e=="object"&&(o=e.resubscribe,delete e.resubscribe,s=Object.keys(e));let a=Fp.validateTopics(s);if(a!==null)return Ha(i,new Error(`Invalid topic ${a}`)),this;if(this._checkDisconnecting(i))return this.log("subscribe: discconecting true"),this;let l={qos:0};n===5&&(l.nl=!1,l.rap=!1,l.rh=0),r=Object.assign(Object.assign({},l),r);let c=r.properties,h=[],d=(y,w)=>{if(w=w||r,!Object.prototype.hasOwnProperty.call(this._resubscribeTopics,y)||this._resubscribeTopics[y].qos{this.log("subscribe: array topic %s",y),d(y)}):Object.keys(e).forEach(y=>{this.log("subscribe: object topic %s, %o",y,e[y]),d(y,e[y])}),!h.length)return i(null,[]),this;let g=()=>{let y=this._nextId();if(y===null)return this.log("No messageId left"),!1;let w={cmd:"subscribe",subscriptions:h,messageId:y};if(c&&(w.properties=c),this.options.resubscribe){this.log("subscribe :: resubscribe true");let S=[];h.forEach(E=>{if(this.options.reconnectPeriod>0){let I={qos:E.qos};n===5&&(I.nl=E.nl||!1,I.rap=E.rap||!1,I.rh=E.rh||0,I.properties=E.properties),this._resubscribeTopics[E.topic]=I,S.push(E.topic)}}),this.messageIdToTopic[w.messageId]=S}return this.outgoing[w.messageId]={volatile:!0,cb(S,E){if(!S){let{granted:I}=E;for(let C=0;C0||!g())&&this._storeProcessingQueue.push({invoke:g,callback:i}),this}subscribeAsync(e,r){return new Promise((i,n)=>{this.subscribe(e,r,(o,s)=>{o?n(o):i(s)})})}unsubscribe(e,r,i){typeof e=="string"&&(e=[e]),typeof r=="function"&&(i=r),i=i||this.noop;let n=Fp.validateTopics(e);if(n!==null)return Ha(i,new Error(`Invalid topic ${n}`)),this;if(this._checkDisconnecting(i))return this;let o=()=>{let s=this._nextId();if(s===null)return this.log("No messageId left"),!1;let a={cmd:"unsubscribe",messageId:s,unsubscriptions:[]};return typeof e=="string"?a.unsubscriptions=[e]:Array.isArray(e)&&(a.unsubscriptions=e),this.options.resubscribe&&a.unsubscriptions.forEach(l=>{delete this._resubscribeTopics[l]}),typeof r=="object"&&r.properties&&(a.properties=r.properties),this.outgoing[a.messageId]={volatile:!0,cb:i},this.log("unsubscribe: call _sendPacket"),this._sendPacket(a),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!o())&&this._storeProcessingQueue.push({invoke:o,callback:i}),this}unsubscribeAsync(e,r){return new Promise((i,n)=>{this.unsubscribe(e,r,(o,s)=>{o?n(o):i(s)})})}end(e,r,i){this.log("end :: (%s)",this.options.clientId),(e==null||typeof e!="boolean")&&(i=i||r,r=e,e=!1),typeof r!="object"&&(i=i||r,r=null),this.log("end :: cb? %s",!!i),(!i||typeof i!="function")&&(i=this.noop);let n=()=>{this.log("end :: closeStores: closing incoming and outgoing stores"),this.disconnected=!0,this.incomingStore.close(s=>{this.outgoingStore.close(a=>{if(this.log("end :: closeStores: emitting end"),this.emit("end"),i){let l=s||a;this.log("end :: closeStores: invoking callback with args"),i(l)}})}),this._deferredReconnect?this._deferredReconnect():(this.options.reconnectPeriod===0||this.options.manualConnect)&&(this.disconnecting=!1)},o=()=>{this.log("end :: (%s) :: finish :: calling _cleanUp with force %s",this.options.clientId,e),this._cleanUp(e,()=>{this.log("end :: finish :: calling process.nextTick on closeStores"),(0,ns.nextTick)(n)},r)};return this.disconnecting?(i(),this):(this._clearReconnect(),this.disconnecting=!0,!e&&Object.keys(this.outgoing).length>0?(this.log("end :: (%s) :: calling finish in 10ms once outgoing is empty",this.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,o,10))):(this.log("end :: (%s) :: immediately calling finish",this.options.clientId),o()),this)}endAsync(e,r){return new Promise((i,n)=>{this.end(e,r,o=>{o?n(o):i()})})}removeOutgoingMessage(e){if(this.outgoing[e]){let{cb:r}=this.outgoing[e];this._removeOutgoingAndStoreMessage(e,()=>{r(new Error("Message removed"))})}return this}reconnect(e){this.log("client reconnect");let r=()=>{e?(this.options.incomingStore=e.incomingStore,this.options.outgoingStore=e.outgoingStore):(this.options.incomingStore=null,this.options.outgoingStore=null),this.incomingStore=this.options.incomingStore||new ii.default,this.outgoingStore=this.options.outgoingStore||new ii.default,this.disconnecting=!1,this.disconnected=!1,this._deferredReconnect=null,this._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),this}_flushVolatile(){this.outgoing&&(this.log("_flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(this.outgoing).forEach(e=>{this.outgoing[e].volatile&&typeof this.outgoing[e].cb=="function"&&(this.outgoing[e].cb(new Error("Connection closed")),delete this.outgoing[e])}))}_flush(){this.outgoing&&(this.log("_flush: queue exists? %b",!!this.outgoing),Object.keys(this.outgoing).forEach(e=>{typeof this.outgoing[e].cb=="function"&&(this.outgoing[e].cb(new Error("Connection closed")),delete this.outgoing[e])}))}_removeTopicAliasAndRecoverTopicName(e){let r;e.properties&&(r=e.properties.topicAlias);let i=e.topic.toString();if(this.log("_removeTopicAliasAndRecoverTopicName :: alias %d, topic %o",r,i),i.length===0){if(typeof r>"u")return new Error("Unregistered Topic Alias");if(i=this.topicAliasSend.getTopicByAlias(r),typeof i>"u")return new Error("Unregistered Topic Alias");e.topic=i}r&&delete e.properties.topicAlias}_checkDisconnecting(e){return this.disconnecting&&(e&&e!==this.noop?e(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting}_reconnect(){this.log("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this.connect()}),this.log("client already connected. disconnecting first.")):(this.log("_reconnect: calling connect"),this.connect())}_setupReconnect(){!this.disconnecting&&!this.reconnectTimer&&this.options.reconnectPeriod>0?(this.reconnecting||(this.log("_setupReconnect :: emit `offline` state"),this.emit("offline"),this.log("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),this.log("_setupReconnect :: setting reconnectTimer for %d ms",this.options.reconnectPeriod),this.reconnectTimer=setInterval(()=>{this.log("reconnectTimer :: reconnect triggered!"),this._reconnect()},this.options.reconnectPeriod)):this.log("_setupReconnect :: doing nothing...")}_clearReconnect(){this.log("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)}_cleanUp(e,r,i={}){if(r&&(this.log("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",r)),this.log("_cleanUp :: forced? %s",e),e)this.options.reconnectPeriod===0&&this.options.clean&&this._flush(),this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{let n=Object.assign({cmd:"disconnect"},i);this.log("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(n,()=>{this.log("_cleanUp :: (%s) :: destroying stream",this.options.clientId),Ha(()=>{this.stream.end(()=>{this.log("_cleanUp :: (%s) :: stream destroyed",this.options.clientId)})})})}!this.disconnecting&&!this.reconnecting&&(this.log("_cleanUp :: client not disconnecting/reconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this._destroyKeepaliveManager(),r&&!this.connected&&(this.log("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",r),r())}_storeAndSend(e,r,i){this.log("storeAndSend :: store packet with cmd %s to outgoingStore",e.cmd);let n=e,o;if(n.cmd==="publish"&&(n=(0,jp.default)(e),o=this._removeTopicAliasAndRecoverTopicName(n),o))return r&&r(o);this.outgoingStore.put(n,s=>{if(s)return r&&r(s);i(),this._writePacket(e,r)})}_applyTopicAlias(e){if(this.options.protocolVersion===5&&e.cmd==="publish"){let r;e.properties&&(r=e.properties.topicAlias);let i=e.topic.toString();if(this.topicAliasSend)if(r){if(i.length!==0&&(this.log("applyTopicAlias :: register topic: %s - alias: %d",i,r),!this.topicAliasSend.put(i,r)))return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",i,r),new Error("Sending Topic Alias out of range")}else i.length!==0&&(this.options.autoAssignTopicAlias?(r=this.topicAliasSend.getAliasByTopic(i),r?(e.topic="",e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",i,r)):(r=this.topicAliasSend.getLruAlias(),this.topicAliasSend.put(i,r),e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log("applyTopicAlias :: auto assign topic: %s - alias: %d",i,r))):this.options.autoUseTopicAlias&&(r=this.topicAliasSend.getAliasByTopic(i),r&&(e.topic="",e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log("applyTopicAlias :: auto use topic: %s - alias: %d",i,r))));else if(r)return this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d",i,r),new Error("Sending Topic Alias out of range")}}_noop(e){this.log("noop ::",e)}_writePacket(e,r){this.log("_writePacket :: packet: %O",e),this.log("_writePacket :: emitting `packetsend`"),this.emit("packetsend",e),this.log("_writePacket :: writing to stream");let i=$a.default.writeToStream(e,this.stream,this.options);this.log("_writePacket :: writeToStream result %s",i),!i&&r&&r!==this.noop?(this.log("_writePacket :: handle events on `drain` once through callback."),this.stream.once("drain",r)):r&&(this.log("_writePacket :: invoking cb"),r())}_sendPacket(e,r,i,n){this.log("_sendPacket :: (%s) :: start",this.options.clientId),i=i||this.noop,r=r||this.noop;let o=this._applyTopicAlias(e);if(o){r(o);return}if(!this.connected){if(e.cmd==="auth"){this._writePacket(e,r);return}this.log("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(e,r,i);return}if(n){this._writePacket(e,r);return}switch(e.cmd){case"publish":break;case"pubrel":this._storeAndSend(e,r,i);return;default:this._writePacket(e,r);return}switch(e.qos){case 2:case 1:this._storeAndSend(e,r,i);break;case 0:default:this._writePacket(e,r);break}this.log("_sendPacket :: (%s) :: end",this.options.clientId)}_storePacket(e,r,i){this.log("_storePacket :: packet: %o",e),this.log("_storePacket :: cb? %s",!!r),i=i||this.noop;let n=e;if(n.cmd==="publish"){n=(0,jp.default)(e);let s=this._removeTopicAliasAndRecoverTopicName(n);if(s)return r&&r(s)}let o=n.qos||0;o===0&&this.queueQoSZero||n.cmd!=="publish"?this.queue.push({packet:n,cb:r}):o>0?(r=this.outgoing[n.messageId]?this.outgoing[n.messageId].cb:null,this.outgoingStore.put(n,s=>{if(s)return r&&r(s);i()})):r&&r(new Error("No connection to broker"))}_setupKeepaliveManager(){this.log("_setupKeepaliveManager :: keepalive %d (seconds)",this.options.keepalive),!this.keepaliveManager&&this.options.keepalive&&(this.keepaliveManager=new eE.default(this,this.options.timerVariant))}_destroyKeepaliveManager(){this.keepaliveManager&&(this.log("_destroyKeepaliveManager :: destroying keepalive manager"),this.keepaliveManager.destroy(),this.keepaliveManager=null)}reschedulePing(e=!1){this.keepaliveManager&&this.options.keepalive&&(e||this.options.reschedulePings)&&this._reschedulePing()}_reschedulePing(){this.log("_reschedulePing :: rescheduling ping"),this.keepaliveManager.reschedule()}sendPing(){this.log("_sendPing :: sending pingreq"),this._sendPacket({cmd:"pingreq"})}onKeepaliveTimeout(){this.emit("error",new Error("Keepalive timeout")),this.log("onKeepaliveTimeout :: calling _cleanUp with force true"),this._cleanUp(!0)}_resubscribe(){this.log("_resubscribe");let e=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion>=4&&!this.connackPacket.sessionPresent)&&e.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){this.log("_resubscribe: protocolVersion 5");for(let r=0;r{let i=this.outgoingStore.createStream(),n=()=>{i.destroy(),i=null,this._flushStoreProcessingQueue(),o()},o=()=>{this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={}};this.once("close",n),i.on("error",a=>{o(),this._flushStoreProcessingQueue(),this.removeListener("close",n),this.emit("error",a)});let s=()=>{if(!i)return;let a=i.read(1),l;if(!a){i.once("readable",s);return}if(this._storeProcessing=!0,this._packetIdsDuringStoreProcessing[a.messageId]){s();return}!this.disconnecting&&!this.reconnectTimer?(l=this.outgoing[a.messageId]?this.outgoing[a.messageId].cb:null,this.outgoing[a.messageId]={volatile:!1,cb(c,h){l&&l(c,h),s()}},this._packetIdsDuringStoreProcessing[a.messageId]=!0,this.messageIdProvider.register(a.messageId)?this._sendPacket(a,void 0,void 0,!0):this.log("messageId: %d has already used.",a.messageId)):i.destroy&&i.destroy()};i.on("end",()=>{let a=!0;for(let l in this._packetIdsDuringStoreProcessing)if(!this._packetIdsDuringStoreProcessing[l]){a=!1;break}this.removeListener("close",n),a?(o(),this._invokeAllStoreProcessingQueue(),this.emit("connect",e)):r()}),s()};r()}_invokeStoreProcessingQueue(){if(!this._storeProcessing&&this._storeProcessingQueue.length>0){let e=this._storeProcessingQueue[0];if(e&&e.invoke())return this._storeProcessingQueue.shift(),!0}return!1}_invokeAllStoreProcessingQueue(){for(;this._invokeStoreProcessingQueue(););}_flushStoreProcessingQueue(){for(let e of this._storeProcessingQueue)e.cbStorePut&&e.cbStorePut(new Error("Connection closed")),e.callback&&e.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)}_removeOutgoingAndStoreMessage(e,r){delete this.outgoing[e],this.outgoingStore.del({messageId:e},(i,n)=>{r(i,n),this.messageIdProvider.deallocate(e),this._invokeStoreProcessingQueue()})}};ss.VERSION=ns.MQTTJS_VERSION;Qe.default=ss});var Vp=M(za=>{"use strict";_();v();m();Object.defineProperty(za,"__esModule",{value:!0});var tE=Ua(),Va=class{constructor(){this.numberAllocator=new tE.NumberAllocator(1,65535)}allocate(){return this.lastId=this.numberAllocator.alloc(),this.lastId}getLastAllocated(){return this.lastId}register(e){return this.numberAllocator.use(e)}deallocate(e){this.numberAllocator.free(e)}clear(){this.numberAllocator.clear()}};za.default=Va});function Rr(t){throw new RangeError(sE[t])}function zp(t,e){let r=t.split("@"),i="";r.length>1&&(i=r[0]+"@",t=r[1]);let n=function(o,s){let a=[],l=o.length;for(;l--;)a[l]=s(o[l]);return a}((t=t.replace(nE,".")).split("."),e).join(".");return i+n}function Yp(t){let e=[],r=0,i=t.length;for(;r=55296&&n<=56319&&r{_();v();m();rE=/^xn--/,iE=/[^\0-\x7E]/,nE=/[\x2E\u3002\uFF0E\uFF61]/g,sE={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},dt=Math.floor,Ka=String.fromCharCode;Kp=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Jp=function(t,e,r){let i=0;for(t=r?dt(t/700):t>>1,t+=dt(t/e);t>455;i+=36)t=dt(t/35);return dt(i+36*t/(t+38))},Gp=function(t){let e=[],r=t.length,i=0,n=128,o=72,s=t.lastIndexOf("-");s<0&&(s=0);for(let l=0;l=128&&Rr("not-basic"),e.push(t.charCodeAt(l));for(let l=s>0?s+1:0;l=r&&Rr("invalid-input");let y=(a=t.charCodeAt(l++))-48<10?a-22:a-65<26?a-65:a-97<26?a-97:36;(y>=36||y>dt((2147483647-i)/d))&&Rr("overflow"),i+=y*d;let w=g<=o?1:g>=o+26?26:g-o;if(ydt(2147483647/S)&&Rr("overflow"),d*=S}let h=e.length+1;o=Jp(i-c,h,c==0),dt(i/h)>2147483647-n&&Rr("overflow"),n+=dt(i/h),i%=h,e.splice(i++,0,n)}var a;return String.fromCodePoint(...e)},Qp=function(t){let e=[],r=(t=Yp(t)).length,i=128,n=0,o=72;for(let l of t)l<128&&e.push(Ka(l));let s=e.length,a=s;for(s&&e.push("-");a=i&&hdt((2147483647-n)/c)&&Rr("overflow"),n+=(l-i)*c,i=l;for(let h of t)if(h2147483647&&Rr("overflow"),h==i){let d=n;for(let g=36;;g+=36){let y=g<=o?1:g>=o+26?26:g-o;if(dString.fromCodePoint(...t)},decode:Gp,encode:Qp,toASCII:function(t){return zp(t,function(e){return iE.test(e)?"xn--"+Qp(e):e})},toUnicode:function(t){return zp(t,function(e){return rE.test(e)?Gp(e.slice(4).toLowerCase()):e})}};Kt.decode;Kt.encode;Kt.toASCII;Kt.toUnicode;Kt.ucs2;Kt.version});function oE(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var aE,Mi,lE,pt,Zp=_e(()=>{_();v();m();aE=function(t,e,r,i){e=e||"&",r=r||"=";var n={};if(typeof t!="string"||t.length===0)return n;var o=/\+/g;t=t.split(e);var s=1e3;i&&typeof i.maxKeys=="number"&&(s=i.maxKeys);var a=t.length;s>0&&a>s&&(a=s);for(var l=0;l=0?(c=y.substr(0,w),h=y.substr(w+1)):(c=y,h=""),d=decodeURIComponent(c),g=decodeURIComponent(h),oE(n,d)?Array.isArray(n[d])?n[d].push(g):n[d]=[n[d],g]:n[d]=g}return n},Mi=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},lE=function(t,e,r,i){return e=e||"&",r=r||"=",t===null&&(t=void 0),typeof t=="object"?Object.keys(t).map(function(n){var o=encodeURIComponent(Mi(n))+r;return Array.isArray(t[n])?t[n].map(function(s){return o+encodeURIComponent(Mi(s))}).join(e):o+encodeURIComponent(Mi(t[n]))}).join(e):i?encodeURIComponent(Mi(i))+r+encodeURIComponent(Mi(t)):""},pt={};pt.decode=pt.parse=aE,pt.encode=pt.stringify=lE;pt.decode;pt.encode;pt.parse;pt.stringify});function Ga(){throw new Error("setTimeout has not been defined")}function Qa(){throw new Error("clearTimeout has not been defined")}function rg(t){if(Pt===setTimeout)return setTimeout(t,0);if((Pt===Ga||!Pt)&&setTimeout)return Pt=setTimeout,setTimeout(t,0);try{return Pt(t,0)}catch{try{return Pt.call(null,t,0)}catch{return Pt.call(this||si,t,0)}}}function uE(){ni&&Cr&&(ni=!1,Cr.length?Ot=Cr.concat(Ot):as=-1,Ot.length&&ig())}function ig(){if(!ni){var t=rg(uE);ni=!0;for(var e=Ot.length;e;){for(Cr=Ot,Ot=[];++as{_();v();m();si=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global,fe=tg={};(function(){try{Pt=typeof setTimeout=="function"?setTimeout:Ga}catch{Pt=Ga}try{kt=typeof clearTimeout=="function"?clearTimeout:Qa}catch{kt=Qa}})();Ot=[],ni=!1,as=-1;fe.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r1)for(var I=1;I{_();v();m();Ya={},sg=!1,oi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:global;re=fE();re.platform="browser";re.addListener;re.argv;re.binding;re.browser;re.chdir;re.cwd;re.emit;re.env;re.listeners;re.nextTick;re.off;re.on;re.once;re.prependListener;re.prependOnceListener;re.removeAllListeners;re.removeListener;re.title;re.umask;re.version;re.versions});function cE(){if(og)return Xa;og=!0;var t=re;function e(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function r(o,s){for(var a="",l=0,c=-1,h=0,d,g=0;g<=o.length;++g){if(g2){var y=a.lastIndexOf("/");if(y!==a.length-1){y===-1?(a="",l=0):(a=a.slice(0,y),l=a.length-1-a.lastIndexOf("/")),c=g,h=0;continue}}else if(a.length===2||a.length===1){a="",l=0,c=g,h=0;continue}}s&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+o.slice(c+1,g):a=o.slice(c+1,g),l=g-c-1;c=g,h=0}else d===46&&h!==-1?++h:h=-1}return a}function i(o,s){var a=s.dir||s.root,l=s.base||(s.name||"")+(s.ext||"");return a?a===s.root?a+l:a+o+l:l}var n={resolve:function(){for(var s="",a=!1,l,c=arguments.length-1;c>=-1&&!a;c--){var h;c>=0?h=arguments[c]:(l===void 0&&(l=t.cwd()),h=l),e(h),h.length!==0&&(s=h+"/"+s,a=h.charCodeAt(0)===47)}return s=r(s,!a),a?s.length>0?"/"+s:"/":s.length>0?s:"."},normalize:function(s){if(e(s),s.length===0)return".";var a=s.charCodeAt(0)===47,l=s.charCodeAt(s.length-1)===47;return s=r(s,!a),s.length===0&&!a&&(s="."),s.length>0&&l&&(s+="/"),a?"/"+s:s},isAbsolute:function(s){return e(s),s.length>0&&s.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var s,a=0;a0&&(s===void 0?s=l:s+="/"+l)}return s===void 0?".":n.normalize(s)},relative:function(s,a){if(e(s),e(a),s===a||(s=n.resolve(s),a=n.resolve(a),s===a))return"";for(var l=1;lw){if(a.charCodeAt(d+E)===47)return a.slice(d+E+1);if(E===0)return a.slice(d+E)}else h>w&&(s.charCodeAt(l+E)===47?S=E:E===0&&(S=0));break}var I=s.charCodeAt(l+E),C=a.charCodeAt(d+E);if(I!==C)break;I===47&&(S=E)}var R="";for(E=l+S+1;E<=c;++E)(E===c||s.charCodeAt(E)===47)&&(R.length===0?R+="..":R+="/..");return R.length>0?R+a.slice(d+S):(d+=S,a.charCodeAt(d)===47&&++d,a.slice(d))},_makeLong:function(s){return s},dirname:function(s){if(e(s),s.length===0)return".";for(var a=s.charCodeAt(0),l=a===47,c=-1,h=!0,d=s.length-1;d>=1;--d)if(a=s.charCodeAt(d),a===47){if(!h){c=d;break}}else h=!1;return c===-1?l?"/":".":l&&c===1?"//":s.slice(0,c)},basename:function(s,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(s);var l=0,c=-1,h=!0,d;if(a!==void 0&&a.length>0&&a.length<=s.length){if(a.length===s.length&&a===s)return"";var g=a.length-1,y=-1;for(d=s.length-1;d>=0;--d){var w=s.charCodeAt(d);if(w===47){if(!h){l=d+1;break}}else y===-1&&(h=!1,y=d+1),g>=0&&(w===a.charCodeAt(g)?--g===-1&&(c=d):(g=-1,c=y))}return l===c?c=y:c===-1&&(c=s.length),s.slice(l,c)}else{for(d=s.length-1;d>=0;--d)if(s.charCodeAt(d)===47){if(!h){l=d+1;break}}else c===-1&&(h=!1,c=d+1);return c===-1?"":s.slice(l,c)}},extname:function(s){e(s);for(var a=-1,l=0,c=-1,h=!0,d=0,g=s.length-1;g>=0;--g){var y=s.charCodeAt(g);if(y===47){if(!h){l=g+1;break}continue}c===-1&&(h=!1,c=g+1),y===46?a===-1?a=g:d!==1&&(d=1):a!==-1&&(d=-1)}return a===-1||c===-1||d===0||d===1&&a===c-1&&a===l+1?"":s.slice(a,c)},format:function(s){if(s===null||typeof s!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof s);return i("/",s)},parse:function(s){e(s);var a={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return a;var l=s.charCodeAt(0),c=l===47,h;c?(a.root="/",h=1):h=0;for(var d=-1,g=0,y=-1,w=!0,S=s.length-1,E=0;S>=h;--S){if(l=s.charCodeAt(S),l===47){if(!w){g=S+1;break}continue}y===-1&&(w=!1,y=S+1),l===46?d===-1?d=S:E!==1&&(E=1):d!==-1&&(E=-1)}return d===-1||y===-1||E===0||E===1&&d===y-1&&d===g+1?y!==-1&&(g===0&&c?a.base=a.name=s.slice(1,y):a.base=a.name=s.slice(g,y)):(g===0&&c?(a.name=s.slice(1,d),a.base=s.slice(1,y)):(a.name=s.slice(g,d),a.base=s.slice(g,y)),a.ext=s.slice(d,y)),g>0?a.dir=s.slice(0,g-1):c&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return n.posix=n,Xa=n,Xa}var Xa,og,Za,ag=_e(()=>{_();v();m();Ja();Xa={},og=!1;Za=cE()});var gg={};Jt(gg,{URL:()=>FE,Url:()=>UE,default:()=>Z,fileURLToPath:()=>dg,format:()=>NE,parse:()=>jE,pathToFileURL:()=>pg,resolve:()=>qE,resolveObject:()=>DE});function Fe(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function Li(t,e,r){if(t&>.isObject(t)&&t instanceof Fe)return t;var i=new Fe;return i.parse(t,e,r),i}function _E(){if(cg)return rl;cg=!0;var t=ne;function e(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function r(o,s){for(var a="",l=0,c=-1,h=0,d,g=0;g<=o.length;++g){if(g2){var y=a.lastIndexOf("/");if(y!==a.length-1){y===-1?(a="",l=0):(a=a.slice(0,y),l=a.length-1-a.lastIndexOf("/")),c=g,h=0;continue}}else if(a.length===2||a.length===1){a="",l=0,c=g,h=0;continue}}s&&(a.length>0?a+="/..":a="..",l=2)}else a.length>0?a+="/"+o.slice(c+1,g):a=o.slice(c+1,g),l=g-c-1;c=g,h=0}else d===46&&h!==-1?++h:h=-1}return a}function i(o,s){var a=s.dir||s.root,l=s.base||(s.name||"")+(s.ext||"");return a?a===s.root?a+l:a+o+l:l}var n={resolve:function(){for(var s="",a=!1,l,c=arguments.length-1;c>=-1&&!a;c--){var h;c>=0?h=arguments[c]:(l===void 0&&(l=t.cwd()),h=l),e(h),h.length!==0&&(s=h+"/"+s,a=h.charCodeAt(0)===47)}return s=r(s,!a),a?s.length>0?"/"+s:"/":s.length>0?s:"."},normalize:function(s){if(e(s),s.length===0)return".";var a=s.charCodeAt(0)===47,l=s.charCodeAt(s.length-1)===47;return s=r(s,!a),s.length===0&&!a&&(s="."),s.length>0&&l&&(s+="/"),a?"/"+s:s},isAbsolute:function(s){return e(s),s.length>0&&s.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var s,a=0;a0&&(s===void 0?s=l:s+="/"+l)}return s===void 0?".":n.normalize(s)},relative:function(s,a){if(e(s),e(a),s===a||(s=n.resolve(s),a=n.resolve(a),s===a))return"";for(var l=1;lw){if(a.charCodeAt(d+E)===47)return a.slice(d+E+1);if(E===0)return a.slice(d+E)}else h>w&&(s.charCodeAt(l+E)===47?S=E:E===0&&(S=0));break}var I=s.charCodeAt(l+E),C=a.charCodeAt(d+E);if(I!==C)break;I===47&&(S=E)}var R="";for(E=l+S+1;E<=c;++E)(E===c||s.charCodeAt(E)===47)&&(R.length===0?R+="..":R+="/..");return R.length>0?R+a.slice(d+S):(d+=S,a.charCodeAt(d)===47&&++d,a.slice(d))},_makeLong:function(s){return s},dirname:function(s){if(e(s),s.length===0)return".";for(var a=s.charCodeAt(0),l=a===47,c=-1,h=!0,d=s.length-1;d>=1;--d)if(a=s.charCodeAt(d),a===47){if(!h){c=d;break}}else h=!1;return c===-1?l?"/":".":l&&c===1?"//":s.slice(0,c)},basename:function(s,a){if(a!==void 0&&typeof a!="string")throw new TypeError('"ext" argument must be a string');e(s);var l=0,c=-1,h=!0,d;if(a!==void 0&&a.length>0&&a.length<=s.length){if(a.length===s.length&&a===s)return"";var g=a.length-1,y=-1;for(d=s.length-1;d>=0;--d){var w=s.charCodeAt(d);if(w===47){if(!h){l=d+1;break}}else y===-1&&(h=!1,y=d+1),g>=0&&(w===a.charCodeAt(g)?--g===-1&&(c=d):(g=-1,c=y))}return l===c?c=y:c===-1&&(c=s.length),s.slice(l,c)}else{for(d=s.length-1;d>=0;--d)if(s.charCodeAt(d)===47){if(!h){l=d+1;break}}else c===-1&&(h=!1,c=d+1);return c===-1?"":s.slice(l,c)}},extname:function(s){e(s);for(var a=-1,l=0,c=-1,h=!0,d=0,g=s.length-1;g>=0;--g){var y=s.charCodeAt(g);if(y===47){if(!h){l=g+1;break}continue}c===-1&&(h=!1,c=g+1),y===46?a===-1?a=g:d!==1&&(d=1):a!==-1&&(d=-1)}return a===-1||c===-1||d===0||d===1&&a===c-1&&a===l+1?"":s.slice(a,c)},format:function(s){if(s===null||typeof s!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof s);return i("/",s)},parse:function(s){e(s);var a={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return a;var l=s.charCodeAt(0),c=l===47,h;c?(a.root="/",h=1):h=0;for(var d=-1,g=0,y=-1,w=!0,S=s.length-1,E=0;S>=h;--S){if(l=s.charCodeAt(S),l===47){if(!w){g=S+1;break}continue}y===-1&&(w=!1,y=S+1),l===46?d===-1?d=S:E!==1&&(E=1):d!==-1&&(E=-1)}return d===-1||y===-1||E===0||E===1&&d===y-1&&d===g+1?y!==-1&&(g===0&&c?a.base=a.name=s.slice(1,y):a.base=a.name=s.slice(g,y)):(g===0&&c?(a.name=s.slice(1,d),a.base=s.slice(1,y)):(a.name=s.slice(g,d),a.base=s.slice(g,y)),a.ext=s.slice(d,y)),g>0?a.dir=s.slice(0,g-1):c&&(a.dir="/"),a},sep:"/",delimiter:":",win32:null,posix:null};return n.posix=n,rl=n,rl}function kE(t){if(typeof t=="string")t=new URL(t);else if(!(t instanceof URL))throw new Deno.errors.InvalidData("invalid argument path , must be a string or URL");if(t.protocol!=="file:")throw new Deno.errors.InvalidData("invalid url scheme");return nl?OE(t):xE(t)}function OE(t){let e=t.hostname,r=t.pathname;for(let i=0;iAE||n!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return r.slice(1)}}function xE(t){if(t.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let e=t.pathname;for(let r=0;rVE||n!==":")throw new Deno.errors.InvalidData("file url path must be absolute");return r.slice(1)}}function ZE(t){if(t.hostname!=="")throw new Deno.errors.InvalidData("invalid file url hostname");let e=t.pathname;for(let r=0;r{_();v();m();Xp();Zp();ng();ag();Ja();Z={},hE=Kt,gt={isString:function(t){return typeof t=="string"},isObject:function(t){return typeof t=="object"&&t!==null},isNull:function(t){return t===null},isNullOrUndefined:function(t){return t==null}};Z.parse=Li,Z.resolve=function(t,e){return Li(t,!1,!0).resolve(e)},Z.resolveObject=function(t,e){return t?Li(t,!1,!0).resolveObject(e):e},Z.format=function(t){return gt.isString(t)&&(t=Li(t)),t instanceof Fe?t.format():Fe.prototype.format.call(t)},Z.Url=Fe;dE=/^([a-z0-9.+-]+:)/i,pE=/:[0-9]*$/,gE=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,yE=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",` +`," "]),il=["'"].concat(yE),lg=["%","/","?",";","#"].concat(il),ug=["/","?","#"],fg=/^[+a-z0-9A-Z_-]{0,63}$/,bE=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,wE={javascript:!0,"javascript:":!0},el={javascript:!0,"javascript:":!0},ai={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},tl=pt;Fe.prototype.parse=function(t,e,r){if(!gt.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),n=i!==-1&&i127?U+="x":U+=R[N];if(!U.match(fg)){var K=I.slice(0,w),z=I.slice(w+1),Q=R.match(bE);Q&&(K.push(Q[1]),z.unshift(Q[2])),z.length&&(s="/"+z.join(".")+s),this.hostname=K.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),E||(this.hostname=hE.toASCII(this.hostname));var pe=this.port?":"+this.port:"",Yt=this.hostname||"";this.host=Yt+pe,this.href+=this.host,E&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),s[0]!=="/"&&(s="/"+s))}if(!wE[c])for(w=0,C=il.length;w0)&&r.host.split("@"))&&(r.auth=Q.shift(),r.host=r.hostname=Q.shift())),r.search=t.search,r.query=t.query,gt.isNull(r.pathname)&>.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!R.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var N=R.slice(-1)[0],W=(r.host||t.host||R.length>1)&&(N==="."||N==="..")||N==="",K=0,z=R.length;z>=0;z--)(N=R[z])==="."?R.splice(z,1):N===".."?(R.splice(z,1),K++):K&&(R.splice(z,1),K--);if(!I&&!C)for(;K--;K)R.unshift("..");!I||R[0]===""||R[0]&&R[0].charAt(0)==="/"||R.unshift(""),W&&R.join("/").substr(-1)!=="/"&&R.push("");var Q,pe=R[0]===""||R[0]&&R[0].charAt(0)==="/";return U&&(r.hostname=r.host=pe?"":R.length?R.shift():"",(Q=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=Q.shift(),r.host=r.hostname=Q.shift())),(I=I||r.host&&R.length)&&!pe&&R.unshift(""),R.length?r.pathname=R.join("/"):(r.pathname=null,r.path=null),gt.isNull(r.pathname)&>.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},Fe.prototype.parseHost=function(){var t=this.host,e=pE.exec(t);e&&((e=e[0])!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};Z.Url;Z.format;Z.resolve;Z.resolveObject;rl={},cg=!1;hg=_E(),mE=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;Z.URL=typeof URL<"u"?URL:null;Z.pathToFileURL=ME;Z.fileURLToPath=kE;Z.Url;Z.format;Z.resolve;Z.resolveObject;Z.URL;vE=92,EE=47,SE=97,AE=122,nl=mE==="win32",IE=/\//g,TE=/%/g,RE=/\\/g,CE=/\n/g,BE=/\r/g,PE=/\t/g;LE=typeof Deno<"u"?Deno.build.os==="windows"?"win32":Deno.build.os:void 0;Z.URL=typeof URL<"u"?URL:null;Z.pathToFileURL=pg;Z.fileURLToPath=dg;UE=Z.Url,NE=Z.format,qE=Z.resolve,DE=Z.resolveObject,jE=Z.parse,FE=Z.URL,WE=92,$E=47,HE=97,VE=122,sl=LE==="win32",zE=/\//g,KE=/%/g,GE=/\\/g,QE=/\n/g,YE=/\r/g,JE=/\t/g});var wg=M((YL,bg)=>{"use strict";_();v();m();bg.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var ls=M(li=>{"use strict";_();v();m();Object.defineProperty(li,"__esModule",{value:!0});li.BufferedDuplex=li.writev=void 0;var eS=jt(),_g=(be(),X(me));function mg(t,e){let r=new Array(t.length);for(let i=0;i{this.destroyed||this.push(n)})}_read(e){this.proxy.read(e)}_write(e,r,i){this.isSocketOpen?this.writeToProxy(e,r,i):this.writeQueue.push({chunk:e,encoding:r,cb:i})}_final(e){this.writeQueue=[],this.proxy.end(e)}_destroy(e,r){this.writeQueue=[],this.proxy.destroy(),r(e)}socketReady(){this.emit("connect"),this.isSocketOpen=!0,this.processWriteQueue()}writeToProxy(e,r,i){this.proxy.write(e,r)===!1?this.proxy.once("drain",i):i()}processWriteQueue(){for(;this.writeQueue.length>0;){let{chunk:e,encoding:r,cb:i}=this.writeQueue.shift();this.writeToProxy(e,r,i)}}};li.BufferedDuplex=ol});var Ui=M(Qt=>{"use strict";_();v();m();var ll=Qt&&Qt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qt,"__esModule",{value:!0});Qt.streamBuilder=Qt.browserStreamBuilder=void 0;var us=(be(),X(me)),vg=ll(wg()),tS=ll(ot()),rS=jt(),iS=ll(Oi()),al=ls(),Gt=(0,tS.default)("mqttjs:ws"),nS=["rejectUnauthorized","ca","cert","key","pfx","passphrase"];function Eg(t,e){let r=`${t.protocol}://${t.hostname}:${t.port}${t.path}`;return typeof t.transformWsUrl=="function"&&(r=t.transformWsUrl(r,t,e)),r}function Sg(t){let e=t;return t.port||(t.protocol==="wss"?e.port=443:e.port=80),t.path||(e.path="/"),t.wsOptions||(e.wsOptions={}),!iS.default&&!t.forceNativeWebSocket&&t.protocol==="wss"&&nS.forEach(r=>{Object.prototype.hasOwnProperty.call(t,r)&&!Object.prototype.hasOwnProperty.call(t.wsOptions,r)&&(e.wsOptions[r]=t[r])}),e}function sS(t){let e=Sg(t);if(e.hostname||(e.hostname=e.host),!e.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");let r=new URL(document.URL);e.hostname=r.hostname,e.port||(e.port=Number(r.port))}return e.objectMode===void 0&&(e.objectMode=!(e.binary===!0||e.binary===void 0)),e}function oS(t,e,r){Gt("createWebSocket"),Gt(`protocol: ${r.protocolId} ${r.protocolVersion}`);let i=r.protocolId==="MQIsdp"&&r.protocolVersion===3?"mqttv3.1":"mqtt";Gt(`creating new Websocket for url: ${e} and protocol: ${i}`);let n;return r.createWebsocket?n=r.createWebsocket(e,[i],r):n=new vg.default(e,[i],r.wsOptions),n}function aS(t,e){let r=e.protocolId==="MQIsdp"&&e.protocolVersion===3?"mqttv3.1":"mqtt",i=Eg(e,t),n;return e.createWebsocket?n=e.createWebsocket(i,[r],e):n=new WebSocket(i,[r]),n.binaryType="arraybuffer",n}var lS=(t,e)=>{Gt("streamBuilder");let r=Sg(e);r.hostname=r.hostname||r.host||"localhost";let i=Eg(r,t),n=oS(t,i,r),o=vg.default.createWebSocketStream(n,r.wsOptions);return o.url=i,n.on("close",()=>{o.destroy()}),o};Qt.streamBuilder=lS;var uS=(t,e)=>{Gt("browserStreamBuilder");let r,n=sS(e).browserBufferSize||1024*512,o=e.browserBufferTimeout||1e3,s=!e.objectMode,a=aS(t,e),l=h(e,S,E);e.objectMode||(l._writev=al.writev.bind(l)),l.on("close",()=>{a.close()});let c=typeof a.addEventListener<"u";a.readyState===a.OPEN?(r=l,r.socket=a):(r=new al.BufferedDuplex(e,l,a),c?a.addEventListener("open",d):a.onopen=d),c?(a.addEventListener("close",g),a.addEventListener("error",y),a.addEventListener("message",w)):(a.onclose=g,a.onerror=y,a.onmessage=w);function h(I,C,R){let U=new rS.Transform({objectMode:I.objectMode});return U._write=C,U._flush=R,U}function d(){Gt("WebSocket onOpen"),r instanceof al.BufferedDuplex&&r.socketReady()}function g(I){Gt("WebSocket onClose",I),r.end(),r.destroy()}function y(I){Gt("WebSocket onError",I);let C=new Error("WebSocket error");C.event=I,r.destroy(C)}async function w(I){let{data:C}=I;C instanceof ArrayBuffer?C=us.Buffer.from(C):C instanceof Blob?C=us.Buffer.from(await new Response(C).arrayBuffer()):C=us.Buffer.from(C,"utf8"),l&&!l.destroyed&&l.push(C)}function S(I,C,R){if(a.bufferedAmount>n){setTimeout(S,o,I,C,R);return}s&&typeof I=="string"&&(I=us.Buffer.from(I,"utf8"));try{a.send(I)}catch(U){return R(U)}R()}function E(I){a.close(),I()}return r};Qt.browserStreamBuilder=uS});var ul={};Jt(ul,{Server:()=>Me,Socket:()=>Me,Stream:()=>Me,_createServerHandle:()=>Me,_normalizeArgs:()=>Me,_setSimultaneousAccepts:()=>Me,connect:()=>Me,createConnection:()=>Me,createServer:()=>Me,default:()=>fS,isIP:()=>Me,isIPv4:()=>Me,isIPv6:()=>Me});function Me(){throw new Error("Node.js net module is not supported by JSPM core outside of Node.js")}var fS,fl=_e(()=>{_();v();m();fS={_createServerHandle:Me,_normalizeArgs:Me,_setSimultaneousAccepts:Me,connect:Me,createConnection:Me,createServer:Me,isIP:Me,isIPv4:Me,isIPv6:Me,Server:Me,Socket:Me,Stream:Me}});var cl=M(Ni=>{"use strict";_();v();m();var Ag=Ni&&Ni.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ni,"__esModule",{value:!0});var cS=Ag((fl(),X(ul))),hS=Ag(ot()),dS=(0,hS.default)("mqttjs:tcp"),pS=(t,e)=>{e.port=e.port||1883,e.hostname=e.hostname||e.host||"localhost";let{port:r,path:i}=e,n=e.hostname;return dS("port %d and host %s",r,n),cS.default.createConnection({port:r,host:n,path:i})};Ni.default=pS});var Ig={};Jt(Ig,{default:()=>gS});var gS,Tg=_e(()=>{_();v();m();gS={}});var dl=M(qi=>{"use strict";_();v();m();var hl=qi&&qi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qi,"__esModule",{value:!0});var yS=hl((Tg(),X(Ig))),bS=hl((fl(),X(ul))),wS=hl(ot()),_S=(0,wS.default)("mqttjs:tls"),mS=(t,e)=>{e.port=e.port||8883,e.host=e.hostname||e.host||"localhost",bS.default.isIP(e.host)===0&&(e.servername=e.host),e.rejectUnauthorized=e.rejectUnauthorized!==!1,delete e.path,_S("port %d host %s rejectUnauthorized %b",e.port,e.host,e.rejectUnauthorized);let r=yS.default.connect(e);r.on("secureConnect",()=>{e.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",i)});function i(n){e.rejectUnauthorized&&t.emit("error",n),r.end()}return r.on("error",i),r};qi.default=mS});var yl=M(gl=>{"use strict";_();v();m();Object.defineProperty(gl,"__esModule",{value:!0});var Rg=(be(),X(me)),vS=jt(),ES=ls(),yt,pl,Le;function SS(){let t=new vS.Transform;return t._write=(e,r,i)=>{yt.send({data:e.buffer,success(){i()},fail(n){i(new Error(n))}})},t._flush=e=>{yt.close({success(){e()}})},t}function AS(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}function IS(t,e){let r=t.protocol==="wxs"?"wss":"ws",i=`${r}://${t.hostname}${t.path}`;return t.port&&t.port!==80&&t.port!==443&&(i=`${r}://${t.hostname}:${t.port}${t.path}`),typeof t.transformWsUrl=="function"&&(i=t.transformWsUrl(i,t,e)),i}function TS(){yt.onOpen(()=>{Le.socketReady()}),yt.onMessage(t=>{let{data:e}=t;e instanceof ArrayBuffer?e=Rg.Buffer.from(e):e=Rg.Buffer.from(e,"utf8"),pl.push(e)}),yt.onClose(()=>{Le.emit("close"),Le.end(),Le.destroy()}),yt.onError(t=>{let e=new Error(t.errMsg);Le.destroy(e)})}var RS=(t,e)=>{if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error("Could not determine host. Specify host manually.");let r=e.protocolId==="MQIsdp"&&e.protocolVersion===3?"mqttv3.1":"mqtt";AS(e);let i=IS(e,t);yt=wx.connectSocket({url:i,protocols:[r]}),pl=SS(),Le=new ES.BufferedDuplex(e,pl,yt),Le._destroy=(o,s)=>{yt.close({success(){s&&s(o)}})};let n=Le.destroy;return Le.destroy=(o,s)=>(Le.destroy=n,setTimeout(()=>{yt.close({fail(){Le._destroy(o,s)}})},0),Le),TS(),Le};gl.default=RS});var _l=M(wl=>{"use strict";_();v();m();Object.defineProperty(wl,"__esModule",{value:!0});var bl=(be(),X(me)),CS=jt(),BS=ls(),xt,fs,ui,Cg=!1;function PS(){let t=new CS.Transform;return t._write=(e,r,i)=>{xt.sendSocketMessage({data:e.buffer,success(){i()},fail(){i(new Error)}})},t._flush=e=>{xt.closeSocket({success(){e()}})},t}function kS(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}function OS(t,e){let r=t.protocol==="alis"?"wss":"ws",i=`${r}://${t.hostname}${t.path}`;return t.port&&t.port!==80&&t.port!==443&&(i=`${r}://${t.hostname}:${t.port}${t.path}`),typeof t.transformWsUrl=="function"&&(i=t.transformWsUrl(i,t,e)),i}function xS(){Cg||(Cg=!0,xt.onSocketOpen(()=>{ui.socketReady()}),xt.onSocketMessage(t=>{if(typeof t.data=="string"){let e=bl.Buffer.from(t.data,"base64");fs.push(e)}else{let e=new FileReader;e.addEventListener("load",()=>{let r=e.result;r instanceof ArrayBuffer?r=bl.Buffer.from(r):r=bl.Buffer.from(r,"utf8"),fs.push(r)}),e.readAsArrayBuffer(t.data)}}),xt.onSocketClose(()=>{ui.end(),ui.destroy()}),xt.onSocketError(t=>{ui.destroy(t)}))}var MS=(t,e)=>{if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error("Could not determine host. Specify host manually.");let r=e.protocolId==="MQIsdp"&&e.protocolVersion===3?"mqttv3.1":"mqtt";kS(e);let i=OS(e,t);return xt=e.my,xt.connectSocket({url:i,protocols:r}),fs=PS(),ui=new BS.BufferedDuplex(e,fs,xt),xS(),ui};wl.default=MS});var kg=M(Br=>{"use strict";_();v();m();var cs=Br&&Br.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Br,"__esModule",{value:!0});Br.connectAsync=void 0;var LS=cs(ot()),US=cs((yg(),X(gg))),NS=cs(os()),qS=cs(Oi());typeof(B===null||B===void 0?void 0:B.nextTick)!="function"&&(B.nextTick=setImmediate);var Bg=(0,LS.default)("mqttjs"),de=null;function DS(t){let e;t.auth&&(e=t.auth.match(/^(.+):(.+)$/),e?(t.username=e[1],t.password=e[2]):t.username=t.auth)}function Pg(t,e){var r,i,n,o;if(Bg("connecting to an MQTT broker..."),typeof t=="object"&&!e&&(e=t,t=""),e=e||{},t&&typeof t=="string"){let l=US.default.parse(t,!0),c={};if(l.port!=null&&(c.port=Number(l.port)),c.host=l.hostname,c.query=l.query,c.auth=l.auth,c.protocol=l.protocol,c.path=l.path,c.protocol=(r=c.protocol)===null||r===void 0?void 0:r.replace(/:$/,""),e=Object.assign(Object.assign({},c),e),!e.protocol)throw new Error("Missing protocol")}if(e.unixSocket=e.unixSocket||((i=e.protocol)===null||i===void 0?void 0:i.includes("+unix")),e.unixSocket?e.protocol=e.protocol.replace("+unix",""):!(!((n=e.protocol)===null||n===void 0)&&n.startsWith("ws"))&&!(!((o=e.protocol)===null||o===void 0)&&o.startsWith("wx"))&&delete e.path,DS(e),e.query&&typeof e.query.clientId=="string"&&(e.clientId=e.query.clientId),e.cert&&e.key)if(e.protocol){if(["mqtts","wss","wxs","alis"].indexOf(e.protocol)===-1)switch(e.protocol){case"mqtt":e.protocol="mqtts";break;case"ws":e.protocol="wss";break;case"wx":e.protocol="wxs";break;case"ali":e.protocol="alis";break;default:throw new Error(`Unknown protocol for secure connection: "${e.protocol}"!`)}}else throw new Error("Missing secure protocol key");if(de||(de={},!qS.default&&!e.forceNativeWebSocket?(de.ws=Ui().streamBuilder,de.wss=Ui().streamBuilder,de.mqtt=cl().default,de.tcp=cl().default,de.ssl=dl().default,de.tls=de.ssl,de.mqtts=dl().default):(de.ws=Ui().browserStreamBuilder,de.wss=Ui().browserStreamBuilder,de.wx=yl().default,de.wxs=yl().default,de.ali=_l().default,de.alis=_l().default)),!de[e.protocol]){let l=["mqtts","wss"].indexOf(e.protocol)!==-1;e.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((c,h)=>l&&h%2===0?!1:typeof de[c]=="function")[0]}if(e.clean===!1&&!e.clientId)throw new Error("Missing clientId for unclean clients");e.protocol&&(e.defaultProtocol=e.protocol);function s(l){return e.servers&&((!l._reconnectCount||l._reconnectCount===e.servers.length)&&(l._reconnectCount=0),e.host=e.servers[l._reconnectCount].host,e.port=e.servers[l._reconnectCount].port,e.protocol=e.servers[l._reconnectCount].protocol?e.servers[l._reconnectCount].protocol:e.defaultProtocol,e.hostname=e.host,l._reconnectCount++),Bg("calling streambuilder for",e.protocol),de[e.protocol](l,e)}let a=new NS.default(s,e);return a.on("error",()=>{}),a}function jS(t,e,r=!0){return new Promise((i,n)=>{let o=Pg(t,e),s={connect:l=>{a(),i(o)},end:()=>{a(),i(o)},error:l=>{a(),o.end(),n(l)}};r===!1&&(s.close=()=>{s.error(new Error("Couldn't connect to server"))});function a(){Object.keys(s).forEach(l=>{o.off(l,s[l])})}Object.keys(s).forEach(l=>{o.on(l,s[l])})})}Br.connectAsync=jS;Br.default=Pg});var ml=M(G=>{"use strict";_();v();m();var Og=G&&G.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),FS=G&&G.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WS=G&&G.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Og(e,t,r);return FS(e,t),e},xg=G&&G.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Og(e,t,r)},Di=G&&G.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(G,"__esModule",{value:!0});G.ReasonCodes=G.KeepaliveManager=G.UniqueMessageIdProvider=G.DefaultMessageIdProvider=G.Store=G.MqttClient=G.connectAsync=G.connect=G.Client=void 0;var Mg=Di(os());G.MqttClient=Mg.default;var $S=Di(Zo());G.DefaultMessageIdProvider=$S.default;var HS=Di(Vp());G.UniqueMessageIdProvider=HS.default;var VS=Di(ra());G.Store=VS.default;var Lg=WS(kg());G.connect=Lg.default;Object.defineProperty(G,"connectAsync",{enumerable:!0,get:function(){return Lg.connectAsync}});var zS=Di(Wa());G.KeepaliveManager=zS.default;G.Client=Mg.default;xg(os(),G);xg(_r(),G);var KS=Ti();Object.defineProperty(G,"ReasonCodes",{enumerable:!0,get:function(){return KS.ReasonCodes}})});var XS=M(We=>{_();v();m();var Ug=We&&We.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),GS=We&&We.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QS=We&&We.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Ug(e,t,r);return GS(e,t),e},YS=We&&We.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ug(e,t,r)};Object.defineProperty(We,"__esModule",{value:!0});var JS=QS(ml());We.default=JS;YS(ml(),We)});return XS();})(); + +}; +gdjs.evtsExt__MQTT__onFirstSceneLoaded.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__MQTT__onFirstSceneLoaded.userFunc0xe68b08(runtimeScene, eventsFunctionContext); + +} + + +}; + +gdjs.evtsExt__MQTT__onFirstSceneLoaded.func = function(runtimeScene, parentEventsFunctionContext) { +let scopeInstanceContainer = null; +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("MQTT"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("MQTT"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__MQTT__onFirstSceneLoaded.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__MQTT__onFirstSceneLoaded.registeredGdjsCallbacks = []; +gdjs.evtsExt__MQTT__onFirstSceneLoaded.registeredGdjsCallbacks.push((runtimeScene) => { + gdjs.evtsExt__MQTT__onFirstSceneLoaded.func(runtimeScene, runtimeScene); +}) +gdjs.registerFirstRuntimeSceneLoadedCallback(gdjs.evtsExt__MQTT__onFirstSceneLoaded.registeredGdjsCallbacks[gdjs.evtsExt__MQTT__onFirstSceneLoaded.registeredGdjsCallbacks.length - 1]); diff --git a/Export/gdjs-evtsext__mqtt__onmessage-func.js b/Export/gdjs-evtsext__mqtt__onmessage-func.js new file mode 100644 index 0000000..526c255 --- /dev/null +++ b/Export/gdjs-evtsext__mqtt__onmessage-func.js @@ -0,0 +1,99 @@ + +if (typeof gdjs.evtsExt__MQTT__onMessage !== "undefined") { + gdjs.evtsExt__MQTT__onMessage.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__MQTT__onMessage = {}; +gdjs.evtsExt__MQTT__onMessage.idToCallbackMap = new Map(); + + +gdjs.evtsExt__MQTT__onMessage.userFunc0xe51170 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const mqttEvent = gdjs.evtTools.mqtt.events[eventsFunctionContext.getArgument("topic")]; +if (typeof mqttEvent === "undefined" || typeof mqttEvent.data === "undefined") return; +eventsFunctionContext.returnValue = + Array.isArray(mqttEvent.data) + ? mqttEvent.data.length !== 0 + : mqttEvent.data !== gdjs.evtTools.mqtt.empty; + +}; +gdjs.evtsExt__MQTT__onMessage.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__MQTT__onMessage.userFunc0xe51170(runtimeScene, eventsFunctionContext); + +} + + +}; + +gdjs.evtsExt__MQTT__onMessage.func = function(runtimeScene, topic, parentEventsFunctionContext) { +let scopeInstanceContainer = null; +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("MQTT"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("MQTT"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "topic") return topic; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__MQTT__onMessage.eventsList0(runtimeScene, eventsFunctionContext); + + +return !!eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__MQTT__onMessage.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/Export/gdjs-evtsext__mqtt__onscenepostevents-func.js b/Export/gdjs-evtsext__mqtt__onscenepostevents-func.js new file mode 100644 index 0000000..6d6f58c --- /dev/null +++ b/Export/gdjs-evtsext__mqtt__onscenepostevents-func.js @@ -0,0 +1,104 @@ + +if (typeof gdjs.evtsExt__MQTT__onScenePostEvents !== "undefined") { + gdjs.evtsExt__MQTT__onScenePostEvents.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__MQTT__onScenePostEvents = {}; +gdjs.evtsExt__MQTT__onScenePostEvents.idToCallbackMap = new Map(); + + +gdjs.evtsExt__MQTT__onScenePostEvents.userFunc0xd6d8a8 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +// Remove the messages of the last frame for no dataloss mode +Object + .values(gdjs.evtTools.mqtt.events) + .forEach((event, index) => { + if (Array.isArray(event.data)) + event.data.shift(); + else event.data = gdjs.evtTools.mqtt.empty; + }); + +}; +gdjs.evtsExt__MQTT__onScenePostEvents.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__MQTT__onScenePostEvents.userFunc0xd6d8a8(runtimeScene, eventsFunctionContext); + +} + + +}; + +gdjs.evtsExt__MQTT__onScenePostEvents.func = function(runtimeScene, parentEventsFunctionContext) { +let scopeInstanceContainer = null; +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("MQTT"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("MQTT"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__MQTT__onScenePostEvents.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__MQTT__onScenePostEvents.registeredGdjsCallbacks = []; +gdjs.evtsExt__MQTT__onScenePostEvents.registeredGdjsCallbacks.push((runtimeScene) => { + gdjs.evtsExt__MQTT__onScenePostEvents.func(runtimeScene, runtimeScene); +}) +gdjs.registerRuntimeScenePostEventsCallback(gdjs.evtsExt__MQTT__onScenePostEvents.registeredGdjsCallbacks[gdjs.evtsExt__MQTT__onScenePostEvents.registeredGdjsCallbacks.length - 1]); diff --git a/Export/gdjs-evtsext__mqtt__publish-func.js b/Export/gdjs-evtsext__mqtt__publish-func.js new file mode 100644 index 0000000..5253724 --- /dev/null +++ b/Export/gdjs-evtsext__mqtt__publish-func.js @@ -0,0 +1,102 @@ + +if (typeof gdjs.evtsExt__MQTT__publish !== "undefined") { + gdjs.evtsExt__MQTT__publish.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__MQTT__publish = {}; +gdjs.evtsExt__MQTT__publish.idToCallbackMap = new Map(); + + +gdjs.evtsExt__MQTT__publish.userFunc0xe51570 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +if (gdjs.evtTools.mqtt.connection === null) return; +gdjs.evtTools.mqtt.connection.publish( + eventsFunctionContext.getArgument("topic"), + eventsFunctionContext.getArgument("content"), + { qos: eventsFunctionContext.getArgument("QoS"), retain: eventsFunctionContext.getArgument("retain") } +); + +}; +gdjs.evtsExt__MQTT__publish.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__MQTT__publish.userFunc0xe51570(runtimeScene, eventsFunctionContext); + +} + + +}; + +gdjs.evtsExt__MQTT__publish.func = function(runtimeScene, content, topic, QoS, retain, parentEventsFunctionContext) { +let scopeInstanceContainer = null; +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("MQTT"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("MQTT"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "content") return content; +if (argName === "topic") return topic; +if (argName === "QoS") return QoS; +if (argName === "retain") return retain; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__MQTT__publish.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__MQTT__publish.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/Export/gdjs-evtsext__mqtt__subscribe-func.js b/Export/gdjs-evtsext__mqtt__subscribe-func.js new file mode 100644 index 0000000..ca59575 --- /dev/null +++ b/Export/gdjs-evtsext__mqtt__subscribe-func.js @@ -0,0 +1,105 @@ + +if (typeof gdjs.evtsExt__MQTT__subscribe !== "undefined") { + gdjs.evtsExt__MQTT__subscribe.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__MQTT__subscribe = {}; +gdjs.evtsExt__MQTT__subscribe.idToCallbackMap = new Map(); + + +gdjs.evtsExt__MQTT__subscribe.userFunc0xe50e50 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +if (gdjs.evtTools.mqtt.connection === null) return; + +const topic = eventsFunctionContext.getArgument("topic"); +if (typeof gdjs.evtTools.mqtt.events[topic] === "undefined") gdjs.evtTools.mqtt.events[topic] = { data: eventsFunctionContext.getArgument("dataloss") ? "" : [] }; +gdjs.evtTools.mqtt.events[topic].loss = eventsFunctionContext.getArgument("dataloss"); + +gdjs.evtTools.mqtt.connection.subscribe( + topic, + { qos: eventsFunctionContext.getArgument("QoS") } +); + +}; +gdjs.evtsExt__MQTT__subscribe.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__MQTT__subscribe.userFunc0xe50e50(runtimeScene, eventsFunctionContext); + +} + + +}; + +gdjs.evtsExt__MQTT__subscribe.func = function(runtimeScene, topic, QoS, dataloss, parentEventsFunctionContext) { +let scopeInstanceContainer = null; +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("MQTT"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("MQTT"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "topic") return topic; +if (argName === "QoS") return QoS; +if (argName === "dataloss") return dataloss; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__MQTT__subscribe.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__MQTT__subscribe.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/Export/gdjs-evtsext__mqtt__unsubscribe-func.js b/Export/gdjs-evtsext__mqtt__unsubscribe-func.js new file mode 100644 index 0000000..86b38c8 --- /dev/null +++ b/Export/gdjs-evtsext__mqtt__unsubscribe-func.js @@ -0,0 +1,97 @@ + +if (typeof gdjs.evtsExt__MQTT__unsubscribe !== "undefined") { + gdjs.evtsExt__MQTT__unsubscribe.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__MQTT__unsubscribe = {}; +gdjs.evtsExt__MQTT__unsubscribe.idToCallbackMap = new Map(); + + +gdjs.evtsExt__MQTT__unsubscribe.userFunc0xe50e50 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +if (gdjs.evtTools.mqtt.connection !== null) + gdjs.evtTools.mqtt.connection.unsubscribe( + eventsFunctionContext.getArgument("topic") + ); + +}; +gdjs.evtsExt__MQTT__unsubscribe.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__MQTT__unsubscribe.userFunc0xe50e50(runtimeScene, eventsFunctionContext); + +} + + +}; + +gdjs.evtsExt__MQTT__unsubscribe.func = function(runtimeScene, topic, parentEventsFunctionContext) { +let scopeInstanceContainer = null; +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("MQTT"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("MQTT"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "topic") return topic; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__MQTT__unsubscribe.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__MQTT__unsubscribe.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/Export/gdjs-evtsext__panelspritebutton__bitmaptextstylestate.js b/Export/gdjs-evtsext__panelspritebutton__bitmaptextstylestate.js new file mode 100644 index 0000000..a5e1d9f --- /dev/null +++ b/Export/gdjs-evtsext__panelspritebutton__bitmaptextstylestate.js @@ -0,0 +1,600 @@ + +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState = gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState || {}; + +/** + * Behavior generated from Hover bitmap text style + */ +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState = class BitmapTextStyleState extends gdjs.RuntimeBehavior { + constructor(instanceContainer, behaviorData, owner) { + super(instanceContainer, behaviorData, owner); + this._runtimeScene = instanceContainer; + + this._onceTriggers = new gdjs.OnceTriggers(); + this._behaviorData = {}; + this._sharedData = gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.getSharedData( + instanceContainer, + behaviorData.name + ); + + this._behaviorData.HoverColor = behaviorData.HoverColor !== undefined ? behaviorData.HoverColor : ""; + this._behaviorData.HoverPrefix = behaviorData.HoverPrefix !== undefined ? behaviorData.HoverPrefix : ""; + this._behaviorData.HoverSuffix = behaviorData.HoverSuffix !== undefined ? behaviorData.HoverSuffix : ""; + this._behaviorData.IsHovered = false; + this._behaviorData.IdleText = ""; + this._behaviorData.IdleColor = ""; + } + + // Hot-reload: + applyBehaviorOverriding(behaviorOverriding) { + + if (behaviorOverriding.HoverColor !== undefined) + this._behaviorData.HoverColor = behaviorOverriding.HoverColor; + if (behaviorOverriding.HoverPrefix !== undefined) + this._behaviorData.HoverPrefix = behaviorOverriding.HoverPrefix; + if (behaviorOverriding.HoverSuffix !== undefined) + this._behaviorData.HoverSuffix = behaviorOverriding.HoverSuffix; + if (behaviorOverriding.IsHovered !== undefined) + this._behaviorData.IsHovered = behaviorOverriding.IsHovered; + if (behaviorOverriding.IdleText !== undefined) + this._behaviorData.IdleText = behaviorOverriding.IdleText; + if (behaviorOverriding.IdleColor !== undefined) + this._behaviorData.IdleColor = behaviorOverriding.IdleColor; + + return true; + } + + // Network sync: + getNetworkSyncData(syncOptions) { + return { + ...super.getNetworkSyncData(syncOptions), + props: { + + HoverColor: this._behaviorData.HoverColor, + HoverPrefix: this._behaviorData.HoverPrefix, + HoverSuffix: this._behaviorData.HoverSuffix, + IsHovered: this._behaviorData.IsHovered, + IdleText: this._behaviorData.IdleText, + IdleColor: this._behaviorData.IdleColor, + } + }; + } + updateFromNetworkSyncData(networkSyncData, options) { + super.updateFromNetworkSyncData(networkSyncData, options); + + if (networkSyncData.props.HoverColor !== undefined) + this._behaviorData.HoverColor = networkSyncData.props.HoverColor; + if (networkSyncData.props.HoverPrefix !== undefined) + this._behaviorData.HoverPrefix = networkSyncData.props.HoverPrefix; + if (networkSyncData.props.HoverSuffix !== undefined) + this._behaviorData.HoverSuffix = networkSyncData.props.HoverSuffix; + if (networkSyncData.props.IsHovered !== undefined) + this._behaviorData.IsHovered = networkSyncData.props.IsHovered; + if (networkSyncData.props.IdleText !== undefined) + this._behaviorData.IdleText = networkSyncData.props.IdleText; + if (networkSyncData.props.IdleColor !== undefined) + this._behaviorData.IdleColor = networkSyncData.props.IdleColor; + } + + // Properties: + + _getHoverColor() { + return this._behaviorData.HoverColor !== undefined ? this._behaviorData.HoverColor : ""; + } + _setHoverColor(newValue) { + this._behaviorData.HoverColor = newValue; + } + _getHoverPrefix() { + return this._behaviorData.HoverPrefix !== undefined ? this._behaviorData.HoverPrefix : ""; + } + _setHoverPrefix(newValue) { + this._behaviorData.HoverPrefix = newValue; + } + _getHoverSuffix() { + return this._behaviorData.HoverSuffix !== undefined ? this._behaviorData.HoverSuffix : ""; + } + _setHoverSuffix(newValue) { + this._behaviorData.HoverSuffix = newValue; + } + _getIsHovered() { + return this._behaviorData.IsHovered !== undefined ? this._behaviorData.IsHovered : false; + } + _setIsHovered(newValue) { + this._behaviorData.IsHovered = newValue; + } + _toggleIsHovered() { + this._setIsHovered(!this._getIsHovered()); + } + _getIdleText() { + return this._behaviorData.IdleText !== undefined ? this._behaviorData.IdleText : ""; + } + _setIdleText(newValue) { + this._behaviorData.IdleText = newValue; + } + _getIdleColor() { + return this._behaviorData.IdleColor !== undefined ? this._behaviorData.IdleColor : ""; + } + _setIdleColor(newValue) { + this._behaviorData.IdleColor = newValue; + } +} + +/** + * Shared data generated from Hover bitmap text style + */ +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.SharedData = class BitmapTextStyleStateSharedData { + constructor(sharedData) { + + } + + // Shared properties: + +} + +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.getSharedData = function(instanceContainer, behaviorName) { + if (!instanceContainer._PanelSpriteButton_BitmapTextStyleStateSharedData) { + const initialData = instanceContainer.getInitialSharedDataForBehavior( + behaviorName + ); + instanceContainer._PanelSpriteButton_BitmapTextStyleStateSharedData = new gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.SharedData( + initialData + ); + } + return instanceContainer._PanelSpriteButton_BitmapTextStyleStateSharedData; +} + +// Methods: +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.IsHoveredContext = {}; +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.IsHoveredContext.idToCallbackMap = new Map(); +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.IsHoveredContext.GDObjectObjects1= []; +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.IsHoveredContext.GDObjectObjects2= []; + + +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.IsHoveredContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getIsHovered(); +} +if (isConditionTrue_0) { +{eventsFunctionContext.returnValue = true;} +} + +} + + +}; + +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.IsHovered = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +let scopeInstanceContainer = null; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("PanelSpriteButton"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("PanelSpriteButton"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.IsHoveredContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.IsHoveredContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.IsHoveredContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.IsHoveredContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.IsHoveredContext.GDObjectObjects2.length = 0; + + +return !!eventsFunctionContext.returnValue; +} +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext = {}; +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.idToCallbackMap = new Map(); +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1= []; +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2= []; +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects3= []; + + +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = (eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getHoverColor() != ""); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2); +{eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setIdleColor((( gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2.length === 0 ) ? "" :gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).Color(eventsFunctionContext))) +} +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2[i].setTint(eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getHoverColor()); +} +} +} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{let isConditionTrue_1 = false; +isConditionTrue_0 = false; +{ +{isConditionTrue_1 = (eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getHoverPrefix() != ""); +} +if(isConditionTrue_1) { + isConditionTrue_0 = true; +} +} +{ +{isConditionTrue_1 = (eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getHoverSuffix() != ""); +} +if(isConditionTrue_1) { + isConditionTrue_0 = true; +} +} +{ +} +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1); +{eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setIdleText((( gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1.length === 0 ) ? "" :gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Text")).getText())) +} +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Text")).setText(eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getHoverPrefix() + (gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Text")).getText()) + eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getHoverSuffix()); +} +} +} + +} + + +};gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.eventsList1 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = (eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getHoverColor() != ""); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2); +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2[i].setTint(eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getIdleColor()); +} +} +} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{let isConditionTrue_1 = false; +isConditionTrue_0 = false; +{ +{isConditionTrue_1 = (eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getHoverPrefix() != ""); +} +if(isConditionTrue_1) { + isConditionTrue_0 = true; +} +} +{ +{isConditionTrue_1 = (eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getHoverSuffix() != ""); +} +if(isConditionTrue_1) { + isConditionTrue_0 = true; +} +} +{ +} +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Text")).setText(eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getIdleText()); +} +} +} + +} + + +};gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.eventsList2 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = !eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getIsHovered(); +} +if (isConditionTrue_0) { +isConditionTrue_0 = false; +{isConditionTrue_0 = eventsFunctionContext.getArgument("Value"); +} +} +if (isConditionTrue_0) { +{eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setIsHovered(true) +} + +{ //Subevents +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.eventsList0(runtimeScene, eventsFunctionContext);} //End of subevents +} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getIsHovered(); +} +if (isConditionTrue_0) { +isConditionTrue_0 = false; +{isConditionTrue_0 = !eventsFunctionContext.getArgument("Value"); +} +} +if (isConditionTrue_0) { +{eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setIsHovered(false) +} + +{ //Subevents +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.eventsList1(runtimeScene, eventsFunctionContext);} //End of subevents +} + +} + + +}; + +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHovered = function(Value, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +let scopeInstanceContainer = null; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("PanelSpriteButton"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("PanelSpriteButton"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Value") return Value; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2.length = 0; +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects3.length = 0; + +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.eventsList2(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2.length = 0; +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.SetIsHoveredContext.GDObjectObjects3.length = 0; + + +return; +} +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.ColorContext = {}; +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.ColorContext.idToCallbackMap = new Map(); +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.ColorContext.GDObjectObjects1= []; + + +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.ColorContext.userFunc0xd6dae8 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {gdjs.BitmapTextRuntimeObject} */ +const object = eventsFunctionContext.getObjects("Object")[0]; + +eventsFunctionContext.returnValue = object._tint.join(";"); +}; +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.ColorContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.ColorContext.userFunc0xd6dae8(runtimeScene, eventsFunctionContext); + +} + + +}; + +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.Color = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +let scopeInstanceContainer = null; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("PanelSpriteButton"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("PanelSpriteButton"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.ColorContext.GDObjectObjects1.length = 0; + +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.ColorContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.ColorContext.GDObjectObjects1.length = 0; + + +return "" + eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState.prototype.doStepPreEvents = function() { + this._onceTriggers.startNewFrame(); +}; + + +gdjs.registerBehavior("PanelSpriteButton::BitmapTextStyleState", gdjs.evtsExt__PanelSpriteButton__BitmapTextStyleState.BitmapTextStyleState); diff --git a/Export/gdjs-evtsext__panelspritebutton__buttonfsm.js b/Export/gdjs-evtsext__panelspritebutton__buttonfsm.js new file mode 100644 index 0000000..d2079ff --- /dev/null +++ b/Export/gdjs-evtsext__panelspritebutton__buttonfsm.js @@ -0,0 +1,1595 @@ + +gdjs.evtsExt__PanelSpriteButton__ButtonFSM = gdjs.evtsExt__PanelSpriteButton__ButtonFSM || {}; + +/** + * Behavior generated from Button finite state machine + */ +gdjs.evtsExt__PanelSpriteButton__ButtonFSM.ButtonFSM = class ButtonFSM extends gdjs.RuntimeBehavior { + constructor(instanceContainer, behaviorData, owner) { + super(instanceContainer, behaviorData, owner); + this._runtimeScene = instanceContainer; + + this._onceTriggers = new gdjs.OnceTriggers(); + this._behaviorData = {}; + this._sharedData = gdjs.evtsExt__PanelSpriteButton__ButtonFSM.ButtonFSM.getSharedData( + instanceContainer, + behaviorData.name + ); + + this._behaviorData.ShouldCheckHovering = true; + this._behaviorData.State = "Idle"; + this._behaviorData.TouchId = Number("0") || 0; + this._behaviorData.TouchIsInside = false; + this._behaviorData.MouseIsInside = false; + this._behaviorData.Index = Number("") || 0; + } + + // Hot-reload: + applyBehaviorOverriding(behaviorOverriding) { + + if (behaviorOverriding.ShouldCheckHovering !== undefined) + this._behaviorData.ShouldCheckHovering = behaviorOverriding.ShouldCheckHovering; + if (behaviorOverriding.State !== undefined) + this._behaviorData.State = behaviorOverriding.State; + if (behaviorOverriding.TouchId !== undefined) + this._behaviorData.TouchId = behaviorOverriding.TouchId; + if (behaviorOverriding.TouchIsInside !== undefined) + this._behaviorData.TouchIsInside = behaviorOverriding.TouchIsInside; + if (behaviorOverriding.MouseIsInside !== undefined) + this._behaviorData.MouseIsInside = behaviorOverriding.MouseIsInside; + if (behaviorOverriding.Index !== undefined) + this._behaviorData.Index = behaviorOverriding.Index; + + return true; + } + + // Network sync: + getNetworkSyncData(syncOptions) { + return { + ...super.getNetworkSyncData(syncOptions), + props: { + + ShouldCheckHovering: this._behaviorData.ShouldCheckHovering, + State: this._behaviorData.State, + TouchId: this._behaviorData.TouchId, + TouchIsInside: this._behaviorData.TouchIsInside, + MouseIsInside: this._behaviorData.MouseIsInside, + Index: this._behaviorData.Index, + } + }; + } + updateFromNetworkSyncData(networkSyncData, options) { + super.updateFromNetworkSyncData(networkSyncData, options); + + if (networkSyncData.props.ShouldCheckHovering !== undefined) + this._behaviorData.ShouldCheckHovering = networkSyncData.props.ShouldCheckHovering; + if (networkSyncData.props.State !== undefined) + this._behaviorData.State = networkSyncData.props.State; + if (networkSyncData.props.TouchId !== undefined) + this._behaviorData.TouchId = networkSyncData.props.TouchId; + if (networkSyncData.props.TouchIsInside !== undefined) + this._behaviorData.TouchIsInside = networkSyncData.props.TouchIsInside; + if (networkSyncData.props.MouseIsInside !== undefined) + this._behaviorData.MouseIsInside = networkSyncData.props.MouseIsInside; + if (networkSyncData.props.Index !== undefined) + this._behaviorData.Index = networkSyncData.props.Index; + } + + // Properties: + + _getShouldCheckHovering() { + return this._behaviorData.ShouldCheckHovering !== undefined ? this._behaviorData.ShouldCheckHovering : true; + } + _setShouldCheckHovering(newValue) { + this._behaviorData.ShouldCheckHovering = newValue; + } + _toggleShouldCheckHovering() { + this._setShouldCheckHovering(!this._getShouldCheckHovering()); + } + _getState() { + return this._behaviorData.State !== undefined ? this._behaviorData.State : "Idle"; + } + _setState(newValue) { + this._behaviorData.State = newValue; + } + _getTouchId() { + return this._behaviorData.TouchId !== undefined ? this._behaviorData.TouchId : Number("0") || 0; + } + _setTouchId(newValue) { + this._behaviorData.TouchId = newValue; + } + _getTouchIsInside() { + return this._behaviorData.TouchIsInside !== undefined ? this._behaviorData.TouchIsInside : false; + } + _setTouchIsInside(newValue) { + this._behaviorData.TouchIsInside = newValue; + } + _toggleTouchIsInside() { + this._setTouchIsInside(!this._getTouchIsInside()); + } + _getMouseIsInside() { + return this._behaviorData.MouseIsInside !== undefined ? this._behaviorData.MouseIsInside : false; + } + _setMouseIsInside(newValue) { + this._behaviorData.MouseIsInside = newValue; + } + _toggleMouseIsInside() { + this._setMouseIsInside(!this._getMouseIsInside()); + } + _getIndex() { + return this._behaviorData.Index !== undefined ? this._behaviorData.Index : Number("") || 0; + } + _setIndex(newValue) { + this._behaviorData.Index = newValue; + } +} + +/** + * Shared data generated from Button finite state machine + */ +gdjs.evtsExt__PanelSpriteButton__ButtonFSM.ButtonFSM.SharedData = class ButtonFSMSharedData { + constructor(sharedData) { + + } + + // Shared properties: + +} + +gdjs.evtsExt__PanelSpriteButton__ButtonFSM.ButtonFSM.getSharedData = function(instanceContainer, behaviorName) { + if (!instanceContainer._PanelSpriteButton_ButtonFSMSharedData) { + const initialData = instanceContainer.getInitialSharedDataForBehavior( + behaviorName + ); + instanceContainer._PanelSpriteButton_ButtonFSMSharedData = new gdjs.evtsExt__PanelSpriteButton__ButtonFSM.ButtonFSM.SharedData( + initialData + ); + } + return instanceContainer._PanelSpriteButton_ButtonFSMSharedData; +} + +// Methods: +gdjs.evtsExt__PanelSpriteButton__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext = {}; +gdjs.evtsExt__PanelSpriteButton__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.idToCallbackMap = new Map(); +gdjs.evtsExt__PanelSpriteButton__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects4_1final = []; + +gdjs.evtsExt__PanelSpriteButton__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects1= []; +gdjs.evtsExt__PanelSpriteButton__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects2= []; +gdjs.evtsExt__PanelSpriteButton__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects3= []; +gdjs.evtsExt__PanelSpriteButton__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects4= []; +gdjs.evtsExt__PanelSpriteButton__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects5= []; + + +gdjs.evtsExt__PanelSpriteButton__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +{eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setMouseIsInside(false) +} +} + +} + + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__PanelSpriteButton__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects3); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getShouldCheckHovering(); +} +if (isConditionTrue_0) { +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__PanelSpriteButton__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects3.length;i + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__PanelSpriteButton__IsInGameEdition = {}; +gdjs.evtsExt__PanelSpriteButton__IsInGameEdition.idToCallbackMap = new Map(); + + +gdjs.evtsExt__PanelSpriteButton__IsInGameEdition.userFunc0xcfe470 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const game = runtimeScene.getGame(); +eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition(); +}; +gdjs.evtsExt__PanelSpriteButton__IsInGameEdition.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__PanelSpriteButton__IsInGameEdition.userFunc0xcfe470(runtimeScene, eventsFunctionContext); + +} + + +}; + +gdjs.evtsExt__PanelSpriteButton__IsInGameEdition.func = function(runtimeScene, parentEventsFunctionContext) { +let scopeInstanceContainer = null; +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("PanelSpriteButton"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("PanelSpriteButton"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__PanelSpriteButton__IsInGameEdition.eventsList0(runtimeScene, eventsFunctionContext); + + +return !!eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__PanelSpriteButton__IsInGameEdition.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/Export/gdjs-evtsext__panelspritebutton__panelspritebutton.js b/Export/gdjs-evtsext__panelspritebutton__panelspritebutton.js new file mode 100644 index 0000000..f4da245 --- /dev/null +++ b/Export/gdjs-evtsext__panelspritebutton__panelspritebutton.js @@ -0,0 +1,2815 @@ + +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton = gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton || {}; + +/** + * Object generated from Labeled button + */ +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton = class PanelSpriteButton extends gdjs.CustomRuntimeObject2D { + constructor(parentInstanceContainer, objectData, instanceData) { + super(parentInstanceContainer, objectData, instanceData); + this._parentInstanceContainer = parentInstanceContainer; + + this._objectData = {}; + + this._objectData.LabelText = objectData.content.LabelText !== undefined ? objectData.content.LabelText : ""; + this._objectData.HoveredFadeOutDuration = objectData.content.HoveredFadeOutDuration !== undefined ? objectData.content.HoveredFadeOutDuration : Number("0.25") || 0; + this._objectData.PressedLabelOffsetY = objectData.content.PressedLabelOffsetY !== undefined ? objectData.content.PressedLabelOffsetY : Number("0") || 0; + this._objectData.LabelOffset = Number("0") || 0; + this._objectData._PropertyMapping = ""; + + + // It calls the onCreated super implementation at the end. + this.onCreated(); + } + + // Hot-reload: + updateFromObjectData(oldObjectData, newObjectData) { + super.updateFromObjectData(oldObjectData, newObjectData); + if (oldObjectData.content.LabelText !== newObjectData.content.LabelText) + this._objectData.LabelText = newObjectData.content.LabelText; + if (oldObjectData.content.HoveredFadeOutDuration !== newObjectData.content.HoveredFadeOutDuration) + this._objectData.HoveredFadeOutDuration = newObjectData.content.HoveredFadeOutDuration; + if (oldObjectData.content.PressedLabelOffsetY !== newObjectData.content.PressedLabelOffsetY) + this._objectData.PressedLabelOffsetY = newObjectData.content.PressedLabelOffsetY; + if (oldObjectData.content.LabelOffset !== newObjectData.content.LabelOffset) + this._objectData.LabelOffset = newObjectData.content.LabelOffset; + if (oldObjectData.content._PropertyMapping !== newObjectData.content._PropertyMapping) + this._objectData._PropertyMapping = newObjectData.content._PropertyMapping; + + this.onHotReloading(this._parentInstanceContainer); + return true; + } + + // Properties: + + _getLabelText() { + return this._objectData.LabelText !== undefined ? this._objectData.LabelText : ""; + } + _setLabelText(newValue) { + this._objectData.LabelText = newValue; + } + _getHoveredFadeOutDuration() { + return this._objectData.HoveredFadeOutDuration !== undefined ? this._objectData.HoveredFadeOutDuration : Number("0.25") || 0; + } + _setHoveredFadeOutDuration(newValue) { + this._objectData.HoveredFadeOutDuration = newValue; + } + _getPressedLabelOffsetY() { + return this._objectData.PressedLabelOffsetY !== undefined ? this._objectData.PressedLabelOffsetY : Number("0") || 0; + } + _setPressedLabelOffsetY(newValue) { + this._objectData.PressedLabelOffsetY = newValue; + } + _getLabelOffset() { + return this._objectData.LabelOffset !== undefined ? this._objectData.LabelOffset : Number("0") || 0; + } + _setLabelOffset(newValue) { + this._objectData.LabelOffset = newValue; + } + _get_PropertyMapping() { + return this._objectData._PropertyMapping !== undefined ? this._objectData._PropertyMapping : ""; + } + _set_PropertyMapping(newValue) { + this._objectData._PropertyMapping = newValue; + } + + + + +} + +// Methods: +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext = {}; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.idToCallbackMap = new Map(); +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDObjectObjects1= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDObjectObjects2= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDLabelObjects1= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDLabelObjects2= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDIdleObjects1= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDIdleObjects2= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDHoveredObjects1= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDHoveredObjects2= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDPressedObjects1= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDPressedObjects2= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDBitmapLabelObjects1= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDBitmapLabelObjects2= []; + + +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.mapOfGDgdjs_9546evtsExt_9595_9595PanelSpriteButton_9595_9595PanelSpriteButton_9546PanelSpriteButton_9546prototype_9546onCreatedContext_9546GDHoveredObjects1Objects = Hashtable.newFrom({"Hovered": gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDHoveredObjects1}); +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.mapOfGDgdjs_9546evtsExt_9595_9595PanelSpriteButton_9595_9595PanelSpriteButton_9546PanelSpriteButton_9546prototype_9546onCreatedContext_9546GDPressedObjects1Objects = Hashtable.newFrom({"Pressed": gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDPressedObjects1}); +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("BitmapLabel"), gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDBitmapLabelObjects1); +gdjs.copyArray(eventsFunctionContext.getObjects("Idle"), gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDIdleObjects1); +gdjs.copyArray(eventsFunctionContext.getObjects("Label"), gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDLabelObjects1); +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDHoveredObjects1.length = 0; + +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDPressedObjects1.length = 0; + +{gdjs.evtTools.object.createObjectOnScene(eventsFunctionContext, gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.mapOfGDgdjs_9546evtsExt_9595_9595PanelSpriteButton_9595_9595PanelSpriteButton_9546PanelSpriteButton_9546prototype_9546onCreatedContext_9546GDHoveredObjects1Objects, 0, 0, ""); +} +{gdjs.evtTools.object.createObjectOnScene(eventsFunctionContext, gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.mapOfGDgdjs_9546evtsExt_9595_9595PanelSpriteButton_9595_9595PanelSpriteButton_9546PanelSpriteButton_9546prototype_9546onCreatedContext_9546GDPressedObjects1Objects, 0, 0, ""); +} +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDHoveredObjects1.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDHoveredObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Resizable")).setSize((( gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDIdleObjects1.length === 0 ) ? 0 :gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDIdleObjects1[0].getWidth()), (( gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDIdleObjects1.length === 0 ) ? 0 :gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDIdleObjects1[0].getHeight())); +} +} +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDPressedObjects1.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDPressedObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Resizable")).setSize((( gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDIdleObjects1.length === 0 ) ? 0 :gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDIdleObjects1[0].getWidth()), (( gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDIdleObjects1.length === 0 ) ? 0 :gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDIdleObjects1[0].getHeight())); +} +} +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDHoveredObjects1.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDHoveredObjects1[i].hide(); +} +} +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDPressedObjects1.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDPressedObjects1[i].hide(); +} +} +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDHoveredObjects1.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDHoveredObjects1[i].setZOrder(1); +} +} +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDPressedObjects1.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDPressedObjects1[i].setZOrder(1); +} +} +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDLabelObjects1.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDLabelObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Text")).setText(eventsFunctionContext.getObjects("Object")[0]._getLabelText()); +} +for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDBitmapLabelObjects1.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDBitmapLabelObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Text")).setText(eventsFunctionContext.getObjects("Object")[0]._getLabelText()); +} +} +} + +} + + +}; + +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreated = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._instanceContainer; +let scopeInstanceContainer = this._instanceContainer; +var thisObjectList = [this]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var thisGDLabelObjectsList = [...runtimeScene.getObjects("Label")]; +var GDLabelObjects = Hashtable.newFrom({"Label": thisGDLabelObjectsList}); +var thisGDIdleObjectsList = [...runtimeScene.getObjects("Idle")]; +var GDIdleObjects = Hashtable.newFrom({"Idle": thisGDIdleObjectsList}); +var thisGDHoveredObjectsList = [...runtimeScene.getObjects("Hovered")]; +var GDHoveredObjects = Hashtable.newFrom({"Hovered": thisGDHoveredObjectsList}); +var thisGDPressedObjectsList = [...runtimeScene.getObjects("Pressed")]; +var GDPressedObjects = Hashtable.newFrom({"Pressed": thisGDPressedObjectsList}); +var thisGDBitmapLabelObjectsList = [...runtimeScene.getObjects("BitmapLabel")]; +var GDBitmapLabelObjects = Hashtable.newFrom({"BitmapLabel": thisGDBitmapLabelObjectsList}); +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +, "Label": GDLabelObjects +, "Idle": GDIdleObjects +, "Hovered": GDHoveredObjects +, "Pressed": GDPressedObjects +, "BitmapLabel": GDBitmapLabelObjects +}, + _objectArraysMap: { +"Object": thisObjectList +, "Label": thisGDLabelObjectsList +, "Idle": thisGDIdleObjectsList +, "Hovered": thisGDHoveredObjectsList +, "Pressed": thisGDPressedObjectsList +, "BitmapLabel": thisGDBitmapLabelObjectsList +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("PanelSpriteButton"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("PanelSpriteButton"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDObjectObjects2.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDLabelObjects1.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDLabelObjects2.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDIdleObjects1.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDIdleObjects2.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDHoveredObjects1.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDHoveredObjects2.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDPressedObjects1.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDPressedObjects2.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDBitmapLabelObjects1.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDBitmapLabelObjects2.length = 0; + +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDObjectObjects2.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDLabelObjects1.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDLabelObjects2.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDIdleObjects1.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDIdleObjects2.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDHoveredObjects1.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDHoveredObjects2.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDPressedObjects1.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDPressedObjects2.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDBitmapLabelObjects1.length = 0; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onCreatedContext.GDBitmapLabelObjects2.length = 0; + +gdjs.CustomRuntimeObject.prototype.onCreated.call(this); + +return; +} +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onHotReloadingContext = {}; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onHotReloadingContext.idToCallbackMap = new Map(); +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onHotReloadingContext.GDObjectObjects1= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onHotReloadingContext.GDObjectObjects2= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onHotReloadingContext.GDLabelObjects1= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onHotReloadingContext.GDLabelObjects2= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onHotReloadingContext.GDIdleObjects1= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onHotReloadingContext.GDIdleObjects2= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onHotReloadingContext.GDHoveredObjects1= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onHotReloadingContext.GDHoveredObjects2= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onHotReloadingContext.GDPressedObjects1= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onHotReloadingContext.GDPressedObjects2= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onHotReloadingContext.GDBitmapLabelObjects1= []; +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onHotReloadingContext.GDBitmapLabelObjects2= []; + + +gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onHotReloadingContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onHotReloadingContext.GDObjectObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.onHotReloadingContext.GDObjectObjects1.length;i 0); +} +} +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.doStepPostEventsContext.GDHoveredObjects3 */ +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.doStepPostEventsContext.GDHoveredObjects3.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.doStepPostEventsContext.GDHoveredObjects3[i].getBehavior(eventsFunctionContext.getBehaviorName("Tween")).addObjectOpacityTween2("Fadeout", 0, "linear", eventsFunctionContext.getObjects("Object")[0]._getHoveredFadeOutDuration(), false); +} +} +} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = (eventsFunctionContext.getObjects("Object")[0]._getHoveredFadeOutDuration() == 0); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Hovered"), gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.doStepPostEventsContext.GDHoveredObjects2); +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.doStepPostEventsContext.GDHoveredObjects2.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.doStepPostEventsContext.GDHoveredObjects2[i].hide(); +} +} +} + +} + + +};gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.doStepPostEventsContext.eventsList1 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = (eventsFunctionContext.getObjects("Object")[0]._getHoveredFadeOutDuration() > 0); +} +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.doStepPostEventsContext.GDHoveredObjects2 */ +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.doStepPostEventsContext.GDHoveredObjects2.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.doStepPostEventsContext.GDHoveredObjects2[i].getBehavior(eventsFunctionContext.getBehaviorName("Tween")).removeTween("Fadeout"); +} +} +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.doStepPostEventsContext.GDHoveredObjects2.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.doStepPostEventsContext.GDHoveredObjects2[i].getBehavior(eventsFunctionContext.getBehaviorName("Opacity")).setOpacity(255); +} +} +} + +} + + +};gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.doStepPostEventsContext.eventsList2 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.doStepPostEventsContext.GDObjectObjects2); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__PanelSpriteButton__PanelSpriteButton.PanelSpriteButton.prototype.doStepPostEventsContext.GDObjectObjects2.length;i 0); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2); +{eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setIdleFontSize((( gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2.length === 0 ) ? 0 :gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2[0].getCharacterSize())) +} +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2[i].setCharacterSize(eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getHoverFontSize()); +} +} +} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = (eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getHoverColor() != ""); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2); +{eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setIdleColor((( gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2.length === 0 ) ? "" :gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).Color(eventsFunctionContext))) +} +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2[i].setColor(eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getHoverColor()); +} +} +} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getShouldEnableShadowOnHover(); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2); +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2[i].showShadow(true); +} +} +} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getShouldEnableOutlineOnHover(); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1[i].setOutlineEnabled(true); +} +} +} + +} + + +};gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.eventsList1 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = (eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getHoverFontSize() > 0); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2); +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2[i].setCharacterSize(eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getIdleFontSize()); +} +} +} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = (eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getHoverColor() != ""); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2); +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2[i].setColor(eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getIdleColor()); +} +} +} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getShouldEnableShadowOnHover(); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2); +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2[i].showShadow(false); +} +} +} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getShouldEnableOutlineOnHover(); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1[i].setOutlineEnabled(false); +} +} +} + +} + + +};gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.eventsList2 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = !eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getIsHovered(); +} +if (isConditionTrue_0) { +isConditionTrue_0 = false; +{isConditionTrue_0 = eventsFunctionContext.getArgument("Value"); +} +} +if (isConditionTrue_0) { +{eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setIsHovered(true) +} + +{ //Subevents +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.eventsList0(runtimeScene, eventsFunctionContext);} //End of subevents +} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getIsHovered(); +} +if (isConditionTrue_0) { +isConditionTrue_0 = false; +{isConditionTrue_0 = !eventsFunctionContext.getArgument("Value"); +} +} +if (isConditionTrue_0) { +{eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setIsHovered(false) +} + +{ //Subevents +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.eventsList1(runtimeScene, eventsFunctionContext);} //End of subevents +} + +} + + +}; + +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHovered = function(Value, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +let scopeInstanceContainer = null; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("PanelSpriteButton"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("PanelSpriteButton"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Value") return Value; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2.length = 0; +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects3.length = 0; + +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.eventsList2(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects2.length = 0; +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.SetIsHoveredContext.GDObjectObjects3.length = 0; + + +return; +} +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.ColorContext = {}; +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.ColorContext.idToCallbackMap = new Map(); +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.ColorContext.GDObjectObjects1= []; + + +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.ColorContext.userFunc0xc97150 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {gdjs.TextRuntimeObject} */ +const object = eventsFunctionContext.getObjects("Object")[0]; + +eventsFunctionContext.returnValue = object._color.join(";"); +}; +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.ColorContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.ColorContext.userFunc0xc97150(runtimeScene, eventsFunctionContext); + +} + + +}; + +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.Color = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +let scopeInstanceContainer = null; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("PanelSpriteButton"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("PanelSpriteButton"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.ColorContext.GDObjectObjects1.length = 0; + +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.ColorContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.ColorContext.GDObjectObjects1.length = 0; + + +return "" + eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState.prototype.doStepPreEvents = function() { + this._onceTriggers.startNewFrame(); +}; + + +gdjs.registerBehavior("PanelSpriteButton::TextStyleState", gdjs.evtsExt__PanelSpriteButton__TextStyleState.TextStyleState); diff --git a/Export/gdjs-evtsext__pixelperfectmovement__brakingdistance-func.js b/Export/gdjs-evtsext__pixelperfectmovement__brakingdistance-func.js new file mode 100644 index 0000000..208a69a --- /dev/null +++ b/Export/gdjs-evtsext__pixelperfectmovement__brakingdistance-func.js @@ -0,0 +1,93 @@ + +if (typeof gdjs.evtsExt__PixelPerfectMovement__BrakingDistance !== "undefined") { + gdjs.evtsExt__PixelPerfectMovement__BrakingDistance.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__PixelPerfectMovement__BrakingDistance = {}; +gdjs.evtsExt__PixelPerfectMovement__BrakingDistance.idToCallbackMap = new Map(); + + +gdjs.evtsExt__PixelPerfectMovement__BrakingDistance.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +{eventsFunctionContext.returnValue = eventsFunctionContext.getArgument("Speed") * eventsFunctionContext.getArgument("Speed") / (2 * eventsFunctionContext.getArgument("Deceleration"));} +} + +} + + +}; + +gdjs.evtsExt__PixelPerfectMovement__BrakingDistance.func = function(runtimeScene, Speed, Deceleration, parentEventsFunctionContext) { +let scopeInstanceContainer = null; +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("PixelPerfectMovement"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("PixelPerfectMovement"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Speed") return Speed; +if (argName === "Deceleration") return Deceleration; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__PixelPerfectMovement__BrakingDistance.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__PixelPerfectMovement__BrakingDistance.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/Export/gdjs-evtsext__pixelperfectmovement__definejavascriptfortopdown-func.js b/Export/gdjs-evtsext__pixelperfectmovement__definejavascriptfortopdown-func.js new file mode 100644 index 0000000..04709af --- /dev/null +++ b/Export/gdjs-evtsext__pixelperfectmovement__definejavascriptfortopdown-func.js @@ -0,0 +1,536 @@ + +if (typeof gdjs.evtsExt__PixelPerfectMovement__DefineJavaScriptForTopDown !== "undefined") { + gdjs.evtsExt__PixelPerfectMovement__DefineJavaScriptForTopDown.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__PixelPerfectMovement__DefineJavaScriptForTopDown = {}; +gdjs.evtsExt__PixelPerfectMovement__DefineJavaScriptForTopDown.idToCallbackMap = new Map(); + + +gdjs.evtsExt__PixelPerfectMovement__DefineJavaScriptForTopDown.userFunc0xa43328 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +if (gdjs.__pixelPerfectExtension) { + return; +} + +const epsilon = 1 / (1 << 20); + +class PixelPerfectTopDownMovement { + + /** + * @param {gdjs.RuntimeBehavior} pixelPerfectBehavior + * @param {gdjs.TopDownMovementRuntimeBehavior} topDownBehavior + */ + constructor(pixelPerfectBehavior, topDownBehavior) { + /** @type {gdjs.RuntimeBehavior} */ + this.pixelPerfectBehavior = pixelPerfectBehavior; + /** @type {gdjs.TopDownMovementRuntimeBehavior} */ + this.topDownBehavior = topDownBehavior; + + topDownBehavior.registerHook(this); + + /** @type {number | null} */ + this.targetX = null; + /** @type {number | null} */ + this.targetY = null; + this.targetDirectionX = 0; + this.targetDirectionY = 0; + this.lastDirection = -1; + this.isVelocityAdjusted = false; + this.isVelocityAdjustedOnX = false; + this.isVelocityAdjustedOnY = false; + } + + /** + * Return the direction to use instead of the direction given in + * parameter. + * @param {gdjs.TopDownMovementRuntimeBehavior.TopDownMovementHookContext} context + * @return {number} + */ + overrideDirection(context) { + let direction = context.getDirection(); + if (!this.pixelPerfectBehavior.activated()) { + return direction; + } + + /** @type {number} */ + const cellSize = this.pixelPerfectBehavior._getPixelSize(); + const that = this.topDownBehavior; + const object = that.owner; + + if (cellSize <= 0 || that._allowDiagonals) { + return direction; + } + + // Forbid to turn before being aligned on the grid. + + const timeDelta = object.getElapsedTime() / 1000; + const deltaX = Math.abs(that._xVelocity * timeDelta); + const deltaY = Math.abs(that._yVelocity * timeDelta); + + const isTryingToMoveOnX = direction === 4 || direction === 0; + const isTryingToMoveOnY = direction === 6 || direction === 2; + if (isTryingToMoveOnX) { + if (that._yVelocity < 0) { + if (Math.abs(this.ceilToCellY(object.y) - object.y) > deltaY) { + direction = 6; + } else { + object.y = this.ceilToCellY(object.y); + } + } + if (that._yVelocity > 0) { + if (Math.abs(this.floorToCellY(object.y) - object.y) > deltaY) { + direction = 2; + } else { + object.y = this.floorToCellY(object.y); + } + } + } else if (isTryingToMoveOnY) { + if (that._xVelocity < 0) { + if (Math.abs(this.ceilToCellX(object.x) - object.x) > deltaX) { + direction = 4; + } else { + object.x = this.ceilToCellX(object.x); + } + } + if (that._xVelocity > 0) { + if (Math.abs(this.floorToCellX(object.x) - object.x) > deltaX) { + direction = 0; + } else { + object.x = this.floorToCellX(object.x); + } + } + } + + // Ensure sharp turn even with Verlet integrations. + const speed = Math.abs(that._xVelocity + that._yVelocity); + if (direction === 0) { + that._xVelocity = speed; + that._yVelocity = 0; + } else if (direction === 4) { + that._xVelocity = -speed; + that._yVelocity = 0; + } else if (direction === 2) { + that._yVelocity = speed; + that._xVelocity = 0; + } else if (direction === 6) { + that._yVelocity = -speed; + that._xVelocity = 0; + } + + this.lastDirection = direction; + return direction; + } + + /** + * Called before the acceleration and new direction is applied to the + * velocity. + * @param {gdjs.TopDownMovementRuntimeBehavior.TopDownMovementHookContext} context + */ + beforeSpeedUpdate(context) { + if (!this.pixelPerfectBehavior.activated()) { + return; + } + + const direction = context.getDirection(); + /** @type {number} */ + const cellSize = this.pixelPerfectBehavior._getPixelSize(); + const that = this.topDownBehavior; + const object = that.owner; + + if (cellSize <= 0) { + return; + } + + const isMovingOnX = + direction !== -1 && direction !== 2 && direction !== 6; + if (isMovingOnX) { + this.targetX = null; + } else if (this.targetX === null) { + // Find where the deceleration should stop the object. + if (that._xVelocity > 0) { + this.targetX = this.ceilToCellX( + object.x + this.getBreakingDistanceX() + ); + this.targetDirectionX = 1; + } + if (that._xVelocity < 0) { + this.targetX = this.floorToCellX( + object.x - this.getBreakingDistanceX() + ); + this.targetDirectionX = -1; + } + } + + const isMovingOnY = + direction !== -1 && direction !== 0 && direction !== 4; + if (isMovingOnY) { + this.targetY = null; + } else if (this.targetY === null) { + // Find where the deceleration should stop the object. + if (that._yVelocity > 0) { + this.targetY = this.ceilToCellY( + object.y + this.getBreakingDistanceY() + ); + this.targetDirectionY = 1; + } + if (that._yVelocity < 0) { + this.targetY = this.floorToCellY( + object.y - this.getBreakingDistanceY() + ); + this.targetDirectionY = -1; + } + } + + // Make as if the player had press button a bit longer to reach exactly + // the next cell. + + this.isVelocityAdjustedOnX = this.targetX !== null; + if (this.isVelocityAdjustedOnX) { + if (this.targetDirectionX > 0) { + if (this.targetX > object.getX()) { + that._xVelocity = Math.min( + that._xVelocity + that._acceleration, + that._maxSpeed, + this.getSpeedToReach(this.targetX - object.getX()) + ); + } + const nextFrameX = object.getX() + that._xVelocity * object.getElapsedTime() / 1000; + if (this.targetX <= nextFrameX) { + that._xVelocity = 0; + object.setX(this.roundToCellX(object.getX())); + this.targetX = null; + } + } + if (this.targetDirectionX < 0) { + if (this.targetX < object.getX()) { + that._xVelocity = Math.max( + that._xVelocity - that._acceleration, + -that._maxSpeed, + this.getSpeedToReach(this.targetX - object.getX()) + ); + } + const nextFrameX = object.getX() + that._xVelocity * object.getElapsedTime() / 1000; + if (this.targetX >= nextFrameX) { + that._xVelocity = 0; + object.setX(this.roundToCellX(object.getX())); + this.targetX = null; + } + } + // The velocity is exact. There no need for Verlet integration. + this.previousVelocityX = that._xVelocity; + } + + this.isVelocityAdjustedOnY = this.targetY !== null; + if (this.isVelocityAdjustedOnY) { + if (this.targetDirectionY > 0) { + if (this.targetY > object.getY()) { + that._yVelocity = Math.min( + that._yVelocity + that._acceleration, + that._maxSpeed, + this.getSpeedToReach(this.targetY - object.getY()) + ); + } + const nextFrameY = object.getY() + that._yVelocity * object.getElapsedTime() / 1000; + if (this.targetY <= nextFrameY) { + that._yVelocity = 0; + object.setY(this.roundToCellY(object.getY())); + this.targetY = null; + } + } + if (this.targetDirectionY < 0) { + if (this.targetY < object.getY()) { + that._yVelocity = Math.max( + that._yVelocity - that._acceleration, + -that._maxSpeed, + this.getSpeedToReach(this.targetY - object.getY()) + ); + } + const nextFrameY = object.getY() + that._yVelocity * object.getElapsedTime() / 1000; + if (this.targetY >= nextFrameY) { + that._yVelocity = 0; + object.setY(this.roundToCellY(object.getY())); + this.targetY = null; + } + } + // The velocity is exact. There no need for Verlet integration. + this.previousVelocityY = that._yVelocity; + } + } + + /** + * Called before the velocity is applied to the object position and + * angle. + */ + beforePositionUpdate() { + if (!this.pixelPerfectBehavior.activated()) { + return; + } + + /** @type {number} */ + const cellSize = this.pixelPerfectBehavior._getPixelSize(); + if (cellSize <= 0) { + return; + } + + const that = this.topDownBehavior; + + if (this.isVelocityAdjustedOnX) { + // The velocity is exact. There no need for Verlet integration. + that._xVelocity = this.previousVelocityX; + } + if (this.isVelocityAdjustedOnY) { + // The velocity is exact. There no need for Verlet integration. + that._yVelocity = this.previousVelocityY; + } + } + + doStepPostEvents(instanceContainer) { + /** @type {number} */ + const cellSize = this.pixelPerfectBehavior._getPixelSize(); + if (cellSize <= 0) { + return; + } + + const that = this.topDownBehavior; + const object = that.owner; + + const isMovingOnX = + this.lastDirection !== -1 && + this.lastDirection !== 2 && + this.lastDirection !== 6; + const isMovingOnY = + this.lastDirection !== -1 && + this.lastDirection !== 0 && + this.lastDirection !== 4; + + // Avoid rounding errors after a call to "separate" to make characters + // move indefinitely in front of a wall because they can't reach the cell. + if (!isMovingOnX && that._xVelocity !== 0) { + const x = object.getX(); + const roundedX = this.roundToCellX(x); + if (Math.abs(roundedX - x) < epsilon) { + object.setX(roundedX); + this.targetDirectionX = 0; + that._xVelocity = 0; + } + } + if (!isMovingOnY && that._yVelocity !== 0) { + const y = object.getY(); + const roundedY = this.roundToCellY(y); + if (Math.abs(roundedY - y) < epsilon) { + object.setY(roundedY); + this.targetDirectionY = 0; + that._yVelocity = 0; + } + } + } + + /** + * @returns {number} the braking distance according to an initial speed and a deceleration. + */ + getBreakingDistanceX() { + const that = this.topDownBehavior; + return (that._xVelocity * that._xVelocity) / (2 * that._deceleration); + } + + /** + * @returns {number} the braking distance according to an initial speed and a deceleration. + */ + getBreakingDistanceY() { + const that = this.topDownBehavior; + return (that._yVelocity * that._yVelocity) / (2 * that._deceleration); + } + + /** + * @param {number} displacement + * @returns {number} the speed necessary to cover a distance according to the deceleration. + */ + getSpeedToReach(displacement) { + const that = this.topDownBehavior; + return ( + Math.sign(displacement) * + Math.sqrt(2 * Math.abs(displacement) * that._deceleration) + ); + } + + /** + * @param {number} x + * @return {number} + */ + ceilToCellX(x) { + /** @type {number} */ + const cellSize = this.pixelPerfectBehavior._getPixelSize(); + /** @type {number} */ + const gridOffsetX = this.pixelPerfectBehavior._getOffsetX(); + + return ( + gridOffsetX + + cellSize * Math.ceil((x - gridOffsetX) / cellSize) + ); + } + + /** + * @param {number} x + * @return {number} + */ + roundToCellX(x) { + /** @type {number} */ + const cellSize = this.pixelPerfectBehavior._getPixelSize(); + /** @type {number} */ + const gridOffsetX = this.pixelPerfectBehavior._getOffsetX(); + + return ( + gridOffsetX + + cellSize * Math.round((x - gridOffsetX) / cellSize) + ); + } + + /** + * @param {number} x + * @return {number} + */ + floorToCellX(x) { + /** @type {number} */ + const cellSize = this.pixelPerfectBehavior._getPixelSize(); + /** @type {number} */ + const gridOffsetX = this.pixelPerfectBehavior._getOffsetX(); + + return ( + gridOffsetX + + cellSize * Math.floor((x - gridOffsetX) / cellSize) + ); + } + + /** + * @param {number} y + * @return {number} + */ + ceilToCellY(y) { + /** @type {number} */ + const cellSize = this.pixelPerfectBehavior._getPixelSize(); + /** @type {number} */ + const gridOffsetY = this.pixelPerfectBehavior._getOffsetY(); + + return ( + gridOffsetY + + cellSize * Math.ceil((y - gridOffsetY) / cellSize) + ); + } + + /** + * @param {number} y + * @return {number} + */ + roundToCellY(y) { + /** @type {number} */ + const cellSize = this.pixelPerfectBehavior._getPixelSize(); + /** @type {number} */ + const gridOffsetY = this.pixelPerfectBehavior._getOffsetY(); + + return ( + gridOffsetY + + cellSize * Math.round((y - gridOffsetY) / cellSize) + ); + } + + /** + * @param {number} y + * @return {number} + */ + floorToCellY(y) { + /** @type {number} */ + const cellSize = this.pixelPerfectBehavior._getPixelSize(); + /** @type {number} */ + const gridOffsetY = this.pixelPerfectBehavior._getOffsetY(); + + return ( + gridOffsetY + + cellSize * Math.floor((y - gridOffsetY) / cellSize) + ); + } +} + +gdjs.__pixelPerfectExtension = { + PixelPerfectTopDownMovement +} +}; +gdjs.evtsExt__PixelPerfectMovement__DefineJavaScriptForTopDown.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__PixelPerfectMovement__DefineJavaScriptForTopDown.userFunc0xa43328(runtimeScene, eventsFunctionContext); + +} + + +}; + +gdjs.evtsExt__PixelPerfectMovement__DefineJavaScriptForTopDown.func = function(runtimeScene, parentEventsFunctionContext) { +let scopeInstanceContainer = null; +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("PixelPerfectMovement"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("PixelPerfectMovement"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__PixelPerfectMovement__DefineJavaScriptForTopDown.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__PixelPerfectMovement__DefineJavaScriptForTopDown.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/Export/gdjs-evtsext__pixelperfectmovement__speedtoreach-func.js b/Export/gdjs-evtsext__pixelperfectmovement__speedtoreach-func.js new file mode 100644 index 0000000..3d8a85d --- /dev/null +++ b/Export/gdjs-evtsext__pixelperfectmovement__speedtoreach-func.js @@ -0,0 +1,110 @@ + +if (typeof gdjs.evtsExt__PixelPerfectMovement__SpeedToReach !== "undefined") { + gdjs.evtsExt__PixelPerfectMovement__SpeedToReach.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__PixelPerfectMovement__SpeedToReach = {}; +gdjs.evtsExt__PixelPerfectMovement__SpeedToReach.idToCallbackMap = new Map(); + + +gdjs.evtsExt__PixelPerfectMovement__SpeedToReach.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = (eventsFunctionContext.getArgument("Distance") >= 0); +} +if (isConditionTrue_0) { +{eventsFunctionContext.returnValue = Math.sqrt(2 * eventsFunctionContext.getArgument("Distance") * eventsFunctionContext.getArgument("Deceleration"));} +} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = (eventsFunctionContext.getArgument("Distance") < 0); +} +if (isConditionTrue_0) { +{eventsFunctionContext.returnValue = -(Math.sqrt(-2 * eventsFunctionContext.getArgument("Distance") * eventsFunctionContext.getArgument("Deceleration")));} +} + +} + + +}; + +gdjs.evtsExt__PixelPerfectMovement__SpeedToReach.func = function(runtimeScene, Distance, Deceleration, parentEventsFunctionContext) { +let scopeInstanceContainer = null; +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("PixelPerfectMovement"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("PixelPerfectMovement"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + if (!(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName))) { + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + } + return object; + } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext && !(scopeInstanceContainer && scopeInstanceContainer.isObjectRegistered(objectName)) ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Distance") return Distance; +if (argName === "Deceleration") return Deceleration; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__PixelPerfectMovement__SpeedToReach.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__PixelPerfectMovement__SpeedToReach.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/Export/howler-sound-manager/howler-sound-manager.js b/Export/howler-sound-manager/howler-sound-manager.js new file mode 100644 index 0000000..350e959 --- /dev/null +++ b/Export/howler-sound-manager/howler-sound-manager.js @@ -0,0 +1,2 @@ +var gdjs;(function(h){const d=new h.Logger("Audio manager"),f=["audio"],_={preload:!0,onplayerror:(l,e)=>d.error("Can't play an audio file: "+e),onloaderror:(l,e)=>d.error("Error while loading an audio file: "+e)},c=l=>l>1?1:l<0?0:l,u=(l,e)=>{if(l instanceof Error&&l.message&&typeof l.message=="string"&&l.message.startsWith("Maximum call stack size exceeded"))console.warn(`An error occurred when call method "${e}":`,l);else throw l};class m{constructor(e,t,s,i,a){this._id=null;this._oncePlay=[];this._onPlay=[];this._howl=e,this._initialVolume=c(t),this._loop=s,this._rate=i,this._audioResourceName=a}isActualId(){return!!this._howl._soundById(this._id)}isLoaded(){return this._howl.state()==="loaded"}play(){try{if(this.isLoaded()){const e=this._howl.play(this._id===null?"__default":this._id);this._id=e,this._howl.volume(this._initialVolume,e),this._howl.loop(this._loop,e),this._howl.rate(h.HowlerSoundManager.clampRate(this._rate),e),this._onPlay.forEach(t=>{this.on("play",t),t(e)}),this._oncePlay.forEach(t=>t(e)),this._onPlay=[],this._oncePlay=[]}else this._howl.once("load",()=>this.play())}catch(e){u(e,"play")}return this}pause(){try{this._id!==null&&this.isActualId()&&this._howl.pause(this._id)}catch(e){u(e,"pause")}return this}stop(){try{this._id!==null&&this.isActualId()&&this._howl.stop(this._id)}catch(e){u(e,"stop")}return this}playing(){return(this._id!==null?this._howl.playing(this._id):!0)||!this.isLoaded()}paused(){return!this.playing()}stopped(){return this.paused()&&this.getSeek()===0}getRate(){return this._rate}setRate(e){try{this._rate=e,this._id!==null&&this.isActualId()&&(e=h.HowlerSoundManager.clampRate(e),this._howl.rate(e,this._id))}catch(t){u(t,"rate")}return this}getLoop(){return this._loop}setLoop(e){try{this._loop=e,this._id!==null&&this.isActualId()&&this._howl.loop(e,this._id)}catch(t){u(t,"loop")}return this}getVolume(){try{return this._id===null||!this.isActualId()?this._initialVolume:this._howl.volume(this._id)}catch(e){u(e,"getVolume")}return this._initialVolume}setVolume(e){try{this._initialVolume=c(e),this._id!==null&&this.isActualId()&&this._howl.volume(this._initialVolume,this._id)}catch(t){u(t,"volume")}return this}getMute(){return this._id===null||!this.isActualId()?!1:this._howl.mute(this._id)}setMute(e){try{this._id!==null&&this.isActualId()&&this._howl.mute(e,this._id)}catch(t){u(t,"mute")}return this}getSeek(){return this._id===null||!this.isActualId()?0:this._howl.seek(this._id)}setSeek(e){try{this._id!==null&&this.isActualId()&&this._howl.seek(e,this._id)}catch(t){u(t,"seek")}return this}getSpatialPosition(e){return this._id===null||!this.isActualId()?0:this._howl.pos(this._id)[e==="x"?0:e==="y"?1:2]}setSpatialPosition(e,t,s){return this._id!==null&&this.isActualId()&&this._howl.pos(e,t,s,this._id),this}fade(e,t,s){try{this._id!==null&&this.isActualId()&&this._howl.fade(c(e),c(t),s,this._id)}catch(i){u(i,"fade")}return this}on(e,t){return e==="play"?this._id===null?this._onPlay.push(t):this._howl.on(e,t,this._id):this._id===null?this.once("play",()=>this.on(e,t)):this._howl.on(e,t,this._id),this}once(e,t){return e==="play"?this._id===null?this._oncePlay.push(t):this.playing()?t(this._id):this._howl.once(e,t,this._id):this._id===null?this.once("play",()=>this.once(e,t)):this._howl.once(e,t,this._id),this}off(e,t){return this._id!==null&&this._howl.off(e,t,this._id),this}getNetworkSyncData(){if(this.paused()||!this.isLoaded()||this.stopped())return;const e=this.getSeek(),t=typeof e!="number"?0:e,s=this.isLoaded()?this.getVolume():this._initialVolume;return{resourceName:this._audioResourceName,loop:this._loop,volume:s,rate:this._rate,seek:t}}}h.HowlerSound=m;class p{constructor(e){this._loadedMusics=new h.ResourceCache;this._loadedSounds=new h.ResourceCache;this._availableResources={};this._globalVolume=100;this._sounds={};this._cachedSpatialPosition={};this._musics={};this._freeSounds=[];this._freeMusics=[];this._muteEverythingReasons=new Set;this._pausedSounds=[];this._paused=!1;this._getAudioResource=e=>{const t=this._resourceLoader.getResource(e);return t&&this.getResourceKinds().includes(t.kind)?t:{file:e,kind:"audio",metadata:"",name:e}};this._resourceLoader=e,h.registerRuntimeScenePostEventsCallback(this._clearCachedSpatialPosition.bind(this));const t=this;document.addEventListener("deviceready",function(){document.addEventListener("pause",function(){t.pauseAllActiveSounds()},!1),document.addEventListener("resume",function(){t.resumeAllActiveSounds()},!1)})}pauseAllActiveSounds(){const e=this._freeSounds.concat(this._freeMusics);for(let t in this._sounds)this._sounds.hasOwnProperty(t)&&e.push(this._sounds[t]);for(let t in this._musics)this._musics.hasOwnProperty(t)&&e.push(this._musics[t]);for(let t=0;t{});try{for(let t=0;t4?4:e<.5?.5:e}_getSoundUrlsFromResource(e){return[this._resourceLoader.getFullUrl(e.file)]}_getDefaultSoundUrl(e){return this._resourceLoader.getFullUrl(e.file)}_preloadAudioFile(e,t){const s=e.file;return new Promise((i,a)=>{const o=t?this._loadedMusics:this._loadedSounds;o[s]=new Howl(Object.assign({},_,{src:this._getSoundUrlsFromResource(e),onload:i,onloaderror:(n,r)=>a(r),html5:t,xhr:{withCredentials:this._resourceLoader.checkIfCredentialsRequired(s)},volume:0}))})}_storeSoundInArray(e,t){for(let s=0,i=e.length;s{this._paused&&(o.pause(),this._pausedSounds.push(o))}),o.play(),a&&o.setSeek(a)}playSoundOnChannel(e,t,s,i,a,o){this._sounds[t]&&this._sounds[t].stop();const n=this.createHowlerSound(e,!1,i/100,s,a),r=this._cachedSpatialPosition[t];r&&n.once("play",()=>{n.setSpatialPosition(...r)}),this._sounds[t]=n,n.once("play",()=>{this._paused&&(n.pause(),this._pausedSounds.push(n))}),n.play(),o&&n.setSeek(o)}getSoundOnChannel(e){return this._sounds[e]||null}playMusic(e,t,s,i,a){const o=this.createHowlerSound(e,!0,s/100,t,i);this._storeSoundInArray(this._freeMusics,o),o.once("play",()=>{this._paused&&(o.pause(),this._pausedSounds.push(o))}),o.play(),a&&o.setSeek(a)}playMusicOnChannel(e,t,s,i,a,o){this._musics[t]&&this._musics[t].stop();const n=this.createHowlerSound(e,!0,i/100,s,a);this._musics[t]=n,n.once("play",()=>{this._paused&&(n.pause(),this._pausedSounds.push(n))}),n.play(),o&&n.setSeek(o)}getMusicOnChannel(e){return this._musics[e]||null}setSoundSpatialPositionOnChannel(e,t,s,i){const a=this.getSoundOnChannel(e);a&&!a.paused()?a.setSpatialPosition(t,s,i):this._cachedSpatialPosition[e]=[t,s,i]}_clearCachedSpatialPosition(){this._cachedSpatialPosition={}}muteEverything(e){this._muteEverythingReasons.add(e),this._updateGlobalVolume()}unmuteEverything(e){this._muteEverythingReasons.delete(e),this._updateGlobalVolume()}setGlobalVolume(e){this._globalVolume=e,this._globalVolume>100&&(this._globalVolume=100),this._globalVolume<0&&(this._globalVolume=0),this._updateGlobalVolume()}getGlobalVolume(){return this._globalVolume}_updateGlobalVolume(){this._muteEverythingReasons.size>0?Howler.volume(0):Howler.volume(this._globalVolume/100)}clearAll(){Howler.stop(),this._freeSounds.length=0,this._freeMusics.length=0,this._sounds={},this._musics={},this._pausedSounds.length=0}async processResource(e){}async loadResource(e){const t=this._resourceLoader.getResource(e);if(!t){d.warn('Unable to find audio for resource "'+e+'".');return}if(t.file){if(this._availableResources[t.name])return;this._availableResources[t.name]=t}if(t.preloadAsMusic)try{await this._preloadAudioFile(t,!0)}catch(s){throw delete this._availableResources[t.name],d.warn("There was an error while preloading an audio file: "+s),s}if(t.preloadAsSound)try{await this._preloadAudioFile(t,!1)}catch(s){throw delete this._availableResources[t.name],d.warn("There was an error while preloading an audio file: "+s),s}else if(t.preloadInCache||!t.preloadAsMusic)try{const s=t.file;await new Promise((i,a)=>{const o=new XMLHttpRequest;o.withCredentials=this._resourceLoader.checkIfCredentialsRequired(s),o.addEventListener("load",()=>{o.status>=200&&o.status<300?i(void 0):a(`HTTP error while preloading audio file in cache. Status is ${o.status}.`)}),o.addEventListener("error",n=>a("XHR error: "+s)),o.addEventListener("abort",n=>a("XHR abort: "+s)),o.open("GET",this._getDefaultSoundUrl(t)),o.send()})}catch(s){throw delete this._availableResources[t.name],d.warn("There was an error while preloading an audio file: "+s),s}}getNetworkSyncData(){const e=[];this._freeMusics.forEach(a=>{const o=a.getNetworkSyncData();o&&e.push(o)});const t=[];this._freeSounds.forEach(a=>{const o=a.getNetworkSyncData();o&&t.push(o)});const s={};Object.entries(this._musics).forEach(([a,o])=>{const n=o.getNetworkSyncData();if(n){const r=parseInt(a,10);s[r]=n}});const i={};return Object.entries(this._sounds).forEach(([a,o])=>{const n=o.getNetworkSyncData();if(n){const r=parseInt(a,10);i[r]=n}}),{globalVolume:this._globalVolume,cachedSpatialPosition:this._cachedSpatialPosition,freeMusics:e,freeSounds:t,musics:s,sounds:i}}updateFromNetworkSyncData(e){this.clearAll(),this._globalVolume=e.globalVolume,this._cachedSpatialPosition=e.cachedSpatialPosition;for(let t=0;t=0&&e<=1){if(o._volume=e,o._muted)return o;o.usingWebAudio&&o.masterGain.gain.setValueAtTime(e,n.ctx.currentTime);for(var t=0;t=0;o--)e._howls[o].unload();return e.usingWebAudio&&e.ctx&&void 0!==e.ctx.close&&(e.ctx.close(),e.ctx=null,_()),e},codecs:function(e){return(this||n)._codecs[e.replace(/^x-/,"")]},_setup:function(){var e=this||n;if(e.state=e.ctx?e.ctx.state||"suspended":"suspended",e._autoSuspend(),!e.usingWebAudio)if("undefined"!=typeof Audio)try{var o=new Audio;void 0===o.oncanplaythrough&&(e._canPlayEvent="canplay")}catch(n){e.noAudio=!0}else e.noAudio=!0;try{var o=new Audio;o.muted&&(e.noAudio=!0)}catch(e){}return e.noAudio||e._setupCodecs(),e},_setupCodecs:function(){var e=this||n,o=null;try{o="undefined"!=typeof Audio?new Audio:null}catch(n){return e}if(!o||"function"!=typeof o.canPlayType)return e;var t=o.canPlayType("audio/mpeg;").replace(/^no$/,""),r=e._navigator?e._navigator.userAgent:"",a=r.match(/OPR\/([0-6].)/g),u=a&&parseInt(a[0].split("/")[1],10)<33,d=-1!==r.indexOf("Safari")&&-1===r.indexOf("Chrome"),i=r.match(/Version\/(.*?) /),_=d&&i&&parseInt(i[1],10)<15;return e._codecs={mp3:!(u||!t&&!o.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!t,opus:!!o.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(o.canPlayType('audio/wav; codecs="1"')||o.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!o.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!o.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(o.canPlayType("audio/x-m4a;")||o.canPlayType("audio/m4a;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(o.canPlayType("audio/x-m4b;")||o.canPlayType("audio/m4b;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(o.canPlayType("audio/x-mp4;")||o.canPlayType("audio/mp4;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(_||!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(_||!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!o.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(o.canPlayType("audio/x-flac;")||o.canPlayType("audio/flac;")).replace(/^no$/,"")},e},_unlockAudio:function(){var e=this||n;if(!e._audioUnlocked&&e.ctx){e._audioUnlocked=!1,e.autoUnlock=!1,e._mobileUnloaded||44100===e.ctx.sampleRate||(e._mobileUnloaded=!0,e.unload()),e._scratchBuffer=e.ctx.createBuffer(1,1,22050);var o=function(n){for(;e._html5AudioPool.length0?d._seek:t._sprite[e][0]/1e3),s=Math.max(0,(t._sprite[e][0]+t._sprite[e][1])/1e3-_),l=1e3*s/Math.abs(d._rate),c=t._sprite[e][0]/1e3,f=(t._sprite[e][0]+t._sprite[e][1])/1e3;d._sprite=e,d._ended=!1;var p=function(){d._paused=!1,d._seek=_,d._start=c,d._stop=f,d._loop=!(!d._loop&&!t._sprite[e][2])};if(_>=f)return void t._ended(d);var m=d._node;if(t._webAudio){var v=function(){t._playLock=!1,p(),t._refreshBuffer(d);var e=d._muted||t._muted?0:d._volume;m.gain.setValueAtTime(e,n.ctx.currentTime),d._playStart=n.ctx.currentTime,void 0===m.bufferSource.start?d._loop?m.bufferSource.noteGrainOn(0,_,86400):m.bufferSource.noteGrainOn(0,_,s):d._loop?m.bufferSource.start(0,_,86400):m.bufferSource.start(0,_,s),l!==1/0&&(t._endTimers[d._id]=setTimeout(t._ended.bind(t,d),l)),o||setTimeout(function(){t._emit("play",d._id),t._loadQueue()},0)};"running"===n.state&&"interrupted"!==n.ctx.state?v():(t._playLock=!0,t.once("resume",v),t._clearTimer(d._id))}else{var h=function(){m.currentTime=_,m.muted=d._muted||t._muted||n._muted||m.muted,m.volume=d._volume*n.volume(),m.playbackRate=d._rate;try{var r=m.play();if(r&&"undefined"!=typeof Promise&&(r instanceof Promise||"function"==typeof r.then)?(t._playLock=!0,p(),r.then(function(){t._playLock=!1,m._unlocked=!0,o||(t._emit("play",d._id),t._loadQueue())}).catch(function(){t._playLock=!1,t._emit("playerror",d._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),d._ended=!0,d._paused=!0})):o||(t._playLock=!1,p(),t._emit("play",d._id),t._loadQueue()),m.playbackRate=d._rate,m.paused)return void t._emit("playerror",d._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==e||d._loop?t._endTimers[d._id]=setTimeout(t._ended.bind(t,d),l):(t._endTimers[d._id]=function(){t._ended(d),m.removeEventListener("ended",t._endTimers[d._id],!1)},m.addEventListener("ended",t._endTimers[d._id],!1))}catch(e){t._emit("playerror",d._id,e)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===m.src&&(m.src=t._src,m.load());var y=window&&window.ejecta||!m.readyState&&n._navigator.isCocoonJS;if(m.readyState>=3||y)h();else{t._playLock=!0,t._state="loading";var g=function(){t._state="loaded",h(),m.removeEventListener(n._canPlayEvent,g,!1)};m.addEventListener(n._canPlayEvent,g,!1),t._clearTimer(d._id)}}return d._id},pause:function(e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"pause",action:function(){n.pause(e)}}),n;for(var o=n._getSoundIds(e),t=0;t=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else r.length>=2&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var a;if(!(void 0!==e&&e>=0&&e<=1))return a=o?t._soundById(o):t._sounds[0],a?a._volume:0;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"volume",action:function(){t.volume.apply(t,r)}}),t;void 0===o&&(t._volume=e),o=t._getSoundIds(o);for(var u=0;u0?t/_:t),l=Date.now();e._fadeTo=o,e._interval=setInterval(function(){var r=(Date.now()-l)/t;l=Date.now(),d+=i*r,d=Math.round(100*d)/100,d=i<0?Math.max(o,d):Math.min(o,d),u._webAudio?e._volume=d:u.volume(d,e._id,!0),a&&(u._volume=d),(on&&d>=o)&&(clearInterval(e._interval),e._interval=null,e._fadeTo=null,u.volume(o,e._id),u._emit("fade",e._id))},s)},_stopFade:function(e){var o=this,t=o._soundById(e);return t&&t._interval&&(o._webAudio&&t._node.gain.cancelScheduledValues(n.ctx.currentTime),clearInterval(t._interval),t._interval=null,o.volume(t._fadeTo,e),t._fadeTo=null,o._emit("fade",e)),o},loop:function(){var e,n,o,t=this,r=arguments;if(0===r.length)return t._loop;if(1===r.length){if("boolean"!=typeof r[0])return!!(o=t._soundById(parseInt(r[0],10)))&&o._loop;e=r[0],t._loop=e}else 2===r.length&&(e=r[0],n=parseInt(r[1],10));for(var a=t._getSoundIds(n),u=0;u=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var d;if("number"!=typeof e)return d=t._soundById(o),d?d._rate:t._rate;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"rate",action:function(){t.rate.apply(t,r)}}),t;void 0===o&&(t._rate=e),o=t._getSoundIds(o);for(var i=0;i=0?o=parseInt(r[0],10):t._sounds.length&&(o=t._sounds[0]._id,e=parseFloat(r[0]))}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));if(void 0===o)return 0;if("number"==typeof e&&("loaded"!==t._state||t._playLock))return t._queue.push({event:"seek",action:function(){t.seek.apply(t,r)}}),t;var d=t._soundById(o);if(d){if(!("number"==typeof e&&e>=0)){if(t._webAudio){var i=t.playing(o)?n.ctx.currentTime-d._playStart:0,_=d._rateSeek?d._rateSeek-d._seek:0;return d._seek+(_+i*Math.abs(d._rate))}return d._node.currentTime}var s=t.playing(o);s&&t.pause(o,!0),d._seek=e,d._ended=!1,t._clearTimer(o),t._webAudio||!d._node||isNaN(d._node.duration)||(d._node.currentTime=e);var l=function(){t._emit("seek",o),s&&t.play(o,!0)};if(s&&!t._webAudio){var c=function(){t._playLock?setTimeout(c,0):l()};setTimeout(c,0)}else l()}return t},playing:function(e){var n=this;if("number"==typeof e){var o=n._soundById(e);return!!o&&!o._paused}for(var t=0;t=0&&n._howls.splice(a,1);var u=!0;for(t=0;t=0){u=!1;break}return r&&u&&delete r[e._src],n.noAudio=!1,e._state="unloaded",e._sounds=[],e=null,null},on:function(e,n,o,t){var r=this,a=r["_on"+e];return"function"==typeof n&&a.push(t?{id:o,fn:n,once:t}:{id:o,fn:n}),r},off:function(e,n,o){var t=this,r=t["_on"+e],a=0;if("number"==typeof n&&(o=n,n=null),n||o)for(a=0;a=0;a--)r[a].id&&r[a].id!==n&&"load"!==e||(setTimeout(function(e){e.call(this,n,o)}.bind(t,r[a].fn),0),r[a].once&&t.off(e,r[a].fn,r[a].id));return t._loadQueue(e),t},_loadQueue:function(e){var n=this;if(n._queue.length>0){var o=n._queue[0];o.event===e&&(n._queue.shift(),n._loadQueue()),e||o.action()}return n},_ended:function(e){var o=this,t=e._sprite;if(!o._webAudio&&e._node&&!e._node.paused&&!e._node.ended&&e._node.currentTime=0;t--){if(o<=n)return;e._sounds[t]._ended&&(e._webAudio&&e._sounds[t]._node&&e._sounds[t]._node.disconnect(0),e._sounds.splice(t,1),o--)}}},_getSoundIds:function(e){var n=this;if(void 0===e){for(var o=[],t=0;t=0;if(n._scratchBuffer&&e.bufferSource&&(e.bufferSource.onended=null,e.bufferSource.disconnect(0),t))try{e.bufferSource.buffer=n._scratchBuffer}catch(e){}return e.bufferSource=null,o},_clearSound:function(e){/MSIE |Trident\//.test(n._navigator&&n._navigator.userAgent)||(e.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var t=function(e){this._parent=e,this.init()};t.prototype={init:function(){var e=this,o=e._parent;return e._muted=o._muted,e._loop=o._loop,e._volume=o._volume,e._rate=o._rate,e._seek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,o._sounds.push(e),e.create(),e},create:function(){var e=this,o=e._parent,t=n._muted||e._muted||e._parent._muted?0:e._volume;return o._webAudio?(e._node=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),e._node.gain.setValueAtTime(t,n.ctx.currentTime),e._node.paused=!0,e._node.connect(n.masterGain)):n.noAudio||(e._node=n._obtainHtml5Audio(),e._errorFn=e._errorListener.bind(e),e._node.addEventListener("error",e._errorFn,!1),e._loadFn=e._loadListener.bind(e),e._node.addEventListener(n._canPlayEvent,e._loadFn,!1),e._endFn=e._endListener.bind(e),e._node.addEventListener("ended",e._endFn,!1),e._node.src=o._src,e._node.preload=!0===o._preload?"auto":o._preload,e._node.volume=t*n.volume(),e._node.load()),e},reset:function(){var e=this,o=e._parent;return e._muted=o._muted,e._loop=o._loop,e._volume=o._volume,e._rate=o._rate,e._seek=0,e._rateSeek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,e},_errorListener:function(){var e=this;e._parent._emit("loaderror",e._id,e._node.error?e._node.error.code:0),e._node.removeEventListener("error",e._errorFn,!1)},_loadListener:function(){var e=this,o=e._parent;o._duration=Math.ceil(10*e._node.duration)/10,0===Object.keys(o._sprite).length&&(o._sprite={__default:[0,1e3*o._duration]}),"loaded"!==o._state&&(o._state="loaded",o._emit("load"),o._loadQueue()),e._node.removeEventListener(n._canPlayEvent,e._loadFn,!1)},_endListener:function(){var e=this,n=e._parent;n._duration===1/0&&(n._duration=Math.ceil(10*e._node.duration)/10,n._sprite.__default[1]===1/0&&(n._sprite.__default[1]=1e3*n._duration),n._ended(e)),e._node.removeEventListener("ended",e._endFn,!1)}};var r={},a=function(e){var n=e._src;if(r[n])return e._duration=r[n].duration,void i(e);if(/^data:[^;]+;base64,/.test(n)){for(var o=atob(n.split(",")[1]),t=new Uint8Array(o.length),a=0;a0?(r[o._src]=e,i(o,e)):t()};"undefined"!=typeof Promise&&1===n.ctx.decodeAudioData.length?n.ctx.decodeAudioData(e).then(a).catch(t):n.ctx.decodeAudioData(e,a,t)},i=function(e,n){n&&!e._duration&&(e._duration=n.duration),0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue())},_=function(){if(n.usingWebAudio){try{"undefined"!=typeof AudioContext?n.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?n.ctx=new webkitAudioContext:n.usingWebAudio=!1}catch(e){n.usingWebAudio=!1}n.ctx||(n.usingWebAudio=!1);var e=/iP(hone|od|ad)/.test(n._navigator&&n._navigator.platform),o=n._navigator&&n._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),t=o?parseInt(o[1],10):null;if(e&&t&&t<9){var r=/safari/.test(n._navigator&&n._navigator.userAgent.toLowerCase());n._navigator&&!r&&(n.usingWebAudio=!1)}n.usingWebAudio&&(n.masterGain=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),n.masterGain.gain.setValueAtTime(n._muted?0:n._volume,n.ctx.currentTime),n.masterGain.connect(n.ctx.destination)),n._setup()}};"function"==typeof define&&define.amd&&define([],function(){return{Howler:n,Howl:o}}),"undefined"!=typeof exports&&(exports.Howler=n,exports.Howl=o),"undefined"!=typeof global?(global.HowlerGlobal=e,global.Howler=n,global.Howl=o,global.Sound=t):"undefined"!=typeof window&&(window.HowlerGlobal=e,window.Howler=n,window.Howl=o,window.Sound=t)}(); diff --git a/Export/index.html b/Export/index.html new file mode 100644 index 0000000..40e9f05 --- /dev/null +++ b/Export/index.html @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Export/indexeddb.js b/Export/indexeddb.js new file mode 100644 index 0000000..073c92a --- /dev/null +++ b/Export/indexeddb.js @@ -0,0 +1,2 @@ +var gdjs;(function(x){let f;(function(l){l.loadFromIndexedDB=async function(i,e,u){return new Promise((s,n)=>{try{const r=indexedDB.open(i,1);r.onupgradeneeded=function(){const o=r.result;o.objectStoreNames.contains(e)||o.createObjectStore(e)},r.onsuccess=function(){const t=r.result.transaction(e,"readonly").objectStore(e).get(u);t.onsuccess=function(){t.result!==void 0?s(t.result):s(null)},t.onerror=function(){console.error("Error loading data from IndexedDB:",t.error),n(t.error)}},r.onerror=function(){console.error("Error opening IndexedDB:",r.error),n(r.error)}}catch(r){console.error("Exception thrown while opening IndexedDB:",r),n(r);return}})},l.saveToIndexedDB=async function(i,e,u,s){return new Promise((n,r)=>{try{const o=indexedDB.open(i,1);o.onupgradeneeded=function(d){const c=o.result;c.objectStoreNames.contains(e)||c.createObjectStore(e)},o.onsuccess=function(){const a=o.result.transaction(e,"readwrite").objectStore(e).put(s,u);a.onsuccess=function(){n()},a.onerror=function(){console.error("Error saving data to IndexedDB:",a.error),r(a.error)}},o.onerror=function(){console.error("Error opening IndexedDB:",o.error),r(o.error)}}catch(o){console.error("Exception thrown while opening IndexedDB:",o),r(o);return}})},l.deleteFromIndexedDB=async function(i,e,u){return new Promise((s,n)=>{try{const r=indexedDB.open(i,1);r.onupgradeneeded=function(){const o=r.result;o.objectStoreNames.contains(e)||o.createObjectStore(e)},r.onsuccess=function(){const t=r.result.transaction(e,"readwrite").objectStore(e).delete(u);t.onsuccess=function(){s()},t.onerror=function(){console.error("Error deleting data from IndexedDB:",t.error),n(t.error)}},r.onerror=function(){console.error("Error opening IndexedDB:",r.error),n(r.error)}}catch(r){console.error("Exception thrown while opening IndexedDB:",r),n(r);return}})},l.keyExistsInIndexedDB=async function(i,e,u){return new Promise((s,n)=>{try{const r=indexedDB.open(i,1);r.onupgradeneeded=function(){const o=r.result;o.objectStoreNames.contains(e)||o.createObjectStore(e)},r.onsuccess=function(){const t=r.result.transaction(e,"readonly").objectStore(e).count(u);t.onsuccess=function(){s(t.result>0)},t.onerror=function(){console.error("Error checking key existence in IndexedDB:",t.error),n(t.error)}},r.onerror=function(){console.error("Error opening IndexedDB:",r.error),n(r.error)}}catch(r){console.error("Exception thrown while opening IndexedDB:",r),n(r);return}})},l.getAllKeysFromIndexedDB=async function(i,e){return new Promise((u,s)=>{try{const n=indexedDB.open(i,1);n.onupgradeneeded=function(){const r=n.result;r.objectStoreNames.contains(e)||r.createObjectStore(e)},n.onsuccess=function(){const c=n.result.transaction(e,"readonly").objectStore(e).getAllKeys();c.onsuccess=function(){u(c.result||[])},c.onerror=function(){console.error("Error listing keys from IndexedDB:",c.error),s(c.error)}},n.onerror=function(){console.error("Error opening IndexedDB:",n.error),s(n.error)}}catch(n){console.error("Exception thrown while opening IndexedDB:",n),s(n);return}})},l.getAllFromIndexedDB=async function(i,e){return new Promise((u,s)=>{try{const n=indexedDB.open(i,1);n.onupgradeneeded=function(){const r=n.result;r.objectStoreNames.contains(e)||r.createObjectStore(e)},n.onsuccess=function(){const o=n.result.transaction(e,"readonly"),d=o.objectStore(e),c=d.getAllKeys(),t=d.getAll();o.oncomplete=function(){const a=c.result||[],g=t.result||[];u(a.map((p,B)=>({key:p,value:g[B]})))},o.onerror=function(){console.error("Error reading all data from IndexedDB:",o.error),s(o.error)}},n.onerror=function(){console.error("Error opening IndexedDB:",n.error),s(n.error)}}catch(n){console.error("Exception thrown while opening IndexedDB:",n),s(n);return}})}})(f=x.indexedDb||(x.indexedDb={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=indexeddb.js.map diff --git a/Export/inputmanager.js b/Export/inputmanager.js new file mode 100644 index 0000000..fd3a713 --- /dev/null +++ b/Export/inputmanager.js @@ -0,0 +1,2 @@ +var gdjs;(function(n){const o=class{constructor(){this._lastPressedKey=0;this._cursorX=0;this._cursorY=0;this._mouseX=0;this._mouseY=0;this._isMouseInsideCanvas=!0;this._wheelDeltaX=0;this._wheelDeltaY=0;this._wheelDeltaZ=0;this._mouseMovementX=0;this._mouseMovementY=0;this._touches={firstKey:()=>{for(const e in this._mouseOrTouches.items)if(e!=="1")return e;return null}};this._startedTouches=[];this._endedTouches=[];this._touchSimulateMouse=!0;this._lastStartedTouchIndex=0;this._lastEndedTouchIndex=0;this._pressedKeys=new Hashtable,this._justPressedKeys=new Hashtable,this._releasedKeys=new Hashtable,this._pressedMouseButtons=new Array(5),this._releasedMouseButtons=new Array(5),this._mouseOrTouches=new Hashtable}static getLocationAwareKeyCode(e,s){return s?96<=e&&e<=105?e:e+1e3*s:o._DEFAULT_LEFT_VARIANT_KEYS.indexOf(e)!==-1?e+1e3:e}onKeyPressed(e,s){const t=o.getLocationAwareKeyCode(e,s);this._pressedKeys.put(t,!0),this._justPressedKeys.put(t,!0),this._lastPressedKey=t}onKeyReleased(e,s){const t=o.getLocationAwareKeyCode(e,s);this._pressedKeys.put(t,!1),this._justPressedKeys.put(t,!1),this._releasedKeys.put(t,!0)}releaseAllPressedKeys(){for(const e in this._pressedKeys.items)this._pressedKeys.put(e,!1),this._justPressedKeys.put(e,!1),this._releasedKeys.put(e,!0)}clearAllPressedKeys(){this._pressedKeys.clear(),this._justPressedKeys.clear()}getLastPressedKey(){return this._lastPressedKey}isKeyPressed(e){return!!this._pressedKeys.get(e)}wasKeyJustPressed(e){return!!this._justPressedKeys.get(e)}wasKeyReleased(e){return!!this._releasedKeys.get(e)}anyKeyPressed(){for(const e in this._pressedKeys.items)if(this._pressedKeys.items.hasOwnProperty(e)&&this._pressedKeys.items[e])return!0;return!1}anyKeyReleased(){for(const e in this._releasedKeys.items)if(this._releasedKeys.items.hasOwnProperty(e)&&this._releasedKeys.items[e])return!0;return!1}exceptionallyGetAllJustPressedKeys(){const e=[];return this._justPressedKeys.keys(e),e.map(s=>parseInt(s,10))}onMouseMove(e,s,t){if(this._setCursorPosition(e,s),this._mouseX=e,this._mouseY=s,t){const{movementX:u,movementY:i}=t;u!==void 0&&(this._mouseMovementX+=u),i!==void 0&&(this._mouseMovementY+=i)}this.isMouseButtonPressed(o.MOUSE_LEFT_BUTTON)&&this._moveTouch(o.MOUSE_TOUCH_ID,this.getCursorX(),this.getCursorY())}_setCursorPosition(e,s){this._cursorX=e,this._cursorY=s}getCursorX(){return this._cursorX}getCursorY(){return this._cursorY}getMouseX(){return this._mouseX}getMouseY(){return this._mouseY}getMouseMovementX(){return this._mouseMovementX}getMouseMovementY(){return this._mouseMovementY}onMouseLeave(){this._isMouseInsideCanvas=!1}onMouseEnter(){this._isMouseInsideCanvas=!0}isMouseInsideCanvas(){return this._isMouseInsideCanvas}onMouseButtonPressed(e){this._setMouseButtonPressed(e),e===o.MOUSE_LEFT_BUTTON&&this._addTouch(o.MOUSE_TOUCH_ID,this.getCursorX(),this.getCursorY())}anyMouseButtonPressed(){for(const e in this._pressedMouseButtons)if(this._pressedMouseButtons[e])return!0;return!1}_setMouseButtonPressed(e){this._pressedMouseButtons[e]=!0,this._releasedMouseButtons[e]=!1}onMouseButtonReleased(e){this._setMouseButtonReleased(e),e===o.MOUSE_LEFT_BUTTON&&this._removeTouch(o.MOUSE_TOUCH_ID)}_setMouseButtonReleased(e){this._pressedMouseButtons[e]=!1,this._releasedMouseButtons[e]=!0}isMouseButtonPressed(e){return this._pressedMouseButtons[e]!==void 0&&this._pressedMouseButtons[e]}isMouseButtonReleased(e){return this._releasedMouseButtons[e]!==void 0&&this._releasedMouseButtons[e]}onMouseWheel(e,s,t){this._wheelDeltaY=e,s!==void 0&&(this._wheelDeltaX=s),t!==void 0&&(this._wheelDeltaZ=t)}getMouseWheelDelta(){return this._wheelDeltaY}getMouseWheelDeltaX(){return this._wheelDeltaX}getMouseWheelDeltaZ(){return this._wheelDeltaZ}getTouchX(e){return this._mouseOrTouches.containsKey(e)?this._mouseOrTouches.get(e).x:0}getTouchY(e){return this._mouseOrTouches.containsKey(e)?this._mouseOrTouches.get(e).y:0}hasTouchEnded(e){return this._mouseOrTouches.containsKey(e)?this._mouseOrTouches.get(e).justEnded:!1}getAllTouchIdentifiers(){o._allTouchIds.length=0;for(const e in this._mouseOrTouches.items)this._mouseOrTouches.items.hasOwnProperty(e)&&o._allTouchIds.push(parseInt(e,10));return o._allTouchIds}onTouchStart(e,s,t){this._addTouch(this.getPublicTouchIdentifier(e),s,t),this._touchSimulateMouse&&(this._setCursorPosition(s,t),this._setMouseButtonPressed(o.MOUSE_LEFT_BUTTON))}_addTouch(e,s,t){this._endedTouches.includes(e)||(this._startedTouches.push(e),this._mouseOrTouches.put(e,{x:s,y:t,justEnded:!1}))}onTouchMove(e,s,t){this._moveTouch(this.getPublicTouchIdentifier(e),s,t),this._touchSimulateMouse&&this._setCursorPosition(s,t)}_moveTouch(e,s,t){const u=this._mouseOrTouches.get(e);!u||(u.x=s,u.y=t)}onTouchEnd(e){this._removeTouch(this.getPublicTouchIdentifier(e)),this._touchSimulateMouse&&this._setMouseButtonReleased(o.MOUSE_LEFT_BUTTON)}onTouchCancel(e){this.onTouchEnd(e)}_removeTouch(e){this._endedTouches.push(e),this._mouseOrTouches.containsKey(e)&&(this._mouseOrTouches.get(e).justEnded=!0)}getPublicTouchIdentifier(e){return e+2}getStartedTouchIdentifiers(){return this._startedTouches}popStartedTouch(){const e=this._startedTouches[this._lastStartedTouchIndex];return this._lastStartedTouchIndex++,e}popEndedTouch(){const e=this._endedTouches[this._lastEndedTouchIndex];return this._lastEndedTouchIndex++,e}touchSimulateMouse(e){e===void 0&&(e=!0),this._touchSimulateMouse=e}isSimulatingMouseWithTouch(){return this._touchSimulateMouse}onFrameEnded(){for(const e in this._mouseOrTouches.items)this._mouseOrTouches.items.hasOwnProperty(e)&&this._mouseOrTouches.items[e].justEnded&&this._mouseOrTouches.remove(e);this._startedTouches.length=0,this._endedTouches.length=0,this._releasedKeys.clear(),this._justPressedKeys.clear(),this._releasedMouseButtons.length=0,this._wheelDeltaX=0,this._wheelDeltaY=0,this._wheelDeltaZ=0,this._mouseMovementX=0,this._mouseMovementY=0,this._lastStartedTouchIndex=0,this._lastEndedTouchIndex=0}isScrollingUp(){return this.getMouseWheelDelta()>0}isScrollingDown(){return this.getMouseWheelDelta()<0}};let r=o;r.MOUSE_LEFT_BUTTON=0,r.MOUSE_RIGHT_BUTTON=1,r.MOUSE_MIDDLE_BUTTON=2,r.MOUSE_BACK_BUTTON=3,r.MOUSE_FORWARD_BUTTON=4,r.MOUSE_TOUCH_ID=1,r._DEFAULT_LEFT_VARIANT_KEYS=[16,17,18,91],r._allTouchIds=[],n.InputManager=r})(gdjs||(gdjs={})); +//# sourceMappingURL=inputmanager.js.map diff --git a/Export/jsonmanager.js b/Export/jsonmanager.js new file mode 100644 index 0000000..3507d93 --- /dev/null +++ b/Export/jsonmanager.js @@ -0,0 +1,2 @@ +var gdjs;(function(l){const c=new l.Logger("JSON Manager"),i=["json","tilemap","tileset"];class d{constructor(e){this._loadedJsons=new l.ResourceCache;this._callbacks=new l.ResourceCache;this._getJsonResource=e=>{const o=this._resourceLoader.getResource(e);return o&&this.getResourceKinds().includes(o.kind)?o:null};this._resourceLoader=e}getResourceKinds(){return i}async loadResource(e){const o=this._resourceLoader.getResource(e);if(!o){c.warn('Unable to find json for resource "'+e+'".');return}if(!o.disablePreload)try{await this.loadJsonAsync(o.name)}catch(s){throw c.error(`Error while preloading json resource ${o.name}:`,s),s}}loadJsonAsync(e){const o=this;return new Promise((s,t)=>{o.loadJson(e,(r,n)=>{r&&t(r.message),s(n)})})}async processResource(e){}loadJson(e,o){const s=this._getJsonResource(e);if(!s){o(new Error(`Can't find resource with name: "`+e+'" (or is not a json resource).'),null);return}if(this._loadedJsons.get(s)){o(null,this._loadedJsons.get(s));return}{const n=this._callbacks.get(s);if(n){n.push(o);return}else this._callbacks.set(s,[o])}const t=this,r=new XMLHttpRequest;r.responseType="json",r.withCredentials=this._resourceLoader.checkIfCredentialsRequired(s.file),r.open("GET",this._resourceLoader.getFullUrl(s.file)),r.onload=function(){const n=t._callbacks.get(s);if(!!n){if(r.status!==200){for(const a of n)a(new Error("HTTP error: "+r.status+"("+r.statusText+")"),null);t._callbacks.delete(s);return}t._loadedJsons.set(s,r.response);for(const a of n)a(null,r.response);t._callbacks.delete(s)}},r.onerror=function(){const n=t._callbacks.get(s);if(!!n){for(const a of n)a(new Error("Network error"),null);t._callbacks.delete(s)}},r.onabort=function(){const n=t._callbacks.get(s);if(!!n){for(const a of n)a(new Error("Request aborted"),null);t._callbacks.delete(s)}},r.send()}isJsonLoaded(e){return!!this._loadedJsons.getFromName(e)}getLoadedJson(e){return this._loadedJsons.getFromName(e)||null}dispose(){this._loadedJsons.clear(),this._callbacks.clear()}unloadResource(e){this._loadedJsons.getFromName(e.name)&&this._loadedJsons.delete(e),this._callbacks.getFromName(e.name)&&this._callbacks.delete(e)}}l.JsonManager=d})(gdjs||(gdjs={})); +//# sourceMappingURL=jsonmanager.js.map diff --git a/Export/layer.js b/Export/layer.js new file mode 100644 index 0000000..c6fb62e --- /dev/null +++ b/Export/layer.js @@ -0,0 +1,2 @@ +var gdjs;(function(m){class c extends m.RuntimeLayer{constructor(e,t){super(e,t);this._cameraRotation=0;this._zoomFactor=1;this._cameraZ=0;this._isCameraZDirty=!0;this._defaultCameraBehavior===m.RuntimeLayerDefaultCameraBehavior.TOP_LEFT_ANCHORED_IF_NEVER_MOVED?(this._cameraX=this._runtimeScene.getViewportOriginX(),this._cameraY=this._runtimeScene.getViewportOriginY()):(this._cameraX=(this._runtimeScene.getInitialUnrotatedViewportMinX()+this._runtimeScene.getInitialUnrotatedViewportMaxX())/2,this._cameraY=(this._runtimeScene.getInitialUnrotatedViewportMinY()+this._runtimeScene.getInitialUnrotatedViewportMaxY())/2),this.getCameraType()===m.RuntimeLayerCameraType.ORTHOGRAPHIC&&(this._cameraZ=(this._initialCamera3DFarPlaneDistance+this._initialCamera3DNearPlaneDistance)/2),this._renderer.onCreated()}onGameResolutionResized(e,t){this._defaultCameraBehavior===m.RuntimeLayerDefaultCameraBehavior.TOP_LEFT_ANCHORED_IF_NEVER_MOVED&&Math.abs(this._cameraX-e)<1&&Math.abs(this._cameraY-t)<1&&this._zoomFactor===1&&(this._cameraX+=this._runtimeScene.getViewportOriginX()-e,this._cameraY+=this._runtimeScene.getViewportOriginY()-t),this._renderer.updatePosition(),this._renderer.updateResolution()}getCameraX(e){return this._forceDimensionUpdate(),this._cameraX}getCameraY(e){return this._forceDimensionUpdate(),this._cameraY}setCameraX(e,t){this._forceDimensionUpdate(),this._cameraX=e,this._renderer.updatePosition()}setCameraY(e,t){this._forceDimensionUpdate(),this._cameraY=e,this._renderer.updatePosition()}getCameraWidth(e){return this.getWidth()/this._zoomFactor}getCameraHeight(e){return this.getHeight()/this._zoomFactor}setCameraZoom(e,t){e<=0||(this._zoomFactor=e,this._isCameraZDirty=!0,this._renderer.updatePosition())}getCameraZoom(e){return this._zoomFactor}setCameraZ(e,t,a){if(t){const i=m.toRad(t),r=Math.min(Number.MAX_SAFE_INTEGER,.5*this.getHeight()/(e*Math.tan(.5*i)));r>0&&(this._zoomFactor=r)}this._cameraZ=e,this._isCameraZDirty=!1,this._renderer.updatePosition()}getCameraZ(e,t){return!this._isCameraZDirty||!e?this._cameraZ:.5*this.getHeight()/this.getCameraZoom()/Math.tan(.5*m.toRad(e))}getCameraRotation(e){return this._cameraRotation}setCameraRotation(e,t){this._cameraRotation=e,this._renderer.updatePosition(),this._renderer.invalidateRotation()}getCameraRotationY(e){return this._renderer.getCameraRotationY()}setCameraRotationY(e,t){this._renderer.setCameraRotationY(e)}getCameraRotationX(e){return this._renderer.getCameraRotationX()}setCameraRotationX(e,t){this._renderer.setCameraRotationX(e)}getCameraForwardX(e){return this._renderer.getCameraForwardX()}getCameraForwardY(e){return this._renderer.getCameraForwardY()}getCameraForwardZ(e){return this._renderer.getCameraForwardZ()}getCameraUpX(e){return this._renderer.getCameraUpX()}getCameraUpY(e){return this._renderer.getCameraUpY()}getCameraUpZ(e){return this._renderer.getCameraUpZ()}getCameraRightX(e){return this._renderer.getCameraRightX()}getCameraRightY(e){return this._renderer.getCameraRightY()}getCameraRightZ(e){return this._renderer.getCameraRightZ()}convertCoords(e,t,a=0,i){let r=i||[0,0];if(this._renderer.isCameraRotatedIn3D())return this._renderer.transformTo3DWorld(e,t,0,a,i);e-=this.getRuntimeScene()._cachedGameResolutionWidth/2,t-=this.getRuntimeScene()._cachedGameResolutionHeight/2,e/=this._zoomFactor,t/=this._zoomFactor;const n=this._cameraRotation/180*Math.PI,s=e,o=Math.cos(n),h=Math.sin(n);return e=o*e-h*t,t=h*s+o*t,r[0]=e+this.getCameraX(a),r[1]=t+this.getCameraY(a),r}applyLayerInverseTransformation(e,t,a,i){e-=this._runtimeScene.getViewportOriginX(),t-=this._runtimeScene.getViewportOriginY(),e/=this._zoomFactor,t/=this._zoomFactor;const r=this._cameraRotation/180*Math.PI,n=e,s=Math.cos(r),o=Math.sin(r);return e=s*e-o*t,t=o*n+s*t,i[0]=e+this.getCameraX(a),i[1]=t+this.getCameraY(a),i}convertInverseCoords(e,t,a=0,i){let r=i||[0,0];e-=this.getCameraX(a),t-=this.getCameraY(a);const n=this._cameraRotation/180*Math.PI,s=e,o=Math.cos(-n),h=Math.sin(-n);return e=o*e-h*t,t=h*s+o*t,e*=this._zoomFactor,t*=this._zoomFactor,r[0]=e+this.getRuntimeScene()._cachedGameResolutionWidth/2,r[1]=t+this.getRuntimeScene()._cachedGameResolutionHeight/2,r}applyLayerTransformation(e,t,a,i){e-=this.getCameraX(a),t-=this.getCameraY(a);const r=this._cameraRotation/180*Math.PI,n=e,s=Math.cos(-r),o=Math.sin(-r);return e=s*e-o*t,t=o*n+s*t,e*=this._zoomFactor,t*=this._zoomFactor,e+=this._runtimeScene.getViewportOriginX(),t+=this._runtimeScene.getViewportOriginY(),i[0]=e,i[1]=t,i}_forceDimensionUpdate(){this._runtimeScene.getViewportWidth()}}m.Layer=c})(gdjs||(gdjs={})); +//# sourceMappingURL=layer.js.map diff --git a/Export/libs/jshashtable.js b/Export/libs/jshashtable.js new file mode 100644 index 0000000..efef562 --- /dev/null +++ b/Export/libs/jshashtable.js @@ -0,0 +1,2 @@ +class Hashtable{constructor(){this.items={}}static newFrom(t){const s=new Hashtable;return s.items=t,s}put(t,s){this.items[t]=s}get(t){return this.items[t]}containsKey(t){return this.items.hasOwnProperty(t)}remove(t){delete this.items[t]}firstKey(){for(const t in this.items)if(this.items.hasOwnProperty(t))return t;return null}keys(t){t.length=0;for(const s in this.items)this.items.hasOwnProperty(s)&&t.push(s)}values(t){t.length=0;for(const s in this.items)this.items.hasOwnProperty(s)&&t.push(this.items[s])}clear(){for(const t in this.items)this.items.hasOwnProperty(t)&&delete this.items[t]}} +//# sourceMappingURL=jshashtable.js.map diff --git a/Export/libs/rbush.js b/Export/libs/rbush.js new file mode 100644 index 0000000..96c70f1 --- /dev/null +++ b/Export/libs/rbush.js @@ -0,0 +1,624 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.rbush = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 0) { + if (insertPath[level].children.length > this._maxEntries) { + this._split(insertPath, level); + level--; + } else break; + } + + // adjust bboxes along the insertion path + this._adjustParentBBoxes(bbox, insertPath, level); + }, + + // split overflowed node into two + _split: function (insertPath, level) { + + var node = insertPath[level], + M = node.children.length, + m = this._minEntries; + + this._chooseSplitAxis(node, m, M); + + var splitIndex = this._chooseSplitIndex(node, m, M); + + var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex)); + newNode.height = node.height; + newNode.leaf = node.leaf; + + calcBBox(node, this.toBBox); + calcBBox(newNode, this.toBBox); + + if (level) insertPath[level - 1].children.push(newNode); + else this._splitRoot(node, newNode); + }, + + _splitRoot: function (node, newNode) { + // split root node + this.data = createNode([node, newNode]); + this.data.height = node.height + 1; + this.data.leaf = false; + calcBBox(this.data, this.toBBox); + }, + + _chooseSplitIndex: function (node, m, M) { + + var i, bbox1, bbox2, overlap, area, minOverlap, minArea, index; + + minOverlap = minArea = Infinity; + + for (i = m; i <= M - m; i++) { + bbox1 = distBBox(node, 0, i, this.toBBox); + bbox2 = distBBox(node, i, M, this.toBBox); + + overlap = intersectionArea(bbox1, bbox2); + area = bboxArea(bbox1) + bboxArea(bbox2); + + // choose distribution with minimum overlap + if (overlap < minOverlap) { + minOverlap = overlap; + index = i; + + minArea = area < minArea ? area : minArea; + + } else if (overlap === minOverlap) { + // otherwise choose distribution with minimum area + if (area < minArea) { + minArea = area; + index = i; + } + } + } + + return index; + }, + + // sorts node children by the best axis for split + _chooseSplitAxis: function (node, m, M) { + + var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX, + compareMinY = node.leaf ? this.compareMinY : compareNodeMinY, + xMargin = this._allDistMargin(node, m, M, compareMinX), + yMargin = this._allDistMargin(node, m, M, compareMinY); + + // if total distributions margin value is minimal for x, sort by minX, + // otherwise it's already sorted by minY + if (xMargin < yMargin) node.children.sort(compareMinX); + }, + + // total margin of all possible split distributions where each node is at least m full + _allDistMargin: function (node, m, M, compare) { + + node.children.sort(compare); + + var toBBox = this.toBBox, + leftBBox = distBBox(node, 0, m, toBBox), + rightBBox = distBBox(node, M - m, M, toBBox), + margin = bboxMargin(leftBBox) + bboxMargin(rightBBox), + i, child; + + for (i = m; i < M - m; i++) { + child = node.children[i]; + extend(leftBBox, node.leaf ? toBBox(child) : child); + margin += bboxMargin(leftBBox); + } + + for (i = M - m - 1; i >= m; i--) { + child = node.children[i]; + extend(rightBBox, node.leaf ? toBBox(child) : child); + margin += bboxMargin(rightBBox); + } + + return margin; + }, + + _adjustParentBBoxes: function (bbox, path, level) { + // adjust bboxes along the given tree path + for (var i = level; i >= 0; i--) { + extend(path[i], bbox); + } + }, + + _condense: function (path) { + // go through the path, removing empty nodes and updating bboxes + for (var i = path.length - 1, siblings; i >= 0; i--) { + if (path[i].children.length === 0) { + if (i > 0) { + siblings = path[i - 1].children; + siblings.splice(siblings.indexOf(path[i]), 1); + + } else this.clear(); + + } else calcBBox(path[i], this.toBBox); + } + }, + + _initFormat: function (format) { + // data format (minX, minY, maxX, maxY accessors) + + // uses eval-type function compilation instead of just accepting a toBBox function + // because the algorithms are very sensitive to sorting functions performance, + // so they should be dead simple and without inner calls + + var compareArr = ['return a', ' - b', ';']; + + this.compareMinX = new Function('a', 'b', compareArr.join(format[0])); + this.compareMinY = new Function('a', 'b', compareArr.join(format[1])); + + this.toBBox = new Function('a', + 'return {minX: a' + format[0] + + ', minY: a' + format[1] + + ', maxX: a' + format[2] + + ', maxY: a' + format[3] + '};'); + } +}; + +function findItem(item, items, equalsFn) { + if (!equalsFn) return items.indexOf(item); + + for (var i = 0; i < items.length; i++) { + if (equalsFn(item, items[i])) return i; + } + return -1; +} + +// calculate node's bbox from bboxes of its children +function calcBBox(node, toBBox) { + distBBox(node, 0, node.children.length, toBBox, node); +} + +// min bounding rectangle of node children from k to p-1 +function distBBox(node, k, p, toBBox, destNode) { + if (!destNode) destNode = createNode(null); + destNode.minX = Infinity; + destNode.minY = Infinity; + destNode.maxX = -Infinity; + destNode.maxY = -Infinity; + + for (var i = k, child; i < p; i++) { + child = node.children[i]; + extend(destNode, node.leaf ? toBBox(child) : child); + } + + return destNode; +} + +function extend(a, b) { + a.minX = Math.min(a.minX, b.minX); + a.minY = Math.min(a.minY, b.minY); + a.maxX = Math.max(a.maxX, b.maxX); + a.maxY = Math.max(a.maxY, b.maxY); + return a; +} + +function compareNodeMinX(a, b) { return a.minX - b.minX; } +function compareNodeMinY(a, b) { return a.minY - b.minY; } + +function bboxArea(a) { return (a.maxX - a.minX) * (a.maxY - a.minY); } +function bboxMargin(a) { return (a.maxX - a.minX) + (a.maxY - a.minY); } + +function enlargedArea(a, b) { + return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) * + (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY)); +} + +function intersectionArea(a, b) { + var minX = Math.max(a.minX, b.minX), + minY = Math.max(a.minY, b.minY), + maxX = Math.min(a.maxX, b.maxX), + maxY = Math.min(a.maxY, b.maxY); + + return Math.max(0, maxX - minX) * + Math.max(0, maxY - minY); +} + +function contains(a, b) { + return a.minX <= b.minX && + a.minY <= b.minY && + b.maxX <= a.maxX && + b.maxY <= a.maxY; +} + +function intersects(a, b) { + return b.minX <= a.maxX && + b.minY <= a.maxY && + b.maxX >= a.minX && + b.maxY >= a.minY; +} + +function createNode(children) { + return { + children: children, + height: 1, + leaf: true, + minX: Infinity, + minY: Infinity, + maxX: -Infinity, + maxY: -Infinity + }; +} + +// sort an array so that items come in groups of n unsorted items, with groups sorted between each other; +// combines selection algorithm with binary divide & conquer approach + +function multiSelect(arr, left, right, n, compare) { + var stack = [left, right], + mid; + + while (stack.length) { + right = stack.pop(); + left = stack.pop(); + + if (right - left <= n) continue; + + mid = left + Math.ceil((right - left) / n / 2) * n; + quickselect(arr, mid, left, right, compare); + + stack.push(left, mid, mid, right); + } +} + +},{"quickselect":2}],2:[function(require,module,exports){ +'use strict'; + +module.exports = partialSort; + +// Floyd-Rivest selection algorithm: +// Rearrange items so that all items in the [left, k] range are smaller than all items in (k, right]; +// The k-th element will have the (k - left + 1)th smallest value in [left, right] + +function partialSort(arr, k, left, right, compare) { + + while (right > left) { + if (right - left > 600) { + var n = right - left + 1; + var m = k - left + 1; + var z = Math.log(n); + var s = 0.5 * Math.exp(2 * z / 3); + var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); + var newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); + var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); + partialSort(arr, k, newLeft, newRight, compare); + } + + var t = arr[k]; + var i = left; + var j = right; + + swap(arr, left, k); + if (compare(arr[right], t) > 0) swap(arr, left, right); + + while (i < j) { + swap(arr, i, j); + i++; + j--; + while (compare(arr[i], t) < 0) i++; + while (compare(arr[j], t) > 0) j--; + } + + if (compare(arr[left], t) === 0) swap(arr, left, j); + else { + j++; + swap(arr, j, right); + } + + if (j <= k) left = j + 1; + if (k <= j) right = j - 1; + } +} + +function swap(arr, i, j) { + var tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; +} + +function defaultCompare(a, b) { + return a < b ? -1 : a > b ? 1 : 0; +} + +},{}]},{},[1])(1) +}); diff --git a/Export/logger.js b/Export/logger.js new file mode 100644 index 0000000..ac133f6 --- /dev/null +++ b/Export/logger.js @@ -0,0 +1,2 @@ +var gdjs;(function(l){const i={info:console.log,warning:console.warn,error:console.error};class g{constructor(){this.discardedConsoleGroups=new Set}discardGroup(r){this.discardedConsoleGroups.add(r)}enableGroup(r){this.discardedConsoleGroups.delete(r)}log(r,n,u="info",d=!0){if(this.discardedConsoleGroups.has(r))return;(i[u]||i.info)(`[${r}] ${n}`)}}const s=new g;let e=s;function o(t){return t.reduce((r,n)=>r+n.toString(),"")}class a{constructor(r){this.enabled=!0;this.group=r}log(...r){!this.enabled||e.log(this.group,o(r),"info")}info(...r){!this.enabled||e.log(this.group,o(r),"info")}warn(...r){!this.enabled||e.log(this.group,o(r),"warning")}error(...r){!this.enabled||e.log(this.group,o(r),"error")}enable(r){return this.enabled=r,this}static getDefaultConsoleLoggerOutput(){return s}static getLoggerOutput(){return e}static setLoggerOutput(r){e=r}}l.Logger=a})(gdjs||(gdjs={})); +//# sourceMappingURL=logger.js.map diff --git a/Export/manifest.webmanifest b/Export/manifest.webmanifest new file mode 100644 index 0000000..dd6a5f7 --- /dev/null +++ b/Export/manifest.webmanifest @@ -0,0 +1,12 @@ +{ + "name": "MultiplayerTest01", + "short_name": "MultiplayerTest01", + "id": "com.example.gamename", + "description": "", + "orientation": "landscape", + "start_url": "./index.html", + "display": "standalone", + "background_color": "black", + "categories": ["games", "entertainment"], + "icons": [] +} \ No newline at end of file diff --git a/Export/object-capabilities/AnimatableBehavior.js b/Export/object-capabilities/AnimatableBehavior.js new file mode 100644 index 0000000..b003a76 --- /dev/null +++ b/Export/object-capabilities/AnimatableBehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(t){class a extends t.RuntimeBehavior{constructor(e,n,i){super(e,n,i);this.object=i}usesLifecycleFunction(){return!1}applyBehaviorOverriding(e){return!0}onDeActivate(){}onDestroy(){}doStepPreEvents(e){}doStepPostEvents(e){}getAnimationIndex(){return this.object.getAnimationIndex()}setAnimationIndex(e){this.object.setAnimationIndex(e)}getAnimationName(){return this.object.getAnimationName()}setAnimationName(e){this.object.setAnimationName(e)}hasAnimationEnded(){return this.object.hasAnimationEnded()}isAnimationPaused(){return this.object.isAnimationPaused()}pauseAnimation(){this.object.pauseAnimation()}resumeAnimation(){this.object.resumeAnimation()}getAnimationSpeedScale(){return this.object.getAnimationSpeedScale()}setAnimationSpeedScale(e){this.object.setAnimationSpeedScale(e)}getAnimationElapsedTime(){return this.object.getAnimationElapsedTime()}setAnimationElapsedTime(e){this.object.setAnimationElapsedTime(e)}getAnimationDuration(){return this.object.getAnimationDuration()}}t.AnimatableBehavior=a,t.registerBehavior("AnimatableCapability::AnimatableBehavior",t.AnimatableBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=AnimatableBehavior.js.map diff --git a/Export/object-capabilities/EffectBehavior.js b/Export/object-capabilities/EffectBehavior.js new file mode 100644 index 0000000..46f4923 --- /dev/null +++ b/Export/object-capabilities/EffectBehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(a){class r extends a.RuntimeBehavior{constructor(e,t,n){super(e,t,n);this.object=n}usesLifecycleFunction(){return!1}applyBehaviorOverriding(e){return!0}onDeActivate(){}onDestroy(){}doStepPreEvents(e){}doStepPostEvents(e){}setEffectDoubleParameter(e,t,n){return this.object.setEffectDoubleParameter(e,t,n)}setEffectStringParameter(e,t,n){return this.object.setEffectStringParameter(e,t,n)}setEffectBooleanParameter(e,t,n){return this.object.setEffectBooleanParameter(e,t,n)}enableEffect(e,t){this.object.enableEffect(e,t)}isEffectEnabled(e){return this.object.isEffectEnabled(e)}}a.EffectBehavior=r,a.registerBehavior("EffectCapability::EffectBehavior",a.EffectBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=EffectBehavior.js.map diff --git a/Export/object-capabilities/FlippableBehavior.js b/Export/object-capabilities/FlippableBehavior.js new file mode 100644 index 0000000..64f34b6 --- /dev/null +++ b/Export/object-capabilities/FlippableBehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(i){class o extends i.RuntimeBehavior{constructor(e,n,t){super(e,n,t);this.object=t}usesLifecycleFunction(){return!1}applyBehaviorOverriding(e){return!0}onDeActivate(){}onDestroy(){}doStepPreEvents(e){}doStepPostEvents(e){}flipX(e){this.object.flipX(e)}flipY(e){this.object.flipY(e)}isFlippedX(){return this.object.isFlippedX()}isFlippedY(){return this.object.isFlippedY()}}i.FlippableBehavior=o,i.registerBehavior("FlippableCapability::FlippableBehavior",i.FlippableBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=FlippableBehavior.js.map diff --git a/Export/object-capabilities/OpacityBehavior.js b/Export/object-capabilities/OpacityBehavior.js new file mode 100644 index 0000000..602f2c3 --- /dev/null +++ b/Export/object-capabilities/OpacityBehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(e){class n extends e.RuntimeBehavior{constructor(t,i,a){super(t,i,a);this.object=a}usesLifecycleFunction(){return!1}applyBehaviorOverriding(t){return!0}onDeActivate(){}onDestroy(){}doStepPreEvents(t){}doStepPostEvents(t){}setOpacity(t){this.object.setOpacity(t)}getOpacity(){return this.object.getOpacity()}}e.OpacityBehavior=n,e.registerBehavior("OpacityCapability::OpacityBehavior",e.OpacityBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=OpacityBehavior.js.map diff --git a/Export/object-capabilities/ResizableBehavior.js b/Export/object-capabilities/ResizableBehavior.js new file mode 100644 index 0000000..e9c1b29 --- /dev/null +++ b/Export/object-capabilities/ResizableBehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(t){class a extends t.RuntimeBehavior{constructor(e,i,o){super(e,i,o);this.object=o}usesLifecycleFunction(){return!1}applyBehaviorOverriding(e){return!0}onDeActivate(){}onDestroy(){}doStepPreEvents(e){}doStepPostEvents(e){}setWidth(e){this.object.setWidth(e)}setHeight(e){this.object.setHeight(e)}setSize(e,i){this.object.setSize(e,i)}getWidth(){return this.object.getWidth()}getHeight(){return this.object.getHeight()}}t.ResizableBehavior=a,t.registerBehavior("ResizableCapability::ResizableBehavior",t.ResizableBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=ResizableBehavior.js.map diff --git a/Export/object-capabilities/ScalableBehavior.js b/Export/object-capabilities/ScalableBehavior.js new file mode 100644 index 0000000..d84fe77 --- /dev/null +++ b/Export/object-capabilities/ScalableBehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(t){class c extends t.RuntimeBehavior{constructor(e,l,a){super(e,l,a);this.object=a}usesLifecycleFunction(){return!1}applyBehaviorOverriding(e){return!0}onDeActivate(){}onDestroy(){}doStepPreEvents(e){}doStepPostEvents(e){}setScale(e){this.object.setScale(e)}setScaleX(e){this.object.setScaleX(e)}setScaleY(e){this.object.setScaleY(e)}getScale(){return this.object.getScale()}getScaleY(){return this.object.getScaleY()}getScaleX(){return this.object.getScaleX()}}t.ScalableBehavior=c,t.registerBehavior("ScalableCapability::ScalableBehavior",t.ScalableBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=ScalableBehavior.js.map diff --git a/Export/object-capabilities/TextContainerBehavior.js b/Export/object-capabilities/TextContainerBehavior.js new file mode 100644 index 0000000..a22ba18 --- /dev/null +++ b/Export/object-capabilities/TextContainerBehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(t){class r extends t.RuntimeBehavior{constructor(e,i,n){super(e,i,n);this.object=n}usesLifecycleFunction(){return!1}applyBehaviorOverriding(e){return!0}onDeActivate(){}onDestroy(){}doStepPreEvents(e){}doStepPostEvents(e){}getText(){return this.object.getText()}setText(e){this.object.setText(e)}}t.TextContainerBehavior=r,t.registerBehavior("TextContainerCapability::TextContainerBehavior",t.TextContainerBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=TextContainerBehavior.js.map diff --git a/Export/oncetriggers.js b/Export/oncetriggers.js new file mode 100644 index 0000000..098fbd5 --- /dev/null +++ b/Export/oncetriggers.js @@ -0,0 +1,2 @@ +var gdjs;(function(g){class r{constructor(){this._onceTriggers={};this._lastFrameOnceTrigger={}}startNewFrame(){for(const e in this._lastFrameOnceTrigger)this._lastFrameOnceTrigger.hasOwnProperty(e)&&delete this._lastFrameOnceTrigger[e];for(const e in this._onceTriggers)this._onceTriggers.hasOwnProperty(e)&&(this._lastFrameOnceTrigger[e]=this._onceTriggers[e],delete this._onceTriggers[e])}triggerOnce(e){return this._onceTriggers[e]=!0,!this._lastFrameOnceTrigger.hasOwnProperty(e)}getNetworkSyncData(){return{onceTriggers:this._onceTriggers,lastFrameOnceTriggers:this._lastFrameOnceTrigger}}updateNetworkSyncData(e){this._onceTriggers=e.onceTriggers,this._lastFrameOnceTrigger=e.lastFrameOnceTriggers}}g.OnceTriggers=r})(gdjs||(gdjs={})); +//# sourceMappingURL=oncetriggers.js.map diff --git a/Export/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js b/Export/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js new file mode 100644 index 0000000..4530a7a --- /dev/null +++ b/Export/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js @@ -0,0 +1,2 @@ +var gdjs;(function(r){class a{constructor(e,t,n){this._isContainerDirty=!0;this._debugDraw=null;this._debugDrawContainer=null;this._object=e,this._instanceContainer=t,this._pixiContainer=new PIXI.Container,this._debugDrawRenderedObjectsPoints={},this._pixiContainer.sortableChildren=!0,this._debugDraw=null;const i=n.getLayer("");i&&i.getRenderer().addRendererObject(this._pixiContainer,e.getZOrder())}reinitialize(e,t){this._object=e,this._isContainerDirty=!0,this._pixiContainer.removeChildren()}getRendererObject(){return this._pixiContainer}get3DRendererObject(){return null}_updatePIXIContainer(){const e=this._object.getScaleX(),t=this._object.getScaleY(),n=this._object.getOpacity();this._pixiContainer.pivot.x=this._object.getUnscaledCenterX(),this._pixiContainer.pivot.y=this._object.getUnscaledCenterY(),this._pixiContainer.position.x=this._object.getX()+this._pixiContainer.pivot.x*Math.abs(e),this._pixiContainer.position.y=this._object.getY()+this._pixiContainer.pivot.y*Math.abs(t),this._pixiContainer.rotation=r.toRad(this._object.angle),this._pixiContainer.scale.x=e*(this._object.isFlippedX()?-1:1),this._pixiContainer.scale.y=t*(this._object.isFlippedY()?-1:1),this._pixiContainer.visible=!this._object.hidden,this._pixiContainer.alpha=n/255,this._isContainerDirty=!1}ensureUpToDate(){this._isContainerDirty&&this._updatePIXIContainer()}update(){this._isContainerDirty=!0}updateX(){const e=this._object.getScaleX();this._pixiContainer.position.x=this._object.x+this._pixiContainer.pivot.x*Math.abs(e)}updateY(){const e=this._object.getScaleY();this._pixiContainer.position.y=this._object.y+this._pixiContainer.pivot.y*Math.abs(e)}updateAngle(){this._pixiContainer.rotation=r.toRad(this._object.angle)}updateOpacity(){const e=this._object.getOpacity();this._pixiContainer.alpha=e/255}updateVisibility(){this._pixiContainer.visible=!this._object.hidden}getPIXIContainer(){return this._pixiContainer}getPIXIRenderer(){return null}setLayerIndex(e,t){const n=e.getRenderer();let i=n.getRendererObject();e.isLightingLayer()&&(i=n.getLightingSprite()),!!i&&this._pixiContainer.children.indexOf(i)!==t&&(this._pixiContainer.removeChild(i),this._pixiContainer.addChildAt(i,t))}static getAnimationFrameTextureManager(e){return r.SpriteRuntimeObjectPixiRenderer.getAnimationFrameTextureManager(e)}}r.CustomRuntimeObject2DPixiRenderer=a,r.CustomRuntimeObject2DRenderer=r.CustomRuntimeObject2DPixiRenderer})(gdjs||(gdjs={})); +//# sourceMappingURL=CustomRuntimeObject2DPixiRenderer.js.map diff --git a/Export/pixi-renderers/DebuggerPixiRenderer.js b/Export/pixi-renderers/DebuggerPixiRenderer.js new file mode 100644 index 0000000..4c94fe8 --- /dev/null +++ b/Export/pixi-renderers/DebuggerPixiRenderer.js @@ -0,0 +1,2 @@ +var gdjs;(function(b){class y{constructor(d){this._debugDraw=null;this._debugDrawContainer=null;this._instanceContainer=d,this._debugDrawRenderedObjectsPoints={},this._debugDraw=null}getRendererObject(){return this._debugDrawContainer}renderDebugDraw(d,w,_,R){const D=this._instanceContainer.getRenderer().getRendererObject();(!this._debugDraw||!this._debugDrawContainer)&&(this._debugDrawContainer=new PIXI.Container,this._debugDraw=new PIXI.Graphics,this._debugDrawContainer.addChild(this._debugDraw),D&&D.addChild(this._debugDrawContainer));const n=this._debugDraw;for(let r in this._debugDrawRenderedObjectsPoints)this._debugDrawRenderedObjectsPoints[r].wasRendered=!1;const u=(r,e,t,l,i)=>{n.line.color=t,n.fill.color=t,n.drawCircle(l,i,3),_&&(r[e]||(r[e]=new PIXI.Text(e,{fill:t,fontSize:12}),this._debugDrawContainer.addChild(r[e])),r[e].position.set(l,i))};n.clear(),n.beginFill(),n.alpha=.8,n.lineStyle(2,255,1);const c=[0,0];for(let r=0;r{s=t.applyLayerTransformation(s[0],s[1],0,c),g.push(s[0]),g.push(s[1])}),n.fill.alpha=0,n.line.alpha=.5,n.line.color=16711680,n.drawPolygon(g)}n.fill.alpha=.3;const P=t.applyLayerTransformation(e.getCenterXInScene(),e.getCenterYInScene(),0,c);u(a.points,"Center",16776960,P[0],P[1]);const p=t.applyLayerTransformation(e.getX(),e.getY(),0,c);if(u(a.points,"Position",16711680,p[0],p[1]),e instanceof b.SpriteRuntimeObject){let o=e.getPointPosition("origin");(Math.abs(o[0]-p[0])>=1||Math.abs(o[1]-p[1])>=1)&&(o=t.applyLayerTransformation(o[0],o[1],0,c),u(a.points,"Origin",16711680,o[0],o[1]))}if(R&&e instanceof b.SpriteRuntimeObject){const o=e._animator.getCurrentFrame();if(!o)continue;for(const g in o.points.items){let s=e.getPointPosition(g);s=t.applyLayerTransformation(s[0],s[1],0,c),u(a.points,g,255,s[0],s[1])}}}for(const r in this._debugDrawRenderedObjectsPoints){const e=this._debugDrawRenderedObjectsPoints[r];if(e.wasRendered)continue;const t=e.points;for(const l in t)this._debugDrawContainer.removeChild(t[l])}n.endFill()}clearDebugDraw(){if(this._debugDraw&&this._debugDraw.clear(),this._debugDrawContainer){this._debugDrawContainer.destroy({children:!0});const d=this._instanceContainer.getRenderer().getRendererObject();d&&d.removeChild(this._debugDrawContainer)}this._debugDraw=null,this._debugDrawContainer=null,this._debugDrawRenderedObjectsPoints={}}}b.DebuggerPixiRenderer=y,b.DebuggerRenderer=b.DebuggerPixiRenderer})(gdjs||(gdjs={})); +//# sourceMappingURL=DebuggerPixiRenderer.js.map diff --git a/Export/pixi-renderers/layer-pixi-renderer.js b/Export/pixi-renderers/layer-pixi-renderer.js new file mode 100644 index 0000000..ece725a --- /dev/null +++ b/Export/pixi-renderers/layer-pixi-renderer.js @@ -0,0 +1,15 @@ +var gdjs;(function(_){const R=new _.Logger("LayerPixiRenderer"),T=[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[1,5],[2,6],[3,7]],y=[[-1,-1,-1],[1,-1,-1],[1,1,-1],[-1,1,-1],[-1,-1,1],[1,-1,1],[1,1,1],[-1,1,1]],D=o=>{if(o.length<=2)return o;const e=o.reduce((t,i)=>t+i.x,0)/o.length,r=o.reduce((t,i)=>t+i.y,0)/o.length;return o.map(t=>({p:t,a:Math.atan2(t.y-r,t.x-e)})).sort((t,i)=>t.a-i.a).map(t=>t.p)},b=(o,e,r=1e-9)=>{const t=o.z,i=e.z,a=i-t;if(Math.abs(a)1+r?null:new THREE.Vector3(o.x+n*(e.x-o.x),o.y+n*(e.y-o.y),0)},M=(o,e=1e-6)=>{const r=[];for(const t of o)r.some(a=>Math.abs(t.x-a.x){o.updateMatrixWorld(!0);const e=y.map(i=>new THREE.Vector3(i[0],i[1],i[2]).unproject(o));if(e.length!==8)return[];const r=[];for(const i of e)Math.abs(i.z)<1e-9&&r.push(new THREE.Vector3(i.x,i.y,0));for(const[i,a]of T){const n=e[i],h=e[a],l=b(n,h);l&&r.push(l)}const t=M(r);return t.length<3?[]:D(t)},E=(o,e,r)=>{if(!o)return null;o.updateMatrixWorld(!0);const t=new THREE.Vector3,i=new THREE.Vector3,a=new THREE.Vector3(e,r,.5);o instanceof THREE.OrthographicCamera?(a.z=0,a.unproject(o),t.copy(a),o.getWorldDirection(i)):(a.unproject(o),t.copy(o.position),i.copy(a).sub(t).normalize());const n=i.z;if(Math.abs(n)<1e-8)return null;const h=-t.z/n;return h<=0?null:t.addScaledVector(i,h).setZ(0)},H=45,f=class{constructor(e,r,t){this._lightingSprite=null;this._renderTexture=null;this._oldWidth=null;this._oldHeight=null;this._threeGroup=null;this._threeScene=null;this._threeCamera=null;this._threeCameraDirty=!1;this._threeEffectComposer=null;this._basis=null;this._threePlaneTexture=null;this._threePlaneGeometry=null;this._threePlaneMaterial=null;this._threePlaneMesh=null;this._threePlaneMeshDebugOutline=null;this._2DPlaneMaxDrawingDistance=5e3;this._2DPlaneClampFreeTiltDeg=.1;this._2DPlaneClampHardTiltDeg=6;this._2DPlaneClampRampPower=1.5;this._pixiContainer=new PIXI.Container,this._pixiContainer.sortableChildren=!0,this._layer=e,this._isLightingLayer=e.isLightingLayer();const i=r.getRendererObject();i&&i.addChild(this._pixiContainer),this._pixiContainer.filters=[];const a=t.getPIXIRenderer();this._isLightingLayer?(this._clearColor=e.getClearColor(),this._setupLightingRendering(a,r)):(this._clearColor=[..._.hexNumberToRGBArray(this._layer.getRuntimeScene().getBackgroundColor()),0],this._setup3DRendering(a,r))}onCreated(){this._update3DCameraAspectAndPosition()}onGameResolutionResized(){this._update3DCameraAspectAndPosition()}_update3DCameraAspectAndPosition(){if(!!this._threeCamera){if(this._threeCamera instanceof THREE.OrthographicCamera){const e=this._layer.getWidth(),r=this._layer.getHeight();this._threeCamera.left=-e/2,this._threeCamera.right=e/2,this._threeCamera.top=r/2,this._threeCamera.bottom=-r/2}else this._threeCamera.aspect=this._layer.getWidth()/this._layer.getHeight();this._threeCamera.updateProjectionMatrix(),this.updatePosition()}}getRendererObject(){return this._pixiContainer}getThreeScene(){return this._threeScene}getThreeGroup(){return this._threeGroup}getThreeCamera(){return this._threeCamera}getThreeEffectComposer(){return this._threeEffectComposer}addPostProcessingPass(e){if(!this._threeEffectComposer)return;const r=this._layer.getRuntimeScene().getGame(),t=this._threeEffectComposer.passes.length-(r.getAntialiasingMode()==="none"?1:2);this._threeEffectComposer.insertPass(e,t)}removePostProcessingPass(e){!this._threeEffectComposer||this._threeEffectComposer.removePass(e)}hasPostProcessingPass(){if(!this._threeEffectComposer)return!1;const r=this._layer.getRuntimeScene().getGame().getAntialiasingMode()==="none"?2:3;return this._threeEffectComposer.passes.length>r}getLightingSprite(){return this._lightingSprite}_setup3DRendering(e,r){if(typeof THREE!="undefined")if(this._layer instanceof _.Layer){if(this._layer.getRenderingType()===_.RuntimeLayerRenderingType.THREE_D||this._layer.getRenderingType()===_.RuntimeLayerRenderingType.TWO_D_PLUS_THREE_D){if(this._threeScene||this._threeGroup||this._threeCamera)throw new Error("Tried to setup 3D rendering for a layer that is already set up.");if(this._threeScene=new THREE.Scene,this._threeScene.scale.y=-1,this._threeGroup=new THREE.Group,this._threeScene.add(this._threeGroup),this._layer.getCameraType()===_.RuntimeLayerCameraType.ORTHOGRAPHIC){const a=this._layer.getWidth(),n=this._layer.getHeight();this._threeCamera=new THREE.OrthographicCamera(-a/2,a/2,n/2,-n/2,this._layer.getInitialCamera3DNearPlaneDistance(),this._layer.getInitialCamera3DFarPlaneDistance())}else this._threeCamera=new THREE.PerspectiveCamera(this._layer.getInitialCamera3DFieldOfView(),1,this._layer.getInitialCamera3DNearPlaneDistance(),this._layer.getInitialCamera3DFarPlaneDistance());this._threeCamera.rotation.order="ZYX";const t=this._layer.getRuntimeScene().getGame(),i=t.getRenderer().getThreeRenderer();if(i&&(this._threeEffectComposer=new THREE_ADDONS.EffectComposer(i),this._threeEffectComposer.addPass(new THREE_ADDONS.RenderPass(this._threeScene,this._threeCamera)),t.getAntialiasingMode()!=="none"&&this._threeEffectComposer.addPass(new THREE_ADDONS.SMAAPass(t.getGameResolutionWidth(),t.getGameResolutionHeight())),this._threeEffectComposer.addPass(new THREE_ADDONS.OutputPass)),this._layer.getRenderingType()===_.RuntimeLayerRenderingType.TWO_D_PLUS_THREE_D){if(this._renderTexture||this._threePlaneGeometry||this._threePlaneMaterial||this._threePlaneTexture||this._threePlaneMesh)throw new Error("Tried to setup PixiJS plane for 2D rendering in 3D for a layer that is already set up.");this.set2DPlaneMaxDrawingDistance(this._layer.getInitialCamera2DPlaneMaxDrawingDistance()),this._createPixiRenderTexture(e),this._threePlaneGeometry=new THREE.PlaneGeometry(1,1);const a=1,n=1,h=a*n,l=new Uint8Array(4*h),c=new THREE.DataTexture(l,a,n);c.needsUpdate=!0,this._threePlaneTexture=c,this._threePlaneTexture.generateMipmaps=!1;const m=this._layer.getRuntimeScene().getGame().getScaleMode()==="nearest"?THREE.NearestFilter:THREE.LinearFilter;this._threePlaneTexture.minFilter=m,this._threePlaneTexture.magFilter=m,this._threePlaneTexture.wrapS=THREE.ClampToEdgeWrapping,this._threePlaneTexture.wrapT=THREE.ClampToEdgeWrapping;const s={vertexShader:` + varying vec2 vUv; + void main() { + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); + } + `,fragmentShader:` + uniform sampler2D map; + varying vec2 vUv; + void main() { + vec4 texel = texture2D(map, vUv); + gl_FragColor = texel; + } + `,uniforms:{map:{value:this._threePlaneTexture}},side:THREE.FrontSide,transparent:!0};this._threePlaneMaterial=new THREE.ShaderMaterial(s),this._threePlaneMaterial,this._threePlaneMesh=new THREE.Mesh(this._threePlaneGeometry,this._threePlaneMaterial),this._threePlaneMesh.renderOrder=Number.MAX_SAFE_INTEGER,this._threeScene.add(this._threePlaneMesh)}}}else{const t=r.get3DRendererObject();if(!t)return;this._threeGroup||(this._threeGroup=new THREE.Group,t.add(this._threeGroup))}}setCamera3DNearPlaneDistance(e){!this._threeCamera||(this._threeCamera.near=Math.min(Math.max(e,1e-4),this._threeCamera.far),this._threeCameraDirty=!0)}getCamera3DNearPlaneDistance(){return this._threeCamera?this._threeCamera.near:0}setCamera3DFarPlaneDistance(e){!this._threeCamera||(this._threeCamera.far=Math.max(e,this._threeCamera.near),this._threeCameraDirty=!0)}getCamera3DFarPlaneDistance(){return this._threeCamera?this._threeCamera.far:0}setCamera3DFieldOfView(e){!this._threeCamera||this._threeCamera instanceof THREE.OrthographicCamera||(this._threeCamera.fov=Math.min(Math.max(e,0),180),this._threeCameraDirty=!0)}getCamera3DFieldOfView(){return this._threeCamera?this._threeCamera?this._threeCamera instanceof THREE.OrthographicCamera?0:this._threeCamera.fov:H:0}show2DRenderingPlane(e){!this._threePlaneMesh||this._threePlaneMesh.visible!==e&&(this._threePlaneMesh.visible=e)}show2DRenderingPlaneDebugOutline(e){if(!!this._threePlaneMesh){if(e&&!this._threePlaneMeshDebugOutline){const r=new THREE.EdgesGeometry(this._threePlaneGeometry),t=new THREE.LineBasicMaterial({color:16711680});this._threePlaneMeshDebugOutline=new THREE.LineSegments(r,t),this._threePlaneMesh.add(this._threePlaneMeshDebugOutline)}!e&&this._threePlaneMeshDebugOutline&&(this._threePlaneMesh.remove(this._threePlaneMeshDebugOutline),this._threePlaneMeshDebugOutline=null)}}set2DPlaneMaxDrawingDistance(e){this._2DPlaneMaxDrawingDistance=Math.max(0,e)}get2DPlaneMaxDrawingDistance(){return this._2DPlaneMaxDrawingDistance}set2DPlaneClampFreeTiltDegrees(e){this._2DPlaneClampFreeTiltDeg=Math.max(0,e)}set2DPlaneClampHardTiltDegrees(e){this._2DPlaneClampHardTiltDeg=Math.max(0,e)}set2DPlaneClampRampPower(e){this._2DPlaneClampRampPower=Math.max(.1,e)}_get2DPlaneSize(){if(!this._threeCamera)return[0,0];const e=v(this._threeCamera);if(e.length===0)return[0,0];let r=1/0,t=-1/0,i=1/0,a=-1/0;for(const g of e)g.xt&&(t=g.x),g.ya&&(a=g.y);let n=Math.max(1e-8,t-r),h=Math.max(1e-8,a-i);const l=this._layer.getWidth()/this._layer.getHeight();n/h=s?p=0:p=(s-d)/(s-u),p=Math.pow(p,this._2DPlaneClampRampPower);const C=1e12,I=Math.max(p,1e-6),P=Math.min(C,this._2DPlaneMaxDrawingDistance/I);if(P0}has2DObjects(){return this._pixiContainer.children.length>0}add3DRendererObject(e){!this._threeGroup||this._threeGroup.add(e)}remove3DRendererObject(e){!this._threeGroup||this._threeGroup.remove(e)}updateClearColor(){this._clearColor=this._layer.getClearColor()}_createPixiRenderTexture(e){if(!e||e.type!==PIXI.RENDERER_TYPE.WEBGL)return;if(this._renderTexture){R.error("Tried to create a PixiJS RenderTexture for a layer that already has one.");return}this._oldWidth=e.screen.width,this._oldHeight=e.screen.height;const r=this._oldWidth,t=this._oldHeight,i=e.resolution;this._renderTexture=PIXI.RenderTexture.create({width:r||100,height:t||100,resolution:i}),this._renderTexture.baseTexture.scaleMode=PIXI.SCALE_MODES.LINEAR,R.info(`RenderTexture created for layer ${this._layer.getName()}.`)}renderOnPixiRenderTexture(e){if(!this._renderTexture)return;(this._oldWidth!==e.screen.width||this._oldHeight!==e.screen.height)&&(this._renderTexture.resize(e.screen.width||100,e.screen.height||100),this._oldWidth=e.screen.width,this._oldHeight=e.screen.height);const r=e.renderTexture.current||void 0,t=e.renderTexture.sourceFrame;e.renderTexture.bind(this._renderTexture),this._clearColor[3]=this._isLightingLayer?1:0,e.renderTexture.clear(this._clearColor),e.render(this._pixiContainer,{renderTexture:this._renderTexture,clear:!1}),e.renderTexture.bind(r,t,void 0)}updateThreePlaneTextureFromPixiRenderTexture(e,r){if(!this._threePlaneTexture||!this._renderTexture)return;const t=this._renderTexture.baseTexture._glTextures[r.CONTEXT_UID];if(t){const i=e.properties.get(this._threePlaneTexture);i.__webglTexture=t.texture}}_setupLightingRendering(e,r){if(this._createPixiRenderTexture(e),!this._renderTexture)return;this._lightingSprite=new PIXI.Sprite(this._renderTexture),this._lightingSprite.blendMode=PIXI.BLEND_MODES.MULTIPLY;const t=r.getRendererObject();if(t){const i=t.getChildIndex(this._pixiContainer);t.addChildAt(this._lightingSprite,i),t.removeChild(this._pixiContainer)}}};let x=f;x.matrix4=null,x.zeroZOrderForPixi=Math.pow(2,-24),x.vectorForProjections=null,_.LayerPixiRenderer=x;class w{constructor(){this.isDirty=!0;this.forwardX=0;this.forwardY=0;this.forwardZ=0;this.upX=0;this.upY=0;this.upZ=0;this.rightX=0;this.rightY=0;this.rightZ=0}}_.LayerRenderer=_.LayerPixiRenderer})(gdjs||(gdjs={})); +//# sourceMappingURL=layer-pixi-renderer.js.map diff --git a/Export/pixi-renderers/loadingscreen-pixi-renderer.js b/Export/pixi-renderers/loadingscreen-pixi-renderer.js new file mode 100644 index 0000000..5b34269 --- /dev/null +++ b/Export/pixi-renderers/loadingscreen-pixi-renderer.js @@ -0,0 +1,2 @@ +var gdjs;(function(p){let a;(function(r){r[r.NOT_STARTED=0]="NOT_STARTED",r[r.STARTED=1]="STARTED",r[r.FINISHED=2]="FINISHED"})(a||(a={}));const d=(n,e,i)=>{!n||(e>0?(n.alpha+=1/e*i/1e3,n.alpha>1&&(n.alpha=1)):n.alpha=1)},_=n=>!n||n.alpha>=1;class c{constructor(e,i,r,t,s){this._backgroundSprite=null;this._gdevelopLogoSprite=null;this._progressBarGraphics=null;this._state=0;this._startTimeInMs=0;this._backgroundReadyTimeInMs=0;this._lastFrameTimeInMs=0;this._progressPercent=0;if(this._loadingScreenData=r,this._isWatermarkEnabled=t,this._isFirstLayout=s,this._loadingScreenContainer=new PIXI.Container,this._pixiRenderer=e.getPIXIRenderer(),!this._pixiRenderer)return;const o=i.getOrLoadPIXITexture(r.backgroundImageResourceName);o!==i.getInvalidPIXITexture()&&(this._backgroundSprite=PIXI.Sprite.from(o),this._backgroundSprite.alpha=0,this._backgroundSprite.anchor.x=.5,this._backgroundSprite.anchor.y=.5,this._loadingScreenContainer.addChild(this._backgroundSprite)),r.showGDevelopSplash&&s&&(this._gdevelopLogoSprite=PIXI.Sprite.from(p.gdevelopLogo),this._gdevelopLogoSprite.alpha=0,this._gdevelopLogoSprite.anchor.x=.5,this._gdevelopLogoSprite.anchor.y=.5,this._loadingScreenContainer.addChild(this._gdevelopLogoSprite)),r.showProgressBar&&(this._progressBarGraphics=new PIXI.Graphics,this._progressBarGraphics.alpha=0,this._loadingScreenContainer.addChild(this._progressBarGraphics)),this._render(performance.now())}setPercent(e){this._progressPercent=e}_startLoadingScreen(){!this._pixiRenderer||(this._state=1,this._startTimeInMs=performance.now())}_updatePositions(){if(!!this._pixiRenderer){if(this._backgroundSprite&&this._backgroundSprite.texture.valid){this._backgroundSprite.position.x=this._pixiRenderer.width/2,this._backgroundSprite.position.y=this._pixiRenderer.height/2;const e=Math.max(this._pixiRenderer.width/this._backgroundSprite.texture.width,this._pixiRenderer.height/this._backgroundSprite.texture.height);this._backgroundSprite.scale.x=e,this._backgroundSprite.scale.y=e}if(this._gdevelopLogoSprite){this._gdevelopLogoSprite.position.x=this._pixiRenderer.width/2,this._gdevelopLogoSprite.position.y=this._pixiRenderer.height/2;const e=680,i=this._pixiRenderer.width>this._pixiRenderer.height&&this._pixiRenderer.width>500?150:35,t=Math.min(e,Math.max(1,this._pixiRenderer.width-i*2))/e;this._gdevelopLogoSprite.scale.x=t,this._gdevelopLogoSprite.scale.y=t,this._gdevelopLogoSprite.visible=this._pixiRenderer.width>200&&this._pixiRenderer.height>200}}}_render(e){!this._pixiRenderer||this._state!==2&&(requestAnimationFrame(()=>this._render(performance.now())),this._renderIfNeeded(e))}renderIfNeeded(){return this._renderIfNeeded(performance.now())}_renderIfNeeded(e){if(e-this._lastFrameTimeInMs<1e3/60||!this._pixiRenderer)return!1;const i=this._lastFrameTimeInMs?e-this._lastFrameTimeInMs:0;if(this._lastFrameTimeInMs=e,this._updatePositions(),this._state===2)return!0;if(this._state==0)return this._pixiRenderer.background.color=this._loadingScreenData.backgroundColor,(!this._backgroundSprite||this._backgroundSprite.texture.valid)&&this._startLoadingScreen(),!0;const r=this._loadingScreenData.backgroundFadeInDuration;if(this._backgroundSprite||d(this._pixiRenderer.background,r,i),this._pixiRenderer.clear(),d(this._backgroundSprite,r,i),_(this._backgroundSprite)){this._backgroundReadyTimeInMs||(this._backgroundReadyTimeInMs=e);const t=this._loadingScreenData.logoAndProgressFadeInDuration,s=this._loadingScreenData.logoAndProgressLogoFadeInDelay;e-this._backgroundReadyTimeInMs>s*1e3&&(d(this._gdevelopLogoSprite,t,i),d(this._progressBarGraphics,t,i))}if(this._progressBarGraphics){const t=this._loadingScreenData.progressBarColor;let s=this._loadingScreenData.progressBarWidthPercent/100*this._pixiRenderer.width;this._loadingScreenData.progressBarMaxWidth>0&&s>this._loadingScreenData.progressBarMaxWidth&&(s=this._loadingScreenData.progressBarMaxWidth),this._loadingScreenData.progressBarMinWidth>0&&sthis._loadingScreenData.minDuration)return this._state=2,Promise.resolve();const r=this._loadingScreenData.minDuration-e;return this.setPercent(100),new Promise(t=>setTimeout(()=>{this._state=2,t()},r*1e3))}}p.LoadingScreenRenderer=c})(gdjs||(gdjs={})); +//# sourceMappingURL=loadingscreen-pixi-renderer.js.map diff --git a/Export/pixi-renderers/pixi-bitmapfont-manager.js b/Export/pixi-renderers/pixi-bitmapfont-manager.js new file mode 100644 index 0000000..d739c5a --- /dev/null +++ b/Export/pixi-renderers/pixi-bitmapfont-manager.js @@ -0,0 +1,4 @@ +var gdjs;(function(o){const a=new o.Logger("Bitmap text"),p="GDJS-DEFAULT-BITMAP-FONT",d=5,u=(n,t)=>{const i=n.pageTextures;return i&&Object.values(i).some(e=>e.baseTexture&&e.baseTexture.destroyed||e.baseTexture!==t.baseTexture)},m=(n,t)=>{const i=n.font;return n.font=t,PIXI.BitmapFont.available[t]=n,delete PIXI.BitmapFont.available[i],PIXI.BitmapFont.available[t]},F=["bitmapFont"];class c{constructor(t,i){this._pixiBitmapFontsInUse={};this._pixiBitmapFontsToUninstall=[];this._loadedFontsData=new o.ResourceCache;this._defaultSlugFontName=null;this._imageManager=i,this._resourceLoader=t}getResourceKinds(){return F}getDefaultBitmapFont(){if(this._defaultSlugFontName!==null)return PIXI.BitmapFont.available[this._defaultSlugFontName];const t="Arial",i=new PIXI.TextStyle({fontFamily:t,fontSize:20,padding:5,align:"left",fill:"#ffffff",wordWrap:!0,lineHeight:20}),e=m(PIXI.BitmapFont.from(t,i,{chars:[[" ","~"]]}),p);return this._defaultSlugFontName=e.font,e}_markBitmapFontAsUsed(t){this._pixiBitmapFontsInUse[t]=this._pixiBitmapFontsInUse[t]||{objectsUsingTheFont:0},this._pixiBitmapFontsInUse[t].objectsUsingTheFont++;for(let i=0;id)){const i=this._pixiBitmapFontsToUninstall.shift();PIXI.BitmapFont.available[i]&&PIXI.BitmapFont.uninstall(i),a.log("Bitmap Text",'Uninstalled BitmapFont "'+i+'" from memory.')}}}obtainBitmapFont(t,i){const e=t+"@"+i;if(PIXI.BitmapFont.available[e]&&u(PIXI.BitmapFont.available[e],this._imageManager.getPIXITexture(i))&&PIXI.BitmapFont.uninstall(e),PIXI.BitmapFont.available[e])return this._markBitmapFontAsUsed(e),PIXI.BitmapFont.available[e];const r=this._loadedFontsData.getFromName(t);if(!r)return a.warn('Could not find Bitmap Font for resource named "'+t+'". The default font will be used.'),this.getDefaultBitmapFont();const l=this._imageManager.getPIXITexture(i);try{const s=m(PIXI.BitmapFont.install(r,l),e);return this._markBitmapFontAsUsed(e),s}catch(s){return a.error('Could not load the Bitmap Font for resource named "'+t+'". The default font will be used. Error is: '+s),this.getDefaultBitmapFont()}}async processResource(t){}async loadResource(t){const i=this._resourceLoader.getResource(t);if(!i){a.warn('Unable to find bitmap font for resource "'+t+'".');return}if(!this._loadedFontsData.get(i))try{const e=await fetch(this._resourceLoader.getFullUrl(i.file),{credentials:this._resourceLoader.checkIfCredentialsRequired(i.file)?"include":"same-origin"});if(!e.ok)throw new Error(`HTTP error while loading bitmap font. Status is ${e.status}.`);const l=(await e.text()).split(` +`).filter(s=>!s.trim().startsWith("#")).join(` +`);this._loadedFontsData.set(i,l)}catch(e){throw a.error("Can't fetch the bitmap font file "+i.file+", error: "+e),this._loadedFontsData.delete(i),e}}dispose(){for(const t in this._pixiBitmapFontsInUse)PIXI.BitmapFont.uninstall(t);for(const t of this._pixiBitmapFontsToUninstall)PIXI.BitmapFont.uninstall(t);this._pixiBitmapFontsInUse={},this._pixiBitmapFontsToUninstall.length=0,this._loadedFontsData.clear()}unloadResource(t){this._loadedFontsData.delete(t);for(let i=0;ia!==this.pixiFilter),!0):!1}updatePreRender(e){this.filterCreator.updatePreRender(this.pixiFilter,e)}updateDoubleParameter(e,t){this.filterCreator.updateDoubleParameter(this.pixiFilter,e,t)}updateStringParameter(e,t){this.filterCreator.updateStringParameter(this.pixiFilter,e,t)}updateBooleanParameter(e,t){this.filterCreator.updateBooleanParameter(this.pixiFilter,e,t)}updateColorParameter(e,t){this.filterCreator.updateColorParameter(this.pixiFilter,e,t)}getDoubleParameter(e){return this.filterCreator.getDoubleParameter(this.pixiFilter,e)}getColorParameter(e){return this.filterCreator.getColorParameter(this.pixiFilter,e)}getNetworkSyncData(){return{ena:this.pixiFilter.enabled,fc:this.filterCreator.getNetworkSyncData(this.pixiFilter)}}updateFromNetworkSyncData(e){this.pixiFilter.enabled=e.ena,this.filterCreator.updateFromNetworkSyncData(this.pixiFilter,e.fc)}}n.PixiFilter=u;class F{isEnabled(e){return!1}setEnabled(e,t){return!1}applyEffect(e){return!1}removeEffect(e){return!1}updatePreRender(e){}updateDoubleParameter(e,t){}updateStringParameter(e,t){}updateBooleanParameter(e,t){}updateColorParameter(e,t){}getDoubleParameter(e){return 0}getColorParameter(e){return 0}getNetworkSyncData(){return{}}updateFromNetworkSyncData(e){}}n.EmptyFilter=F})(m=o.PixiFiltersTools||(o.PixiFiltersTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=pixi-filters-tools.js.map diff --git a/Export/pixi-renderers/pixi-image-manager.js b/Export/pixi-renderers/pixi-image-manager.js new file mode 100644 index 0000000..2c39806 --- /dev/null +++ b/Export/pixi-renderers/pixi-image-manager.js @@ -0,0 +1,2 @@ +var gdjs;(function(d){const l=new d.Logger("PIXI Image manager"),c=(u,e)=>{l.error("Unable to load file "+u+" with error:",e||"(unknown error)")},g=(u,e)=>{!u||e.smoothed||(u.baseTexture.scaleMode=PIXI.SCALE_MODES.NEAREST)},h=(u,e)=>{e&&!e.smoothed&&(u.magFilter=THREE.NearestFilter,u.minFilter=THREE.NearestFilter)},A=["image","video"];class E{constructor(e){this._loadedTextures=new d.ResourceCache;this._loadedThreeMaterials=new f;this._loadedThreeCubeTextures=new Map;this._loadedThreeCubeTextureKeysByResourceName=new x;this._diskTextures=new Map;this._rectangleTextures=new Map;this._scaledTextures=new Map;this._getImageResource=e=>{const r=this._resourceLoader.getResource(e);return r&&this.getResourceKinds().includes(r.kind)?r:null};this._resourceLoader=e,this._invalidTexture=PIXI.Texture.from("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAMAAABlApw1AAAAkFBMVEWdIvr///+hOfrx6v7i0/39/P+eK/rn2v6vbPv7+f/cx/359v/38v7s4v7Wvf3LqvzFnvysY/v18P6jQvrz7P7u5P7ezP3Or/yoV/qlTfrq3v7l1v3hz/2fLvrTuPy0efufMvraxP3YwP3AlPu2fvuuavvRtPy8i/uqXfu5hvvIo/y4gvuxcvugNfq+j/vCmfxfwZ2lAAAF60lEQVR42uzPMQ0AAAjEQPBvmhkBDE+uAppcdXgfAHXY9R4AAAAAAAAAAGAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAEA/YAQAMNfa2nCoMhmE4HxhcFESggMhGtNa11NLl/d9dO53pQRMklPKn4TllhuEdEjb/CK/WWPXvBTjOOVxvDsvVO3u03e8EnC9BZnNMwNcfYDU728NkLpoDLpmPSQU6Ax5vNsfE0lpbwOs1AYGbroDnBCQyPQH7tQsanpYAqwQVftEQEKWgE9AHtAkIpTV1QBOD1Jk4IPJA6y9tQF2C2Io24ApqXq4OMHgBvTsSBjgVBnA9P7HH2xEGPOM+7hVPQdhGUZRvt4/WeHvCgBJ3uFXYsn4m/BO3HJ2Ko8XuMSogQBdvzXoYFRCjQ3GazWQuRIfKms1o0Skge3DmMxvdckiWzoyGu0dIvGhO0+kAkmBW4/UVRPw0qwAfopKpmRPwh0N0ZGrmBPyDyI2Yms6AaiH48nd3g8hmsijMFkrZ9UQSwCFY9j+EHpgor1wM4gaO9oAKog0TtDEGuxoQIF7DOcZwqQEB4kJe4Bt83QHOEiJLuAGe2QG2KuAF37HUHVAn0wZsdAfs/WkD8pkHrGrtSyhWBVgxhnti5m1itsZg/IUiIO4NKJQBzoFjoJjRB6hfZA0T/U8xTEASkMo7TfEtJLGa4CB81JYeZM3PAmQfUQUEtsUY+zx66N6I+MTuySFJPk48Sl9ACYH/1s6dICkKQwEYfg9NkE1QdhkREXGZ1rn/7aZmrR4SAdHnMpXvAF31txETSPA/BXjy9QBiV0KKAhNuCwA5E5vS1hWZtYc+XBScYbDhAVsDm7xeuxYX2GQUzwgAu9+cHrFzkuoCTcAamz7ar6O46QiQr6WNLVGAOFjjjrE88rsDIskHRxRQYVPecTlEszvAEP8tVAErbFrDJ0sHRceuAA8FCVXAB2u/81OjiOW8PUAXR9CJKsCfY4OtwSeFhRJm2haQGpJ5EFUAjLCp6vGQL9gUlwM8yUyaLmDcccXeGyjleKf+f3IOdAHiILc5CD8FMuzLZg8SmiWOIMKAr9gxhvYMLzKCsp5onbe0cUUY4KMgb6y5sN1I183Y+yM2Q3EE+VQB8mXjqIDPEhtvFJE+4Cg7t2Nv8EZn0oAdCnSh8SZWQRrALWxijS+dtqAfQcMDwETBmMM/fB1vcCYOWKGo+cup3VBgnYgDtKDHjXB/gUNl5I9Z8z7bCE9THMgjD0gZCmwfmg4BDhEW5AGwRlHGocmfWni9KdAHTIyeF780MvBKrCIIEMS9HwhtTYZXCeARAVrQfz/wrMRrlBQBohol7C3I8KQOGPZVPSbAH0kLJnBBlS+wm/PleFiSBIg22PoZiLi/yZ3AkC9zRuG69hLhoCplwHKMMtaOQwu+XR3itfnXOvcOq9VMe8aGp5mNUqUPT9crADyUcyZAgCAAdJSzvwIBgoDEQjlWJu/xWoaVgRfMa+0dAuBg4MUE178xYDuR2t8zAI4MLyfE6fAAvhsxKeN81wDIsYUVbQYGrMZ4QcTvGwBrbGWXX0/XBvDDmOEFQQp3DuARdljEiQa9cf+Y4WWb+289LiLsNB+7uz4RxS7WGbbIKfZO85phD8Y8Ko/bWcJBwt/PdlMzMLDduqDZ/L0zsDcrdJxFNI3dX+JppDuOM8c+oiXV7vXVCB8gO9Ftv/czJJdplOcHuGshLfNEfABiFyKlbEl+gqOoGZKJl484gjLLkEa4HTobfYlxxGrtgWcpzzremf7x2OO4vMoMvBsWnjkQB4gmEd5J8PU5r2nj23yEt1scORAFdCsm0znD4Zg9/eC0a+JuVa0bOARb5BXpor4/v8qdOV7DDstvKQd4kYAfllW/l+Sx+RfzW+XDDy8V8BPnyc511wvHCQPb+F3DDDsIHcfJStc9p5w//zRrL1qazH7ZJ6nP4a8XOI77IlTAld4w4FVu7qqA31SAClABKkAFqAAVoAJUgApQASpABagAFaACVIAKUAH/TcB7e/uA7+03ZsJSaNOuAAAAAElFTkSuQmCC",{width:192,height:192}),this._loadedThreeTextures=new Hashtable}getResourceKinds(){return A}getPIXITexture(e){const r=this._getImageResource(e);if(!r)return l.warn('Unable to find texture for resource "'+e+'".'),this._invalidTexture;const t=this._loadedTextures.get(r);return t?t.destroyed?(l.error("Texture for "+e+" is not valid anymore."),this._invalidTexture):t.valid?t:(l.error("Texture for "+e+" is not valid anymore (or never was)."),this._invalidTexture):this._invalidTexture}getOrLoadPIXITexture(e){const r=this._getImageResource(e);if(!r)return l.warn('Unable to find texture for resource "'+e+'".'),this._invalidTexture;const t=this._loadedTextures.get(r);if(t)return t.valid?t:(l.error("Texture for "+e+" is not valid anymore (or never was)."),this._invalidTexture);l.log('Loading texture for resource "'+e+'"...');const s=r.file,a=this._resourceLoader.getFullUrl(s),i=PIXI.Texture.from(a,{resourceOptions:{crossorigin:this._resourceLoader.checkIfCredentialsRequired(s)?"use-credentials":"anonymous"}}).on("error",o=>{c(s,o)});if(!i)throw new Error("Texture loading by PIXI returned nothing for file "+s+" behind url "+a);return g(i,r),this._loadedTextures.set(r,i),i}getThreeTexture(e){const r=this._loadedThreeTextures.get(e);if(r)return r;const t=this._getImageSource(e),s=new THREE.Texture(t);s.magFilter=THREE.LinearFilter,s.minFilter=THREE.LinearFilter,s.wrapS=THREE.RepeatWrapping,s.wrapT=THREE.RepeatWrapping,s.colorSpace=THREE.SRGBColorSpace,s.needsUpdate=!0;const a=this._getImageResource(e);return h(s,a),this._loadedThreeTextures.put(e,s),s}_getImageSource(e){const r=this.getPIXITexture(e);if(!this._resourceLoader._runtimeGame.getRenderer().getPIXIRenderer())throw new Error("No PIXI renderer was found.");const s=r.baseTexture.resource.source;if(!(s instanceof HTMLImageElement))throw new Error(`Can't load texture for resource "${e}" as it's not an image.`);return s}getThreeCubeTexture(e,r,t,s,a,i){const o=e+"|"+r+"|"+t+"|"+s+"|"+a+"|"+i,T=this._loadedThreeCubeTextures.get(o);if(T)return T;const n=new THREE.CubeTexture;n.images[0]=this._getImageSource(r),n.images[1]=this._getImageSource(e),n.images[2]=this._getImageSource(t),n.images[3]=this._getImageSource(s),n.images[4]=this._getImageSource(a),n.images[5]=this._getImageSource(i),n.magFilter=THREE.LinearFilter,n.minFilter=THREE.LinearFilter,n.colorSpace=THREE.SRGBColorSpace,n.needsUpdate=!0;const I=this._getImageResource(e);return h(n,I),this._loadedThreeCubeTextures.set(o,n),this._loadedThreeCubeTextureKeysByResourceName.add(e,o),this._loadedThreeCubeTextureKeysByResourceName.add(r,o),this._loadedThreeCubeTextureKeysByResourceName.add(t,o),this._loadedThreeCubeTextureKeysByResourceName.add(s,o),this._loadedThreeCubeTextureKeysByResourceName.add(a,o),this._loadedThreeCubeTextureKeysByResourceName.add(i,o),n}getThreeMaterial(e,r){const t=this._loadedThreeMaterials.get(e,r);if(t)return t;const s=r.forceBasicMaterial?new THREE.MeshBasicMaterial({map:this.getThreeTexture(e),side:r.useTransparentTexture?THREE.DoubleSide:THREE.FrontSide,transparent:r.useTransparentTexture,vertexColors:r.vertexColors}):new THREE.MeshStandardMaterial({map:this.getThreeTexture(e),side:r.useTransparentTexture?THREE.DoubleSide:THREE.FrontSide,transparent:r.useTransparentTexture,metalness:0,vertexColors:r.vertexColors});return this._loadedThreeMaterials.set(e,r,s),s}getPIXIVideoTexture(e){if(e==="")return this._invalidTexture;const r=this._getImageResource(e);if(!r)return l.warn('Unable to find video texture for resource "'+e+'".'),this._invalidTexture;const t=this._loadedTextures.get(r);return t||this._invalidTexture}getInvalidPIXITexture(){return this._invalidTexture}async loadResource(e){const r=this._resourceLoader.getResource(e);if(!r){l.warn('Unable to find texture for resource "'+e+'".');return}await this._loadTexture(r)}async processResource(e){}async _loadTexture(e){if(this._loadedTextures.get(e))return;const r=this._resourceLoader.getFullUrl(e.file);try{if(e.kind==="video")await new Promise((t,s)=>{const a=PIXI.Texture.from(r,{resourceOptions:{crossorigin:this._resourceLoader.checkIfCredentialsRequired(e.file)?"use-credentials":"anonymous",autoPlay:!1}}).on("error",o=>{s(o)});a.baseTexture.on("loaded",()=>{this._loadedTextures.set(e,a),g(a,e),t()}).on("error",o=>{s(o)})});else{const t=PIXI.Texture.from(r,{resourceOptions:{autoLoad:!1,crossorigin:this._resourceLoader.checkIfCredentialsRequired(e.file)?"use-credentials":"anonymous"}});await t.baseTexture.resource.load(),this._loadedTextures.set(e,t),g(t,e)}}catch(t){throw c(e.file,t),PIXI.Texture.removeFromCache(r),PIXI.BaseTexture.removeFromCache(r),t}}getOrCreateDiskTexture(e,r){let t=this._diskTextures.get(e);if(!t){const s=new PIXI.Graphics;s.lineStyle(0,0,0),s.beginFill(d.rgbToHexNumber(255,255,255),1),s.drawCircle(0,0,e),s.endFill(),t=r.generateTexture(s),s.destroy(),this._diskTextures.set(e,t)}return t}getOrCreateRectangleTexture(e,r,t){const s=`${e}_${r}`;let a=this._rectangleTextures.get(s);if(!a){const i=new PIXI.Graphics;i.lineStyle(0,0,0),i.beginFill(d.rgbToHexNumber(255,255,255),1),i.drawRect(0,0,e,r),i.endFill(),a=t.generateTexture(i),i.destroy(),this._rectangleTextures.set(s,a)}return a}getOrCreateScaledTexture(e,r,t,s){const a=`${e}_${r}_${t}`;let i=this._scaledTextures.get(a);if(!i){const o=new PIXI.Graphics,T=new PIXI.Sprite(this.getPIXITexture(e));T.width=r,T.height=t,o.addChild(T),i=s.generateTexture(o),o.destroy(),this._scaledTextures.set(a,i)}return i}dispose(){this._loadedTextures.clear();const e=[];this._loadedThreeTextures.values(e),this._loadedThreeTextures.clear();for(const r of e)r.dispose();for(const r of this._loadedThreeCubeTextures.values())r.dispose();this._loadedThreeCubeTextures.clear(),this._loadedThreeCubeTextureKeysByResourceName.clear(),this._loadedThreeMaterials.disposeAll();for(const r of this._diskTextures.values())r.destroyed||r.destroy();this._diskTextures.clear();for(const r of this._rectangleTextures.values())r.destroyed||r.destroy();this._rectangleTextures.clear();for(const r of this._scaledTextures.values())r.destroyed||r.destroy();this._scaledTextures.clear()}unloadResource(e){const r=e.name,t=this._loadedTextures.getFromName(r);t&&(t.destroy(!0),this._loadedTextures.delete(e));const s=this._loadedThreeTextures.get(r);s&&(s.dispose(),this._loadedThreeTextures.remove(r)),this._loadedThreeMaterials.dispose(r);const a=this._loadedThreeCubeTextureKeysByResourceName.getValuesFor(r);if(a)for(const i of a){const o=this._loadedThreeCubeTextures.get(i);o&&(o.dispose(),this._loadedThreeCubeTextures.delete(i))}}}d.PixiImageManager=E;class x{constructor(){this.map=new Map}getValuesFor(e){return this.map.get(e)}add(e,r){let t=this.map.get(e);t||(t=[],this.map.set(e,t)),t.push(r)}deleteValuesFor(e){this.map.delete(e)}clear(){this.map.clear()}}class f{constructor(){this._flaggedMaterials=new Map;this._materialFlaggedKeys=new x}get(e,{useTransparentTexture:r,forceBasicMaterial:t,vertexColors:s}){const a=`${e}|${r?1:0}|${t?1:0}|${s?1:0}`;return this._flaggedMaterials.get(a)||null}set(e,{useTransparentTexture:r,forceBasicMaterial:t,vertexColors:s},a){const i=`${e}|${r?1:0}|${t?1:0}|${s?1:0}`;this._flaggedMaterials.set(i,a),this._materialFlaggedKeys.add(e,i)}dispose(e){const r=this._materialFlaggedKeys.getValuesFor(e);if(r)for(const t of r){const s=this._flaggedMaterials.get(t);s&&s.dispose(),this._flaggedMaterials.delete(t)}this._materialFlaggedKeys.deleteValuesFor(e)}disposeAll(){for(const e of this._flaggedMaterials.values())e.dispose();this._flaggedMaterials.clear(),this._materialFlaggedKeys.clear()}}d.ImageManager=d.PixiImageManager})(gdjs||(gdjs={})); +//# sourceMappingURL=pixi-image-manager.js.map diff --git a/Export/pixi-renderers/pixi.js b/Export/pixi-renderers/pixi.js new file mode 100644 index 0000000..7c96c26 --- /dev/null +++ b/Export/pixi-renderers/pixi.js @@ -0,0 +1,1109 @@ +/*! + * pixi.js-legacy - v7.4.2 + * Compiled Wed, 20 Mar 2024 19:55:28 UTC + * + * pixi.js-legacy is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */var PIXI=function(v){"use strict";var be=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(be||{}),cr=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(cr||{}),dr=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(dr||{}),C=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(C||{}),Ot=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(Ot||{}),P=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(P||{}),Me=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(Me||{}),$=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))($||{}),k=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(k||{}),Bt=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(Bt||{}),Zt=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Zt||{}),Ht=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Ht||{}),wt=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(wt||{}),Vt=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(Vt||{}),fr=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(fr||{}),Rt=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Rt||{}),pt=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(pt||{}),Da=(r=>(r[r.RED=1]="RED",r[r.GREEN=2]="GREEN",r[r.BLUE=4]="BLUE",r[r.ALPHA=8]="ALPHA",r))(Da||{}),ft=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(ft||{}),jt=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(jt||{});const Oa={createCanvas:(r,t)=>{const e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>{var r;return(r=document.baseURI)!=null?r:window.location.href},getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")},N={ADAPTER:Oa,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Si=/iPhone/i,Ba=/iPod/i,Fa=/iPad/i,Na=/\biOS-universal(?:.+)Mac\b/i,Ci=/\bAndroid(?:.+)Mobile\b/i,La=/Android/i,ze=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,pr=/Silk/i,ue=/Windows Phone/i,Ua=/\bWindows(?:.+)ARM\b/i,ka=/BlackBerry/i,Ga=/BB10/i,$a=/Opera Mini/i,Ha=/\b(CriOS|Chrome)(?:.+)Mobile/i,Va=/Mobile(?:.+)Firefox\b/i,ja=function(r){return typeof r!="undefined"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream=="undefined"};function zu(r){return function(t){return t.test(r)}}function Xa(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator!="undefined"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,s=e.split("[FBAN");typeof s[1]!="undefined"&&(e=s[0]),s=e.split("Twitter"),typeof s[1]!="undefined"&&(e=s[0]);var i=zu(e),n={apple:{phone:i(Si)&&!i(ue),ipod:i(Ba),tablet:!i(Si)&&(i(Fa)||ja(t))&&!i(ue),universal:i(Na),device:(i(Si)||i(Ba)||i(Fa)||i(Na)||ja(t))&&!i(ue)},amazon:{phone:i(ze),tablet:!i(ze)&&i(pr),device:i(ze)||i(pr)},android:{phone:!i(ue)&&i(ze)||!i(ue)&&i(Ci),tablet:!i(ue)&&!i(ze)&&!i(Ci)&&(i(pr)||i(La)),device:!i(ue)&&(i(ze)||i(pr)||i(Ci)||i(La))||i(/\bokhttp\b/i)},windows:{phone:i(ue),tablet:i(Ua),device:i(ue)||i(Ua)},other:{blackberry:i(ka),blackberry10:i(Ga),opera:i($a),firefox:i(Va),chrome:i(Ha),device:i(ka)||i(Ga)||i($a)||i(Va)||i(Ha)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}var za;const Xt=((za=Xa.default)!=null?za:Xa)(globalThis.navigator);N.RETINA_PREFIX=/@([0-9\.]+)x/,N.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Ri=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function We(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Tg(r){return r&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Eg(r){return r&&Object.prototype.hasOwnProperty.call(r,"default")&&Object.keys(r).length===1?r.default:r}function Ag(r){if(r.__esModule)return r;var t=r.default;if(typeof t=="function"){var e=function s(){if(this instanceof s){var i=[null];i.push.apply(i,arguments);var n=Function.bind.apply(t,i);return new n}return t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(s){var i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return r[s]}})}),e}var Ii={exports:{}},wg=Ii.exports;(function(r){"use strict";var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function i(h,l,u){this.fn=h,this.context=l,this.once=u||!1}function n(h,l,u,c,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new i(u,c||h,d),p=e?e+l:l;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],f]:h._events[p].push(f):(h._events[p]=f,h._eventsCount++),h}function a(h,l){--h._eventsCount===0?h._events=new s:delete h._events[l]}function o(){this._events=new s,this._eventsCount=0}o.prototype.eventNames=function(){var l=[],u,c;if(this._eventsCount===0)return l;for(c in u=this._events)t.call(u,c)&&l.push(e?c.slice(1):c);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(u)):l},o.prototype.listeners=function(l){var u=e?e+l:l,c=this._events[u];if(!c)return[];if(c.fn)return[c.fn];for(var d=0,f=c.length,p=new Array(f);d80*e){o=l=r[0],h=u=r[1];for(var p=e;pl&&(l=c),d>u&&(u=d);f=Math.max(l-o,u-h),f=f!==0?32767/f:0}return cs(n,a,e,o,h,f,0),a}function Wa(r,t,e,s,i){var n,a;if(i===Di(r,t,e,s)>0)for(n=t;n=t;n-=s)a=Ka(n,r[n],r[n+1],a);return a&&_r(a,a.next)&&(fs(a),a=a.next),a}function De(r,t){if(!r)return r;t||(t=r);var e=r,s;do if(s=!1,!e.steiner&&(_r(e,e.next)||ct(e.prev,e,e.next)===0)){if(fs(e),e=t=e.prev,e===e.next)break;s=!0}else e=e.next;while(s||e!==t);return t}function cs(r,t,e,s,i,n,a){if(r){!a&&n&&rc(r,s,i,n);for(var o=r,h,l;r.prev!==r.next;){if(h=r.prev,l=r.next,n?qu(r,s,i,n):Yu(r)){t.push(h.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),fs(r),r=l.next,o=l.next;continue}if(r=l,r===o){a?a===1?(r=Ku(De(r),t,e),cs(r,t,e,s,i,n,2)):a===2&&Zu(r,t,e,s,i,n):cs(De(r),t,e,s,i,n,1);break}}}}function Yu(r){var t=r.prev,e=r,s=r.next;if(ct(t,e,s)>=0)return!1;for(var i=t.x,n=e.x,a=s.x,o=t.y,h=e.y,l=s.y,u=in?i>a?i:a:n>a?n:a,f=o>h?o>l?o:l:h>l?h:l,p=s.next;p!==t;){if(p.x>=u&&p.x<=d&&p.y>=c&&p.y<=f&&qe(i,o,n,h,a,l,p.x,p.y)&&ct(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function qu(r,t,e,s){var i=r.prev,n=r,a=r.next;if(ct(i,n,a)>=0)return!1;for(var o=i.x,h=n.x,l=a.x,u=i.y,c=n.y,d=a.y,f=oh?o>l?o:l:h>l?h:l,g=u>c?u>d?u:d:c>d?c:d,_=Pi(f,p,t,e,s),x=Pi(m,g,t,e,s),y=r.prevZ,b=r.nextZ;y&&y.z>=_&&b&&b.z<=x;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==i&&y!==a&&qe(o,u,h,c,l,d,y.x,y.y)&&ct(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=f&&b.x<=m&&b.y>=p&&b.y<=g&&b!==i&&b!==a&&qe(o,u,h,c,l,d,b.x,b.y)&&ct(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=f&&y.x<=m&&y.y>=p&&y.y<=g&&y!==i&&y!==a&&qe(o,u,h,c,l,d,y.x,y.y)&&ct(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=x;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=g&&b!==i&&b!==a&&qe(o,u,h,c,l,d,b.x,b.y)&&ct(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Ku(r,t,e){var s=r;do{var i=s.prev,n=s.next.next;!_r(i,n)&&Ya(i,s,s.next,n)&&ds(i,n)&&ds(n,i)&&(t.push(i.i/e|0),t.push(s.i/e|0),t.push(n.i/e|0),fs(s),fs(s.next),s=r=n),s=s.next}while(s!==r);return De(s)}function Zu(r,t,e,s,i,n){var a=r;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&ac(a,o)){var h=qa(a,o);a=De(a,a.next),h=De(h,h.next),cs(a,t,e,s,i,n,0),cs(h,t,e,s,i,n,0);return}o=o.next}a=a.next}while(a!==r)}function Qu(r,t,e,s){var i=[],n,a,o,h,l;for(n=0,a=t.length;n=e.next.y&&e.next.y!==e.y){var o=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(o<=s&&o>n&&(n=o,a=e.x=e.x&&e.x>=l&&s!==e.x&&qe(ia.x||e.x===a.x&&sc(a,e)))&&(a=e,c=d)),e=e.next;while(e!==h);return a}function sc(r,t){return ct(r.prev,r,t.prev)<0&&ct(t.next,r,r.next)<0}function rc(r,t,e,s){var i=r;do i.z===0&&(i.z=Pi(i.x,i.y,t,e,s)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,ic(i)}function ic(r){var t,e,s,i,n,a,o,h,l=1;do{for(e=r,r=null,n=null,a=0;e;){for(a++,s=e,o=0,t=0;t0||h>0&&s;)o!==0&&(h===0||!s||e.z<=s.z)?(i=e,e=e.nextZ,o--):(i=s,s=s.nextZ,h--),n?n.nextZ=i:r=i,i.prevZ=n,n=i;e=s}n.nextZ=null,l*=2}while(a>1);return r}function Pi(r,t,e,s,i){return r=(r-e)*i|0,t=(t-s)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function nc(r){var t=r,e=r;do(t.x=(r-a)*(n-o)&&(r-a)*(s-o)>=(e-a)*(t-o)&&(e-a)*(n-o)>=(i-a)*(s-o)}function ac(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!oc(r,t)&&(ds(r,t)&&ds(t,r)&&hc(r,t)&&(ct(r.prev,r,t.prev)||ct(r,t.prev,t))||_r(r,t)&&ct(r.prev,r,r.next)>0&&ct(t.prev,t,t.next)>0)}function ct(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function _r(r,t){return r.x===t.x&&r.y===t.y}function Ya(r,t,e,s){var i=yr(ct(r,t,e)),n=yr(ct(r,t,s)),a=yr(ct(e,s,r)),o=yr(ct(e,s,t));return!!(i!==n&&a!==o||i===0&&vr(r,e,t)||n===0&&vr(r,s,t)||a===0&&vr(e,r,s)||o===0&&vr(e,t,s))}function vr(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function yr(r){return r>0?1:r<0?-1:0}function oc(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Ya(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function ds(r,t){return ct(r.prev,r,r.next)<0?ct(r,t,r.next)>=0&&ct(r,r.prev,t)>=0:ct(r,t,r.prev)<0||ct(r,r.next,t)<0}function hc(r,t){var e=r,s=!1,i=(r.x+t.x)/2,n=(r.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&i<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(s=!s),e=e.next;while(e!==r);return s}function qa(r,t){var e=new Mi(r.i,r.x,r.y),s=new Mi(t.i,t.x,t.y),i=r.next,n=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,s.next=e,e.prev=s,n.next=s,s.prev=n,s}function Ka(r,t,e,s){var i=new Mi(r,t,e);return s?(i.next=s.next,i.prev=s,s.next.prev=i,s.next=i):(i.prev=i,i.next=i),i}function fs(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Mi(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}gr.deviation=function(r,t,e,s){var i=t&&t.length,n=i?t[0]*e:r.length,a=Math.abs(Di(r,0,n,e));if(i)for(var o=0,h=t.length;o0&&(s+=r[i-1].length,e.holes.push(s))}return e};var lc=mr.exports,Za=We(lc),ps={},xr={exports:{}};/*! https://mths.be/punycode v1.3.2 by @mathias */var Rg=xr.exports;(function(r,t){(function(e){var s=t&&!t.nodeType&&t,i=r&&!r.nodeType&&r,n=typeof Ri=="object"&&Ri;(n.global===n||n.window===n||n.self===n)&&(e=n);var a,o=2147483647,h=36,l=1,u=26,c=38,d=700,f=72,p=128,m="-",g=/^xn--/,_=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},b=h-l,T=Math.floor,S=String.fromCharCode,A;function w(F){throw RangeError(y[F])}function R(F,O){for(var Z=F.length,Q=[];Z--;)Q[Z]=O(F[Z]);return Q}function M(F,O){var Z=F.split("@"),Q="";Z.length>1&&(Q=Z[0]+"@",F=Z[1]),F=F.replace(x,".");var J=F.split("."),st=R(J,O).join(".");return Q+st}function H(F){for(var O=[],Z=0,Q=F.length,J,st;Z=55296&&J<=56319&&Z65535&&(O-=65536,Z+=S(O>>>10&1023|55296),O=56320|O&1023),Z+=S(O),Z}).join("")}function E(F){return F-48<10?F-22:F-65<26?F-65:F-97<26?F-97:h}function I(F,O){return F+22+75*(F<26)-((O!=0)<<5)}function V(F,O,Z){var Q=0;for(F=Z?T(F/d):F>>1,F+=T(F/O);F>b*u>>1;Q+=h)F=T(F/b);return T(Q+(b+1)*F/(F+c))}function q(F){var O=[],Z=F.length,Q,J=0,st=p,et=f,it,lt,vt,nt,ut,mt,yt,oe,he;for(it=F.lastIndexOf(m),it<0&&(it=0),lt=0;lt=128&&w("not-basic"),O.push(F.charCodeAt(lt));for(vt=it>0?it+1:0;vt=Z&&w("invalid-input"),yt=E(F.charCodeAt(vt++)),(yt>=h||yt>T((o-J)/ut))&&w("overflow"),J+=yt*ut,oe=mt<=et?l:mt>=et+u?u:mt-et,!(ytT(o/he)&&w("overflow"),ut*=he;Q=O.length+1,et=V(J-nt,Q,nt==0),T(J/Q)>o-st&&w("overflow"),st+=T(J/Q),J%=Q,O.splice(J++,0,st)}return B(O)}function j(F){var O,Z,Q,J,st,et,it,lt,vt,nt,ut,mt=[],yt,oe,he,nr;for(F=H(F),yt=F.length,O=p,Z=0,st=f,et=0;et=O&&utT((o-Z)/oe)&&w("overflow"),Z+=(it-O)*oe,O=it,et=0;eto&&w("overflow"),ut==O){for(lt=Z,vt=h;nt=vt<=st?l:vt>=st+u?u:vt-st,!(lt0&&o>a&&(o=a);for(var h=0;h=0?(c=l.substr(0,u),d=l.substr(u+1)):(c=l,d=""),f=decodeURIComponent(c),p=decodeURIComponent(d),uc(i,f)?Array.isArray(i[f])?i[f].push(p):i[f]=[i[f],p]:i[f]=p}return i},Mg=We(to),gs=function(r){switch(typeof r){case"string":return r;case"boolean":return r?"true":"false";case"number":return isFinite(r)?r:"";default:return""}},eo=function(r,t,e,s){return t=t||"&",e=e||"=",r===null&&(r=void 0),typeof r=="object"?Object.keys(r).map(function(i){var n=encodeURIComponent(gs(i))+e;return Array.isArray(r[i])?r[i].map(function(a){return n+encodeURIComponent(gs(a))}).join(t):n+encodeURIComponent(gs(r[i]))}).join(t):s?encodeURIComponent(gs(s))+e+encodeURIComponent(gs(r)):""},Dg=We(eo),cc,dc,Og=ms.decode=dc=ms.parse=to,Bg=ms.encode=cc=ms.stringify=eo,fc=Qa,Qt=Ja,pc=ps.parse=_s,mc=ps.resolve=Sc,Fg=ps.resolveObject=Cc,gc=ps.format=wc,Ng=ps.Url=Ft;function Ft(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var _c=/^([a-z0-9.+-]+:)/i,vc=/:[0-9]*$/,yc=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,xc=["<",">",'"',"`"," ","\r",` +`," "],bc=["{","}","|","\\","^","`"].concat(xc),Oi=["'"].concat(bc),so=["%","/","?",";","#"].concat(Oi),ro=["/","?","#"],Tc=255,io=/^[+a-z0-9A-Z_-]{0,63}$/,Ec=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Ac={javascript:!0,"javascript:":!0},Bi={javascript:!0,"javascript:":!0},Ke={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Fi=ms;function _s(r,t,e){if(r&&Qt.isObject(r)&&r instanceof Ft)return r;var s=new Ft;return s.parse(r,t,e),s}Ft.prototype.parse=function(r,t,e){if(!Qt.isString(r))throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var s=r.indexOf("?"),i=s!==-1&&s127?T+="x":T+=b[S];if(!T.match(io)){var w=x.slice(0,f),R=x.slice(f+1),M=b.match(Ec);M&&(w.push(M[1]),R.unshift(M[2])),R.length&&(o="/"+R.join(".")+o),this.hostname=w.join(".");break}}}this.hostname.length>Tc?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=fc.toASCII(this.hostname));var H=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+H,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),o[0]!=="/"&&(o="/"+o))}if(!Ac[u])for(var f=0,y=Oi.length;f0?e.host.split("@"):!1;T&&(e.auth=T.shift(),e.host=e.hostname=T.shift())}return e.search=r.search,e.query=r.query,(!Qt.isNull(e.pathname)||!Qt.isNull(e.search))&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!x.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var S=x.slice(-1)[0],A=(e.host||r.host||x.length>1)&&(S==="."||S==="..")||S==="",w=0,R=x.length;R>=0;R--)S=x[R],S==="."?x.splice(R,1):S===".."?(x.splice(R,1),w++):w&&(x.splice(R,1),w--);if(!g&&!_)for(;w--;w)x.unshift("..");g&&x[0]!==""&&(!x[0]||x[0].charAt(0)!=="/")&&x.unshift(""),A&&x.join("/").substr(-1)!=="/"&&x.push("");var M=x[0]===""||x[0]&&x[0].charAt(0)==="/";if(b){e.hostname=e.host=M?"":x.length?x.shift():"";var T=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;T&&(e.auth=T.shift(),e.host=e.hostname=T.shift())}return g=g||e.host&&x.length,g&&!M&&x.unshift(""),x.length?e.pathname=x.join("/"):(e.pathname=null,e.path=null),(!Qt.isNull(e.pathname)||!Qt.isNull(e.search))&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e},Ft.prototype.parseHost=function(){var r=this.host,t=vc.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};const no={};function ao(r,t,e=3){if(no[t])return;let s=new Error().stack;typeof s=="undefined"?console.warn("PixiJS Deprecation Warning: ",`${t} +Deprecated since v${r}`):(s=s.split(` +`).splice(e).join(` +`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t} +Deprecated since v${r}`),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t} +Deprecated since v${r}`),console.warn(s))),no[t]=!0}const Rc={get parse(){return pc},get format(){return gc},get resolve(){return mc}};function zt(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function vs(r){return r.split("?")[0].split("#")[0]}function Ic(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Pc(r,t,e){return r.replace(new RegExp(Ic(t),"g"),e)}function Mc(r,t){let e="",s=0,i=-1,n=0,a=-1;for(let o=0;o<=r.length;++o){if(o2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",s=0):(e=e.slice(0,h),s=e.length-1-e.lastIndexOf("/")),i=o,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,i=o,n=0;continue}}t&&(e.length>0?e+="/..":e="..",s=2)}else e.length>0?e+=`/${r.slice(i+1,o)}`:e=r.slice(i+1,o),s=o-i-1;i=o,n=0}else a===46&&n!==-1?++n:n=-1}return e}const gt={toPosix(r){return Pc(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){zt(r),r=this.toPosix(r);const t=/^file:\/\/\//.exec(r);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(zt(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const s=vs(this.toPosix(t!=null?t:N.ADAPTER.getBaseUrl())),i=vs(this.toPosix(e!=null?e:this.rootname(s)));return r=this.toPosix(r),r.startsWith("/")?gt.join(i,r.slice(1)):this.isAbsolute(r)?r:this.join(s,r)},normalize(r){if(zt(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const s=r.endsWith("/");return r=Mc(r,!1),r.length>0&&s&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return zt(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){var t;if(r.length===0)return".";let e;for(let s=0;s0)if(e===void 0)e=i;else{const n=(t=r[s-1])!=null?t:"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${i}`:e+=`/${i}`}}return e===void 0?".":this.normalize(e)},dirname(r){if(zt(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let s=-1,i=!0;const n=this.getProtocol(r),a=r;r=r.slice(n.length);for(let o=r.length-1;o>=1;--o)if(t=r.charCodeAt(o),t===47){if(!i){s=o;break}}else i=!1;return s===-1?e?"/":this.isUrl(a)?n+r:n:e&&s===1?"//":n+r.slice(0,s)},rootname(r){zt(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){const e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){zt(r),t&&zt(t),r=vs(this.toPosix(r));let e=0,s=-1,i=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let a=t.length-1,o=-1;for(n=r.length-1;n>=0;--n){const h=r.charCodeAt(n);if(h===47){if(!i){e=n+1;break}}else o===-1&&(i=!1,o=n+1),a>=0&&(h===t.charCodeAt(a)?--a===-1&&(s=n):(a=-1,s=o))}return e===s?s=o:s===-1&&(s=r.length),r.slice(e,s)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!i){e=n+1;break}}else s===-1&&(i=!1,s=n+1);return s===-1?"":r.slice(e,s)},extname(r){zt(r),r=vs(this.toPosix(r));let t=-1,e=0,s=-1,i=!0,n=0;for(let a=r.length-1;a>=0;--a){const o=r.charCodeAt(a);if(o===47){if(!i){e=a+1;break}continue}s===-1&&(i=!1,s=a+1),o===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||s===-1||n===0||n===1&&t===s-1&&t===e+1?"":r.slice(t,s)},parse(r){zt(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=vs(this.toPosix(r));let e=r.charCodeAt(0);const s=this.isAbsolute(r);let i;const n="";t.root=this.rootname(r),s||this.hasProtocol(r)?i=1:i=0;let a=-1,o=0,h=-1,l=!0,u=r.length-1,c=0;for(;u>=i;--u){if(e=r.charCodeAt(u),e===47){if(!l){o=u+1;break}continue}h===-1&&(l=!1,h=u+1),e===46?a===-1?a=u:c!==1&&(c=1):a!==-1&&(c=-1)}return a===-1||h===-1||c===0||c===1&&a===h-1&&a===o+1?h!==-1&&(o===0&&s?t.base=t.name=r.slice(1,h):t.base=t.name=r.slice(o,h)):(o===0&&s?(t.name=r.slice(1,a),t.base=r.slice(1,h)):(t.name=r.slice(o,a),t.base=r.slice(o,h)),t.ext=r.slice(a,h)),t.dir=this.dirname(r),n&&(t.dir=n+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let Ni;async function oo(){return Ni!=null||(Ni=(async()=>{var r;const t=document.createElement("canvas").getContext("webgl");if(!t)return wt.UNPACK;const e=await new Promise(a=>{const o=document.createElement("video");o.onloadeddata=()=>a(o),o.onerror=()=>a(null),o.autoplay=!1,o.crossOrigin="anonymous",o.preload="auto",o.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",o.load()});if(!e)return wt.UNPACK;const s=t.createTexture();t.bindTexture(t.TEXTURE_2D,s);const i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(i),t.deleteTexture(s),(r=t.getExtension("WEBGL_lose_context"))==null||r.loseContext(),n[0]<=n[3]?wt.PMA:wt.UNPACK})()),Ni}function Dc(){}function Oc(){}let Li;function ho(){return typeof Li=="undefined"&&(Li=function(){var r;const t={stencil:!0,failIfMajorPerformanceCaveat:N.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!N.ADAPTER.getWebGLRenderingContext())return!1;const e=N.ADAPTER.createCanvas();let s=e.getContext("webgl",t)||e.getContext("experimental-webgl",t);const i=!!((r=s==null?void 0:s.getContextAttributes())!=null&&r.stencil);if(s){const n=s.getExtension("WEBGL_lose_context");n&&n.loseContext()}return s=null,i}catch(e){return!1}}()),Li}var Bc={grad:.9,turn:360,rad:360/(2*Math.PI)},ce=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},xt=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},Nt=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},lo=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},uo=function(r){return{r:Nt(r.r,0,255),g:Nt(r.g,0,255),b:Nt(r.b,0,255),a:Nt(r.a)}},Ui=function(r){return{r:xt(r.r),g:xt(r.g),b:xt(r.b),a:xt(r.a,3)}},Fc=/^#([0-9a-f]{3,8})$/i,br=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},co=function(r){var t=r.r,e=r.g,s=r.b,i=r.a,n=Math.max(t,e,s),a=n-Math.min(t,e,s),o=a?n===t?(e-s)/a:n===e?2+(s-t)/a:4+(t-e)/a:0;return{h:60*(o<0?o+6:o),s:n?a/n*100:0,v:n/255*100,a:i}},fo=function(r){var t=r.h,e=r.s,s=r.v,i=r.a;t=t/360*6,e/=100,s/=100;var n=Math.floor(t),a=s*(1-e),o=s*(1-(t-n)*e),h=s*(1-(1-t+n)*e),l=n%6;return{r:255*[s,o,a,a,h,s][l],g:255*[h,s,s,o,a,a][l],b:255*[a,a,h,s,s,o][l],a:i}},po=function(r){return{h:lo(r.h),s:Nt(r.s,0,100),l:Nt(r.l,0,100),a:Nt(r.a)}},mo=function(r){return{h:xt(r.h),s:xt(r.s),l:xt(r.l),a:xt(r.a,3)}},go=function(r){return fo((e=(t=r).s,{h:t.h,s:(e*=((s=t.l)<50?s:100-s)/100)>0?2*e/(s+e)*100:0,v:s+e,a:t.a}));var t,e,s},ys=function(r){return{h:(t=co(r)).h,s:(i=(200-(e=t.s))*(s=t.v)/100)>0&&i<200?e*s/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,e,s,i},Nc=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Lc=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Uc=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,kc=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ki={string:[[function(r){var t=Fc.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?xt(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?xt(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=Uc.exec(r)||kc.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:uo({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=Nc.exec(r)||Lc.exec(r);if(!t)return null;var e,s,i=po({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(Bc[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return go(i)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,s=r.b,i=r.a,n=i===void 0?1:i;return ce(t)&&ce(e)&&ce(s)?uo({r:Number(t),g:Number(e),b:Number(s),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,s=r.l,i=r.a,n=i===void 0?1:i;if(!ce(t)||!ce(e)||!ce(s))return null;var a=po({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return go(a)},"hsl"],[function(r){var t=r.h,e=r.s,s=r.v,i=r.a,n=i===void 0?1:i;if(!ce(t)||!ce(e)||!ce(s))return null;var a=function(o){return{h:lo(o.h),s:Nt(o.s,0,100),v:Nt(o.v,0,100),a:Nt(o.a)}}({h:Number(t),s:Number(e),v:Number(s),a:Number(n)});return fo(a)},"hsv"]]},_o=function(r,t){for(var e=0;e=.5},r.prototype.toHex=function(){return t=Ui(this.rgba),e=t.r,s=t.g,i=t.b,a=(n=t.a)<1?br(xt(255*n)):"","#"+br(e)+br(s)+br(i)+a;var t,e,s,i,n,a},r.prototype.toRgb=function(){return Ui(this.rgba)},r.prototype.toRgbString=function(){return t=Ui(this.rgba),e=t.r,s=t.g,i=t.b,(n=t.a)<1?"rgba("+e+", "+s+", "+i+", "+n+")":"rgb("+e+", "+s+", "+i+")";var t,e,s,i,n},r.prototype.toHsl=function(){return mo(ys(this.rgba))},r.prototype.toHslString=function(){return t=mo(ys(this.rgba)),e=t.h,s=t.s,i=t.l,(n=t.a)<1?"hsla("+e+", "+s+"%, "+i+"%, "+n+")":"hsl("+e+", "+s+"%, "+i+"%)";var t,e,s,i,n},r.prototype.toHsv=function(){return t=co(this.rgba),{h:xt(t.h),s:xt(t.s),v:xt(t.v),a:xt(t.a,3)};var t},r.prototype.invert=function(){return Jt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),Jt(Gi(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Jt(Gi(this.rgba,-t))},r.prototype.grayscale=function(){return Jt(Gi(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Jt(yo(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Jt(yo(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?Jt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):xt(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=ys(this.rgba);return typeof t=="number"?Jt({h:t,s:e.s,l:e.l,a:e.a}):xt(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Jt(t).toHex()},r}(),Jt=function(r){return r instanceof Tr?r:new Tr(r)},xo=[],Gc=function(r){r.forEach(function(t){xo.indexOf(t)<0&&(t(Tr,ki),xo.push(t))})},Ug=function(){return new Tr({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};function $c(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var i in e)s[e[i]]=i;var n={};r.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,h,l=s[this.toHex()];if(l)return l;if(a!=null&&a.closest){var u=this.toRgb(),c=1/0,d="black";if(!n.length)for(var f in e)n[f]=new r(e[f]).toRgb();for(var p in e){var m=(o=u,h=n[p],Math.pow(o.r-h.r,2)+Math.pow(o.g-h.g,2)+Math.pow(o.b-h.b,2));mt in r?Hc(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Xc=(r,t)=>{for(var e in t||(t={}))Vc.call(t,e)&&To(r,e,t[e]);if(bo)for(var e of bo(t))jc.call(t,e)&&To(r,e,t[e]);return r};Gc([$c]);const Ze=class bi{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof bi)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?Xc({},t):t}isSourceEqual(t,e){const s=typeof t;if(s!==typeof e)return!1;if(s==="number"||s==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((i,n)=>i===e[n]);if(t!==null&&e!==null){const i=Object.keys(t),n=Object.keys(e);return i.length!==n.length?!1:i.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,s,i]=this._components;return{r:t,g:e,b:s,a:i}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,i]=this._components;return t=t!=null?t:[],t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(i*255),t}toRgbArray(t){t=t!=null?t:[];const[e,s,i]=this._components;return t[0]=e,t[1]=s,t[2]=i,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,s,i,n]=bi.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=i,this._components[3]*=n,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let s=this._int>>16&255,i=this._int>>8&255,n=this._int&255;return e&&(s=s*t+.5|0,i=i*t+.5|0,n=n*t+.5|0),(t*255<<24)+(s<<16)+(i<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){const[e,s,i]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(s*t)/t,this._components[2]=Math.round(i*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t!=null?t:[];const[e,s,i,n]=this._components;return t[0]=e,t[1]=s,t[2]=i,t[3]=n,t}normalize(t){let e,s,i,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const a=t;e=(a>>16&255)/255,s=(a>>8&255)/255,i=(a&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,s,i,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,s,i,n=255]=t,e/=255,s/=255,i/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const o=bi.HEX_PATTERN.exec(t);o&&(t=`#${o[2]}`)}const a=Jt(t);a.isValid()&&({r:e,g:s,b:i,a:n}=a.rgba,e/=255,s/=255,i/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=s,this._components[2]=i,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,s]=this._components;this._int=(t*255<<16)+(e*255<<8)+(s*255|0)}_clamp(t,e=0,s=1){return typeof t=="number"?Math.min(Math.max(t,e),s):(t.forEach((i,n)=>{t[n]=Math.min(Math.max(i,e),s)}),t)}};Ze.shared=new Ze,Ze.temp=new Ze,Ze.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Y=Ze;function zc(r,t=[]){return Y.shared.setValue(r).toRgbArray(t)}function Eo(r){return Y.shared.setValue(r).toHex()}function Wc(r){return Y.shared.setValue(r).toNumber()}function Ao(r){return Y.shared.setValue(r).toNumber()}function Yc(){const r=[],t=[];for(let s=0;s<32;s++)r[s]=s,t[s]=s;r[C.NORMAL_NPM]=C.NORMAL,r[C.ADD_NPM]=C.ADD,r[C.SCREEN_NPM]=C.SCREEN,t[C.NORMAL]=C.NORMAL_NPM,t[C.ADD]=C.ADD_NPM,t[C.SCREEN]=C.SCREEN_NPM;const e=[];return e.push(t),e.push(r),e}const Hi=Yc();function Vi(r,t){return Hi[t?1:0][r]}function qc(r,t,e,s=!0){return Y.shared.setValue(r).premultiply(t,s).toArray(e!=null?e:new Float32Array(4))}function Kc(r,t){return Y.shared.setValue(r).toPremultiplied(t)}function Zc(r,t,e,s=!0){return Y.shared.setValue(r).premultiply(t,s).toArray(e!=null?e:new Float32Array(4))}const wo=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i;function So(r,t=null){const e=r*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let s=0,i=0;s>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function ji(r){return!(r&r-1)&&!!r}function Xi(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function Oe(r,t,e){const s=r.length;let i;if(t>=s||e===0)return;e=t+e>s?s-t:e;const n=s-e;for(i=t;it in r?id(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Fo=(r,t)=>{for(var e in t||(t={}))od.call(t,e)&&Bo(r,e,t[e]);if(Oo)for(var e of Oo(t))hd.call(t,e)&&Bo(r,e,t[e]);return r},ld=(r,t)=>nd(r,ad(t)),D=(r=>(r.Renderer="renderer",r.Application="application",r.RendererSystem="renderer-webgl-system",r.RendererPlugin="renderer-webgl-plugin",r.CanvasRendererSystem="renderer-canvas-system",r.CanvasRendererPlugin="renderer-canvas-plugin",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r))(D||{});const qi=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){const t=typeof r.extension!="object"?{type:r.extension}:r.extension;r=ld(Fo({},t),{ref:r})}if(typeof r=="object")r=Fo({},r);else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},No=(r,t)=>{var e;return(e=qi(r).priority)!=null?e:t},U={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(qi).forEach(t=>{t.type.forEach(e=>{var s,i;return(i=(s=this._removeHandlers)[e])==null?void 0:i.call(s,t)})}),this},add(...r){return r.map(qi).forEach(t=>{t.type.forEach(e=>{var s,i;const n=this._addHandlers,a=this._queue;n[e]?(i=n[e])==null||i.call(n,t):(a[e]=a[e]||[],(s=a[e])==null||s.push(t))})}),this},handle(r,t,e){var s;const i=this._addHandlers,n=this._removeHandlers;i[r]=t,n[r]=e;const a=this._queue;return a[r]&&((s=a[r])==null||s.forEach(o=>t(o)),delete a[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(r,t,e=-1){return this.handle(r,s=>{t.includes(s.ref)||(t.push(s.ref),t.sort((i,n)=>No(n,e)-No(i,e)))},s=>{const i=t.indexOf(s.ref);i!==-1&&t.splice(i,1)})}};class Ar{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}const ud=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` +`);function cd(r){let t="";for(let e=0;e0&&(t+=` +else `),e=0;--s){const i=wr[s];if(i.test&&i.test(r,e))return new i(r,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class Pt{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,s,i,n,a,o,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:u}=this;this._aliasCount++;for(let c=0,d=u.length;c0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(Pt.prototype,{dispatch:{value:Pt.prototype.emit},run:{value:Pt.prototype.emit}});class Qe{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Pt("setRealSize"),this.onUpdate=new Pt("update"),this.onError=new Pt("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,s){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class Ts extends Qe{constructor(t,e){var s;const{width:i,height:n}=e||{};if(!i||!n)throw new Error("BufferResource width or height invalid");super(i,n),this.data=t,this.unpackAlignment=(s=e.unpackAlignment)!=null?s:4}upload(t,e,s){const i=t.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,this.unpackAlignment),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===wt.UNPACK);const n=e.realWidth,a=e.realHeight;return s.width===n&&s.height===a?i.texSubImage2D(e.target,0,0,0,n,a,e.format,s.type,this.data):(s.width=n,s.height=a,i.texImage2D(e.target,0,s.internalFormat,n,a,0,e.format,s.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}var dd=Object.defineProperty,Uo=Object.getOwnPropertySymbols,fd=Object.prototype.hasOwnProperty,pd=Object.prototype.propertyIsEnumerable,ko=(r,t,e)=>t in r?dd(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,md=(r,t)=>{for(var e in t||(t={}))fd.call(t,e)&&ko(r,e,t[e]);if(Uo)for(var e of Uo(t))pd.call(t,e)&&ko(r,e,t[e]);return r};const gd={scaleMode:Bt.NEAREST,alphaMode:wt.NPM},rn=class os extends Ye{constructor(t=null,e=null){super(),e=Object.assign({},os.defaultOptions,e);const{alphaMode:s,mipmap:i,anisotropicLevel:n,scaleMode:a,width:o,height:h,wrapMode:l,format:u,type:c,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof Qe)&&(t=sn(t,p),t.internal=!0),this.resolution=f||N.RESOLUTION,this.width=Math.round((o||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=i,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=a,this.format=u,this.type=c,this.target=d,this.alphaMode=s,this.uid=Te(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=o>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let s;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,s=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,s=!0),s&&this.dirtyStyleId++,this}setSize(t,e,s){return s=s||this.resolution,this.setRealSize(t*s,e*s,s)}setRealSize(t,e,s){return this.resolution=s||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=ji(this.realWidth)&&ji(this.realHeight)}setResolution(t){const e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete It[this.cacheId],delete St[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),os.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,s=N.STRICT_TEXTURE_CACHE){const i=typeof t=="string";let n=null;if(i)n=t;else{if(!t._pixiId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${o}_${Te()}`}n=t._pixiId}let a=It[n];if(i&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return a||(a=new os(t,e),a.cacheId=n,os.addToCache(a,n)),a}static fromBuffer(t,e,s,i){t=t||new Float32Array(e*s*4);const n=new Ts(t,md({width:e,height:s},i==null?void 0:i.resourceOptions));let a,o;return t instanceof Float32Array?(a=P.RGBA,o=$.FLOAT):t instanceof Int32Array?(a=P.RGBA_INTEGER,o=$.INT):t instanceof Uint32Array?(a=P.RGBA_INTEGER,o=$.UNSIGNED_INT):t instanceof Int16Array?(a=P.RGBA_INTEGER,o=$.SHORT):t instanceof Uint16Array?(a=P.RGBA_INTEGER,o=$.UNSIGNED_SHORT):t instanceof Int8Array?(a=P.RGBA,o=$.BYTE):(a=P.RGBA,o=$.UNSIGNED_BYTE),n.internal=!0,new os(n,Object.assign({},gd,{type:o,format:a},i))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),It[e]&&It[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),It[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=It[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete It[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e1){for(let c=0;c(r[r.POLY=0]="POLY",r[r.RECT=1]="RECT",r[r.CIRC=2]="CIRC",r[r.ELIP=3]="ELIP",r[r.RREC=4]="RREC",r))(rt||{});class K{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new K(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}}const Cr=[new K,new K,new K,new K];class z{constructor(t=0,e=0,s=0,i=0){this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(i),this.type=rt.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new z(0,0,0,0)}clone(){return new z(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t=this.y&&et.right?t.right:this.right)<=w)return!1;const R=this.yt.bottom?t.bottom:this.bottom)>R}const s=this.left,i=this.right,n=this.top,a=this.bottom;if(i<=s||a<=n)return!1;const o=Cr[0].set(t.left,t.top),h=Cr[1].set(t.left,t.bottom),l=Cr[2].set(t.right,t.top),u=Cr[3].set(t.right,t.bottom);if(l.x<=o.x||h.y<=o.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(o,o),e.apply(h,h),e.apply(l,l),e.apply(u,u),Math.max(o.x,h.x,l.x,u.x)<=s||Math.min(o.x,h.x,l.x,u.x)>=i||Math.max(o.y,h.y,l.y,u.y)<=n||Math.min(o.y,h.y,l.y,u.y)>=a))return!1;const d=c*(h.y-o.y),f=c*(o.x-h.x),p=d*s+f*n,m=d*i+f*n,g=d*s+f*a,_=d*i+f*a;if(Math.max(p,m,g,_)<=d*o.x+f*o.y||Math.min(p,m,g,_)>=d*u.x+f*u.y)return!1;const x=c*(o.y-l.y),y=c*(l.x-o.x),b=x*s+y*n,T=x*i+y*n,S=x*s+y*a,A=x*i+y*a;return!(Math.max(b,T,S,A)<=x*o.x+y*o.y||Math.min(b,T,S,A)>=x*u.x+y*u.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),s=Math.min(this.x+this.width,t.x+t.width),i=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(s-e,0),this.y=i,this.height=Math.max(n-i,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,i=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=s-this.x,this.height=i-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),i=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=i,this.height=n-i,this}}class Rr{constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.radius=s,this.type=rt.CIRC}clone(){return new Rr(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const s=this.radius*this.radius;let i=this.x-t,n=this.y-e;return i*=i,n*=n,i+n<=s}getBounds(){return new z(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}class Ir{constructor(t=0,e=0,s=0,i=0){this.x=t,this.y=e,this.width=s,this.height=i,this.type=rt.ELIP}clone(){return new Ir(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let s=(t-this.x)/this.width,i=(e-this.y)/this.height;return s*=s,i*=i,s+i<=1}getBounds(){return new z(this.x-this.width,this.y-this.height,this.width,this.height)}}class Be{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const s=[];for(let i=0,n=e.length;ie!=u>e&&t<(l-o)*((e-h)/(u-h))+o&&(s=!s)}return s}}class Pr{constructor(t=0,e=0,s=0,i=0,n=20){this.x=t,this.y=e,this.width=s,this.height=i,this.radius=n,this.type=rt.RREC}clone(){return new Pr(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+s&&e<=this.y+this.height-s||t>=this.x+s&&t<=this.x+this.width-s)return!0;let i=t-(this.x+s),n=e-(this.y+s);const a=s*s;if(i*i+n*n<=a||(i=t-(this.x+this.width-s),i*i+n*n<=a)||(n=e-(this.y+this.height-s),i*i+n*n<=a)||(i=t-(this.x+s),i*i+n*n<=a))return!0}return!1}}class tt{constructor(t=1,e=0,s=0,i=1,n=0,a=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=i,this.tx=n,this.ty=a}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,s,i,n,a){return this.a=t,this.b=e,this.c=s,this.d=i,this.tx=n,this.ty=a,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const s=e||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(t,e){e=e||new K;const s=t.x,i=t.y;return e.x=this.a*s+this.c*i+this.tx,e.y=this.b*s+this.d*i+this.ty,e}applyInverse(t,e){e=e||new K;const s=1/(this.a*this.d+this.c*-this.b),i=t.x,n=t.y;return e.x=this.d*s*i+-this.c*s*n+(this.ty*this.c-this.tx*this.d)*s,e.y=this.a*s*n+-this.b*s*i+(-this.ty*this.a+this.tx*this.b)*s,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),s=Math.sin(t),i=this.a,n=this.c,a=this.tx;return this.a=i*e-this.b*s,this.b=i*s+this.b*e,this.c=n*e-this.d*s,this.d=n*s+this.d*e,this.tx=a*e-this.ty*s,this.ty=a*s+this.ty*e,this}append(t){const e=this.a,s=this.b,i=this.c,n=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*s+t.b*n,this.c=t.c*e+t.d*i,this.d=t.c*s+t.d*n,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*s+t.ty*n+this.ty,this}setTransform(t,e,s,i,n,a,o,h,l){return this.a=Math.cos(o+l)*n,this.b=Math.sin(o+l)*n,this.c=-Math.sin(o-h)*a,this.d=Math.cos(o-h)*a,this.tx=t-(s*this.a+i*this.c),this.ty=e-(s*this.b+i*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const s=this.a,i=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,s=this.b,i=this.c,n=this.d,a=t.pivot,o=-Math.atan2(-i,n),h=Math.atan2(s,e),l=Math.abs(o+h);return l<1e-5||Math.abs(As-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=h),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(i*i+n*n),t.position.x=this.tx+(a.x*e+a.y*i),t.position.y=this.ty+(a.x*s+a.y*n),t}invert(){const t=this.a,e=this.b,s=this.c,i=this.d,n=this.tx,a=t*i-e*s;return this.a=i/a,this.b=-e/a,this.c=-s/a,this.d=t/a,this.tx=(s*this.ty-i*n)/a,this.ty=-(t*this.ty-e*n)/a,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new tt;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new tt}static get TEMP_MATRIX(){return new tt}}const Fe=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Ne=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Le=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Ue=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],an=[],Vo=[],Mr=Math.sign;function Td(){for(let r=0;r<16;r++){const t=[];an.push(t);for(let e=0;e<16;e++){const s=Mr(Fe[r]*Fe[e]+Le[r]*Ne[e]),i=Mr(Ne[r]*Fe[e]+Ue[r]*Ne[e]),n=Mr(Fe[r]*Le[e]+Le[r]*Ue[e]),a=Mr(Ne[r]*Le[e]+Ue[r]*Ue[e]);for(let o=0;o<16;o++)if(Fe[o]===s&&Ne[o]===i&&Le[o]===n&&Ue[o]===a){t.push(o);break}}}for(let r=0;r<16;r++){const t=new tt;t.set(Fe[r],Ne[r],Le[r],Ue[r],0,0),Vo.push(t)}}Td();const at={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>Fe[r],uY:r=>Ne[r],vX:r=>Le[r],vY:r=>Ue[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>an[r][t],sub:(r,t)=>an[r][at.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?at.S:at.N:Math.abs(t)*2<=Math.abs(r)?r>0?at.E:at.W:t>0?r>0?at.SE:at.SW:r>0?at.NE:at.NW,matrixAppendRotationInv:(r,t,e=0,s=0)=>{const i=Vo[at.inv(t)];i.tx=e,i.ty=s,r.append(i)}};class pe{constructor(t,e,s=0,i=0){this._x=s,this._y=i,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new pe(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}}const on=class{constructor(){this.worldTransform=new tt,this.localTransform=new tt,this.position=new pe(this.onChange,this,0,0),this.scale=new pe(this.onChange,this,1,1),this.pivot=new pe(this.onChange,this,0,0),this.skew=new pe(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(t){const e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){const s=t.worldTransform,i=this.worldTransform;i.a=e.a*s.a+e.b*s.c,i.b=e.a*s.b+e.b*s.d,i.c=e.c*s.a+e.d*s.c,i.d=e.c*s.b+e.d*s.d,i.tx=e.tx*s.a+e.ty*s.c+s.tx,i.ty=e.tx*s.b+e.ty*s.d+s.ty,this._parentID=t._worldID,this._worldID++}}setFromMatrix(t){t.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())}};on.IDENTITY=new on;let Dr=on;var Ed=`varying vec2 vTextureCoord; + +uniform sampler2D uSampler; + +void main(void){ + gl_FragColor *= texture2D(uSampler, vTextureCoord); +}`,Ad=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void){ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +} +`;function jo(r,t,e){const s=r.createShader(t);return r.shaderSource(s,e),r.compileShader(s),s}function hn(r){const t=new Array(r);for(let e=0;er.type==="float"&&r.size===1&&!r.isArray,code:r=>` + if(uv["${r}"] !== ud["${r}"].value) + { + ud["${r}"].value = uv["${r}"] + gl.uniform1f(ud["${r}"].location, uv["${r}"]) + } + `},{test:(r,t)=>(r.type==="sampler2D"||r.type==="samplerCube"||r.type==="sampler2DArray")&&r.size===1&&!r.isArray&&(t==null||t.castToBaseTexture!==void 0),code:r=>`t = syncData.textureCount++; + + renderer.texture.bind(uv["${r}"], t); + + if(ud["${r}"].value !== t) + { + ud["${r}"].value = t; + gl.uniform1i(ud["${r}"].location, t); +; // eslint-disable-line max-len + }`},{test:(r,t)=>r.type==="mat3"&&r.size===1&&!r.isArray&&t.a!==void 0,code:r=>` + gl.uniformMatrix3fv(ud["${r}"].location, false, uv["${r}"].toArray(true)); + `,codeUbo:r=>` + var ${r}_matrix = uv.${r}.toArray(true); + + data[offset] = ${r}_matrix[0]; + data[offset+1] = ${r}_matrix[1]; + data[offset+2] = ${r}_matrix[2]; + + data[offset + 4] = ${r}_matrix[3]; + data[offset + 5] = ${r}_matrix[4]; + data[offset + 6] = ${r}_matrix[5]; + + data[offset + 8] = ${r}_matrix[6]; + data[offset + 9] = ${r}_matrix[7]; + data[offset + 10] = ${r}_matrix[8]; + `},{test:(r,t)=>r.type==="vec2"&&r.size===1&&!r.isArray&&t.x!==void 0,code:r=>` + cv = ud["${r}"].value; + v = uv["${r}"]; + + if(cv[0] !== v.x || cv[1] !== v.y) + { + cv[0] = v.x; + cv[1] = v.y; + gl.uniform2f(ud["${r}"].location, v.x, v.y); + }`,codeUbo:r=>` + v = uv.${r}; + + data[offset] = v.x; + data[offset+1] = v.y; + `},{test:r=>r.type==="vec2"&&r.size===1&&!r.isArray,code:r=>` + cv = ud["${r}"].value; + v = uv["${r}"]; + + if(cv[0] !== v[0] || cv[1] !== v[1]) + { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2f(ud["${r}"].location, v[0], v[1]); + } + `},{test:(r,t)=>r.type==="vec4"&&r.size===1&&!r.isArray&&t.width!==void 0,code:r=>` + cv = ud["${r}"].value; + v = uv["${r}"]; + + if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) + { + cv[0] = v.x; + cv[1] = v.y; + cv[2] = v.width; + cv[3] = v.height; + gl.uniform4f(ud["${r}"].location, v.x, v.y, v.width, v.height) + }`,codeUbo:r=>` + v = uv.${r}; + + data[offset] = v.x; + data[offset+1] = v.y; + data[offset+2] = v.width; + data[offset+3] = v.height; + `},{test:(r,t)=>r.type==="vec4"&&r.size===1&&!r.isArray&&t.red!==void 0,code:r=>` + cv = ud["${r}"].value; + v = uv["${r}"]; + + if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) + { + cv[0] = v.red; + cv[1] = v.green; + cv[2] = v.blue; + cv[3] = v.alpha; + gl.uniform4f(ud["${r}"].location, v.red, v.green, v.blue, v.alpha) + }`,codeUbo:r=>` + v = uv.${r}; + + data[offset] = v.red; + data[offset+1] = v.green; + data[offset+2] = v.blue; + data[offset+3] = v.alpha; + `},{test:(r,t)=>r.type==="vec3"&&r.size===1&&!r.isArray&&t.red!==void 0,code:r=>` + cv = ud["${r}"].value; + v = uv["${r}"]; + + if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a) + { + cv[0] = v.red; + cv[1] = v.green; + cv[2] = v.blue; + + gl.uniform3f(ud["${r}"].location, v.red, v.green, v.blue) + }`,codeUbo:r=>` + v = uv.${r}; + + data[offset] = v.red; + data[offset+1] = v.green; + data[offset+2] = v.blue; + `},{test:r=>r.type==="vec4"&&r.size===1&&!r.isArray,code:r=>` + cv = ud["${r}"].value; + v = uv["${r}"]; + + if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + + gl.uniform4f(ud["${r}"].location, v[0], v[1], v[2], v[3]) + }`}],wd={float:` + if (cv !== v) + { + cu.value = v; + gl.uniform1f(location, v); + }`,vec2:` + if (cv[0] !== v[0] || cv[1] !== v[1]) + { + cv[0] = v[0]; + cv[1] = v[1]; + + gl.uniform2f(location, v[0], v[1]) + }`,vec3:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + + gl.uniform3f(location, v[0], v[1], v[2]) + }`,vec4:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + + gl.uniform4f(location, v[0], v[1], v[2], v[3]); + }`,int:` + if (cv !== v) + { + cu.value = v; + + gl.uniform1i(location, v); + }`,ivec2:` + if (cv[0] !== v[0] || cv[1] !== v[1]) + { + cv[0] = v[0]; + cv[1] = v[1]; + + gl.uniform2i(location, v[0], v[1]); + }`,ivec3:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + + gl.uniform3i(location, v[0], v[1], v[2]); + }`,ivec4:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + + gl.uniform4i(location, v[0], v[1], v[2], v[3]); + }`,uint:` + if (cv !== v) + { + cu.value = v; + + gl.uniform1ui(location, v); + }`,uvec2:` + if (cv[0] !== v[0] || cv[1] !== v[1]) + { + cv[0] = v[0]; + cv[1] = v[1]; + + gl.uniform2ui(location, v[0], v[1]); + }`,uvec3:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + + gl.uniform3ui(location, v[0], v[1], v[2]); + }`,uvec4:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + + gl.uniform4ui(location, v[0], v[1], v[2], v[3]); + }`,bool:` + if (cv !== v) + { + cu.value = v; + gl.uniform1i(location, v); + }`,bvec2:` + if (cv[0] != v[0] || cv[1] != v[1]) + { + cv[0] = v[0]; + cv[1] = v[1]; + + gl.uniform2i(location, v[0], v[1]); + }`,bvec3:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + + gl.uniform3i(location, v[0], v[1], v[2]); + }`,bvec4:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + + gl.uniform4i(location, v[0], v[1], v[2], v[3]); + }`,mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:` + if (cv !== v) + { + cu.value = v; + + gl.uniform1i(location, v); + }`,samplerCube:` + if (cv !== v) + { + cu.value = v; + + gl.uniform1i(location, v); + }`,sampler2DArray:` + if (cv !== v) + { + cu.value = v; + + gl.uniform1i(location, v); + }`},Sd={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function Cd(r,t){var e;const s=[` + var v = null; + var cv = null; + var cu = null; + var t = 0; + var gl = renderer.gl; + `];for(const i in r.uniforms){const n=t[i];if(!n){((e=r.uniforms[i])==null?void 0:e.group)===!0&&(r.uniforms[i].ubo?s.push(` + renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}'); + `):s.push(` + renderer.shader.syncUniformGroup(uv.${i}, syncData); + `));continue}const a=r.uniforms[i];let o=!1;for(let h=0;h=be.WEBGL2&&(t=r.getContext("webgl2",{})),t||(t=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),ws=t}return ws}let Or;function Rd(){if(!Or){Or=Rt.MEDIUM;const r=Wo();if(r&&r.getShaderPrecisionFormat){const t=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);t&&(Or=t.precision?Rt.HIGH:Rt.MEDIUM)}}return Or}function Yo(r,t){const e=r.getShaderSource(t).split(` +`).map((l,u)=>`${u}: ${l}`),s=r.getShaderInfoLog(t),i=s.split(` +`),n={},a=i.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!n[l]?(n[l]=!0,!0):!1),o=[""];a.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const h=e.join(` +`);o[0]=h,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function Id(r,t,e,s){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||Yo(r,e),r.getShaderParameter(s,r.COMPILE_STATUS)||Yo(r,s),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}const Pd={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function qo(r){return Pd[r]}let Br=null;const Ko={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function Zo(r,t){if(!Br){const e=Object.keys(Ko);Br={};for(let s=0;s0&&(e+=` +else `),sthis.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:t,maxTextures:e}=this,s=Kt._textureArrayPool,i=this.renderer.batch,n=this._tempBoundTextures,a=this.renderer.textureGC.count;let o=++X._globalBatch,h=0,l=s[0],u=0;i.copyBoundTextures(n,e);for(let c=0;c=e&&(i.boundArray(l,n,o,e),this.buildDrawCalls(l,u,c),u=c,l=s[++h],++o),d._batchEnabled=o,d.touched=a,l.elements[l.count++]=d)}l.count>0&&(i.boundArray(l,n,o,e),this.buildDrawCalls(l,u,this._bufferSize),++h,++o);for(let c=0;c0);for(let m=0;m=0;--i)t[i]=s[i]||null,t[i]&&(t[i]._batchLocation=i)}boundArray(t,e,s,i){const{elements:n,ids:a,count:o}=t;let h=0;for(let l=0;l=0&&c=be.WEBGL2&&(s=t.getContext("webgl2",e)),s)this.webGLVersion=2;else if(this.webGLVersion=1,s=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!s)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=s,this.getExtensions(),this.gl}getExtensions(){const{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){const e=t.getContextAttributes(),s="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;s&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const i=s||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}Ps.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Ps.extension={type:D.RendererSystem,name:"context"},U.add(Ps);class Lr{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new Pt("disposeFramebuffer"),this.multisample=ft.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new X(null,{scaleMode:Bt.NEAREST,resolution:1,mipmap:Ht.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new X(null,{scaleMode:Bt.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Ht.OFF,format:P.DEPTH_COMPONENT,type:$.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let s=0;s{const i=this.source;this.url=i.src;const n=()=>{this.destroyed||(i.onload=null,i.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};i.complete&&i.src?n():(i.onload=n,i.onerror=a=>{s(a),this.onError.emit(a)})}),this._load)}process(){const t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,s=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:s?"cors":"no-cors"}).then(i=>i.blob()).then(i=>e(i,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===wt.UNPACK?"premultiply":"none"})).then(i=>this.destroyed?Promise.reject():(this.bitmap=i,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,s){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,s);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,s,this.bitmap),!this.preserveBitmap){let i=!0;const n=e._glTextures;for(const a in n){const o=n[a];if(o!==s&&o.dirtyId!==e.dirtyId){i=!1;break}}i&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement!="undefined"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class fn{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,s){const i=e.width,n=e.height;if(s){const a=t.width/2/i,o=t.height/2/n,h=t.x/i+a,l=t.y/n+o;s=at.add(s,at.NW),this.x0=h+a*at.uX(s),this.y0=l+o*at.uY(s),s=at.add(s,2),this.x1=h+a*at.uX(s),this.y1=l+o*at.uY(s),s=at.add(s,2),this.x2=h+a*at.uX(s),this.y2=l+o*at.uY(s),s=at.add(s,2),this.x3=h+a*at.uX(s),this.y3=l+o*at.uY(s)}else this.x0=t.x/i,this.y0=t.y/n,this.x1=(t.x+t.width)/i,this.y1=t.y/n,this.x2=(t.x+t.width)/i,this.y2=(t.y+t.height)/n,this.x3=t.x/i,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}const sh=new fn;function kr(r){r.destroy=function(){},r.on=function(){},r.once=function(){},r.emit=function(){}}class L extends Ye{constructor(t,e,s,i,n,a,o){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new z(0,0,1,1)),t instanceof L&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=i,this.valid=!1,this.destroyed=!1,this._uvs=sh,this.uvMatrix=null,this.orig=s||e,this._rotate=Number(n||0),n===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=a?new K(a.x,a.y):new K(0,0),this.defaultBorders=o,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){const{resource:e}=this.baseTexture;e!=null&&e.url&&St[e.url]&&L.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,L.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var t;const e=this._frame.clone(),s=this._frame===this.orig?e:this.orig.clone(),i=new L(this.baseTexture,!this.noFrame&&e,s,(t=this.trim)==null?void 0:t.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(i._frame=e),i}updateUvs(){this._uvs===sh&&(this._uvs=new fn),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},s=N.STRICT_TEXTURE_CACHE){const i=typeof t=="string";let n=null;if(i)n=t;else if(t instanceof X){if(!t.cacheId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${o}-${Te()}`,X.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${o}_${Te()}`}n=t._pixiId}let a=St[n];if(i&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!a&&!(t instanceof X)?(e.resolution||(e.resolution=te(t)),a=new L(new X(t,e)),a.baseTexture.cacheId=n,X.addToCache(a.baseTexture,n),L.addToCache(a,n)):!a&&t instanceof X&&(a=new L(t),L.addToCache(a,n)),a}static fromURL(t,e){const s=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),i=L.from(t,Object.assign({resourceOptions:s},e),!1),n=i.baseTexture.resource;return i.baseTexture.valid?Promise.resolve(i):n.load().then(()=>Promise.resolve(i))}static fromBuffer(t,e,s,i){return new L(X.fromBuffer(t,e,s,i))}static fromLoader(t,e,s,i){const n=new X(t,Object.assign({scaleMode:X.defaultOptions.scaleMode,resolution:te(e)},i)),{resource:a}=n;a instanceof dn&&(a.url=e);const o=new L(n);return s||(s=e),X.addToCache(o.baseTexture,s),L.addToCache(o,s),s!==e&&(X.addToCache(o.baseTexture,e),L.addToCache(o,e)),o.baseTexture.valid?Promise.resolve(o):new Promise(h=>{o.baseTexture.once("loaded",()=>h(o))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),St[e]&&St[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),St[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=St[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete St[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;ethis.baseTexture.width,o=s+n>this.baseTexture.height;if(a||o){const h=a&&o?"and":"or",l=`X: ${e} + ${i} = ${e+i} > ${this.baseTexture.width}`,u=`Y: ${s} + ${n} = ${s+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${u}`)}this.valid=i&&n&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return L._EMPTY||(L._EMPTY=new L(new X),kr(L._EMPTY),kr(L._EMPTY.baseTexture)),L._EMPTY}static get WHITE(){if(!L._WHITE){const t=N.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),L._WHITE=new L(X.from(t)),kr(L._WHITE),kr(L._WHITE.baseTexture)}return L._WHITE}}class Yt extends L{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,s=!0){const i=this.baseTexture.resolution,n=Math.round(t*i)/i,a=Math.round(e*i)/i;this.valid=n>0&&a>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=a,s&&this.baseTexture.resize(n,a),this.updateUvs()}setResolution(t){const{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new Yt(new Ur(t))}}class pn{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,s=ft.NONE){const i=new Ur(Object.assign({width:t,height:e,resolution:1,multisample:s},this.textureOptions));return new Yt(i)}getOptimalTexture(t,e,s=1,i=ft.NONE){let n;t=Math.max(Math.ceil(t*s-1e-6),1),e=Math.max(Math.ceil(e*s-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=xs(t),e=xs(e),n=((t&65535)<<16|e&65535)>>>0,i>1&&(n+=i*4294967296)):n=i>1?-i:-1,this.texturePool[n]||(this.texturePool[n]=[]);let a=this.texturePool[n].pop();return a||(a=this.createTexture(t,e,i)),a.filterPoolKey=n,a.setResolution(s),a}getFilterTexture(t,e,s){const i=this.getOptimalTexture(t.width,t.height,e||t.resolution,s||ft.NONE);return i.filterFrame=t.filterFrame,i}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(const e in this.texturePool){const s=this.texturePool[e];if(s)for(let i=0;i0&&t.height>0;for(const e in this.texturePool){if(!(Number(e)<0))continue;const s=this.texturePool[e];if(s)for(let i=0;i1&&(u=this.getOptimalFilterTexture(l.width,l.height,e.resolution),u.filterFrame=l.filterFrame),s[c].apply(this,l,u,Vt.CLEAR,e);const d=l;l=u,u=d}s[c].apply(this,l,h.renderTexture,Vt.BLEND,e),c>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(u)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Vt.CLEAR){const{renderTexture:s,state:i}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t!=null&&t.filterFrame){const a=this.tempRect;a.x=0,a.y=0,a.width=t.filterFrame.width,a.height=t.filterFrame.height,s.bind(t,t.filterFrame,a)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?s.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=i.stateId&1||this.forceClear;(e===Vt.CLEAR||e===Vt.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,s,i){const n=this.renderer;n.state.set(t.state),this.bindAndClear(s,i),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(Ot.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(Ot.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:s,destinationFrame:i}=this.activeState,{orig:n}=e._texture,a=t.set(i.width,0,0,i.height,s.x,s.y),o=e.worldTransform.copyTo(tt.TEMP_MATRIX);return o.invert(),a.prepend(o),a.scale(1/n.width,1/n.height),a.translate(e.anchor.x,e.anchor.y),a}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,s=1,i=ft.NONE){return this.texturePool.getOptimalTexture(t,e,s,i)}getFilterTexture(t,e,s){if(typeof t=="number"){const n=t;t=e,e=n}t=t||this.activeState.renderTexture;const i=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,s||ft.NONE);return i.filterFrame=t.filterFrame,i}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const s=Gr[0],i=Gr[1],n=Gr[2],a=Gr[3];s.set(e.left,e.top),i.set(e.left,e.bottom),n.set(e.right,e.top),a.set(e.right,e.bottom),t.apply(s,s),t.apply(i,i),t.apply(n,n),t.apply(a,a);const o=Math.min(s.x,i.x,n.x,a.x),h=Math.min(s.y,i.y,n.y,a.y),l=Math.max(s.x,i.x,n.x,a.x),u=Math.max(s.y,i.y,n.y,a.y);e.x=o,e.y=h,e.width=l-o,e.height=u-h}roundFrame(t,e,s,i,n){if(!(t.width<=0||t.height<=0||s.width<=0||s.height<=0)){if(n){const{a,b:o,c:h,d:l}=n;if((Math.abs(o)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(l)>1e-4))return}n=n?gn.copyFrom(n):gn.identity(),n.translate(-s.x,-s.y).scale(i.width/s.width,i.height/s.height).translate(i.x,i.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}_n.extension={type:D.RendererSystem,name:"filter"},U.add(_n);class nh{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=ft.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const kd=new z;class vn{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Lr(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new z,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,s=this.renderer.context.extensions.depthTexture;N.PREFER_ENV===be.WEBGL_LEGACY&&(e=null,s=null),e?t.drawBuffers=i=>e.drawBuffersWEBGL(i):(this.hasMRT=!1,t.drawBuffers=()=>{}),s||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,s=0){const{gl:i}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,i.bindFramebuffer(i.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==s&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=s),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,s)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let a=0;a>s,o=e.height>>s,h=a/e.width;this.setViewport(e.x*h,e.y*h,a,o)}else{const a=t.width>>s,o=t.height>>s;this.setViewport(0,0,a,o)}}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,s,i){const n=this.viewport;t=Math.round(t),e=Math.round(e),s=Math.round(s),i=Math.round(i),(n.width!==s||n.height!==i||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=s,n.height=i,this.gl.viewport(t,e,s,i))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,s,i,n=dr.COLOR|dr.DEPTH){const{gl:a}=this;a.clearColor(t,e,s,i),a.clear(n)}initFramebuffer(t){const{gl:e}=this,s=new nh(e.createFramebuffer());return s.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=s,this.managedFramebuffers.push(t),t.disposeRunner.add(this),s}resizeFramebuffer(t){const{gl:e}=this,s=t.glFramebuffers[this.CONTEXT_UID];if(s.stencil){e.bindRenderbuffer(e.RENDERBUFFER,s.stencil);let a;this.renderer.context.webGLVersion===1?a=e.DEPTH_STENCIL:t.depth&&t.stencil?a=e.DEPTH24_STENCIL8:t.depth?a=e.DEPTH_COMPONENT24:a=e.STENCIL_INDEX8,s.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,a,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,a,t.width,t.height)}const i=t.colorTextures;let n=i.length;e.drawBuffers||(n=Math.min(n,1));for(let a=0;a1&&this.canMultisampleFramebuffer(t)?i.msaaBuffer=i.msaaBuffer||s.createRenderbuffer():i.msaaBuffer&&(s.deleteRenderbuffer(i.msaaBuffer),i.msaaBuffer=null,i.blitFramebuffer&&(i.blitFramebuffer.dispose(),i.blitFramebuffer=null));const o=[];for(let h=0;h1&&s.drawBuffers(o),t.depthTexture&&this.writeDepthTexture){const h=t.depthTexture;this.renderer.texture.bind(h,0),s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){i.stencil=i.stencil||s.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH_STENCIL):t.depth&&t.stencil?(h=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH24_STENCIL8):t.depth?(h=s.DEPTH_ATTACHMENT,l=s.DEPTH_COMPONENT24):(h=s.STENCIL_ATTACHMENT,l=s.STENCIL_INDEX8),s.bindRenderbuffer(s.RENDERBUFFER,i.stencil),i.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,i.multisample,l,t.width,t.height):s.renderbufferStorage(s.RENDERBUFFER,l,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,h,s.RENDERBUFFER,i.stencil)}else i.stencil&&(s.deleteRenderbuffer(i.stencil),i.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let s=ft.NONE;if(t<=1||e===null)return s;for(let i=0;i=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(i.deleteFramebuffer(s.framebuffer),s.msaaBuffer&&i.deleteRenderbuffer(s.msaaBuffer),s.stencil&&i.deleteRenderbuffer(s.stencil)),s.blitFramebuffer&&this.disposeFramebuffer(s.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let s=0;ss.createVertexArrayOES(),t.bindVertexArray=i=>s.bindVertexArrayOES(i),t.deleteVertexArray=i=>s.deleteVertexArrayOES(i)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){const s=t.getExtension("ANGLE_instanced_arrays");s?(t.vertexAttribDivisor=(i,n)=>s.vertexAttribDivisorANGLE(i,n),t.drawElementsInstanced=(i,n,a,o,h)=>s.drawElementsInstancedANGLE(i,n,a,o,h),t.drawArraysInstanced=(i,n,a,o)=>s.drawArraysInstancedANGLE(i,n,a,o)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:s}=this;let i=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;i||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=i={},n=!0);const a=i[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==a&&(this._activeVao=a,this.hasVao?s.bindVertexArray(a):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let s=0;s0?this.maskStack[this.maskStack.length-1]._colorMask:15;s!==e&&this.renderer.gl.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)}destroy(){this.renderer=null}}bn.extension={type:D.RendererSystem,name:"mask"},U.add(bn);class lh{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,s=this.getStackLength();this.maskStack=t;const i=this.getStackLength();i!==s&&(i===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const uh=new tt,ch=[],dh=class Ti extends lh{constructor(t){super(t),this.glConst=N.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){var e;if(t._scissorRectLocal)return;const s=t._scissorRect,{maskObject:i}=t,{renderer:n}=this,a=n.renderTexture,o=i.getBounds(!0,(e=ch.pop())!=null?e:new z);this.roundFrameToPixels(o,a.current?a.current.resolution:n.resolution,a.sourceFrame,a.destinationFrame,n.projection.transform),s&&o.fit(s),t._scissorRectLocal=o}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:s,c:i,d:n}=t;return(Math.abs(s)>1e-4||Math.abs(i)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||Ti.isMatrixRotated(e.worldTransform)||Ti.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const s=t._scissorRectLocal;return s.width>0&&s.height>0}roundFrameToPixels(t,e,s,i,n){Ti.isMatrixRotated(n)||(n=n?uh.copyFrom(n):uh.identity(),n.translate(-s.x,-s.y).scale(i.width/s.width,i.height/s.height).translate(i.x,i.y),this.renderer.filter.transformAABB(n,t),t.fit(i),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);const{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){const{gl:e}=this.renderer;t&&ch.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};dh.extension={type:D.RendererSystem,name:"scissor"};let fh=dh;U.add(fh);class Tn extends lh{constructor(t){super(t),this.glConst=N.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:s}=this.renderer,i=t._stencilCounter;i===0&&(this.renderer.framebuffer.forceStencil(),s.clearStencil(0),s.clear(s.STENCIL_BUFFER_BIT),s.enable(s.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;n!==0&&(t._colorMask=0,s.colorMask(!1,!1,!1,!1)),s.stencilFunc(s.EQUAL,i,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(t._colorMask=n,s.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(t){const e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,i=s?s._colorMask:15;i!==0&&(s._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,i!==0&&(s._colorMask=i,e.colorMask((i&1)!==0,(i&2)!==0,(i&4)!==0,(i&8)!==0)),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}Tn.extension={type:D.RendererSystem,name:"stencil"},U.add(Tn);class En{constructor(t){this.renderer=t,this.plugins={}}init(){const t=this.rendererPlugins;for(const e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(const t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}En.extension={type:[D.RendererSystem,D.CanvasRendererSystem],name:"_plugin"},U.add(En);class An{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new tt,this.transform=null}update(t,e,s,i){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,s,i),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(t,e,s,i){const n=this.projectionMatrix,a=i?-1:1;n.identity(),n.a=1/e.width*2,n.d=a*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-a-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}An.extension={type:D.RendererSystem,name:"projection"},U.add(An);var ph=Object.getOwnPropertySymbols,Hd=Object.prototype.hasOwnProperty,Vd=Object.prototype.propertyIsEnumerable,jd=(r,t)=>{var e={};for(var s in r)Hd.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&ph)for(var s of ph(r))t.indexOf(s)<0&&Vd.call(r,s)&&(e[s]=r[s]);return e};const Xd=new Dr,mh=new z;class wn{constructor(t){this.renderer=t,this._tempMatrix=new tt}generateTexture(t,e){var s;const i=e||{},{region:n}=i,a=jd(i,["region"]),o=(n==null?void 0:n.copyTo(mh))||t.getLocalBounds(mh,!0),h=a.resolution||this.renderer.resolution;o.width=Math.max(o.width,1/h),o.height=Math.max(o.height,1/h),a.width=o.width,a.height=o.height,a.resolution=h,(s=a.multisample)!=null||(a.multisample=this.renderer.multisample);const l=Yt.create(a);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;const u=t.transform;return t.transform=Xd,this.renderer.render(t,{renderTexture:l,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=u,l}destroy(){}}wn.extension={type:[D.RendererSystem,D.CanvasRendererSystem],name:"textureGenerator"},U.add(wn);const Ge=new z,Ms=new z;class Sn{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new z,this.destinationFrame=new z,this.viewportFrame=new z}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(t=null,e,s){const i=this.renderer;this.current=t;let n,a,o;t?(n=t.baseTexture,o=n.resolution,e||(Ge.width=t.frame.width,Ge.height=t.frame.height,e=Ge),s||(Ms.x=t.frame.x,Ms.y=t.frame.y,Ms.width=e.width,Ms.height=e.height,s=Ms),a=n.framebuffer):(o=i.resolution,e||(Ge.width=i._view.screen.width,Ge.height=i._view.screen.height,e=Ge),s||(s=Ge,s.width=e.width,s.height=e.height));const h=this.viewportFrame;h.x=s.x*o,h.y=s.y*o,h.width=s.width*o,h.height=s.height*o,t||(h.y=i.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(a,h),this.renderer.projection.update(s,e,o,!a),t?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(s)}clear(t,e){const s=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,i=Y.shared.setValue(t||s);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&i.premultiply(i.alpha);const n=this.destinationFrame,a=this.current?this.current.baseTexture:this.renderer._view.screen,o=n.width!==a.width||n.height!==a.height;if(o){let{x:h,y:l,width:u,height:c}=this.viewportFrame;h=Math.round(h),l=Math.round(l),u=Math.round(u),c=Math.round(c),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,u,c)}this.renderer.framebuffer.clear(i.red,i.green,i.blue,i.alpha,e),o&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Sn.extension={type:D.RendererSystem,name:"renderTexture"},U.add(Sn);class zd{}class gh{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}}function Wd(r,t){const e={},s=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let i=0;il>u?1:-1);for(let l=0;l({data:n,offset:0,dataLen:0,dirty:0}));let e=0,s=0,i=0;for(let n=0;n1&&(e=Math.max(e,16)*a.data.size),a.dataLen=e,s%e!==0&&s<16){const o=s%e%16;s+=o,i+=o}s+e>16?(i=Math.ceil(i/16)*16,a.offset=i,i+=e,s=e):(a.offset=i,s+=e,i+=e)}return i=Math.ceil(i/16)*16,{uboElements:t,size:i}}function xh(r,t){const e=[];for(const s in r)t[s]&&e.push(t[s]);return e.sort((s,i)=>s.index-i.index),e}function bh(r,t){if(!r.autoManage)return{size:0,syncFunc:qd};const e=xh(r.uniforms,t),{uboElements:s,size:i}=yh(e),n=[` + var v = null; + var v2 = null; + var cv = null; + var t = 0; + var gl = renderer.gl + var index = 0; + var data = buffer.data; + `];for(let a=0;a1){const c=qo(o.data.type),d=Math.max(vh[o.data.type]/16,1),f=c/d,p=(4-f%4)%4;n.push(` + cv = ud.${l}.value; + v = uv.${l}; + offset = ${o.offset/4}; + + t = 0; + + for(var i=0; i < ${o.data.size*d}; i++) + { + for(var j = 0; j < ${f}; j++) + { + data[offset++] = v[t++]; + } + offset += ${p}; + } + + `)}else{const c=Kd[o.data.type];n.push(` + cv = ud.${l}.value; + v = uv.${l}; + offset = ${o.offset/4}; + ${c}; + `)}}return n.push(` + renderer.buffer.update(buffer); + `),{size:i,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(` +`))}}let Zd=0;const Hr={textureCount:0,uboCount:0};class Cn{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=Zd++}systemCheck(){if(!Jo())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const s=t.program,i=s.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==s&&(this.program=s,this.gl.useProgram(i.program)),e||(Hr.textureCount=0,Hr.uboCount=0,this.syncUniformGroup(t.uniformGroup,Hr)),i}setUniforms(t){const e=this.shader.program,s=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(s.uniformData,t,this.renderer)}syncUniformGroup(t,e){const s=this.getGlProgram();(!t.static||t.dirtyId!==s.uniformDirtyGroups[t.id])&&(s.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,s,e))}syncUniforms(t,e,s){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,s)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Cd(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const s=this.getGlProgram();if(!t.static||t.dirtyId!==0||!s.uniformGroups[t.id]){t.dirtyId=0;const i=s.uniformGroups[t.id]||this.createSyncBufferGroup(t,s,e);t.buffer.update(),i(s.uniformData,t.uniforms,this.renderer,Hr,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,s.uniformBufferBindings[e])}createSyncBufferGroup(t,e,s){const{gl:i}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,s);e.uniformBufferBindings[s]=this.shader.uniformBindCount,i.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const a=this.getSignature(t,this.shader.program.uniformData,"ubo");let o=this._uboCache[a];if(o||(o=this._uboCache[a]=bh(t,this.shader.program.uniformData)),t.autoManage){const h=new Float32Array(o.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=o.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,s){const i=t.uniforms,n=[`${s}-`];for(const a in i)n.push(a),e[a]&&n.push(e[a].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,s=t.program,i=_h(e,s);return s.glPrograms[this.renderer.CONTEXT_UID]=i,i}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}Cn.extension={type:D.RendererSystem,name:"shader"},U.add(Cn);class Ds{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.2 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}Ds.defaultOptions={hello:!1},Ds.extension={type:[D.RendererSystem,D.CanvasRendererSystem],name:"startup"},U.add(Ds);function Qd(r,t=[]){return t[C.NORMAL]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.ADD]=[r.ONE,r.ONE],t[C.MULTIPLY]=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.SCREEN]=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.OVERLAY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.DARKEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.LIGHTEN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.COLOR_DODGE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.COLOR_BURN]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.HARD_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.SOFT_LIGHT]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.DIFFERENCE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.EXCLUSION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.HUE]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.SATURATION]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.COLOR]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.LUMINOSITY]=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.NONE]=[0,0],t[C.NORMAL_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.ADD_NPM]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t[C.SCREEN_NPM]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t[C.SRC_IN]=[r.DST_ALPHA,r.ZERO],t[C.SRC_OUT]=[r.ONE_MINUS_DST_ALPHA,r.ZERO],t[C.SRC_ATOP]=[r.DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[C.DST_OVER]=[r.ONE_MINUS_DST_ALPHA,r.ONE],t[C.DST_IN]=[r.ZERO,r.SRC_ALPHA],t[C.DST_OUT]=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],t[C.DST_ATOP]=[r.ONE_MINUS_DST_ALPHA,r.SRC_ALPHA],t[C.XOR]=[r.ONE_MINUS_DST_ALPHA,r.ONE_MINUS_SRC_ALPHA],t[C.SUBTRACT]=[r.ONE,r.ONE,r.ONE,r.ONE,r.FUNC_REVERSE_SUBTRACT,r.FUNC_ADD],t}const Jd=0,tf=1,ef=2,sf=3,rf=4,nf=5,Th=class Aa{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=C.NONE,this._blendEq=!1,this.map=[],this.map[Jd]=this.setBlend,this.map[tf]=this.setOffset,this.map[ef]=this.setCullFace,this.map[sf]=this.setDepthTest,this.map[rf]=this.setFrontFace,this.map[nf]=this.setDepthMask,this.checks=[],this.defaultState=new ee,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Qd(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,s=0;for(;e;)e&1&&this.map[s].call(this,!!(t.data&1<>1,s++;this.stateId=t.data}for(let e=0;et.systems[n]),i=[...s,...Object.keys(t.systems).filter(n=>!s.includes(n))];for(const n of i)this.addSystem(t.systems[n],n)}addRunners(...t){t.forEach(e=>{this.runners[e]=new Pt(e)})}addSystem(t,e){const s=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=s,this._systemsHash[e]=s;for(const i in this.runners)this.runners[i].add(s);return this}emitWithCustomOptions(t,e){const s=Object.keys(this._systemsHash);t.items.forEach(i=>{const n=s.find(a=>this._systemsHash[a]===i);i[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const Os=class Ei{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Ei.defaultMaxIdle,this.checkCountMax=Ei.defaultCheckCountMax,this.mode=Ei.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==fr.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let s=!1;for(let i=0;ithis.maxIdle&&(t.destroyTexture(n,!0),e[i]=null,s=!0)}if(s){let i=0;for(let n=0;n=0;i--)this.unload(t.children[i])}destroy(){this.renderer=null}};Os.defaultMode=fr.AUTO,Os.defaultMaxIdle=3600,Os.defaultCheckCountMax=600,Os.extension={type:D.RendererSystem,name:"textureGC"};let Ae=Os;U.add(Ae);class Vr{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=$.UNSIGNED_BYTE,this.internalFormat=P.RGBA,this.samplerType=0}}function af(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[r.RGB]:k.FLOAT,[r.RGBA]:k.FLOAT,[r.ALPHA]:k.FLOAT,[r.LUMINANCE]:k.FLOAT,[r.LUMINANCE_ALPHA]:k.FLOAT,[r.R8]:k.FLOAT,[r.R8_SNORM]:k.FLOAT,[r.RG8]:k.FLOAT,[r.RG8_SNORM]:k.FLOAT,[r.RGB8]:k.FLOAT,[r.RGB8_SNORM]:k.FLOAT,[r.RGB565]:k.FLOAT,[r.RGBA4]:k.FLOAT,[r.RGB5_A1]:k.FLOAT,[r.RGBA8]:k.FLOAT,[r.RGBA8_SNORM]:k.FLOAT,[r.RGB10_A2]:k.FLOAT,[r.RGB10_A2UI]:k.FLOAT,[r.SRGB8]:k.FLOAT,[r.SRGB8_ALPHA8]:k.FLOAT,[r.R16F]:k.FLOAT,[r.RG16F]:k.FLOAT,[r.RGB16F]:k.FLOAT,[r.RGBA16F]:k.FLOAT,[r.R32F]:k.FLOAT,[r.RG32F]:k.FLOAT,[r.RGB32F]:k.FLOAT,[r.RGBA32F]:k.FLOAT,[r.R11F_G11F_B10F]:k.FLOAT,[r.RGB9_E5]:k.FLOAT,[r.R8I]:k.INT,[r.R8UI]:k.UINT,[r.R16I]:k.INT,[r.R16UI]:k.UINT,[r.R32I]:k.INT,[r.R32UI]:k.UINT,[r.RG8I]:k.INT,[r.RG8UI]:k.UINT,[r.RG16I]:k.INT,[r.RG16UI]:k.UINT,[r.RG32I]:k.INT,[r.RG32UI]:k.UINT,[r.RGB8I]:k.INT,[r.RGB8UI]:k.UINT,[r.RGB16I]:k.INT,[r.RGB16UI]:k.UINT,[r.RGB32I]:k.INT,[r.RGB32UI]:k.UINT,[r.RGBA8I]:k.INT,[r.RGBA8UI]:k.UINT,[r.RGBA16I]:k.INT,[r.RGBA16UI]:k.UINT,[r.RGBA32I]:k.INT,[r.RGBA32UI]:k.UINT,[r.DEPTH_COMPONENT16]:k.FLOAT,[r.DEPTH_COMPONENT24]:k.FLOAT,[r.DEPTH_COMPONENT32F]:k.FLOAT,[r.DEPTH_STENCIL]:k.FLOAT,[r.DEPTH24_STENCIL8]:k.FLOAT,[r.DEPTH32F_STENCIL8]:k.FLOAT}:t={[r.RGB]:k.FLOAT,[r.RGBA]:k.FLOAT,[r.ALPHA]:k.FLOAT,[r.LUMINANCE]:k.FLOAT,[r.LUMINANCE_ALPHA]:k.FLOAT,[r.DEPTH_STENCIL]:k.FLOAT},t}function of(r){let t;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?t={[$.UNSIGNED_BYTE]:{[P.RGBA]:r.RGBA8,[P.RGB]:r.RGB8,[P.RG]:r.RG8,[P.RED]:r.R8,[P.RGBA_INTEGER]:r.RGBA8UI,[P.RGB_INTEGER]:r.RGB8UI,[P.RG_INTEGER]:r.RG8UI,[P.RED_INTEGER]:r.R8UI,[P.ALPHA]:r.ALPHA,[P.LUMINANCE]:r.LUMINANCE,[P.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[$.BYTE]:{[P.RGBA]:r.RGBA8_SNORM,[P.RGB]:r.RGB8_SNORM,[P.RG]:r.RG8_SNORM,[P.RED]:r.R8_SNORM,[P.RGBA_INTEGER]:r.RGBA8I,[P.RGB_INTEGER]:r.RGB8I,[P.RG_INTEGER]:r.RG8I,[P.RED_INTEGER]:r.R8I},[$.UNSIGNED_SHORT]:{[P.RGBA_INTEGER]:r.RGBA16UI,[P.RGB_INTEGER]:r.RGB16UI,[P.RG_INTEGER]:r.RG16UI,[P.RED_INTEGER]:r.R16UI,[P.DEPTH_COMPONENT]:r.DEPTH_COMPONENT16},[$.SHORT]:{[P.RGBA_INTEGER]:r.RGBA16I,[P.RGB_INTEGER]:r.RGB16I,[P.RG_INTEGER]:r.RG16I,[P.RED_INTEGER]:r.R16I},[$.UNSIGNED_INT]:{[P.RGBA_INTEGER]:r.RGBA32UI,[P.RGB_INTEGER]:r.RGB32UI,[P.RG_INTEGER]:r.RG32UI,[P.RED_INTEGER]:r.R32UI,[P.DEPTH_COMPONENT]:r.DEPTH_COMPONENT24},[$.INT]:{[P.RGBA_INTEGER]:r.RGBA32I,[P.RGB_INTEGER]:r.RGB32I,[P.RG_INTEGER]:r.RG32I,[P.RED_INTEGER]:r.R32I},[$.FLOAT]:{[P.RGBA]:r.RGBA32F,[P.RGB]:r.RGB32F,[P.RG]:r.RG32F,[P.RED]:r.R32F,[P.DEPTH_COMPONENT]:r.DEPTH_COMPONENT32F},[$.HALF_FLOAT]:{[P.RGBA]:r.RGBA16F,[P.RGB]:r.RGB16F,[P.RG]:r.RG16F,[P.RED]:r.R16F},[$.UNSIGNED_SHORT_5_6_5]:{[P.RGB]:r.RGB565},[$.UNSIGNED_SHORT_4_4_4_4]:{[P.RGBA]:r.RGBA4},[$.UNSIGNED_SHORT_5_5_5_1]:{[P.RGBA]:r.RGB5_A1},[$.UNSIGNED_INT_2_10_10_10_REV]:{[P.RGBA]:r.RGB10_A2,[P.RGBA_INTEGER]:r.RGB10_A2UI},[$.UNSIGNED_INT_10F_11F_11F_REV]:{[P.RGB]:r.R11F_G11F_B10F},[$.UNSIGNED_INT_5_9_9_9_REV]:{[P.RGB]:r.RGB9_E5},[$.UNSIGNED_INT_24_8]:{[P.DEPTH_STENCIL]:r.DEPTH24_STENCIL8},[$.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[P.DEPTH_STENCIL]:r.DEPTH32F_STENCIL8}}:t={[$.UNSIGNED_BYTE]:{[P.RGBA]:r.RGBA,[P.RGB]:r.RGB,[P.ALPHA]:r.ALPHA,[P.LUMINANCE]:r.LUMINANCE,[P.LUMINANCE_ALPHA]:r.LUMINANCE_ALPHA},[$.UNSIGNED_SHORT_5_6_5]:{[P.RGB]:r.RGB},[$.UNSIGNED_SHORT_4_4_4_4]:{[P.RGBA]:r.RGBA},[$.UNSIGNED_SHORT_5_5_5_1]:{[P.RGBA]:r.RGBA}},t}class In{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new X,this.hasIntegerTextures=!1}contextChange(){const t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=of(t),this.samplerTypes=af(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let i=0;i=0;--n){const a=e[n];a&&a._glTextures[i].samplerType!==k.FLOAT&&this.renderer.texture.unbind(a)}}initTexture(t){const e=new Vr(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){var s,i,n;e.internalFormat=(i=(s=this.internalFormats[t.type])==null?void 0:s[t.format])!=null?i:t.format,e.samplerType=(n=this.samplerTypes[e.internalFormat])!=null?n:k.FLOAT,this.webGLVersion===2&&t.type===$.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var e;const s=t._glTextures[this.CONTEXT_UID];if(!s)return;const i=this.renderer;if(this.initTextureType(t,s),(e=t.resource)!=null&&e.upload(i,t,s))s.samplerType!==k.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,a=t.realHeight,o=i.gl;(s.width!==n||s.height!==a||s.dirtyId<0)&&(s.width=n,s.height=a,o.texImage2D(t.target,0,s.internalFormat,n,a,0,t.format,s.type,null))}t.dirtyStyleId!==s.dirtyStyleId&&this.updateTextureStyle(t),s.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:s}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),s.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const i=this.managedTextures.indexOf(t);i!==-1&&Oe(this.managedTextures,i,1)}}updateTextureStyle(t){var e;const s=t._glTextures[this.CONTEXT_UID];s&&((t.mipmap===Ht.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?s.mipmap=!1:s.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?s.wrapMode=Zt.CLAMP:s.wrapMode=t.wrapMode,(e=t.resource)!=null&&e.style(this.renderer,t,s)||this.setStyle(t,s),s.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const s=this.gl;if(e.mipmap&&t.mipmap!==Ht.ON_MANUAL&&s.generateMipmap(t.target),s.texParameteri(t.target,s.TEXTURE_WRAP_S,e.wrapMode),s.texParameteri(t.target,s.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===Bt.LINEAR?s.LINEAR_MIPMAP_LINEAR:s.NEAREST_MIPMAP_NEAREST);const i=this.renderer.context.extensions.anisotropicFiltering;if(i&&t.anisotropicLevel>0&&t.scaleMode===Bt.LINEAR){const n=Math.min(t.anisotropicLevel,s.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));s.texParameterf(t.target,i.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===Bt.LINEAR?s.LINEAR:s.NEAREST);s.texParameteri(t.target,s.TEXTURE_MAG_FILTER,t.scaleMode===Bt.LINEAR?s.LINEAR:s.NEAREST)}destroy(){this.renderer=null}}In.extension={type:D.RendererSystem,name:"texture"},U.add(In);class Pn{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,i=t._glTransformFeedbacks[s]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,i)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:s,renderer:i}=this;e&&i.shader.bind(e),s.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:s,CONTEXT_UID:i}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[i]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let a=0;at in r?hf(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,jr=(r,t)=>{for(var e in t||(t={}))lf.call(t,e)&&wh(r,e,t[e]);if(Ah)for(var e of Ah(t))uf.call(t,e)&&wh(r,e,t[e]);return r};N.PREFER_ENV=be.WEBGL2,N.STRICT_TEXTURE_CACHE=!1,N.RENDER_OPTIONS=jr(jr(jr(jr({},Ps.defaultOptions),Is.defaultOptions),Bs.defaultOptions),Ds.defaultOptions),Object.defineProperties(N,{WRAP_MODE:{get(){return X.defaultOptions.wrapMode},set(r){X.defaultOptions.wrapMode=r}},SCALE_MODE:{get(){return X.defaultOptions.scaleMode},set(r){X.defaultOptions.scaleMode=r}},MIPMAP_TEXTURES:{get(){return X.defaultOptions.mipmap},set(r){X.defaultOptions.mipmap=r}},ANISOTROPIC_LEVEL:{get(){return X.defaultOptions.anisotropicLevel},set(r){X.defaultOptions.anisotropicLevel=r}},FILTER_RESOLUTION:{get(){return Et.defaultResolution},set(r){Et.defaultResolution=r}},FILTER_MULTISAMPLE:{get(){return Et.defaultMultisample},set(r){Et.defaultMultisample=r}},SPRITE_MAX_TEXTURES:{get(){return Ee.defaultMaxTextures},set(r){Ee.defaultMaxTextures=r}},SPRITE_BATCH_SIZE:{get(){return Ee.defaultBatchSize},set(r){Ee.defaultBatchSize=r}},CAN_UPLOAD_SAME_BUFFER:{get(){return Ee.canUploadSameBuffer},set(r){Ee.canUploadSameBuffer=r}},GC_MODE:{get(){return Ae.defaultMode},set(r){Ae.defaultMode=r}},GC_MAX_IDLE:{get(){return Ae.defaultMaxIdle},set(r){Ae.defaultMaxIdle=r}},GC_MAX_CHECK_COUNT:{get(){return Ae.defaultCheckCountMax},set(r){Ae.defaultCheckCountMax=r}},PRECISION_VERTEX:{get(){return se.defaultVertexPrecision},set(r){se.defaultVertexPrecision=r}},PRECISION_FRAGMENT:{get(){return se.defaultFragmentPrecision},set(r){se.defaultFragmentPrecision=r}}});var me=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(me||{});class Mn{constructor(t,e=null,s=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=s,this.once=i}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const Sh=class Dt{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Mn(null,null,1/0),this.deltaMS=1/Dt.targetFPMS,this.elapsedMS=1/Dt.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,s=me.NORMAL){return this._addListener(new Mn(t,e,s))}addOnce(t,e,s=me.NORMAL){return this._addListener(new Mn(t,e,s,!0))}_addListener(t){let e=this._head.next,s=this._head;if(!e)t.connect(s);else{for(;e;){if(t.priority>e.priority){t.connect(s);break}s=e,e=e.next}t.previous||t.connect(s)}return this._startIfPossible(),this}remove(t,e){let s=this._head.next;for(;s;)s.match(t,e)?s=s.destroy():s=s.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?bt.shared:new bt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Dn.extension=D.Application,U.add(Dn);const Ch=[];U.handleByList(D.Renderer,Ch);function Rh(r){for(const t of Ch)if(t.test(r))return new t(r);throw new Error("Unable to auto-detect a suitable renderer.")}var cf=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,df=`attribute vec2 aVertexPosition; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +uniform vec4 inputSize; +uniform vec4 outputFrame; + +vec4 filterVertexPosition( void ) +{ + vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; + + return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); +} + +vec2 filterTextureCoord( void ) +{ + return aVertexPosition * (outputFrame.zw * inputSize.zw); +} + +void main(void) +{ + gl_Position = filterVertexPosition(); + vTextureCoord = filterTextureCoord(); +} +`;const Ih=cf,On=df;class Bn{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){const s=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,s)}else{const s=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,s)}e>=ft.HIGH?this.multisample=ft.HIGH:e>=ft.MEDIUM?this.multisample=ft.MEDIUM:e>=ft.LOW?this.multisample=ft.LOW:this.multisample=ft.NONE}destroy(){}}Bn.extension={type:D.RendererSystem,name:"_multisample"},U.add(Bn);class ff{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Fn{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,i=t._glBuffers[s]||this.createGLBuffer(t);e.bindBuffer(t.type,i.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:s,CONTEXT_UID:i}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[i]||this.createGLBuffer(t);this.boundBufferBases[e]=t,s.bindBufferBase(s.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,s){const{gl:i,CONTEXT_UID:n}=this;s=s||0;const a=t._glBuffers[n]||this.createGLBuffer(t);i.bindBufferRange(i.UNIFORM_BUFFER,e||0,a.buffer,s*256,256)}update(t){const{gl:e,CONTEXT_UID:s}=this,i=t._glBuffers[s]||this.createGLBuffer(t);if(t._updateID!==i.updateID)if(i.updateID=t._updateID,e.bindBuffer(t.type,i.buffer),i.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;i.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const s=t._glBuffers[this.CONTEXT_UID],i=this.gl;t.disposeRunner.remove(this),s&&(e||i.deleteBuffer(s.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let s=0;se.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{const{realWidth:e,realHeight:s}=this.items[0];return this.resize(e,s),this.update(),Promise.resolve(this)}),this._load}}class Ph extends Ln{constructor(t,e){const{width:s,height:i}=e||{};let n,a;Array.isArray(t)?(n=t,a=t.length):a=t,super(a,{width:s,height:i}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=Me.TEXTURE_2D_ARRAY}upload(t,e,s){const{length:i,itemDirtyIds:n,items:a}=this,{gl:o}=t;s.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,s.internalFormat,this._width,this._height,i,0,e.format,s.type,null);for(let h=0;h0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=Me.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,s){const i=this.itemDirtyIds;for(let n=0;n{if(this.url===null){t(this);return}try{const s=await N.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const i=await s.blob();if(this.destroyed)return;const n=await createImageBitmap(i,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===wt.UNPACK?"premultiply":"none"});if(this.destroyed){n.close();return}this.source=n,this.update(),t(this)}catch(s){if(this.destroyed)return;e(s),this.onError.emit(s)}}),this._load)}upload(t,e,s){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,s)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap!="undefined"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){var t;return $e._EMPTY=(t=$e._EMPTY)!=null?t:N.ADAPTER.createCanvas(0,0),$e._EMPTY}}const kn=class Ai extends re{constructor(t,e){e=e||{},super(N.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},Ai.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){const t=new Image;re.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;const e=t.width,s=t.height;if(!e||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let i=e*this.scale,n=s*this.scale;(this._overrideWidth||this._overrideHeight)&&(i=this._overrideWidth||this._overrideHeight/s*e,n=this._overrideHeight||this._overrideWidth/e*s),i=Math.round(i),n=Math.round(n);const a=this.source;a.width=i,a.height=n,a._pixiId=`canvas_${Te()}`,a.getContext("2d").drawImage(t,0,0,e,s,0,0,i,n),this._resolve(),this._resolve=null}}static getSize(t){const e=Ai.SVG_SIZE.exec(t),s={};return e&&(s[e[1]]=Math.round(parseFloat(e[3])),s[e[5]]=Math.round(parseFloat(e[7]))),s}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&Ai.SVG_XML.test(t)}};kn.SVG_XML=/^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Wr=kn;class pf extends re{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}}const Gn=class Sa extends re{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const s=document.createElement("video");e.autoLoad!==!1&&s.setAttribute("preload","auto"),e.playsinline!==!1&&(s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline","")),e.muted===!0&&(s.setAttribute("muted",""),s.muted=!0),e.loop===!0&&s.setAttribute("loop",""),e.autoPlay!==!1&&s.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);const i=t[0].src||t[0];re.crossOrigin(s,i,e.crossorigin);for(let n=0;n{this.valid?e(this):(this._resolve=e,this._reject=s,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();const t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(bt.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(bt.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(bt.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||Sa.TYPES.includes(e)}};Gn.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Gn.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let $n=Gn;wr.push($e,dn,Un,$n,pf,Wr,Ts,Dh,Ph);class mf{constructor(){this._glTransformFeedbacks={},this.buffers=[],this.disposeRunner=new Pt("disposeTransformFeedback")}bindBuffer(t,e){this.buffers[t]=e}destroy(){this.disposeRunner.emit(this,!1)}}const gf="7.4.2";X.prototype.getDrawableSource=function(){const r=this.resource;return r?r.bitmap||r.source:null},Ur.prototype._canvasRenderTarget=null,L.prototype.patternCache=null,L.prototype.tintCache=null;let Fs;function Oh(r){const t=N.ADAPTER.createCanvas(6,1),e=t.getContext("2d");return e.fillStyle=r,e.fillRect(0,0,6,1),t}function Hn(){if(typeof document=="undefined")return!1;if(Fs!==void 0)return Fs;const r=Oh("#ff00ff"),t=Oh("#ffff00"),e=N.ADAPTER.createCanvas(6,1).getContext("2d");e.globalCompositeOperation="multiply",e.drawImage(r,0,0),e.drawImage(t,2,0);const s=e.getImageData(2,0,1,1);if(!s)Fs=!1;else{const i=s.data;Fs=i[0]===255&&i[1]===0&&i[2]===0}return Fs}function _f(r=[]){return Hn()?(r[C.NORMAL]="source-over",r[C.ADD]="lighter",r[C.MULTIPLY]="multiply",r[C.SCREEN]="screen",r[C.OVERLAY]="overlay",r[C.DARKEN]="darken",r[C.LIGHTEN]="lighten",r[C.COLOR_DODGE]="color-dodge",r[C.COLOR_BURN]="color-burn",r[C.HARD_LIGHT]="hard-light",r[C.SOFT_LIGHT]="soft-light",r[C.DIFFERENCE]="difference",r[C.EXCLUSION]="exclusion",r[C.HUE]="hue",r[C.SATURATION]="saturation",r[C.COLOR]="color",r[C.LUMINOSITY]="luminosity"):(r[C.NORMAL]="source-over",r[C.ADD]="lighter",r[C.MULTIPLY]="source-over",r[C.SCREEN]="source-over",r[C.OVERLAY]="source-over",r[C.DARKEN]="source-over",r[C.LIGHTEN]="source-over",r[C.COLOR_DODGE]="source-over",r[C.COLOR_BURN]="source-over",r[C.HARD_LIGHT]="source-over",r[C.SOFT_LIGHT]="source-over",r[C.DIFFERENCE]="source-over",r[C.EXCLUSION]="source-over",r[C.HUE]="source-over",r[C.SATURATION]="source-over",r[C.COLOR]="source-over",r[C.LUMINOSITY]="source-over"),r[C.NORMAL_NPM]=r[C.NORMAL],r[C.ADD_NPM]=r[C.ADD],r[C.SCREEN_NPM]=r[C.SCREEN],r[C.SRC_IN]="source-in",r[C.SRC_OUT]="source-out",r[C.SRC_ATOP]="source-atop",r[C.DST_OVER]="destination-over",r[C.DST_IN]="destination-in",r[C.DST_OUT]="destination-out",r[C.DST_ATOP]="destination-atop",r[C.XOR]="xor",r[C.SUBTRACT]="source-over",r}const vf=new tt;class Vn{constructor(t){this.activeResolution=1,this.smoothProperty="imageSmoothingEnabled",this.blendModes=_f(),this._activeBlendMode=null,this._projTransform=null,this._outerBlend=!1,this.renderer=t}init(){const t=this.renderer.background.alpha<1;if(this.rootContext=this.renderer.view.getContext("2d",{alpha:t}),this.activeContext=this.rootContext,!this.rootContext.imageSmoothingEnabled){const e=this.rootContext;e.webkitImageSmoothingEnabled?this.smoothProperty="webkitImageSmoothingEnabled":e.mozImageSmoothingEnabled?this.smoothProperty="mozImageSmoothingEnabled":e.oImageSmoothingEnabled?this.smoothProperty="oImageSmoothingEnabled":e.msImageSmoothingEnabled&&(this.smoothProperty="msImageSmoothingEnabled")}}setContextTransform(t,e,s){let i=t;const n=this._projTransform,a=this.activeResolution;s=s||a,n&&(i=vf,i.copyFrom(t),i.prepend(n)),e?this.activeContext.setTransform(i.a*s,i.b*s,i.c*s,i.d*s,i.tx*a|0,i.ty*a|0):this.activeContext.setTransform(i.a*s,i.b*s,i.c*s,i.d*s,i.tx*a,i.ty*a)}clear(t,e){const{activeContext:s,renderer:i}=this,n=t?Y.shared.setValue(t):this.renderer.background.backgroundColor;s.clearRect(0,0,i.width,i.height),t&&(s.globalAlpha=e!=null?e:this.renderer.background.alpha,s.fillStyle=n.toHex(),s.fillRect(0,0,i.width,i.height),s.globalAlpha=1)}setBlendMode(t,e){const s=t===C.SRC_IN||t===C.SRC_OUT||t===C.DST_IN||t===C.DST_ATOP;!e&&s&&(t=C.NORMAL),this._activeBlendMode!==t&&(this._activeBlendMode=t,this._outerBlend=s,this.activeContext.globalCompositeOperation=this.blendModes[t])}resize(){this.smoothProperty&&(this.rootContext[this.smoothProperty]=X.defaultOptions.scaleMode===Bt.LINEAR)}invalidateBlendMode(){this._activeBlendMode=this.blendModes.indexOf(this.activeContext.globalCompositeOperation)}destroy(){this.renderer=null,this.rootContext=null,this.activeContext=null,this.smoothProperty=null}}Vn.extension={type:D.CanvasRendererSystem,name:"canvasContext"},U.add(Vn);class jn{constructor(t){this._foundShapes=[],this.renderer=t}pushMask(t){const e=this.renderer,s=t.maskObject||t;e.canvasContext.activeContext.save();const i=this._foundShapes;if(this.recursiveFindShapes(s,i),i.length>0){const n=e.canvasContext.activeContext;n.beginPath();for(let a=0;a0){u=0,d=h[0],f=h[1];for(let p=2;p+2=0;m-=2)e.lineTo(h[m],h[m+1])}l[p].shape.closeStroke&&e.closePath()}}h[0]===h[h.length-2]&&h[1]===h[h.length-1]&&e.closePath()}else if(o.type===rt.RECT)e.rect(o.x,o.y,o.width,o.height),e.closePath();else if(o.type===rt.CIRC)e.arc(o.x,o.y,o.radius,0,2*Math.PI),e.closePath();else if(o.type===rt.ELIP){const h=o.width*2,l=o.height*2,u=o.x-h/2,c=o.y-l/2,d=.5522848,f=h/2*d,p=l/2*d,m=u+h,g=c+l,_=u+h/2,x=c+l/2;e.moveTo(u,x),e.bezierCurveTo(u,x-p,_-f,c,_,c),e.bezierCurveTo(_+f,c,m,x-p,m,x),e.bezierCurveTo(m,x+p,_+f,g,_,g),e.bezierCurveTo(_-f,g,u,x+p,u,x),e.closePath()}else if(o.type===rt.RREC){const h=o.x,l=o.y,u=o.width,c=o.height;let d=o.radius;const f=Math.min(u,c)/2;d=d>f?f:d,e.moveTo(h,l+d),e.lineTo(h,l+c-d),e.quadraticCurveTo(h,l+c,h+d,l+c),e.lineTo(h+u-d,l+c),e.quadraticCurveTo(h+u,l+c,h+u,l+c-d),e.lineTo(h+u,l+d),e.quadraticCurveTo(h+u,l,h+u-d,l),e.lineTo(h+d,l),e.quadraticCurveTo(h,l,h,l+d),e.closePath()}}}popMask(t){t.canvasContext.activeContext.restore(),t.canvasContext.invalidateBlendMode()}destroy(){}}jn.extension={type:D.CanvasRendererSystem,name:"mask"},U.add(jn);class Xn{constructor(t){this.renderer=t}render(t,e){const s=this.renderer;if(!s.view)return;const i=s.canvasContext;let n,a,o,h;e&&(n=e.renderTexture,a=e.clear,o=e.transform,h=e.skipUpdateTransform),this.renderingToScreen=!n,s.emit("prerender");const l=s.resolution;n?(n=n.castToBaseTexture(),n._canvasRenderTarget||(n._canvasRenderTarget=new bs(n.width,n.height,n.resolution),n.resource=new Un(n._canvasRenderTarget.canvas),n.valid=!0),i.activeContext=n._canvasRenderTarget.context,s.canvasContext.activeResolution=n._canvasRenderTarget.resolution):(i.activeContext=i.rootContext,i.activeResolution=l);const u=i.activeContext;if(i._projTransform=o||null,n||(this.lastObjectRendered=t),!h){const d=t.enableTempParent();t.updateTransform(),t.disableTempParent(d)}if(u.save(),u.setTransform(1,0,0,1,0,0),u.globalAlpha=1,i._activeBlendMode=C.NORMAL,i._outerBlend=!1,u.globalCompositeOperation=i.blendModes[C.NORMAL],a!=null?a:s.background.clearBeforeRender)if(this.renderingToScreen){u.clearRect(0,0,s.width,s.height);const d=s.background;d.alpha>0&&(u.globalAlpha=d.backgroundColor.alpha,u.fillStyle=d.backgroundColor.toHex(),u.fillRect(0,0,s.width,s.height),u.globalAlpha=1)}else n=n,n._canvasRenderTarget.clear(),n.clear.alpha>0&&(u.globalAlpha=n.clear.alpha,u.fillStyle=n.clear.toHex(),u.fillRect(0,0,n.realWidth,n.realHeight),u.globalAlpha=1);const c=i.activeContext;i.activeContext=u,t.renderCanvas(s),i.activeContext=c,u.restore(),i.activeResolution=l,i._projTransform=null,s.emit("postrender")}destroy(){this.lastObjectRendered=null,this.render=null}}Xn.extension={type:D.CanvasRendererSystem,name:"objectRenderer"},U.add(Xn);const{deprecation:yf}=Do,Yr=class Ca extends Rn{constructor(t){super(),this.type=cr.CANVAS,this.rendererLogId="Canvas",t=Object.assign({},N.RENDER_OPTIONS,t);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Ca.__systems,priority:["textureGenerator","background","_view","_plugin","startup","mask","canvasContext","objectRenderer"]};this.setup(e),"useContextAlpha"in t&&(t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=Ca.__plugins,this.options=t,this.startup.run(this.options)}static test(){return!0}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}reset(){}render(t,e){this.objectRenderer.render(t,e)}clear(){this.canvasContext.clear()}destroy(t){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}resize(t,e){this._view.resizeView(t,e)}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get clearBeforeRender(){return this.background.clearBeforeRender}get blendModes(){return this.canvasContext.blendModes}get maskManager(){return yf("7.0.0","renderer.maskManager has been deprecated, please use renderer.mask instead"),this.mask}get refresh(){return!0}get rootContext(){return this.canvasContext.rootContext}get context(){return this.canvasContext.activeContext}get smoothProperty(){return this.canvasContext.smoothProperty}setBlendMode(t,e){this.canvasContext.setBlendMode(t,e)}invalidateBlendMode(){this.canvasContext.invalidateBlendMode()}setContextTransform(t,e,s){this.canvasContext.setContextTransform(t,e,s)}get backgroundColor(){return this.background.color}set backgroundColor(t){this.background.color=t}get backgroundAlpha(){return this.background.alpha}set backgroundAlpha(t){this.background.alpha=t}get preserveDrawingBuffer(){return!1}get useContextAlpha(){return!1}};Yr.extension={type:D.Renderer,priority:0},Yr.__plugins={},Yr.__systems={};let Ns=Yr;U.handleByMap(D.CanvasRendererPlugin,Ns.__plugins),U.handleByMap(D.CanvasRendererSystem,Ns.__systems),U.add(Ns);const _t={canvas:null,getTintedCanvas:(r,t)=>{const e=r.texture,s=Y.shared.setValue(t).toHex();e.tintCache=e.tintCache||{};const i=e.tintCache[s];let n;if(i){if(i.tintId===e._updateID)return e.tintCache[s];n=e.tintCache[s]}else n=N.ADAPTER.createCanvas();if(_t.tintMethod(e,t,n),n.tintId=e._updateID,_t.convertTintToImage&&n.toDataURL!==void 0){const a=new Image;a.src=n.toDataURL(),e.tintCache[s]=a}else e.tintCache[s]=n;return n},getTintedPattern:(r,t)=>{const e=Y.shared.setValue(t).toHex();r.patternCache=r.patternCache||{};let s=r.patternCache[e];return(s==null?void 0:s.tintId)===r._updateID||(_t.canvas||(_t.canvas=N.ADAPTER.createCanvas()),_t.tintMethod(r,t,_t.canvas),s=_t.canvas.getContext("2d").createPattern(_t.canvas,"repeat"),s.tintId=r._updateID,r.patternCache[e]=s),s},tintWithMultiply:(r,t,e)=>{const s=e.getContext("2d"),i=r._frame.clone(),n=r.baseTexture.resolution;i.x*=n,i.y*=n,i.width*=n,i.height*=n,e.width=Math.ceil(i.width),e.height=Math.ceil(i.height),s.save(),s.fillStyle=Y.shared.setValue(t).toHex(),s.fillRect(0,0,i.width,i.height),s.globalCompositeOperation="multiply";const a=r.baseTexture.getDrawableSource();s.drawImage(a,i.x,i.y,i.width,i.height,0,0,i.width,i.height),s.globalCompositeOperation="destination-atop",s.drawImage(a,i.x,i.y,i.width,i.height,0,0,i.width,i.height),s.restore()},tintWithOverlay:(r,t,e)=>{const s=e.getContext("2d"),i=r._frame.clone(),n=r.baseTexture.resolution;i.x*=n,i.y*=n,i.width*=n,i.height*=n,e.width=Math.ceil(i.width),e.height=Math.ceil(i.height),s.save(),s.globalCompositeOperation="copy",s.fillStyle=`#${`00000${(t|0).toString(16)}`.slice(-6)}`,s.fillRect(0,0,i.width,i.height),s.globalCompositeOperation="destination-atop",s.drawImage(r.baseTexture.getDrawableSource(),i.x,i.y,i.width,i.height,0,0,i.width,i.height),s.restore()},tintWithPerPixel:(r,t,e)=>{const s=e.getContext("2d"),i=r._frame.clone(),n=r.baseTexture.resolution;i.x*=n,i.y*=n,i.width*=n,i.height*=n,e.width=Math.ceil(i.width),e.height=Math.ceil(i.height),s.save(),s.globalCompositeOperation="copy",s.drawImage(r.baseTexture.getDrawableSource(),i.x,i.y,i.width,i.height,0,0,i.width,i.height),s.restore();const[a,o,h]=Y.shared.setValue(t).toArray(),l=s.getImageData(0,0,i.width,i.height),u=l.data;for(let c=0;cY.shared.setValue(r).round(_t.cacheStepsPerColorChannel).toNumber(),cacheStepsPerColorChannel:8,convertTintToImage:!1,canUseMultiply:Hn(),tintMethod:null};_t.tintMethod=_t.canUseMultiply?_t.tintWithMultiply:_t.tintWithPerPixel;class Ls{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(t){return this.minX>this.maxX||this.minY>this.maxY?z.EMPTY:(t=t||new z(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,e){const{a:s,b:i,c:n,d:a,tx:o,ty:h}=t,l=s*e.x+n*e.y+o,u=i*e.x+a*e.y+h;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,u),this.maxY=Math.max(this.maxY,u)}addQuad(t){let e=this.minX,s=this.minY,i=this.maxX,n=this.maxY,a=t[0],o=t[1];e=ai?a:i,n=o>n?o:n,a=t[2],o=t[3],e=ai?a:i,n=o>n?o:n,a=t[4],o=t[5],e=ai?a:i,n=o>n?o:n,a=t[6],o=t[7],e=ai?a:i,n=o>n?o:n,this.minX=e,this.minY=s,this.maxX=i,this.maxY=n}addFrame(t,e,s,i,n){this.addFrameMatrix(t.worldTransform,e,s,i,n)}addFrameMatrix(t,e,s,i,n){const a=t.a,o=t.b,h=t.c,l=t.d,u=t.tx,c=t.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=a*e+h*s+u,_=o*e+l*s+c;d=gp?g:p,m=_>m?_:m,g=a*i+h*s+u,_=o*i+l*s+c,d=gp?g:p,m=_>m?_:m,g=a*e+h*n+u,_=o*e+l*n+c,d=gp?g:p,m=_>m?_:m,g=a*i+h*n+u,_=o*i+l*n+c,d=gp?g:p,m=_>m?_:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(t,e,s){let i=this.minX,n=this.minY,a=this.maxX,o=this.maxY;for(let h=e;ha?l:a,o=u>o?u:o}this.minX=i,this.minY=n,this.maxX=a,this.maxY=o}addVertices(t,e,s,i){this.addVerticesMatrix(t.worldTransform,e,s,i)}addVerticesMatrix(t,e,s,i,n=0,a=n){const o=t.a,h=t.b,l=t.c,u=t.d,c=t.tx,d=t.ty;let f=this.minX,p=this.minY,m=this.maxX,g=this.maxY;for(let _=s;_i?t.maxX:i,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const s=t.minX>e.minX?t.minX:e.minX,i=t.minY>e.minY?t.minY:e.minY,n=t.maxXl?n:l,this.maxY=a>u?a:u}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const s=t.minX>e.x?t.minX:e.x,i=t.minY>e.y?t.minY:e.y,n=t.maxXl?n:l,this.maxY=a>u?a:u}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,s,i,n,a){t-=n,e-=a,s+=n,i+=a,this.minX=this.minXs?this.maxX:s,this.minY=this.minYi?this.maxY:i}}class ot extends Ye{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new Dr,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new Ls,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const e=Object.keys(t);for(let s=0;s1)for(let e=0;ethis.children.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;const s=this.getChildIndex(t),i=this.getChildIndex(e);this.children[s]=e,this.children[i]=t,this.onChildrenChange(s=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const s=this.getChildIndex(t);Oe(this.children,s,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e0&&n<=i){a=this.children.splice(s,n);for(let o=0;o1&&this.children.sort(bf),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t0&&e.height>0))return;let s,i;this.cullArea?(s=this.cullArea,i=this.worldTransform):this._render!==Ra.prototype._render&&(s=this.getBounds(!0));const n=t.projection.transform;if(n&&(i?(i=xf.copyFrom(i),i.prepend(n)):i=n),s&&e.intersects(s,i))this._render(t);else if(this.cullArea)return;for(let a=0,o=this.children.length;a=i&&Us.x=n&&Us.y=i&&ks.x=n&&ks.y1?Wt.from(Af,Ef,e):Wt.from(Nh,wf,e)}render(t){const e=this.renderer,s=this.quad;let i=s.vertices;i[0]=i[6]=t._width*-t.anchor.x,i[1]=i[3]=t._height*-t.anchor.y,i[2]=i[4]=t._width*(1-t.anchor.x),i[5]=i[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,a=t.uvRespectAnchor?t.anchor.y:0;i=s.uvs,i[0]=i[6]=-n,i[1]=i[3]=-a,i[2]=i[4]=1-n,i[5]=i[7]=1-a,s.invalidate();const o=t._texture,h=o.baseTexture,l=h.alphaMode>0,u=t.tileTransform.localTransform,c=t.uvMatrix;let d=h.isPowerOfTwo&&o.frame.width===h.width&&o.frame.height===h.height;d&&(h._glTextures[e.CONTEXT_UID]?d=h.wrapMode!==Zt.CLAMP:h.wrapMode===Zt.CLAMP&&(h.wrapMode=Zt.REPEAT));const f=d?this.simpleShader:this.shader,p=o.width,m=o.height,g=t._width,_=t._height;Kr.set(u.a*p/g,u.b*p/_,u.c*m/g,u.d*m/_,u.tx/g,u.ty/_),Kr.invert(),d?Kr.prepend(c.mapCoord):(f.uniforms.uMapCoord=c.mapCoord.toArray(!0),f.uniforms.uClampFrame=c.uClampFrame,f.uniforms.uClampOffset=c.uClampOffset),f.uniforms.uTransform=Kr.toArray(!0),f.uniforms.uColor=Y.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=o,e.shader.bind(f),e.geometry.bind(s),this.state.blendMode=Vi(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}zn.extension={name:"tilingSprite",type:D.RendererPlugin},U.add(zn);const Zr=new tt,Gs=new tt,ie=[new K,new K,new K,new K];qr.prototype._renderCanvas=function(r){const t=this._texture;if(!t.baseTexture.valid)return;const e=r.canvasContext.activeContext,s=this.worldTransform,i=t.baseTexture,n=i.getDrawableSource(),a=i.resolution;if(this._textureID!==this._texture._updateID||this._cachedTint!==this.tintValue){this._textureID=this._texture._updateID;const d=new bs(t._frame.width,t._frame.height,a);this.tintValue!==16777215?(this._tintedCanvas=_t.getTintedCanvas(this,this.tintValue),d.context.drawImage(this._tintedCanvas,0,0)):d.context.drawImage(n,-t._frame.x*a,-t._frame.y*a),this._cachedTint=this.tintValue,this._canvasPattern=d.context.createPattern(d.canvas,"repeat")}e.globalAlpha=this.worldAlpha,r.canvasContext.setBlendMode(this.blendMode),this.tileTransform.updateLocalTransform();const o=this.tileTransform.localTransform,h=this._width,l=this._height;Zr.identity(),Gs.copyFrom(o),this.uvRespectAnchor||Gs.translate(-this.anchor.x*h,-this.anchor.y*l),Gs.scale(1/a,1/a),Zr.prepend(Gs),Zr.prepend(s),r.canvasContext.setContextTransform(Zr),e.fillStyle=this._canvasPattern;const u=this.anchor.x*-h,c=this.anchor.y*-l;ie[0].set(u,c),ie[1].set(u+h,c),ie[2].set(u+h,c+l),ie[3].set(u,c+l);for(let d=0;d<4;d++)Gs.applyInverse(ie[d],ie[d]);e.beginPath(),e.moveTo(ie[0].x,ie[0].y);for(let d=1;d<4;d++)e.lineTo(ie[d].x,ie[d].y);e.closePath(),e.fill()};class Lh extends Ct{constructor(t=1500,e,s=16384,i=!1){super();const n=16384;s>n&&(s=n),this._properties=[!1,!0,!1,!1,!1],this._maxSize=t,this._batchSize=s,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=C.NORMAL,this.autoResize=i,this.roundPixels=!0,this.baseTexture=null,this.setProperties(e),this._tintColor=new Y(0),this.tintRgb=new Float32Array(3),this.tint=16777215}setProperties(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])}updateTransform(){this.displayObjectUpdateTransform()}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintColor.toRgbArray(this.tintRgb)}render(t){!this.visible||this.worldAlpha<=0||!this.children.length||!this.renderable||(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",()=>this.onChildrenChange(0))),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))}onChildrenChange(t){const e=Math.floor(t/this._batchSize);for(;this._bufferUpdateIDs.lengths&&!t.autoResize&&(a=s);let o=t._buffers;o||(o=t._buffers=this.generateBuffers(t));const h=e[0]._texture.baseTexture,l=h.alphaMode>0;this.state.blendMode=Vi(t.blendMode,l),n.state.set(this.state);const u=n.gl,c=t.worldTransform.copyTo(this.tempMatrix);c.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=c.toArray(!0),this.shader.uniforms.uColor=Y.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=h,this.renderer.shader.bind(this.shader);let d=!1;for(let f=0,p=0;fi&&(m=i),p>=o.length&&o.push(this._generateOneMoreBuffer(t));const g=o[p];g.uploadDynamic(e,f,m);const _=t._bufferUpdateIDs[p]||0;d=d||g._updateID<_,d&&(g._updateID=t._updateID,g.uploadStatic(e,f,m)),n.geometry.bind(g.geometry),u.drawElements(u.TRIANGLES,m*6,u.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],s=t._maxSize,i=t._batchSize,n=t._properties;for(let a=0;a0);i[a]=l,i[a+n]=l,i[a+n*2]=l,i[a+n*3]=l,a+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Wn.extension={name:"particle",type:D.RendererPlugin},U.add(Wn),Lh.prototype.renderCanvas=function(r){if(!this.visible||this.worldAlpha<=0||!this.children.length||!this.renderable)return;const t=r.canvasContext.activeContext,e=this.worldTransform;let s=!0,i=0,n=0,a=0,o=0;r.canvasContext.setBlendMode(this.blendMode),t.globalAlpha=this.worldAlpha,this.displayObjectUpdateTransform();for(let h=0;h(r[r.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",r[r.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",r))($s||{});const Qr={willReadFrequently:!0},ne=class G{static get experimentalLetterSpacingSupported(){let t=G._experimentalLetterSpacingSupported;if(t!==void 0){const e=N.ADAPTER.getCanvasRenderingContext2D().prototype;t=G._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,s,i,n,a,o,h,l){this.text=t,this.style=e,this.width=s,this.height=i,this.lines=n,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=h,this.fontProperties=l}static measureText(t,e,s,i=G._canvas){s=s==null?e.wordWrap:s;const n=e.toFontString(),a=G.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);const o=i.getContext("2d",Qr);o.font=n;const h=(s?G.wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let u=0;for(let p=0;p0&&(i?n-=e:n+=(G.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,s=G._canvas){const i=s.getContext("2d",Qr);let n=0,a="",o="";const h=Object.create(null),{letterSpacing:l,whiteSpace:u}=e,c=G.collapseSpaces(u),d=G.collapseNewlines(u);let f=!c;const p=e.wordWrapWidth+l,m=G.tokenize(t);for(let g=0;gp)if(a!==""&&(o+=G.addLine(a),a="",n=0),G.canBreakWords(_,e.breakWords)){const y=G.wordWrapSplit(_);for(let b=0;bp&&(o+=G.addLine(a),f=!1,a="",n=0),a+=T,n+=w}}else{a.length>0&&(o+=G.addLine(a),a="",n=0);const y=g===m.length-1;o+=G.addLine(_,!y),f=!1,a="",n=0}else x+n>p&&(f=!1,o+=G.addLine(a),a="",n=0),(a.length>0||!G.isBreakingSpace(_)||f)&&(a+=_,n+=x)}return o+=G.addLine(a,!1),o}static addLine(t,e=!0){return t=G.trimRight(t),t=e?`${t} +`:t,t}static getFromCache(t,e,s,i){let n=s[t];return typeof n!="number"&&(n=G._measureText(t,e,i)+e,s[t]=n),n}static collapseSpaces(t){return t==="normal"||t==="pre-line"}static collapseNewlines(t){return t==="normal"}static trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const s=t[e];if(!G.isBreakingSpace(s))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:G._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:G._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let s="";if(typeof t!="string")return e;for(let i=0;io;--d){for(let m=0;m{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})(),ne.experimentalLetterSpacing=!1,ne._fonts={},ne._newlines=[10,13],ne._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let ge=ne;const If=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],kh=class hr{constructor(t){this.styleID=0,this.reset(),qn(this,t,t)}clone(){const t={};return qn(t,this,hr.defaultStyle),new hr(t)}reset(){qn(this,hr.defaultStyle,hr.defaultStyle)}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(t){const e=Yn(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)}get fill(){return this._fill}set fill(t){const e=Yn(t);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(t){Pf(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.styleID++)}get stroke(){return this._stroke}set stroke(t){const e=Yn(t);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)}toFontString(){const t=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let s=e.length-1;s>=0;s--){let i=e[s].trim();!/([\"\'])[^\'\"]+\1/.test(i)&&!If.includes(i)&&(i=`"${i}"`),e[s]=i}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};kh.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:$s.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let _e=kh;function Yn(r){const t=Y.shared,e=s=>{const i=t.setValue(s);return i.alpha===1?i.toHex():i.toRgbaString()};return Array.isArray(r)?r.map(e):e(r)}function Pf(r,t){if(!Array.isArray(r)||!Array.isArray(t)||r.length!==t.length)return!1;for(let e=0;e0&&p>m&&(g=(m+p)/2);const _=m+d,x=s.lineHeight*(f+1);let y=_;f+1=e&&(a=r-o-1),h=h.replace("%value%",t[a].toString()),i+=h,i+=` +`}return s=s.replace("%blur%",i),s=s.replace("%size%",r.toString()),s}const Lf=` + attribute vec2 aVertexPosition; + + uniform mat3 projectionMatrix; + + uniform float strength; + + varying vec2 vBlurTexCoords[%size%]; + + uniform vec4 inputSize; + uniform vec4 outputFrame; + + vec4 filterVertexPosition( void ) + { + vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; + + return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); + } + + vec2 filterTextureCoord( void ) + { + return aVertexPosition * (outputFrame.zw * inputSize.zw); + } + + void main(void) + { + gl_Position = filterVertexPosition(); + + vec2 textureCoord = filterTextureCoord(); + %blur% + }`;function Uf(r,t){const e=Math.ceil(r/2);let s=Lf,i="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let a=0;a 0.0) { + c.rgb /= c.a; + } + + vec4 result; + + result.r = (m[0] * c.r); + result.r += (m[1] * c.g); + result.r += (m[2] * c.b); + result.r += (m[3] * c.a); + result.r += m[4]; + + result.g = (m[5] * c.r); + result.g += (m[6] * c.g); + result.g += (m[7] * c.b); + result.g += (m[8] * c.a); + result.g += m[9]; + + result.b = (m[10] * c.r); + result.b += (m[11] * c.g); + result.b += (m[12] * c.b); + result.b += (m[13] * c.a); + result.b += m[14]; + + result.a = (m[15] * c.r); + result.a += (m[16] * c.g); + result.a += (m[17] * c.b); + result.a += (m[18] * c.a); + result.a += m[19]; + + vec3 rgb = mix(c.rgb, result.rgb, uAlpha); + + // Premultiply alpha again. + rgb *= result.a; + + gl_FragColor = vec4(rgb, result.a); +} +`;class ei extends Et{constructor(){const t={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};super(On,kf,t),this.alpha=1}_loadMatrix(t,e=!1){let s=t;e&&(this._multiply(s,this.uniforms.m,t),s=this._colorMatrix(s)),this.uniforms.m=s}_multiply(t,e,s){return t[0]=e[0]*s[0]+e[1]*s[5]+e[2]*s[10]+e[3]*s[15],t[1]=e[0]*s[1]+e[1]*s[6]+e[2]*s[11]+e[3]*s[16],t[2]=e[0]*s[2]+e[1]*s[7]+e[2]*s[12]+e[3]*s[17],t[3]=e[0]*s[3]+e[1]*s[8]+e[2]*s[13]+e[3]*s[18],t[4]=e[0]*s[4]+e[1]*s[9]+e[2]*s[14]+e[3]*s[19]+e[4],t[5]=e[5]*s[0]+e[6]*s[5]+e[7]*s[10]+e[8]*s[15],t[6]=e[5]*s[1]+e[6]*s[6]+e[7]*s[11]+e[8]*s[16],t[7]=e[5]*s[2]+e[6]*s[7]+e[7]*s[12]+e[8]*s[17],t[8]=e[5]*s[3]+e[6]*s[8]+e[7]*s[13]+e[8]*s[18],t[9]=e[5]*s[4]+e[6]*s[9]+e[7]*s[14]+e[8]*s[19]+e[9],t[10]=e[10]*s[0]+e[11]*s[5]+e[12]*s[10]+e[13]*s[15],t[11]=e[10]*s[1]+e[11]*s[6]+e[12]*s[11]+e[13]*s[16],t[12]=e[10]*s[2]+e[11]*s[7]+e[12]*s[12]+e[13]*s[17],t[13]=e[10]*s[3]+e[11]*s[8]+e[12]*s[13]+e[13]*s[18],t[14]=e[10]*s[4]+e[11]*s[9]+e[12]*s[14]+e[13]*s[19]+e[14],t[15]=e[15]*s[0]+e[16]*s[5]+e[17]*s[10]+e[18]*s[15],t[16]=e[15]*s[1]+e[16]*s[6]+e[17]*s[11]+e[18]*s[16],t[17]=e[15]*s[2]+e[16]*s[7]+e[17]*s[12]+e[18]*s[17],t[18]=e[15]*s[3]+e[16]*s[8]+e[17]*s[13]+e[18]*s[18],t[19]=e[15]*s[4]+e[16]*s[9]+e[17]*s[14]+e[18]*s[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const s=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}tint(t,e){const[s,i,n]=Y.shared.setValue(t).toArray(),a=[s,0,0,0,0,0,i,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(a,e)}greyscale(t,e){const s=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const s=Math.cos(t),i=Math.sin(t),n=Math.sqrt,a=1/3,o=n(a),h=s+(1-s)*a,l=a*(1-s)-o*i,u=a*(1-s)+o*i,c=a*(1-s)+o*i,d=s+a*(1-s),f=a*(1-s)-o*i,p=a*(1-s)-o*i,m=a*(1-s)+o*i,g=s+a*(1-s),_=[h,l,u,0,0,c,d,f,0,0,p,m,g,0,0,0,0,0,1,0];this._loadMatrix(_,e)}contrast(t,e){const s=(t||0)+1,i=-.5*(s-1),n=[s,0,0,0,i,0,s,0,0,i,0,0,s,0,i,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const s=t*2/3+1,i=(s-1)*-.5,n=[s,i,i,0,0,i,s,i,0,0,i,i,s,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,s,i,n){t=t||.2,e=e||.15,s=s||16770432,i=i||3375104;const a=Y.shared,[o,h,l]=a.setValue(s).toArray(),[u,c,d]=a.setValue(i).toArray(),f=[.3,.59,.11,0,0,o,h,l,t,0,u,c,d,e,0,o-u,h-c,l-d,0,0];this._loadMatrix(f,n)}night(t,e){t=t||.1;const s=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,0,0,0,0,0,1,0];this._loadMatrix(s,e)}predator(t,e){const s=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(s,e)}lsd(t){const e=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(e,t)}reset(){const t=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(t,!1)}get matrix(){return this.uniforms.m}set matrix(t){this.uniforms.m=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}ei.prototype.grayscale=ei.prototype.greyscale;var Gf=`varying vec2 vFilterCoord; +varying vec2 vTextureCoord; + +uniform vec2 scale; +uniform mat2 rotation; +uniform sampler2D uSampler; +uniform sampler2D mapSampler; + +uniform highp vec4 inputSize; +uniform vec4 inputClamp; + +void main(void) +{ + vec4 map = texture2D(mapSampler, vFilterCoord); + + map -= 0.5; + map.xy = scale * inputSize.zw * (rotation * map.xy); + + gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw)); +} +`,$f=`attribute vec2 aVertexPosition; + +uniform mat3 projectionMatrix; +uniform mat3 filterMatrix; + +varying vec2 vTextureCoord; +varying vec2 vFilterCoord; + +uniform vec4 inputSize; +uniform vec4 outputFrame; + +vec4 filterVertexPosition( void ) +{ + vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; + + return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); +} + +vec2 filterTextureCoord( void ) +{ + return aVertexPosition * (outputFrame.zw * inputSize.zw); +} + +void main(void) +{ + gl_Position = filterVertexPosition(); + vTextureCoord = filterTextureCoord(); + vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy; +} +`;class jh extends Et{constructor(t,e){const s=new tt;t.renderable=!1,super($f,Gf,{mapSampler:t._texture,filterMatrix:s,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=s,e==null&&(e=20),this.scale=new K(e,e)}apply(t,e,s,i){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const n=this.maskSprite.worldTransform,a=Math.sqrt(n.a*n.a+n.b*n.b),o=Math.sqrt(n.c*n.c+n.d*n.d);a!==0&&o!==0&&(this.uniforms.rotation[0]=n.a/a,this.uniforms.rotation[1]=n.b/a,this.uniforms.rotation[2]=n.c/o,this.uniforms.rotation[3]=n.d/o),t.applyFilter(this,e,s,i)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var Hf=`varying vec2 v_rgbNW; +varying vec2 v_rgbNE; +varying vec2 v_rgbSW; +varying vec2 v_rgbSE; +varying vec2 v_rgbM; + +varying vec2 vFragCoord; +uniform sampler2D uSampler; +uniform highp vec4 inputSize; + + +/** + Basic FXAA implementation based on the code on geeks3d.com with the + modification that the texture2DLod stuff was removed since it's + unsupported by WebGL. + + -- + + From: + https://github.com/mitsuhiko/webgl-meincraft + + Copyright (c) 2011 by Armin Ronacher. + + Some rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * The names of the contributors may not be used to endorse or + promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FXAA_REDUCE_MIN +#define FXAA_REDUCE_MIN (1.0/ 128.0) +#endif +#ifndef FXAA_REDUCE_MUL +#define FXAA_REDUCE_MUL (1.0 / 8.0) +#endif +#ifndef FXAA_SPAN_MAX +#define FXAA_SPAN_MAX 8.0 +#endif + +//optimized version for mobile, where dependent +//texture reads can be a bottleneck +vec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP, + vec2 v_rgbNW, vec2 v_rgbNE, + vec2 v_rgbSW, vec2 v_rgbSE, + vec2 v_rgbM) { + vec4 color; + vec3 rgbNW = texture2D(tex, v_rgbNW).xyz; + vec3 rgbNE = texture2D(tex, v_rgbNE).xyz; + vec3 rgbSW = texture2D(tex, v_rgbSW).xyz; + vec3 rgbSE = texture2D(tex, v_rgbSE).xyz; + vec4 texColor = texture2D(tex, v_rgbM); + vec3 rgbM = texColor.xyz; + vec3 luma = vec3(0.299, 0.587, 0.114); + float lumaNW = dot(rgbNW, luma); + float lumaNE = dot(rgbNE, luma); + float lumaSW = dot(rgbSW, luma); + float lumaSE = dot(rgbSE, luma); + float lumaM = dot(rgbM, luma); + float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE))); + float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE))); + + mediump vec2 dir; + dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE)); + dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE)); + + float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * + (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN); + + float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce); + dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), + max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), + dir * rcpDirMin)) * inverseVP; + + vec3 rgbA = 0.5 * ( + texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz + + texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz); + vec3 rgbB = rgbA * 0.5 + 0.25 * ( + texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz + + texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz); + + float lumaB = dot(rgbB, luma); + if ((lumaB < lumaMin) || (lumaB > lumaMax)) + color = vec4(rgbA, texColor.a); + else + color = vec4(rgbB, texColor.a); + return color; +} + +void main() { + + vec4 color; + + color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM); + + gl_FragColor = color; +} +`,Vf=` +attribute vec2 aVertexPosition; + +uniform mat3 projectionMatrix; + +varying vec2 v_rgbNW; +varying vec2 v_rgbNE; +varying vec2 v_rgbSW; +varying vec2 v_rgbSE; +varying vec2 v_rgbM; + +varying vec2 vFragCoord; + +uniform vec4 inputSize; +uniform vec4 outputFrame; + +vec4 filterVertexPosition( void ) +{ + vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; + + return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); +} + +void texcoords(vec2 fragCoord, vec2 inverseVP, + out vec2 v_rgbNW, out vec2 v_rgbNE, + out vec2 v_rgbSW, out vec2 v_rgbSE, + out vec2 v_rgbM) { + v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP; + v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP; + v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP; + v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP; + v_rgbM = vec2(fragCoord * inverseVP); +} + +void main(void) { + + gl_Position = filterVertexPosition(); + + vFragCoord = aVertexPosition * outputFrame.zw; + + texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM); +} +`;class Xh extends Et{constructor(){super(Vf,Hf)}}var jf=`precision highp float; + +varying vec2 vTextureCoord; +varying vec4 vColor; + +uniform float uNoise; +uniform float uSeed; +uniform sampler2D uSampler; + +float rand(vec2 co) +{ + return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); +} + +void main() +{ + vec4 color = texture2D(uSampler, vTextureCoord); + float randomValue = rand(gl_FragCoord.xy * uSeed); + float diff = (randomValue - 0.5) * uNoise; + + // Un-premultiply alpha before applying the color matrix. See issue #3539. + if (color.a > 0.0) { + color.rgb /= color.a; + } + + color.r += diff; + color.g += diff; + color.b += diff; + + // Premultiply alpha again. + color.rgb *= color.a; + + gl_FragColor = color; +} +`;class zh extends Et{constructor(t=.5,e=Math.random()){super(On,jf,{uNoise:0,uSeed:0}),this.noise=t,this.seed=e}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}const Kn={AlphaFilter:Hh,BlurFilter:Vh,BlurFilterPass:ti,ColorMatrixFilter:ei,DisplacementFilter:jh,FXAAFilter:Xh,NoiseFilter:zh};Object.entries(Kn).forEach(([r,t])=>{Object.defineProperty(Kn,r,{get(){return ao("7.1.0",`filters.${r} has moved to ${r}`),t}})});let Xf=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this.tickerAdded||!this.domElement||(bt.system.add(this.tickerUpdate,this,me.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(bt.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTimes.priority-i.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let s=0,i=e.length;s=0;i--)if(t.currentTarget=s[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,s=this._allInteractiveElements){if(s.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const i=Array.isArray(e)?e:[e];for(let n=s.length-1;n>=0;n--)i.forEach(a=>{t.currentTarget=s[n],this.notifyTarget(t,a)})}propagationPath(t){const e=[t];for(let s=0;s=0;c--){const d=u[c],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,s,i,n,a||n(t,s));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),o=!0}}}const h=this._isInteractive(e),l=t.isInteractive();return h&&l&&this._allInteractiveElements.push(t),a||this._hitElements.length>0?null:o?this._hitElements:h&&!n(t,s)&&i(t,s)?l?[t]:[]:null}hitTestRecursive(t,e,s,i,n){if(this._interactivePrune(t)||n(t,s))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(we.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let l=h.length-1;l>=0;l--){const u=h[l],c=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,s,i,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;const d=t.isInteractive();return(c.length>0||d)&&c.push(t),c}}}const a=this._isInteractive(e),o=t.isInteractive();return a&&i(t,s)?o?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){var s;if(t.hitArea&&(t.worldTransform.applyInverse(e,Zn),!t.hitArea.contains(Zn.x,Zn.y)))return!0;if(t._mask){const i=t._mask.isMaskData?t._mask.maskObject:t._mask;if(i&&!((s=i.containsPoint)!=null&&s.call(i,e)))return!0}return!1}hitTestFn(t,e){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(e):!1}notifyTarget(t,e){var s,i;e=e!=null?e:t.type;const n=`on${e}`;(i=(s=t.currentTarget)[n])==null||i.call(s,t);const a=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,a),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof kt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){const i=e.button===2;this.dispatchEvent(e,i?"rightdown":"mousedown")}const s=this.trackingData(t.pointerId);s.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var e,s,i;if(!(t instanceof kt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const n=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const a=n.pointerType==="mouse"||n.pointerType==="pen",o=this.trackingData(t.pointerId),h=this.findMountedTarget(o.overTargets);if(((e=o.overTargets)==null?void 0:e.length)>0&&h!==n.target){const c=t.type==="mousemove"?"mouseout":"pointerout",d=this.createPointerEvent(t,c,h);if(this.dispatchEvent(d,"pointerout"),a&&this.dispatchEvent(d,"mouseout"),!n.composedPath().includes(h)){const f=this.createPointerEvent(t,"pointerleave",h);for(f.eventPhase=f.AT_TARGET;f.target&&!n.composedPath().includes(f.target);)f.currentTarget=f.target,this.notifyTarget(f),a&&this.notifyTarget(f,"mouseleave"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(d)}if(h!==n.target){const c=t.type==="mousemove"?"mouseover":"pointerover",d=this.clonePointerEvent(n,c);this.dispatchEvent(d,"pointerover"),a&&this.dispatchEvent(d,"mouseover");let f=h==null?void 0:h.parent;for(;f&&f!==this.rootTarget.parent&&f!==n.target;)f=f.parent;if(!f||f===this.rootTarget.parent){const p=this.clonePointerEvent(n,"pointerenter");for(p.eventPhase=p.AT_TARGET;p.target&&p.target!==h&&p.target!==this.rootTarget.parent;)p.currentTarget=p.target,this.notifyTarget(p),a&&this.notifyTarget(p,"mouseenter"),p.target=p.target.parent;this.freeEvent(p)}this.freeEvent(d)}const l=[],u=(s=this.enableGlobalMoveEvents)!=null?s:!0;this.moveOnAll?l.push("pointermove"):this.dispatchEvent(n,"pointermove"),u&&l.push("globalpointermove"),n.pointerType==="touch"&&(this.moveOnAll?l.splice(1,0,"touchmove"):this.dispatchEvent(n,"touchmove"),u&&l.push("globaltouchmove")),a&&(this.moveOnAll?l.splice(1,0,"mousemove"):this.dispatchEvent(n,"mousemove"),u&&l.push("globalmousemove"),this.cursor=(i=n.target)==null?void 0:i.cursor),l.length>0&&this.all(n,l),this._allInteractiveElements.length=0,this._hitElements.length=0,o.overTargets=n.composedPath(),this.freeEvent(n)}mapPointerOver(t){var e;if(!(t instanceof kt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const s=this.trackingData(t.pointerId),i=this.createPointerEvent(t),n=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),n&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(e=i.target)==null?void 0:e.cursor);const a=this.clonePointerEvent(i,"pointerenter");for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),n&&this.notifyTarget(a,"mouseenter"),a.target=a.target.parent;s.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(a)}mapPointerOut(t){if(!(t instanceof kt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const s=t.pointerType==="mouse"||t.pointerType==="pen",i=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",i);this.dispatchEvent(n),s&&this.dispatchEvent(n,"mouseout");const a=this.createPointerEvent(t,"pointerleave",i);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),s&&this.notifyTarget(a,"mouseleave"),a.target=a.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(a)}this.cursor=null}mapPointerUp(t){if(!(t instanceof kt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=performance.now(),s=this.createPointerEvent(t);if(this.dispatchEvent(s,"pointerup"),s.pointerType==="touch")this.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const o=s.button===2;this.dispatchEvent(s,o?"rightup":"mouseup")}const i=this.trackingData(t.pointerId),n=this.findMountedTarget(i.pressTargetsByButton[t.button]);let a=n;if(n&&!s.composedPath().includes(n)){let o=n;for(;o&&!s.composedPath().includes(o);){if(s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")this.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const h=s.button===2;this.notifyTarget(s,h?"rightupoutside":"mouseupoutside")}o=o.parent}delete i.pressTargetsByButton[t.button],a=o}if(a){const o=this.clonePointerEvent(s,"click");o.target=a,o.path=null,i.clicksByButton[t.button]||(i.clicksByButton[t.button]={clickCount:0,target:o.target,timeStamp:e});const h=i.clicksByButton[t.button];if(h.target===o.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=o.target,h.timeStamp=e,o.detail=h.clickCount,o.pointerType==="mouse"){const l=o.button===2;this.dispatchEvent(o,l?"rightclick":"click")}else o.pointerType==="touch"&&this.dispatchEvent(o,"tap");this.dispatchEvent(o,"pointertap"),this.freeEvent(o)}this.freeEvent(s)}mapPointerUpOutside(t){if(!(t instanceof kt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),s=this.findMountedTarget(e.pressTargetsByButton[t.button]),i=this.createPointerEvent(t);if(s){let n=s;for(;n;)i.currentTarget=n,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch"?this.notifyTarget(i,"touchendoutside"):(i.pointerType==="mouse"||i.pointerType==="pen")&&this.notifyTarget(i,i.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(i)}mapWheel(t){if(!(t instanceof He)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let s=1;st in r?Yf(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Zf=(r,t)=>{for(var e in t||(t={}))qf.call(t,e)&&qh(r,e,t[e]);if(Yh)for(var e of Yh(t))Kf.call(t,e)&&qh(r,e,t[e]);return r};const Qf=1,Jf={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Qn=class Pa{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Wh(null),we.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new kt(null),this.rootWheelEvent=new He(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy(Zf({},Pa.defaultEventFeatures),{set:(e,s,i)=>(s==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=i),e[s]=i,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){var e,s;const{view:i,resolution:n}=this.renderer;this.setTargetElement(i),this.resolution=n,Pa._defaultEventMode=(e=t.eventMode)!=null?e:"auto",Object.assign(this.features,(s=t.eventFeatures)!=null?s:{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(t){t=t||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor===t)return;this.currentCursor=t;const s=this.cursorStyles[t];if(s)switch(typeof s){case"string":e&&(this.domElement.style.cursor=s);break;case"function":s(t);break;case"object":e&&Object.assign(this.domElement.style,s);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this.rootPointerEvent}onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let s=0,i=e.length;s0&&(e=t.composedPath()[0]);const s=e!==this.domElement?"outside":"",i=this.normalizeToPointerData(t);for(let n=0,a=i.length;n{h.off(r,o,a)}),n?h.once(r,o,a):h.on(r,o,a)},removeEventListener(r,t,e){const s=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,i=typeof t=="function"?void 0:t;r=s?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,i)},dispatchEvent(r){if(!(r instanceof Je))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};ot.mixin(Zh);const Qh={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};ot.mixin(Qh);const tp=9,ri=100,ep=0,sp=0,Jh=2,tl=1,rp=-1e3,ip=-1e3,np=2;class Jn{constructor(t){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(Xt.tablet||Xt.phone)&&this.createTouchHook();const e=document.createElement("div");e.style.width=`${ri}px`,e.style.height=`${ri}px`,e.style.position="absolute",e.style.top=`${ep}px`,e.style.left=`${sp}px`,e.style.zIndex=Jh.toString(),this.div=e,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}createTouchHook(){const t=document.createElement("button");t.style.width=`${tl}px`,t.style.height=`${tl}px`,t.style.position="absolute",t.style.top=`${rp}px`,t.style.left=`${ip}px`,t.style.zIndex=np.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(t=this.renderer.view.parentNode)==null||t.appendChild(this.div))}deactivate(){var t;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(t=this.div.parentNode)==null||t.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);const e=t.children;if(e)for(let s=0;s title : ${t.title}
tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:s}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>s&&(t.height=s-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${ri}px`,e.style.height=`${ri}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Jh.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{displayObject:s}=t.target,i=this.renderer.events.rootBoundary,n=Object.assign(new Je(i),{target:s});i.rootTarget=this.renderer.lastObjectRendered,e.forEach(a=>i.dispatchEvent(n,a))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode===tp&&this.activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}Jn.extension={name:"accessibility",type:[D.RendererPlugin,D.CanvasRendererPlugin]},U.add(Jn);const el=class Ma{constructor(t){this.stage=new Ct,t=Object.assign({forceCanvas:!1},t),this.renderer=Rh(t),Ma._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render(this.stage)}get view(){var t;return(t=this.renderer)==null?void 0:t.view}get screen(){var t;return(t=this.renderer)==null?void 0:t.screen}destroy(t,e){const s=Ma._plugins.slice(0);s.reverse(),s.forEach(i=>{i.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};el._plugins=[];let sl=el;U.handleByList(D.Application,sl._plugins);class ta{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let e,s;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,s=globalThis.innerHeight;else{const{clientWidth:i,clientHeight:n}=this._resizeTo;e=i,s=n}this.renderer.resize(e,s),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}ta.extension=D.Application,U.add(ta);const rl={loader:D.LoadParser,resolver:D.ResolveParser,cache:D.CacheParser,detection:D.DetectionParser};U.handle(D.Asset,r=>{const t=r.ref;Object.entries(rl).filter(([e])=>!!t[e]).forEach(([e,s])=>{var i;return U.add(Object.assign(t[e],{extension:(i=t[e].extension)!=null?i:s}))})},r=>{const t=r.ref;Object.keys(rl).filter(e=>!!t[e]).forEach(e=>U.remove(t[e]))});class ap{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let s=0;s(Array.isArray(r)||(r=[r]),t?r.map(s=>typeof s=="string"||e?t(s):s):r),ii=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};function il(r,t,e,s,i){const n=t[e];for(let a=0;a{const a=n.substring(1,n.length-1).split(",");i.push(a)}),il(r,i,0,e,s)}else s.push(r);return s}const Vs=r=>!Array.isArray(r);let op=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){return this._cache.get(t)}set(t,e){const s=Gt(t);let i;for(let o=0;o{i[o]=e}));const n=Object.keys(i),a={cacheKeys:n,keys:s};if(s.forEach(o=>{this._cacheMap.set(o,a)}),n.forEach(o=>{this._cache.has(o)&&this._cache.get(o),this._cache.set(o,i[o])}),e instanceof L){const o=e;s.forEach(h=>{o.baseTexture!==L.EMPTY.baseTexture&&X.addToCache(o.baseTexture,h),L.addToCache(o,h)})}}remove(t){if(!this._cacheMap.has(t))return;const e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s)}),e.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}};const Se=new op;var hp=Object.defineProperty,lp=Object.defineProperties,up=Object.getOwnPropertyDescriptors,al=Object.getOwnPropertySymbols,cp=Object.prototype.hasOwnProperty,dp=Object.prototype.propertyIsEnumerable,ol=(r,t,e)=>t in r?hp(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,fp=(r,t)=>{for(var e in t||(t={}))cp.call(t,e)&&ol(r,e,t[e]);if(al)for(var e of al(t))dp.call(t,e)&&ol(r,e,t[e]);return r},pp=(r,t)=>lp(r,up(t));class mp{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,s)=>(this._parsersValidated=!1,t[e]=s,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const s={promise:null,parser:null};return s.promise=(async()=>{var i,n;let a=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser]),!o){for(let h=0;h({alias:[l],src:l})),o=a.length,h=a.map(async l=>{const u=gt.toAbsolute(l.src);if(!i[l.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,l)),i[l.src]=await this.promiseCache[u].promise,e&&e(++s/o)}catch(c){throw delete this.promiseCache[u],delete i[l.src],new Error(`[Loader.load] Failed to load ${u}. +${c}`)}});return await Promise.all(h),n?i[a[0].src]:i}async unload(t){const e=Gt(t,s=>({alias:[s],src:s})).map(async s=>{var i,n;const a=gt.toAbsolute(s.src),o=this.promiseCache[a];if(o){const h=await o.promise;delete this.promiseCache[a],(n=(i=o.parser)==null?void 0:i.unload)==null||n.call(i,h,s,this)}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(t[e.name],pp(fp({},t),{[e.name]:e})),{})}}var $t=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))($t||{});const gp=".json",_p="application/json",hl={extension:{type:D.LoadParser,priority:$t.Low},name:"loadJson",test(r){return Ve(r,_p)||ve(r,gp)},async load(r){return await(await N.ADAPTER.fetch(r)).json()}};U.add(hl);const vp=".txt",yp="text/plain",ll={name:"loadTxt",extension:{type:D.LoadParser,priority:$t.Low},test(r){return Ve(r,yp)||ve(r,vp)},async load(r){return await(await N.ADAPTER.fetch(r)).text()}};U.add(ll);var xp=Object.defineProperty,bp=Object.defineProperties,Tp=Object.getOwnPropertyDescriptors,ul=Object.getOwnPropertySymbols,Ep=Object.prototype.hasOwnProperty,Ap=Object.prototype.propertyIsEnumerable,cl=(r,t,e)=>t in r?xp(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,wp=(r,t)=>{for(var e in t||(t={}))Ep.call(t,e)&&cl(r,e,t[e]);if(ul)for(var e of ul(t))Ap.call(t,e)&&cl(r,e,t[e]);return r},Sp=(r,t)=>bp(r,Tp(t));const Cp=["normal","bold","100","200","300","400","500","600","700","800","900"],Rp=[".ttf",".otf",".woff",".woff2"],Ip=["font/ttf","font/otf","font/woff","font/woff2"],Pp=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function dl(r){const t=gt.extname(r),e=gt.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let s=e.length>0;for(const n of e)if(!n.match(Pp)){s=!1;break}let i=e.join(" ");return s||(i=`"${i.replace(/[\\"]/g,"\\$&")}"`),i}const Mp=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Dp(r){return Mp.test(r)?r:encodeURI(r)}const fl={extension:{type:D.LoadParser,priority:$t.Low},name:"loadWebFont",test(r){return Ve(r,Ip)||ve(r,Rp)},async load(r,t){var e,s,i,n,a,o;const h=N.ADAPTER.getFontFaceSet();if(h){const l=[],u=(s=(e=t.data)==null?void 0:e.family)!=null?s:dl(r),c=(a=(n=(i=t.data)==null?void 0:i.weights)==null?void 0:n.filter(f=>Cp.includes(f)))!=null?a:["normal"],d=(o=t.data)!=null?o:{};for(let f=0;fN.ADAPTER.getFontFaceSet().delete(t))}};U.add(fl);const Op=`(function(){"use strict";const e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";async function a(){try{if(typeof createImageBitmap!="function")return!1;const A=await(await fetch(e)).blob(),t=await createImageBitmap(A);return t.width===1&&t.height===1}catch(A){return!1}}a().then(A=>{self.postMessage(A)})})(); +`;let ts=null,ea=class{constructor(){ts||(ts=URL.createObjectURL(new Blob([Op],{type:"application/javascript"}))),this.worker=new Worker(ts)}};ea.revokeObjectURL=function(){ts&&(URL.revokeObjectURL(ts),ts=null)};const Bp='(function(){"use strict";async function e(t){const a=await fetch(t);if(!a.ok)throw new Error(`[WorkerManager.loadImageBitmap] Failed to fetch ${t}: ${a.status} ${a.statusText}`);const s=await a.blob();return await createImageBitmap(s)}self.onmessage=async t=>{try{const a=await e(t.data.data[0]);self.postMessage({data:a,uuid:t.data.uuid,id:t.data.id},[a])}catch(a){self.postMessage({error:a,uuid:t.data.uuid,id:t.data.id})}}})();\n';let es=null;class pl{constructor(){es||(es=URL.createObjectURL(new Blob([Bp],{type:"application/javascript"}))),this.worker=new Worker(es)}}pl.revokeObjectURL=function(){es&&(URL.revokeObjectURL(es),es=null)};let ml=0,sa,Fp=class{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new ea;e.addEventListener("message",s=>{e.terminate(),ea.revokeObjectURL(),t(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){sa===void 0&&(sa=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers{this.complete(e.data),this.returnWorker(e.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){t.error!==void 0?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const s=new Promise((i,n)=>{this.queue.push({id:t,arguments:e,resolve:i,reject:n})});return this.next(),s}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),s=e.id;this.resolveHash[ml]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:ml++,id:s})}};const gl=new Fp;function ss(r,t,e){r.resource.internal=!0;const s=new L(r),i=()=>{delete t.promiseCache[e],Se.has(e)&&Se.remove(e)};return s.baseTexture.once("destroyed",()=>{e in t.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),i())}),s.once("destroyed",()=>{r.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),i())}),s}var Np=Object.defineProperty,_l=Object.getOwnPropertySymbols,Lp=Object.prototype.hasOwnProperty,Up=Object.prototype.propertyIsEnumerable,vl=(r,t,e)=>t in r?Np(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,yl=(r,t)=>{for(var e in t||(t={}))Lp.call(t,e)&&vl(r,e,t[e]);if(_l)for(var e of _l(t))Up.call(t,e)&&vl(r,e,t[e]);return r};const kp=[".jpeg",".jpg",".png",".webp",".avif"],Gp=["image/jpeg","image/png","image/webp","image/avif"];async function xl(r){const t=await N.ADAPTER.fetch(r);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const js={name:"loadTextures",extension:{type:D.LoadParser,priority:$t.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return Ve(r,Gp)||ve(r,kp)},async load(r,t,e){var s,i;const n=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let a;n?this.config.preferWorkers&&await gl.isImageBitmapSupported()?a=await gl.loadImageBitmap(r):a=await xl(r):a=await new Promise((l,u)=>{const c=new Image;c.crossOrigin=this.config.crossOrigin,c.src=r,c.complete?l(c):(c.onload=()=>l(c),c.onerror=d=>u(d))});const o=yl({},t.data);(s=o.resolution)!=null||(o.resolution=te(r)),n&&((i=o.resourceOptions)==null?void 0:i.ownsImageBitmap)===void 0&&(o.resourceOptions=yl({},o.resourceOptions),o.resourceOptions.ownsImageBitmap=!0);const h=new X(a,o);return h.resource.src=r,ss(h,e,r)},unload(r){r.destroy(!0)}};U.add(js);var $p=Object.defineProperty,bl=Object.getOwnPropertySymbols,Hp=Object.prototype.hasOwnProperty,Vp=Object.prototype.propertyIsEnumerable,Tl=(r,t,e)=>t in r?$p(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,jp=(r,t)=>{for(var e in t||(t={}))Hp.call(t,e)&&Tl(r,e,t[e]);if(bl)for(var e of bl(t))Vp.call(t,e)&&Tl(r,e,t[e]);return r};const Xp=".svg",zp="image/svg+xml",El={extension:{type:D.LoadParser,priority:$t.High},name:"loadSVG",test(r){return Ve(r,zp)||ve(r,Xp)},async testParse(r){return Wr.test(r)},async parse(r,t,e){var s;const i=new Wr(r,(s=t==null?void 0:t.data)==null?void 0:s.resourceOptions);await i.load();const n=new X(i,jp({resolution:te(r)},t==null?void 0:t.data));return n.resource.src=t.src,ss(n,e,t.src)},async load(r,t){return(await N.ADAPTER.fetch(r)).text()},unload:js.unload};U.add(El);var Wp=Object.defineProperty,Yp=Object.defineProperties,qp=Object.getOwnPropertyDescriptors,Al=Object.getOwnPropertySymbols,Kp=Object.prototype.hasOwnProperty,Zp=Object.prototype.propertyIsEnumerable,wl=(r,t,e)=>t in r?Wp(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Sl=(r,t)=>{for(var e in t||(t={}))Kp.call(t,e)&&wl(r,e,t[e]);if(Al)for(var e of Al(t))Zp.call(t,e)&&wl(r,e,t[e]);return r},Qp=(r,t)=>Yp(r,qp(t));const Jp=[".mp4",".m4v",".webm",".ogv"],tm=["video/mp4","video/webm","video/ogg"],Cl={name:"loadVideo",extension:{type:D.LoadParser,priority:$t.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(r){return Ve(r,tm)||ve(r,Jp)},async load(r,t,e){var s;let i;const n=await(await N.ADAPTER.fetch(r)).blob(),a=URL.createObjectURL(n);try{const o=Qp(Sl({autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline},(s=t==null?void 0:t.data)==null?void 0:s.resourceOptions),{autoLoad:!0}),h=new $n(a,o);await h.load();const l=new X(h,Sl({alphaMode:await oo(),resolution:te(r)},t==null?void 0:t.data));l.resource.src=r,i=ss(l,e,r),i.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(a)})}catch(o){throw URL.revokeObjectURL(a),o}return i},unload(r){r.destroy(!0)}};U.add(Cl);var em=Object.defineProperty,sm=Object.defineProperties,rm=Object.getOwnPropertyDescriptors,Rl=Object.getOwnPropertySymbols,im=Object.prototype.hasOwnProperty,nm=Object.prototype.propertyIsEnumerable,Il=(r,t,e)=>t in r?em(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,rs=(r,t)=>{for(var e in t||(t={}))im.call(t,e)&&Il(r,e,t[e]);if(Rl)for(var e of Rl(t))nm.call(t,e)&&Il(r,e,t[e]);return r},Pl=(r,t)=>sm(r,rm(t));class am{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){var e,s,i;if(this._bundleIdConnector=(e=t.connector)!=null?e:this._bundleIdConnector,this._createBundleAssetId=(s=t.createBundleAssetId)!=null?s:this._createBundleAssetId,this._extractAssetIdFromBundle=(i=t.extractAssetIdFromBundle)!=null?i:this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(s=>`${encodeURIComponent(s)}=${encodeURIComponent(e[s])}`).join("&")}}getAlias(t){const{alias:e,name:s,src:i,srcs:n}=t;return Gt(e||s||i||n,a=>{var o;return typeof a=="string"?a:Array.isArray(a)?a.map(h=>{var l,u;return(u=(l=h==null?void 0:h.src)!=null?l:h==null?void 0:h.srcs)!=null?u:h}):a!=null&&a.src||a!=null&&a.srcs?(o=a.src)!=null?o:a.srcs:a},!0)}addManifest(t){this._manifest,this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const s=[];Array.isArray(e)?e.forEach(i=>{var n,a;const o=(n=i.src)!=null?n:i.srcs,h=(a=i.alias)!=null?a:i.name;let l;if(typeof h=="string"){const u=this._createBundleAssetId(t,h);s.push(u),l=[h,u]}else{const u=h.map(c=>this._createBundleAssetId(t,c));s.push(...u),l=[...h,...u]}this.add(Pl(rs({},i),{alias:l,src:o}))}):Object.keys(e).forEach(i=>{var n;const a=[i,this._createBundleAssetId(t,i)];if(typeof e[i]=="string")this.add({alias:a,src:e[i]});else if(Array.isArray(e[i]))this.add({alias:a,src:e[i]});else{const o=e[i],h=(n=o.src)!=null?n:o.srcs;this.add(Pl(rs({},o),{alias:a,src:Array.isArray(h)?h:[h]}))}s.push(...a)}),this._bundles[t]=s}add(t,e,s,i,n){const a=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?a.push({alias:t,src:e,data:s,format:i,loadParser:n}):Array.isArray(t)?a.push(...t):a.push(t);let o;Gt(a).forEach(h=>{const{src:l,srcs:u}=h;let{data:c,format:d,loadParser:f}=h;const p=Gt(l||u).map(_=>typeof _=="string"?nl(_):Array.isArray(_)?_:[_]),m=this.getAlias(h),g=[];p.forEach(_=>{_.forEach(x=>{var y,b,T;let S={};if(typeof x!="object"){S.src=x;for(let A=0;A{this._assetMap[_]=g})})}resolveBundle(t){const e=Vs(t);t=Gt(t);const s={};return t.forEach(i=>{const n=this._bundles[i];if(n){const a=this.resolve(n),o={};for(const h in a){const l=a[h];o[this._extractAssetIdFromBundle(i,h)]=l}s[i]=o}}),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const s={};for(const i in e)s[i]=e[i].src;return s}return e.src}resolve(t){const e=Vs(t);t=Gt(t);const s={};return t.forEach(i=>{var n;if(!this._resolverHash[i])if(this._assetMap[i]){let a=this._assetMap[i];const o=a[0],h=this._getPreferredOrder(a);h==null||h.priority.forEach(l=>{h.params[l].forEach(u=>{const c=a.filter(d=>d[l]?d[l]===u:!1);c.length&&(a=c)})}),this._resolverHash[i]=(n=a[0])!=null?n:o}else this._resolverHash[i]=this.buildResolvedAsset({alias:[i],src:i},{});s[i]=this._resolverHash[i]}),e?s[t[0]]:s}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;en.params.format.includes(s.format));if(i)return i}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){var s,i;const{aliases:n,data:a,loadParser:o,format:h}=e;return(this._basePath||this._rootPath)&&(t.src=gt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=(s=n!=null?n:t.alias)!=null?s:[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data=rs(rs({},a||{}),t.data),t.loadParser=o!=null?o:t.loadParser,t.format=(i=h!=null?h:t.format)!=null?i:gt.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class Ml{constructor(){this._detections=[],this._initialized=!1,this.resolver=new am,this.loader=new mp,this.cache=Se,this._backgroundLoader=new ap(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var e,s,i;if(this._initialized)return;if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let h=t.manifest;typeof h=="string"&&(h=await this.load(h)),this.resolver.addManifest(h)}const n=(s=(e=t.texturePreference)==null?void 0:e.resolution)!=null?s:1,a=typeof n=="number"?[n]:n,o=await this._detectFormats({preferredFormats:(i=t.texturePreference)==null?void 0:i.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:o,resolution:a}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,s,i,n){this.resolver.add(t,e,s,i,n)}async load(t,e){this._initialized||await this.init();const s=Vs(t),i=Gt(t).map(o=>{if(typeof o!="string"){const h=this.resolver.getAlias(o);return h.some(l=>!this.resolver.hasKey(l))&&this.add(o),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(o)||this.add({alias:o,src:o}),o}),n=this.resolver.resolve(i),a=await this._mapLoadToResolve(n,e);return s?a[i[0]]:a}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let s=!1;typeof t=="string"&&(s=!0,t=[t]);const i=this.resolver.resolveBundle(t),n={},a=Object.keys(i);let o=0,h=0;const l=()=>{e==null||e(++o/h)},u=a.map(c=>{const d=i[c];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{n[c]=f})});return await Promise.all(u),s?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(s=>{this._backgroundLoader.add(Object.values(s))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return Se.get(t);const e={};for(let s=0;s{const l=n[o.src],u=[o.src];o.alias&&u.push(...o.alias),a[i[h]]=l,Se.set(u,l)}),a}async unload(t){this._initialized||await this.init();const e=Gt(t).map(i=>typeof i!="string"?i.src:i),s=this.resolver.resolve(e);await this._unloadFromResolved(s)}async unloadBundle(t){this._initialized||await this.init(),t=Gt(t);const e=this.resolver.resolveBundle(t),s=Object.keys(e).map(i=>this._unloadFromResolved(e[i]));await Promise.all(s)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(s=>{Se.remove(s.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const s of t.detections)t.skipDetections||await s.test()?e=await s.add(e):t.skipDetections||(e=await s.remove(e));return e=e.filter((s,i)=>e.indexOf(s)===i),e}get detections(){return this._detections}get preferWorkers(){return js.config.preferWorkers}set preferWorkers(t){this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(s=>s in t).forEach(s=>{e.config[s]=t[s]})})}}const Xs=new Ml;U.handleByList(D.LoadParser,Xs.loader.parsers).handleByList(D.ResolveParser,Xs.resolver.parsers).handleByList(D.CacheParser,Xs.cache.parsers).handleByList(D.DetectionParser,Xs.detections);const Dl={extension:D.CacheParser,test:r=>Array.isArray(r)&&r.every(t=>t instanceof L),getCacheableAssets:(r,t)=>{const e={};return r.forEach(s=>{t.forEach((i,n)=>{e[s+(n===0?"":n+1)]=i})}),e}};U.add(Dl);async function Ol(r){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(r)).blob();await createImageBitmap(t)}catch(t){return!1}return!0}return!1}const Bl={extension:{type:D.DetectionParser,priority:1},test:async()=>Ol("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")};U.add(Bl);const Fl={extension:{type:D.DetectionParser,priority:0},test:async()=>Ol("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};U.add(Fl);const Nl=["png","jpg","jpeg"],Ll={extension:{type:D.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...Nl],remove:async r=>r.filter(t=>!Nl.includes(t))};U.add(Ll);const om="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function ra(r){return om?!1:document.createElement("video").canPlayType(r)!==""}const Ul={extension:{type:D.DetectionParser,priority:0},test:async()=>ra("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")};U.add(Ul);const kl={extension:{type:D.DetectionParser,priority:0},test:async()=>ra("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")};U.add(kl);const Gl={extension:{type:D.DetectionParser,priority:0},test:async()=>ra("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")};U.add(Gl);const $l={extension:D.ResolveParser,test:js.test,parse:r=>{var t,e;return{resolution:parseFloat((e=(t=N.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:gt.extname(r).slice(1),src:r}}};U.add($l);var Tt=(r=>(r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r))(Tt||{});const zs={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35987:1,34798:1,37808:1,36492:1,36493:1,36494:1,36495:1};let ae,is;function Hl(){is={bptc:ae.getExtension("EXT_texture_compression_bptc"),astc:ae.getExtension("WEBGL_compressed_texture_astc"),etc:ae.getExtension("WEBGL_compressed_texture_etc"),s3tc:ae.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:ae.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:ae.getExtension("WEBGL_compressed_texture_pvrtc")||ae.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:ae.getExtension("WEBGL_compressed_texture_etc1"),atc:ae.getExtension("WEBGL_compressed_texture_atc")}}const Vl={extension:{type:D.DetectionParser,priority:2},test:async()=>{const r=N.ADAPTER.createCanvas().getContext("webgl");return r?(ae=r,!0):!1},add:async r=>{is||Hl();const t=[];for(const e in is)is[e]&&t.push(e);return[...t,...r]},remove:async r=>(is||Hl(),r.filter(t=>!(t in is)))};U.add(Vl);class jl extends Ts{constructor(t,e={width:1,height:1,autoLoad:!0}){let s,i;typeof t=="string"?(s=t,i=new Uint8Array):(s=null,i=t),super(i,e),this.origin=s,this.buffer=i?new Ar(i):null,this._load=null,this.loaded=!1,this.origin!==null&&e.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load?this._load:(this._load=fetch(this.origin).then(t=>t.blob()).then(t=>t.arrayBuffer()).then(t=>(this.data=new Uint32Array(t),this.buffer=new Ar(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Ce extends jl{constructor(t,e){super(t,e),this.format=e.format,this.levels=e.levels||1,this._width=e.width,this._height=e.height,this._extension=Ce._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Ce._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,s){const i=t.gl;if(!t.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;i.pixelStorei(i.UNPACK_ALIGNMENT,4);for(let n=0,a=this.levels;n=33776&&t<=33779)return"s3tc";if(t>=35916&&t<=35919)return"s3tc_sRGB";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t===36196)return"etc1";if(t===35986||t===35987||t===34798)return"atc";if(t>=36492&&t<=36495)return"bptc";if(t===37808)return"astc";throw new Error(`Invalid (compressed) texture format given: ${t}`)}static _createLevelBuffers(t,e,s,i,n,a,o){const h=new Array(s);let l=t.byteOffset,u=a,c=o,d=u+i-1&~(i-1),f=c+n-1&~(n-1),p=d*f*zs[e];for(let m=0;m1?u:d,levelHeight:s>1?c:f,levelBuffer:new Uint8Array(t.buffer,l,p)},l+=p,u=u>>1||1,c=c>>1||1,d=u+i-1&~(i-1),f=c+n-1&~(n-1),p=d*f*zs[e];return h}}const ia=4,ni=124,hm=32,Xl=20,lm=542327876,ai={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},um={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},oi={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},cm=1,dm=2,fm=4,pm=64,mm=512,gm=131072,_m=827611204,vm=861165636,ym=894720068,xm=808540228,bm=4,Tm={[_m]:Tt.COMPRESSED_RGBA_S3TC_DXT1_EXT,[vm]:Tt.COMPRESSED_RGBA_S3TC_DXT3_EXT,[ym]:Tt.COMPRESSED_RGBA_S3TC_DXT5_EXT},Em={70:Tt.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Tt.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Tt.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Tt.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Tt.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Tt.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Tt.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Tt.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Tt.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:Tt.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:Tt.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:Tt.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:Tt.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function zl(r){const t=new Uint32Array(r);if(t[0]!==lm)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(r,0,ni/Uint32Array.BYTES_PER_ELEMENT),s=e[ai.HEIGHT],i=e[ai.WIDTH],n=e[ai.MIPMAP_COUNT],a=new Uint32Array(r,ai.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,hm/Uint32Array.BYTES_PER_ELEMENT),o=a[cm];if(o&fm){const h=a[um.FOURCC];if(h!==xm){const x=Tm[h],y=ia+ni,b=new Uint8Array(r,y);return[new Ce(b,{format:x,width:i,height:s,levels:n})]}const l=ia+ni,u=new Uint32Array(t.buffer,l,Xl/Uint32Array.BYTES_PER_ELEMENT),c=u[oi.DXGI_FORMAT],d=u[oi.RESOURCE_DIMENSION],f=u[oi.MISC_FLAG],p=u[oi.ARRAY_SIZE],m=Em[c];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(f===bm)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const g=new Array,_=ia+ni+Xl;if(p===1)g.push(new Uint8Array(r,_));else{const x=zs[m];let y=0,b=i,T=s;for(let A=0;A>>1,T=T>>>1}let S=_;for(let A=0;Anew Ce(x,{format:m,width:i,height:s,levels:n}))}throw o&pm?new Error("DDSParser does not support uncompressed texture data."):o&mm?new Error("DDSParser does not supported YUV uncompressed texture data."):o&gm?new Error("DDSParser does not support single-channel (lumninance) texture data!"):o&dm?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}const Wl=[171,75,84,88,32,49,49,187,13,10,26,10],Am=67305985,qt={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},na=64,aa={[$.UNSIGNED_BYTE]:1,[$.UNSIGNED_SHORT]:2,[$.INT]:4,[$.UNSIGNED_INT]:4,[$.FLOAT]:4,[$.HALF_FLOAT]:8},Yl={[P.RGBA]:4,[P.RGB]:3,[P.RG]:2,[P.RED]:1,[P.LUMINANCE]:1,[P.LUMINANCE_ALPHA]:2,[P.ALPHA]:1},ql={[$.UNSIGNED_SHORT_4_4_4_4]:2,[$.UNSIGNED_SHORT_5_5_5_1]:2,[$.UNSIGNED_SHORT_5_6_5]:2};function Kl(r,t,e=!1){const s=new DataView(t);if(!wm(r,s))return null;const i=s.getUint32(qt.ENDIANNESS,!0)===Am,n=s.getUint32(qt.GL_TYPE,i),a=s.getUint32(qt.GL_FORMAT,i),o=s.getUint32(qt.GL_INTERNAL_FORMAT,i),h=s.getUint32(qt.PIXEL_WIDTH,i),l=s.getUint32(qt.PIXEL_HEIGHT,i)||1,u=s.getUint32(qt.PIXEL_DEPTH,i)||1,c=s.getUint32(qt.NUMBER_OF_ARRAY_ELEMENTS,i)||1,d=s.getUint32(qt.NUMBER_OF_FACES,i),f=s.getUint32(qt.NUMBER_OF_MIPMAP_LEVELS,i),p=s.getUint32(qt.BYTES_OF_KEY_VALUE_DATA,i);if(l===0||u!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(c!==1)throw new Error("WebGL does not support array textures");const m=4,g=4,_=h+3&-4,x=l+3&-4,y=new Array(c);let b=h*l;n===0&&(b=_*x);let T;if(n!==0?aa[n]?T=aa[n]*Yl[a]:T=ql[n]:T=zs[o],T===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const S=e?Cm(s,p,i):null;let A=b*T,w=h,R=l,M=_,H=x,B=na+p;for(let E=0;E1||n!==0?w:M,levelHeight:f>1||n!==0?R:H,levelBuffer:new Uint8Array(t,V,A)},V+=A}B+=I+4,B=B%4!==0?B+4-B%4:B,w=w>>1||1,R=R>>1||1,M=w+m-1&~(m-1),H=R+g-1&~(g-1),A=M*H*T}return n!==0?{uncompressed:y.map(E=>{let I=E[0].levelBuffer,V=!1;return n===$.FLOAT?I=new Float32Array(E[0].levelBuffer.buffer,E[0].levelBuffer.byteOffset,E[0].levelBuffer.byteLength/4):n===$.UNSIGNED_INT?(V=!0,I=new Uint32Array(E[0].levelBuffer.buffer,E[0].levelBuffer.byteOffset,E[0].levelBuffer.byteLength/4)):n===$.INT&&(V=!0,I=new Int32Array(E[0].levelBuffer.buffer,E[0].levelBuffer.byteOffset,E[0].levelBuffer.byteLength/4)),{resource:new Ts(I,{width:E[0].levelWidth,height:E[0].levelHeight}),type:n,format:V?Sm(a):a}}),kvData:S}:{compressed:y.map(E=>new Ce(null,{format:o,width:h,height:l,levels:f,levelBuffers:E})),kvData:S}}function wm(r,t){for(let e=0;et-i){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;ht in r?Rm(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Mm=(r,t)=>{for(var e in t||(t={}))Im.call(t,e)&&Ql(r,e,t[e]);if(Zl)for(var e of Zl(t))Pm.call(t,e)&&Ql(r,e,t[e]);return r};const Jl={extension:{type:D.LoadParser,priority:$t.High},name:"loadDDS",test(r){return ve(r,".dds")},async load(r,t,e){const s=await(await N.ADAPTER.fetch(r)).arrayBuffer(),i=zl(s).map(n=>{const a=new X(n,Mm({mipmap:Ht.OFF,alphaMode:wt.NO_PREMULTIPLIED_ALPHA,resolution:te(r)},t.data));return ss(a,e,r)});return i.length===1?i[0]:i},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};U.add(Jl);var Dm=Object.defineProperty,tu=Object.getOwnPropertySymbols,Om=Object.prototype.hasOwnProperty,Bm=Object.prototype.propertyIsEnumerable,eu=(r,t,e)=>t in r?Dm(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Fm=(r,t)=>{for(var e in t||(t={}))Om.call(t,e)&&eu(r,e,t[e]);if(tu)for(var e of tu(t))Bm.call(t,e)&&eu(r,e,t[e]);return r};const su={extension:{type:D.LoadParser,priority:$t.High},name:"loadKTX",test(r){return ve(r,".ktx")},async load(r,t,e){const s=await(await N.ADAPTER.fetch(r)).arrayBuffer(),{compressed:i,uncompressed:n,kvData:a}=Kl(r,s),o=i!=null?i:n,h=Fm({mipmap:Ht.OFF,alphaMode:wt.NO_PREMULTIPLIED_ALPHA,resolution:te(r)},t.data),l=o.map(u=>{var c;o===n&&Object.assign(h,{type:u.type,format:u.format});const d=(c=u.resource)!=null?c:u,f=new X(d,h);return f.ktxKeyValueData=a,ss(f,e,r)});return l.length===1?l[0]:l},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};U.add(su);const Nm=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],ru={extension:D.ResolveParser,test:r=>{const t=gt.extname(r).slice(1);return["basis","ktx","dds"].includes(t)},parse:r=>{var t,e,s,i;const n=r.split("."),a=n.pop();if(["ktx","dds"].includes(a)){const o=n.pop();if(Nm.includes(o))return{resolution:parseFloat((e=(t=N.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:o,src:r}}return{resolution:parseFloat((i=(s=N.RETINA_PREFIX.exec(r))==null?void 0:s[1])!=null?i:"1"),format:a,src:r}}};U.add(ru);const hi=new z,Lm=4,iu=class lr{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}async image(t,e,s,i){const n=new Image;return n.src=await this.base64(t,e,s,i),n}async base64(t,e,s,i){const n=this.canvas(t,i);if(n.toBlob!==void 0)return new Promise((a,o)=>{n.toBlob(h=>{if(!h){o(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>a(l.result),l.onerror=o,l.readAsDataURL(h)},e,s)});if(n.toDataURL!==void 0)return n.toDataURL(e,s);if(n.convertToBlob!==void 0){const a=await n.convertToBlob({type:e,quality:s});return new Promise((o,h)=>{const l=new FileReader;l.onload=()=>o(l.result),l.onerror=h,l.readAsDataURL(a)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:s,width:i,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(t,e);a&&lr._flipY(s,i,n),o&&lr._unpremultiplyAlpha(s);const h=new bs(i,n,1),l=new ImageData(new Uint8ClampedArray(s.buffer),i,n);return h.context.putImageData(l,0,0),h.canvas}pixels(t,e){const{pixels:s,width:i,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(t,e);return a&&lr._flipY(s,i,n),o&&lr._unpremultiplyAlpha(s),s}_rawPixels(t,e){const s=this.renderer;if(!s)throw new Error("The Extract has already been destroyed");let i,n=!1,a=!1,o,h=!1;t&&(t instanceof Yt?o=t:(o=s.generateTexture(t,{region:e,resolution:s.resolution,multisample:s.multisample}),h=!0,e&&(hi.width=e.width,hi.height=e.height,e=hi)));const l=s.gl;if(o){if(i=o.baseTexture.resolution,e=e!=null?e:o.frame,n=!1,a=o.baseTexture.alphaMode>0&&o.baseTexture.format===P.RGBA,!h){s.renderTexture.bind(o);const f=o.framebuffer.glFramebuffers[s.CONTEXT_UID];f.blitFramebuffer&&s.framebuffer.bind(f.blitFramebuffer)}}else i=s.resolution,e||(e=hi,e.width=s.width/i,e.height=s.height/i),n=!0,a=this._rendererPremultipliedAlpha,s.renderTexture.bind();const u=Math.max(Math.round(e.width*i),1),c=Math.max(Math.round(e.height*i),1),d=new Uint8Array(Lm*u*c);return l.readPixels(Math.round(e.x*i),Math.round(e.y*i),u,c,l.RGBA,l.UNSIGNED_BYTE,d),h&&(o==null||o.destroy(!0)),{pixels:d,width:u,height:c,flipY:n,premultipliedAlpha:a}}destroy(){this.renderer=null}static _flipY(t,e,s){const i=e<<2,n=s>>1,a=new Uint8Array(i);for(let o=0;o=0&&o>=0&&i>=0&&n>=0)){t.length=0;return}const h=Math.ceil(2.3*Math.sqrt(a+o)),l=h*8+(i?4:0)+(n?4:0);if(t.length=l,l===0)return;if(h===0){t.length=8,t[0]=t[6]=e+i,t[1]=t[3]=s+n,t[2]=t[4]=e-i,t[5]=t[7]=s-n;return}let u=0,c=h*4+(i?2:0)+2,d=c,f=l;{const p=i+a,m=n,g=e+p,_=e-p,x=s+m;if(t[u++]=g,t[u++]=x,t[--c]=x,t[--c]=_,n){const y=s-m;t[d++]=_,t[d++]=y,t[--f]=y,t[--f]=g}}for(let p=1;p0||t&&s<=0){const i=e/2;for(let n=i+i%2;n=6){au(e,!1);const a=[];for(let l=0;l=0&&n>=0&&a.push(e,s,e+i,s,e+i,s+n,e,s+n)},triangulate(r,t){const e=r.points,s=t.points;if(e.length===0)return;const i=s.length/2;s.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(i,i+1,i+2,i+1,i+2,i+3)}},hu={build(r){Ws.build(r)},triangulate(r,t){Ws.triangulate(r,t)}};var Mt=(r=>(r.MITER="miter",r.BEVEL="bevel",r.ROUND="round",r))(Mt||{}),ye=(r=>(r.BUTT="butt",r.ROUND="round",r.SQUARE="square",r))(ye||{});const Re={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(r,t=20){if(!this.adaptive||!r||isNaN(r))return t;let e=Math.ceil(r/this.maxLength);return ethis.maxSegments&&(e=this.maxSegments),e}},Um=Re;class ha{static curveTo(t,e,s,i,n,a){const o=a[a.length-2],h=a[a.length-1]-e,l=o-t,u=i-e,c=s-t,d=Math.abs(h*c-l*u);if(d<1e-8||n===0)return(a[a.length-2]!==t||a[a.length-1]!==e)&&a.push(t,e),null;const f=h*h+l*l,p=u*u+c*c,m=h*u+l*c,g=n*Math.sqrt(f)/d,_=n*Math.sqrt(p)/d,x=g*m/f,y=_*m/p,b=g*c+_*l,T=g*u+_*h,S=l*(_+x),A=h*(_+x),w=c*(g+y),R=u*(g+y),M=Math.atan2(A-T,S-b),H=Math.atan2(R-T,w-b);return{cx:b+t,cy:T+e,radius:n,startAngle:M,endAngle:H,anticlockwise:l*u>c*h}}static arc(t,e,s,i,n,a,o,h,l){const u=o-a,c=Re._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/As)*40),d=u/(c*2),f=d*2,p=Math.cos(d),m=Math.sin(d),g=c-1,_=g%1/g;for(let x=0;x<=g;++x){const y=x+_*x,b=d+a+f*y,T=Math.cos(b),S=-Math.sin(b);l.push((p*T+m*S)*n+s,(p*-S+m*T)*n+i)}}}class lu{constructor(){this.reset()}begin(t,e,s){this.reset(),this.style=t,this.start=e,this.attribStart=s}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class li{static curveLength(t,e,s,i,n,a,o,h){let l=0,u=0,c=0,d=0,f=0,p=0,m=0,g=0,_=0,x=0,y=0,b=t,T=e;for(let S=1;S<=10;++S)u=S/10,c=u*u,d=c*u,f=1-u,p=f*f,m=p*f,g=m*t+3*p*u*s+3*f*c*n+d*o,_=m*e+3*p*u*i+3*f*c*a+d*h,x=b-g,y=T-_,b=g,T=_,l+=Math.sqrt(x*x+y*y);return l}static curveTo(t,e,s,i,n,a,o){const h=o[o.length-2],l=o[o.length-1];o.length-=2;const u=Re._segmentsCount(li.curveLength(h,l,t,e,s,i,n,a));let c=0,d=0,f=0,p=0,m=0;o.push(h,l);for(let g=1,_=0;g<=u;++g)_=g/u,c=1-_,d=c*c,f=d*c,p=_*_,m=p*_,o.push(f*h+3*d*_*t+3*c*p*s+m*n,f*l+3*d*_*e+3*c*p*i+m*a)}}function uu(r,t,e,s,i,n,a,o){const h=r-e*i,l=t-s*i,u=r+e*n,c=t+s*n;let d,f;a?(d=s,f=-e):(d=-s,f=e);const p=h+d,m=l+f,g=u+d,_=c+f;return o.push(p,m,g,_),2}function je(r,t,e,s,i,n,a,o){const h=e-r,l=s-t;let u=Math.atan2(h,l),c=Math.atan2(i-r,n-t);o&&uc&&(c+=Math.PI*2);let d=u;const f=c-u,p=Math.abs(f),m=Math.sqrt(h*h+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,_=f/g;if(d+=_,o){a.push(r,t,e,s);for(let x=1,y=d;x=0&&(n.join===Mt.ROUND?d+=je(y,b,y-A*E,b-w*E,y-R*E,b-M*E,u,!1)+4:d+=2,u.push(y-R*I,b-M*I,y+R*E,b+M*E));continue}const st=(-A+_)*(-w+b)-(-A+y)*(-w+x),et=(-R+T)*(-M+b)-(-R+y)*(-M+S),it=(W*et-F*st)/Q,lt=(O*st-ht*et)/Q,vt=(it-y)*(it-y)+(lt-b)*(lt-b),nt=y+(it-y)*E,ut=b+(lt-b)*E,mt=y-(it-y)*I,yt=b-(lt-b)*I,oe=Math.min(W*W+ht*ht,F*F+O*O),he=J?E:I,nr=oe+he*he*m,xg=vt<=nr;let xi=n.join;if(xi===Mt.MITER&&vt/m>g&&(xi=Mt.BEVEL),xg)switch(xi){case Mt.MITER:{u.push(nt,ut,mt,yt);break}case Mt.BEVEL:{J?u.push(nt,ut,y+A*I,b+w*I,nt,ut,y+R*I,b+M*I):u.push(y-A*E,b-w*E,mt,yt,y-R*E,b-M*E,mt,yt),d+=2;break}case Mt.ROUND:{J?(u.push(nt,ut,y+A*I,b+w*I),d+=je(y,b,y+A*I,b+w*I,y+R*I,b+M*I,u,!0)+4,u.push(nt,ut,y+R*I,b+M*I)):(u.push(y-A*E,b-w*E,mt,yt),d+=je(y,b,y-A*E,b-w*E,y-R*E,b-M*E,u,!1)+4,u.push(y-R*E,b-M*E,mt,yt));break}}else{switch(u.push(y-A*E,b-w*E,y+A*I,b+w*I),xi){case Mt.MITER:{J?u.push(mt,yt,mt,yt):u.push(nt,ut,nt,ut),d+=2;break}case Mt.ROUND:{J?d+=je(y,b,y+A*I,b+w*I,y+R*I,b+M*I,u,!0)+2:d+=je(y,b,y-A*E,b-w*E,y-R*E,b-M*E,u,!1)+2;break}}u.push(y-R*E,b-M*E,y+R*I,b+M*I),d+=2}}_=s[(c-2)*2],x=s[(c-2)*2+1],y=s[(c-1)*2],b=s[(c-1)*2+1],A=-(x-b),w=_-y,H=Math.sqrt(A*A+w*w),A/=H,w/=H,A*=p,w*=p,u.push(y-A*E,b-w*E,y+A*I,b+w*I),h||(n.cap===ye.ROUND?d+=je(y-A*(E-I)*.5,b-w*(E-I)*.5,y-A*E,b-w*E,y+A*I,b+w*I,u,!1)+2:n.cap===ye.SQUARE&&(d+=uu(y,b,A,w,E,I,!1,u)));const V=t.indices,q=Re.epsilon*Re.epsilon;for(let j=f;j0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,s=null,i=null){const n=new qs(t,e,s,i);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const s=new qs(t,null,null,e),i=this.graphicsData[this.graphicsData.length-1];return s.lineStyle=i.lineStyle,i.holes.push(s),this.dirty++,this}destroy(){super.destroy();for(let t=0;t0&&(s=this.batches[this.batches.length-1],i=s.style);for(let h=this.shapeIndex;h65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&o===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=o?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t65535*2)return!1;const t=this.batches;for(let e=0;e0&&(i=Ys.pop(),i||(i=new Sr,i.texArray=new Nr),this.drawCalls.push(i)),i.start=u,i.size=0,i.texArray.count=0,i.type=l),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=Zt.REPEAT,i.texArray.elements[i.texArray.count++]=m,n++)),i.size+=d.size,u+=d.size,o=m._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,o,d.attribSize,d.attribStart)}X._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,s=this.colors,i=this.textureIds,n=new ArrayBuffer(t.length*3*4),a=new Float32Array(n),o=new Uint32Array(n);let h=0;for(let l=0;l0&&t.alpha>0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:s},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new Be,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Be,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const s=this.currentPath.points,i=s[s.length-2],n=s[s.length-1];return(i!==t||n!==e)&&s.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,s,i){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),ui.curveTo(t,e,s,i,n),this}bezierCurveTo(t,e,s,i,n,a){return this._initCurve(),li.curveTo(t,e,s,i,n,a,this.currentPath.points),this}arcTo(t,e,s,i,n){this._initCurve(t,e);const a=this.currentPath.points,o=ha.curveTo(t,e,s,i,n,a);if(o){const{cx:h,cy:l,radius:u,startAngle:c,endAngle:d,anticlockwise:f}=o;this.arc(h,l,u,c,d,f)}return this}arc(t,e,s,i,n,a=!1){if(i===n)return this;if(!a&&n<=i?n+=As:a&&i<=n&&(i+=As),n-i===0)return this;const o=t+Math.cos(i)*s,h=e+Math.sin(i)*s,l=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const c=Math.abs(u[u.length-2]-o),d=Math.abs(u[u.length-1]-h);c0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:s},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,s,i){return this.drawShape(new z(t,e,s,i))}drawRoundedRect(t,e,s,i,n){return this.drawShape(new Pr(t,e,s,i,n))}drawCircle(t,e,s){return this.drawShape(new Rr(t,e,s))}drawEllipse(t,e,s,i){return this.drawShape(new Ir(t,e,s,i))}drawPolygon(...t){let e,s=!0;const i=t[0];i.points?(s=i.closeStroke,e=i.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new Be(e);return n.closeStroke=s,this.drawShape(n),this}drawShape(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const t=this._geometry.graphicsData;return t.length===1&&t[0].shape.type===rt.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){const t=this._geometry,e=this.blendMode,s=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=s,this.vertexData=new Float32Array(t.points);for(let i=0;i0){const p=h.x-t[d].x,m=h.y-t[d].y,g=Math.sqrt(p*p+m*m);h=t[d],o+=g/l}else o=d/(u-1);n[f]=o,n[f+1]=0,n[f+2]=o,n[f+3]=1}let c=0;for(let d=0;d0?this.textureScale*this._width/2:this._width/2;for(let l=0;l1&&(d=1);const f=Math.sqrt(i*i+n*n);f<1e-6?(i=0,n=0):(i/=f,n/=f,i*=h,n*=h),a[c]=u.x+i,a[c+1]=u.y+n,a[c+2]=u.x-i,a[c+3]=u.y-n,e=u}this.buffers[0].update()}update(){this.textureScale>0?this.build():this.updateVertices()}}class vu extends At{constructor(t,e,s){const i=new gu(t.width,t.height,e,s),n=new Xe(L.WHITE);super(i,n),this.texture=t,this.autoResize=!0}textureUpdated(){this._textureID=this.shader.texture._updateID;const t=this.geometry,{width:e,height:s}=this.shader.texture;this.autoResize&&(t.width!==e||t.height!==s)&&(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())}set texture(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))}get texture(){return this.shader.texture}_render(t){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),super._render(t)}destroy(t){this.shader.texture.off("update",this.textureUpdated,this),super.destroy(t)}}const fi=10;class Qs extends vu{constructor(t,e,s,i,n){var a,o,h,l,u,c,d,f;super(L.WHITE,4,4),this._origWidth=t.orig.width,this._origHeight=t.orig.height,this._width=this._origWidth,this._height=this._origHeight,this._leftWidth=(o=e!=null?e:(a=t.defaultBorders)==null?void 0:a.left)!=null?o:fi,this._rightWidth=(l=i!=null?i:(h=t.defaultBorders)==null?void 0:h.right)!=null?l:fi,this._topHeight=(c=s!=null?s:(u=t.defaultBorders)==null?void 0:u.top)!=null?c:fi,this._bottomHeight=(f=n!=null?n:(d=t.defaultBorders)==null?void 0:d.bottom)!=null?f:fi,this.texture=t}textureUpdated(){this._textureID=this.shader.texture._updateID,this._refresh()}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}updateHorizontalVertices(){const t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height}updateVerticalVertices(){const t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width}_getMinScale(){const t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,s=this._topHeight+this._bottomHeight,i=this._height>s?1:this._height/s;return Math.min(e,i)}get width(){return this._width}set width(t){this._width=t,this._refresh()}get height(){return this._height}set height(t){this._height=t,this._refresh()}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this._refresh()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this._refresh()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this._refresh()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this._refresh()}_refresh(){const t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;const s=1/this._origWidth,i=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=s*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-s*this._rightWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}class yu extends At{constructor(t=L.EMPTY,e,s,i,n){const a=new Zs(e,s,i);a.getBuffer("aVertexPosition").static=!1;const o=new Xe(t);super(a,o,null,n),this.autoUpdate=!0}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}_render(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),super._render(t)}}class xu extends At{constructor(t,e,s=0){const i=new _u(t.height,e,s),n=new Xe(t);s>0&&(t.baseTexture.wrapMode=Zt.REPEAT),super(i,n),this.autoUpdate=!0}_render(t){const e=this.geometry;(this.autoUpdate||e._width!==this.shader.texture.height)&&(e._width=this.shader.texture.height,e.update()),super._render(t)}}class bu{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function jm(r,t){var e;let s=!1;if((e=r==null?void 0:r._textures)!=null&&e.length){for(let i=0;i{this.queue&&this.prepareItems()},this.registerFindHook(qm),this.registerFindHook(Km),this.registerFindHook(jm),this.registerFindHook(Xm),this.registerFindHook(zm),this.registerUploadHook(Wm),this.registerUploadHook(Ym)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,bt.system.addOnce(this.tick,this,me.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const t=this.queue[0];let e=!1;if(t&&!t._destroyed){for(let s=0,i=this.uploadHooks.length;s=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&bt.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null}};Tu.uploadsPerFrame=4;let Js=Tu;Object.defineProperties(N,{UPLOADS_PER_FRAME:{get(){return Js.uploadsPerFrame},set(r){Js.uploadsPerFrame=r}}});function Eu(r,t){return t instanceof X?(t._glTextures[r.CONTEXT_UID]||r.texture.bind(t),!0):!1}function Zm(r,t){if(!(t instanceof as))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:s}=e;for(let i=0;i=this._durations[this.currentFrame];)i-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=i/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrames)&&this.onLoop(),this.updateTexture())}updateTexture(){const t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(t){this.stop(),super.destroy(t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let s=0;sthis.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);const e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(bt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(bt.shared.add(this.update,this),this._isConnectedToTicker=!0))}}const Au=class ur{constructor(t,e,s){this.linkedSheets=[],(t instanceof X||t instanceof L)&&(t={texture:t,data:e,resolutionFilename:s});const{texture:i,data:n,resolutionFilename:a=null,cachePrefix:o=""}=t;this.cachePrefix=o,this._texture=i instanceof L?i:null,this.baseTexture=i instanceof X?i:this._texture.baseTexture,this.textures={},this.animations={},this.data=n;const h=this.baseTexture.resource;this.resolution=this._updateResolution(a||(h?h.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){const{scale:e}=this.data.meta;let s=te(t,null);return s===null&&(s=typeof e=="number"?e:parseFloat(e!=null?e:"1")),s!==1&&this.baseTexture.setResolution(s),s}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=ur.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const s=ur.BATCH_SIZE;for(;e-t{this._batchIndex*ur.BATCH_SIZE{s[i]=t}),Object.keys(t.textures).forEach(i=>{s[`${t.cachePrefix}${i}`]=t.textures[i]}),!e){const i=gt.dirname(r[0]);t.linkedSheets.forEach((n,a)=>{Object.assign(s,wu([`${i}/${t.data.meta.related_multi_packs[a]}`],n,!0))})}return s}const Su={extension:D.Asset,cache:{test:r=>r instanceof ma,getCacheableAssets:(r,t)=>wu(r,t,!1)},resolver:{test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),s=t.pop();return e==="json"&&tg.includes(s)},parse:r=>{var t,e;const s=r.split(".");return{resolution:parseFloat((e=(t=N.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:s[s.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:D.LoadParser,priority:$t.Normal},async testParse(r,t){return gt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var s,i,n;const{texture:a,imageFilename:o,cachePrefix:h}=(s=t==null?void 0:t.data)!=null?s:{};let l=gt.dirname(t.src);l&&l.lastIndexOf("/")!==l.length-1&&(l+="/");let u;if(a&&a.baseTexture)u=a;else{const f=ii(l+(o!=null?o:r.meta.image),t.src);u=(await e.load([f]))[f]}const c=new ma({texture:u.baseTexture,data:r,resolutionFilename:t.src,cachePrefix:h});await c.parse();const d=(i=r==null?void 0:r.meta)==null?void 0:i.related_multi_packs;if(Array.isArray(d)){const f=[];for(const m of d){if(typeof m!="string")continue;let g=l+m;(n=t.data)!=null&&n.ignoreMultiPack||(g=ii(g,t.src),f.push(e.load({src:g,data:{ignoreMultiPack:!0}})))}const p=await Promise.all(f);c.linkedSheets=p,p.forEach(m=>{m.linkedSheets=[c].concat(c.linkedSheets.filter(g=>g!==m))})}return c},unload(r){r.destroy(!0)}}};U.add(Su);class tr{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class er{static test(t){return typeof t=="string"&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),s={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in e){const a=e[n].match(/^[a-z]+/gm)[0],o=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const l in o){const u=o[l].split("="),c=u[0],d=u[1].replace(/"/gm,""),f=parseFloat(d),p=isNaN(f)?d:f;h[c]=p}s[a].push(h)}const i=new tr;return s.info.forEach(n=>i.info.push({face:n.face,size:parseInt(n.size,10)})),s.common.forEach(n=>i.common.push({lineHeight:parseInt(n.lineHeight,10)})),s.page.forEach(n=>i.page.push({id:parseInt(n.id,10),file:n.file})),s.char.forEach(n=>i.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),s.kerning.forEach(n=>i.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),s.distanceField.forEach(n=>i.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),i}}class mi{static test(t){const e=t;return typeof t!="string"&&"getElementsByTagName"in t&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(t){const e=new tr,s=t.getElementsByTagName("info"),i=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),a=t.getElementsByTagName("char"),o=t.getElementsByTagName("kerning"),h=t.getElementsByTagName("distanceField");for(let l=0;l")?mi.test(N.ADAPTER.parseXML(t)):!1}static parse(t){return mi.parse(N.ADAPTER.parseXML(t))}}const ga=[er,mi,gi];function Cu(r){for(let t=0;tt in r?ig(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ng=(r,t)=>{for(var e in t||(t={}))Iu.call(t,e)&&Mu(r,e,t[e]);if(vi)for(var e of vi(t))Pu.call(t,e)&&Mu(r,e,t[e]);return r},ag=(r,t)=>{var e={};for(var s in r)Iu.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&vi)for(var s of vi(r))t.indexOf(s)<0&&Pu.call(r,s)&&(e[s]=r[s]);return e};const Ie=class le{constructor(t,e,s){var i,n;const[a]=t.info,[o]=t.common,[h]=t.page,[l]=t.distanceField,u=te(h.file),c={};this._ownsTextures=s,this.font=a.face,this.size=a.size,this.lineHeight=o.lineHeight/u,this.chars={},this.pageTextures=c;for(let d=0;d=l-B*o){if(g===0)throw new Error(`[BitmapFont] textureHeight ${l}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${R}')`);--w,_=null,x=null,y=null,g=0,m=0,b=0;continue}if(b=Math.max(B+M.fontProperties.descent,b),E*o+m>=f){if(m===0)throw new Error(`[BitmapFont] textureWidth ${h}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${R}')`);--w,g+=b*o,g=Math.ceil(g),m=0,b=0;continue}sg(_,x,M,m,g,o,d);const I=_i(M.text);p.char.push({id:I,page:S.length-1,x:m/o,y:g/o,width:E,height:B,xoffset:0,yoffset:0,xadvance:H-(d.dropShadow?d.dropShadowDistance:0)-(d.stroke?d.strokeThickness:0)}),m+=(E+2*a)*o,m=Math.ceil(m)}if(!(s!=null&&s.skipKerning))for(let w=0,R=c.length;w 0.99) {\r + alpha = 1.0;\r + }\r +\r + // Gamma correction for coverage-like alpha\r + float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r + float gamma = mix(1.0, 1.0 / 2.2, luma);\r + float coverage = pow(uColor.a * alpha, gamma); \r +\r + // NPM Textures, NPM outputs\r + gl_FragColor = vec4(uColor.rgb, coverage);\r +}\r +`,hg=`// Mesh material default fragment\r +attribute vec2 aVertexPosition;\r +attribute vec2 aTextureCoord;\r +\r +uniform mat3 projectionMatrix;\r +uniform mat3 translationMatrix;\r +uniform mat3 uTextureMatrix;\r +\r +varying vec2 vTextureCoord;\r +\r +void main(void)\r +{\r + gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r +\r + vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r +}\r +`;const Du=[],Ou=[],Bu=[],Fu=class Xu extends Ct{constructor(t,e={}){super();const{align:s,tint:i,maxWidth:n,letterSpacing:a,fontName:o,fontSize:h}=Object.assign({},Xu.styleDefaults,e);if(!xe.available[o])throw new Error(`Missing BitmapFont "${o}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=s,this._tintColor=new Y(i),this._font=void 0,this._fontName=o,this._fontSize=h,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=a,this._anchor=new pe(()=>{this.dirty=!0},this,0,0),this._roundPixels=N.ROUND_PIXELS,this.dirty=!0,this._resolution=N.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var t;const e=xe.available[this._fontName],s=this.fontSize,i=s/e.size,n=new K,a=[],o=[],h=[],l=this._text.replace(/(?:\r\n|\r)/g,` +`)||" ",u=Ru(l),c=this._maxWidth*e.size/s,d=e.distanceFieldType==="none"?Du:Ou;let f=null,p=0,m=0,g=0,_=-1,x=0,y=0,b=0,T=0;for(let B=0;B0&&n.x>c&&(++y,Oe(a,1+_-y,1+B-_),B=_,_=-1,o.push(x),h.push(a.length>0?a[a.length-1].prevSpaces:0),m=Math.max(m,x),g++,n.x=0,n.y+=e.lineHeight,f=null,T=0)}const S=u[u.length-1];S!=="\r"&&S!==` +`&&(/(?:\s)/.test(S)&&(p=x),o.push(p),m=Math.max(m,p),h.push(-1));const A=[];for(let B=0;B<=g;B++){let E=0;this._align==="right"?E=m-o[B]:this._align==="center"?E=(m-o[B])/2:this._align==="justify"&&(E=h[B]<0?0:(m-o[B])/h[B]),A.push(E)}const w=a.length,R={},M=[],H=this._activePagesMeshData;d.push(...H);for(let B=0;B6*I)||E.vertices.lengthe[i.mesh.texture.baseTexture.uid]).forEach(i=>{i.mesh.texture=L.EMPTY});for(const i in e)e[i].destroy(),delete e[i];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};Fu.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let lg=Fu;const ug=[".xml",".fnt"],Nu={extension:{type:D.LoadParser,priority:$t.Normal},name:"loadBitmapFont",test(r){return ug.includes(gt.extname(r).toLowerCase())},async testParse(r){return er.test(r)||gi.test(r)},async parse(r,t,e){const s=er.test(r)?er.parse(r):gi.parse(r),{src:i}=t,{page:n}=s,a=[];for(let l=0;lo[l]);return xe.install(s,h,!0)},async load(r,t){return(await N.ADAPTER.fetch(r)).text()},unload(r){r.destroy()}};U.add(Nu);var cg=Object.defineProperty,dg=Object.defineProperties,fg=Object.getOwnPropertyDescriptors,Lu=Object.getOwnPropertySymbols,pg=Object.prototype.hasOwnProperty,mg=Object.prototype.propertyIsEnumerable,Uu=(r,t,e)=>t in r?cg(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,gg=(r,t)=>{for(var e in t||(t={}))pg.call(t,e)&&Uu(r,e,t[e]);if(Lu)for(var e of Lu(t))mg.call(t,e)&&Uu(r,e,t[e]);return r},_g=(r,t)=>dg(r,fg(t));const _a=class ls extends _e{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new ls(Object.keys(ls.defaultOptions).reduce((e,s)=>_g(gg({},e),{[s]:t[s]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(t=>{URL.revokeObjectURL(t.src),t.refs--,t.refs===0&&(t.fontFace&&document.fonts.delete(t.fontFace),delete ls.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:s}=ls;if(s[t]){const i=s[t];return this._fonts.push(i),i.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return N.ADAPTER.fetch(t).then(i=>i.blob()).then(async i=>new Promise((n,a)=>{const o=URL.createObjectURL(i),h=new FileReader;h.onload=()=>n([o,h.result]),h.onerror=a,h.readAsDataURL(i)})).then(async([i,n])=>{const a=Object.assign({family:gt.basename(t,gt.extname(t)),weight:"normal",style:"normal",display:"auto",src:i,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);s[t]=a,this._fonts.push(a),this.styleID++;const o=new FontFace(a.family,`url(${a.src})`,{weight:a.weight,style:a.style,display:a.display});a.fontFace=o,await o.load(),document.fonts.add(o),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...t){const e=t.filter(s=>!this._overrides.includes(s));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){const e=t.filter(s=>this._overrides.includes(s));e.length>0&&(this._overrides=this._overrides.filter(s=>!e.includes(s)),this.styleID++)}toCSS(t){return[`transform: scale(${t})`,"transform-origin: top left","display: inline-block",`color: ${this.normalizeColor(this.fill)}`,`font-size: ${this.fontSize}px`,`font-family: ${this.fontFamily}`,`font-weight: ${this.fontWeight}`,`font-style: ${this.fontStyle}`,`font-variant: ${this.fontVariant}`,`letter-spacing: ${this.letterSpacing}px`,`text-align: ${this.align}`,`padding: ${this.padding}px`,`white-space: ${this.whiteSpace}`,...this.lineHeight?[`line-height: ${this.lineHeight}px`]:[],...this.wordWrap?[`word-wrap: ${this.breakWords?"break-all":"break-word"}`,`max-width: ${this.wordWrapWidth}px`]:[],...this.strokeThickness?[`-webkit-text-stroke-width: ${this.strokeThickness}px`,`-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,`text-stroke-width: ${this.strokeThickness}px`,`text-stroke-color: ${this.normalizeColor(this.stroke)}`,"paint-order: stroke"]:[],...this.dropShadow?[this.dropShadowToCSS()]:[],...this._overrides].join(";")}toGlobalCSS(){return this._fonts.reduce((t,e)=>`${t} + @font-face { + font-family: "${e.family}"; + src: url('${e.dataSrc}'); + font-weight: ${e.weight}; + font-style: ${e.style}; + font-display: ${e.display}; + }`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(t){this._stylesheet!==t&&(this._stylesheet=t,this.styleID++)}normalizeColor(t){return Array.isArray(t)&&(t=Ao(t)),typeof t=="number"?Eo(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,s=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),i=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(e*255|0).toString(16).padStart(2,"0"));const n=`${s}px ${i}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${n} ${t}`}reset(){Object.assign(this,ls.defaultOptions)}onBeforeDraw(){const{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise(e=>setTimeout(e,100)):Promise.resolve()}get isSafari(){const{userAgent:t}=N.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}set fillGradientStops(t){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(t){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(t){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(t){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(t){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(t){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(t){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};_a.availableFonts={},_a.defaultOptions={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,padding:0,stroke:"black",strokeThickness:0,whiteSpace:"normal",wordWrap:!1,wordWrapWidth:100};let yi=_a;const sr=class us extends Ut{constructor(t="",e={}){var s;super(L.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const i=new Image,n=L.from(i,{scaleMode:N.SCALE_MODE,resourceOptions:{autoLoad:!1}});n.orig=new z,n.trim=new z,this.texture=n;const a="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",h=document.createElementNS(a,"svg"),l=document.createElementNS(a,"foreignObject"),u=document.createElementNS(o,"div"),c=document.createElementNS(o,"style");l.setAttribute("width","10000"),l.setAttribute("height","10000"),l.style.overflow="hidden",h.appendChild(l),this.maxWidth=us.defaultMaxWidth,this.maxHeight=us.defaultMaxHeight,this._domElement=u,this._styleElement=c,this._svgRoot=h,this._foreignObject=l,this._foreignObject.appendChild(c),this._foreignObject.appendChild(u),this._image=i,this._loadImage=new Image,this._autoResolution=us.defaultAutoResolution,this._resolution=(s=us.defaultResolution)!=null?s:N.RESOLUTION,this.text=t,this.style=e}measureText(t){var e,s;const{text:i,style:n,resolution:a}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:i,style:n.toCSS(a)}),this._styleElement.textContent=n.toGlobalCSS(),document.body.appendChild(this._svgRoot);const o=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:h,height:l}=o,u=Math.min(this.maxWidth,Math.ceil(h)),c=Math.min(this.maxHeight,Math.ceil(l));return this._svgRoot.setAttribute("width",u.toString()),this._svgRoot.setAttribute("height",c.toString()),i!==this._text&&(this._domElement.innerHTML=this._text),n!==this._style&&(Object.assign(this._domElement,{style:(e=this._style)==null?void 0:e.toCSS(a)}),this._styleElement.textContent=(s=this._style)==null?void 0:s.toGlobalCSS()),{width:u+n.padding*2,height:c+n.padding*2}}async updateText(t=!0){const{style:e,_image:s,_loadImage:i}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:a}=this.measureText();s.width=i.width=Math.ceil(Math.max(1,n)),s.height=i.height=Math.ceil(Math.max(1,a)),this._updateID++;const o=this._updateID;await new Promise(h=>{i.onload=async()=>{if(o/gi,"

").replace(/
/gi,"
").replace(/ /gi," ")}};sr.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},sr.defaultMaxWidth=2024,sr.defaultMaxHeight=2024,sr.defaultAutoResolution=!0;let vg=sr;const Pe=new z;class va{constructor(t){this.renderer=t}async image(t,e,s,i){const n=new Image;return n.src=await this.base64(t,e,s,i),n}async base64(t,e,s,i){const n=this.canvas(t,i);if(n.toBlob!==void 0)return new Promise((a,o)=>{n.toBlob(h=>{if(!h){o(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>a(l.result),l.onerror=o,l.readAsDataURL(h)},e,s)});if(n.toDataURL!==void 0)return n.toDataURL(e,s);if(n.convertToBlob!==void 0){const a=await n.convertToBlob({type:e,quality:s});return new Promise((o,h)=>{const l=new FileReader;l.onload=()=>o(l.result),l.onerror=h,l.readAsDataURL(a)})}throw new Error("CanvasExtract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const s=this.renderer;if(!s)throw new Error("The CanvasExtract has already been destroyed");let i,n,a;t&&(t instanceof Yt?a=t:(a=s.generateTexture(t,{region:e,resolution:s.resolution}),e&&(Pe.width=e.width,Pe.height=e.height,e=Pe))),a?(i=a.baseTexture._canvasRenderTarget.context,n=a.baseTexture._canvasRenderTarget.resolution,e=e!=null?e:a.frame):(i=s.canvasContext.rootContext,n=s._view.resolution,e||(e=Pe,e.width=s.width/n,e.height=s.height/n));const o=Math.round(e.x*n),h=Math.round(e.y*n),l=Math.max(Math.round(e.width*n),1),u=Math.max(Math.round(e.height*n),1),c=new bs(l,u,1),d=i.getImageData(o,h,l,u);return c.context.putImageData(d,0,0),c.canvas}pixels(t,e){const s=this.renderer;if(!s)throw new Error("The CanvasExtract has already been destroyed");let i,n,a;t&&(t instanceof Yt?a=t:(a=s.generateTexture(t,{region:e,resolution:s.resolution}),e&&(Pe.width=e.width,Pe.height=e.height,e=Pe))),a?(i=a.baseTexture._canvasRenderTarget.context,n=a.baseTexture._canvasRenderTarget.resolution,e=e!=null?e:a.frame):(i=s.canvasContext.rootContext,n=s.resolution,e||(e=Pe,e.width=s.width/n,e.height=s.height/n));const o=Math.round(e.x*n),h=Math.round(e.y*n),l=Math.max(Math.round(e.width*n),1),u=Math.max(Math.round(e.height*n),1);return i.getImageData(o,h,l,u).data}destroy(){this.renderer=null}}va.extension={name:"extract",type:D.CanvasRendererSystem},U.add(va);let ya;const rr=new tt;as.prototype.generateCanvasTexture=function(r,t=1){const e=this.getLocalBounds(new z);e.width=Math.max(e.width,1/t),e.height=Math.max(e.height,1/t);const s=Yt.create({width:e.width,height:e.height,scaleMode:r,resolution:t});ya||(ya=new Ns),this.transform.updateLocalTransform(),this.transform.localTransform.copyTo(rr),rr.invert(),rr.tx-=e.x,rr.ty-=e.y,ya.render(this,{renderTexture:s,clear:!0,transform:rr});const i=L.from(s.baseTexture._canvasRenderTarget.canvas,{scaleMode:r});return i.baseTexture.setResolution(t),i},as.prototype.cachedGraphicsData=[],as.prototype._renderCanvas=function(r){this.isMask!==!0&&(this.finishPoly(),r.plugins.graphics.render(this))};class ir{static offsetPolygon(t,e){const s=[],i=t.length;e=ir.isPolygonClockwise(t)?e:-1*e;for(let n=0;n0}}class xa{constructor(t){this._svgMatrix=null,this._tempMatrix=new tt,this.renderer=t}_calcCanvasStyle(t,e){let s;return t.texture&&t.texture.baseTexture!==L.WHITE.baseTexture?t.texture.valid?(s=_t.getTintedPattern(t.texture,e),this.setPatternTransform(s,t.matrix||tt.IDENTITY)):s="#808080":s=`#${`00000${(e|0).toString(16)}`.slice(-6)}`,s}render(t){const e=this.renderer,s=e.canvasContext.activeContext,i=t.worldAlpha,n=t.transform.worldTransform;e.canvasContext.setContextTransform(n),e.canvasContext.setBlendMode(t.blendMode);const a=t.geometry.graphicsData;let o,h;const l=Y.shared.setValue(t.tint).toArray();for(let u=0;u0){w=[],b=0,S=x[0],A=x[1];for(let R=2;R+2=0;M-=2)s.lineTo(x[M],x[M+1])}y[R].shape.closeStroke&&s.closePath(),w[R]=T*b<0}}f.visible&&(s.globalAlpha=f.alpha*i,s.fillStyle=o,s.fill()),p.visible&&this.paintPolygonStroke(_,p,h,y,w,i,s)}else if(c.type===rt.RECT){const _=d;if(f.visible&&(s.globalAlpha=f.alpha*i,s.fillStyle=o,s.fillRect(_.x,_.y,_.width,_.height)),p.visible){const x=p.width*(.5-(1-p.alignment)),y=_.width+2*x,b=_.height+2*x;s.globalAlpha=p.alpha*i,s.strokeStyle=h,s.strokeRect(_.x-x,_.y-x,y,b)}}else if(c.type===rt.CIRC){const _=d;if(s.beginPath(),s.arc(_.x,_.y,_.radius,0,2*Math.PI),s.closePath(),f.visible&&(s.globalAlpha=f.alpha*i,s.fillStyle=o,s.fill()),p.visible){if(p.alignment!==.5){const x=p.width*(.5-(1-p.alignment));s.beginPath(),s.arc(_.x,_.y,_.radius+x,0,2*Math.PI),s.closePath()}s.globalAlpha=p.alpha*i,s.strokeStyle=h,s.stroke()}}else if(c.type===rt.ELIP){const _=d,x=p.alignment===1;if(x||this.paintEllipse(_,f,p,o,i,s),p.visible){if(p.alignment!==.5){const y=.5522848,b=p.width*(.5-(1-p.alignment)),T=(_.width+b)*2,S=(_.height+b)*2,A=_.x-T/2,w=_.y-S/2,R=T/2*y,M=S/2*y,H=A+T,B=w+S,E=A+T/2,I=w+S/2;s.beginPath(),s.moveTo(A,I),s.bezierCurveTo(A,I-M,E-R,w,E,w),s.bezierCurveTo(E+R,w,H,I-M,H,I),s.bezierCurveTo(H,I+M,E+R,B,E,B),s.bezierCurveTo(E-R,B,A,I+M,A,I),s.closePath()}s.globalAlpha=p.alpha*i,s.strokeStyle=h,s.stroke()}x&&this.paintEllipse(_,f,p,o,i,s)}else if(c.type===rt.RREC){const _=d,x=p.alignment===1;if(x||this.paintRoundedRectangle(_,f,p,o,i,s),p.visible){if(p.alignment!==.5){const y=_.width,b=_.height,T=p.width*(.5-(1-p.alignment)),S=_.x-T,A=_.y-T,w=_.width+2*T,R=_.height+2*T,M=T*(p.alignment>=1?Math.min(w/y,R/b):Math.min(y/w,b/R));let H=_.radius+M;const B=Math.min(w,R)/2;H=H>B?B:H,s.beginPath(),s.moveTo(S,A+H),s.lineTo(S,A+R-H),s.quadraticCurveTo(S,A+R,S+H,A+R),s.lineTo(S+w-H,A+R),s.quadraticCurveTo(S+w,A+R,S+w,A+R-H),s.lineTo(S+w,A+H),s.quadraticCurveTo(S+w,A,S+w-H,A),s.lineTo(S+H,A),s.quadraticCurveTo(S,A,S,A+H),s.closePath()}s.globalAlpha=p.alpha*i,s.strokeStyle=h,s.stroke()}x&&this.paintRoundedRectangle(_,f,p,o,i,s)}}}paintPolygonStroke(t,e,s,i,n,a,o){if(e.alignment!==.5){const h=e.width*(.5-(1-e.alignment));let l=ir.offsetPolygon(t.points,h),u;o.beginPath(),o.moveTo(l[0],l[1]);for(let c=2;c=0;d-=2)o.lineTo(l[d],l[d+1])}i[c].shape.closeStroke&&o.closePath()}}o.globalAlpha=e.alpha*a,o.strokeStyle=s,o.stroke()}paintEllipse(t,e,s,i,n,a){const o=t.width*2,h=t.height*2,l=t.x-o/2,u=t.y-h/2,c=.5522848,d=o/2*c,f=h/2*c,p=l+o,m=u+h,g=l+o/2,_=u+h/2;s.alignment===0&&a.save(),a.beginPath(),a.moveTo(l,_),a.bezierCurveTo(l,_-f,g-d,u,g,u),a.bezierCurveTo(g+d,u,p,_-f,p,_),a.bezierCurveTo(p,_+f,g+d,m,g,m),a.bezierCurveTo(g-d,m,l,_+f,l,_),a.closePath(),s.alignment===0&&a.clip(),e.visible&&(a.globalAlpha=e.alpha*n,a.fillStyle=i,a.fill()),s.alignment===0&&a.restore()}paintRoundedRectangle(t,e,s,i,n,a){const o=t.x,h=t.y,l=t.width,u=t.height;let c=t.radius;const d=Math.min(l,u)/2;c=c>d?d:c,s.alignment===0&&a.save(),a.beginPath(),a.moveTo(o,h+c),a.lineTo(o,h+u-c),a.quadraticCurveTo(o,h+u,o+c,h+u),a.lineTo(o+l-c,h+u),a.quadraticCurveTo(o+l,h+u,o+l,h+u-c),a.lineTo(o+l,h+c),a.quadraticCurveTo(o+l,h,o+l-c,h),a.lineTo(o+c,h),a.quadraticCurveTo(o,h,o,h+c),a.closePath(),s.alignment===0&&a.clip(),e.visible&&(a.globalAlpha=e.alpha*n,a.fillStyle=i,a.fill()),s.alignment===0&&a.restore()}setPatternTransform(t,e){if(this._svgMatrix!==!1){if(!this._svgMatrix){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");if(s!=null&&s.createSVGMatrix&&(this._svgMatrix=s.createSVGMatrix()),!this._svgMatrix||!t.setTransform){this._svgMatrix=!1;return}}this._svgMatrix.a=e.a,this._svgMatrix.b=e.b,this._svgMatrix.c=e.c,this._svgMatrix.d=e.d,this._svgMatrix.e=e.tx,this._svgMatrix.f=e.ty,t.setTransform(this._svgMatrix.inverse())}}destroy(){this.renderer=null,this._svgMatrix=null,this._tempMatrix=null}}xa.extension={name:"graphics",type:D.CanvasRendererPlugin},U.add(xa),Object.defineProperties(N,{MESH_CANVAS_PADDING:{get(){return At.defaultCanvasPadding},set(r){At.defaultCanvasPadding=r}}}),Xe.prototype._renderCanvas=function(r,t){r.plugins.mesh.render(t)},Qs.prototype._cachedTint=16777215,Qs.prototype._tintedCanvas=null,Qs.prototype._canvasUvs=null,Qs.prototype._renderCanvas=function(r){const t=r.canvasContext.activeContext,e=this.worldTransform,s=this.tintValue!==16777215,i=this.texture;if(!i.valid)return;s&&this._cachedTint!==this.tintValue&&(this._cachedTint=this.tintValue,this._tintedCanvas=_t.getTintedCanvas(this,this.tintValue));const n=s?this._tintedCanvas:i.baseTexture.getDrawableSource();this._canvasUvs||(this._canvasUvs=[0,0,0,0,0,0,0,0]);const a=this.vertices,o=this._canvasUvs,h=s?0:i.frame.x,l=s?0:i.frame.y,u=h+i.frame.width,c=l+i.frame.height;o[0]=h,o[1]=h+this._leftWidth,o[2]=u-this._rightWidth,o[3]=u,o[4]=l,o[5]=l+this._topHeight,o[6]=c-this._bottomHeight,o[7]=c;for(let d=0;d<8;d++)o[d]*=i.baseTexture.resolution;t.globalAlpha=this.worldAlpha,r.canvasContext.setBlendMode(this.blendMode),r.canvasContext.setContextTransform(e,this.roundPixels);for(let d=0;d<3;d++)for(let f=0;f<3;f++){const p=f*2+d*8,m=Math.max(1,o[f+1]-o[f]),g=Math.max(1,o[d+5]-o[d+4]),_=Math.max(1,a[p+10]-a[p]),x=Math.max(1,a[p+11]-a[p+1]);t.drawImage(n,o[f],o[d+4],m,g,a[p],a[p+1],_,x)}};let ku=!1;At.prototype._cachedTint=16777215,At.prototype._tintedCanvas=null,At.prototype._cachedTexture=null,At.prototype._renderCanvas=function(r){this.shader.uvMatrix&&(this.shader.uvMatrix.update(),this.calculateUvs()),this.material._renderCanvas?this.material._renderCanvas(r,this):ku||(ku=!0,globalThis.console.warn("Mesh with custom shaders are not supported in CanvasRenderer."))},At.prototype._canvasPadding=null,At.defaultCanvasPadding=0,Object.defineProperty(At.prototype,"canvasPadding",{get(){var r;return(r=this._canvasPadding)!=null?r:At.defaultCanvasPadding},set(r){this._canvasPadding=r}}),yu.prototype._renderCanvas=function(r){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),this.shader.update&&this.shader.update(),this.calculateUvs(),this.material._renderCanvas(r,this)},xu.prototype._renderCanvas=function(r){(this.autoUpdate||this.geometry._width!==this.shader.texture.height)&&(this.geometry._width=this.shader.texture.height,this.geometry.update()),this.shader.update&&this.shader.update(),this.calculateUvs(),this.material._renderCanvas(r,this)};class ba{constructor(t){this.renderer=t}render(t){const e=this.renderer,s=t.worldTransform;e.canvasContext.activeContext.globalAlpha=t.worldAlpha,e.canvasContext.setBlendMode(t.blendMode),e.canvasContext.setContextTransform(s,t.roundPixels),t.drawMode!==Ot.TRIANGLES?this._renderTriangleMesh(t):this._renderTriangles(t)}_renderTriangleMesh(t){const e=t.geometry.buffers[0].data.length;for(let s=0;s0){const{a:ht,b:F,c:O,d:Z}=t.worldTransform,Q=(T+S+A)/3,J=(w+R+M)/3;let st=T-Q,et=w-J,it=ht*st+O*et,lt=F*st+Z*et,vt=Math.sqrt(it*it+lt*lt),nt=1+H/vt;T=Q+st*nt,w=J+et*nt,st=S-Q,et=R-J,it=ht*st+O*et,lt=F*st+Z*et,vt=Math.sqrt(it*it+lt*lt),nt=1+H/vt,S=Q+st*nt,R=J+et*nt,st=A-Q,et=M-J,it=ht*st+O*et,lt=F*st+Z*et,vt=Math.sqrt(it*it+lt*lt),nt=1+H/vt,A=Q+st*nt,M=J+et*nt}a.save(),a.beginPath(),a.moveTo(T,w),a.lineTo(S,R),a.lineTo(A,M),a.closePath(),a.clip();const B=m*y+x*_+g*b-y*_-x*g-m*b,E=T*y+x*A+S*b-y*A-x*S-T*b,I=m*S+T*_+g*A-S*_-T*g-m*A,V=m*y*A+x*S*_+T*g*b-T*y*_-x*g*A-m*S*b,q=w*y+x*M+R*b-y*M-x*R-w*b,j=m*R+w*_+g*M-R*_-w*g-m*M,W=m*y*M+x*R*_+w*g*b-w*y*_-x*g*M-m*R*b;a.transform(E/B,q/B,I/B,j/B,V/B,W/B),a.drawImage(p,0,0,d*c.resolution,f*c.resolution,0,0,d,f),a.restore(),this.renderer.canvasContext.invalidateBlendMode()}renderMeshFlat(t){const e=this.renderer.canvasContext.activeContext,s=t.geometry.getBuffer("aVertexPosition").data,i=s.length/2;e.beginPath();for(let n=1;n{if(typeof require=="function"){const e=this._game.getAdditionalOptions(),n=e&&e.electronRemoteRequirePath?e.electronRemoteRequirePath:"@electron/remote";try{return require(n)}catch(i){console.error(`Could not load @electron/remote from "${n}". Error is:`,i)}}return null};this._game=e,this._forceFullscreen=n,this._marginLeft=this._marginTop=this._marginRight=this._marginBottom=0,this._setupOrientation()}createStandardCanvas(e){this._throwIfDisposed();const n=document.createElement("canvas");e.appendChild(n),this.initializeRenderers(n),this.initializeCanvas(n)}initializeRenderers(e){this._throwIfDisposed(),typeof THREE!="undefined"?(this._threeRenderer=new THREE.WebGLRenderer({canvas:e,antialias:this._game.getAntialiasingMode()!=="none"&&(this._game.isAntialisingEnabledOnMobile()||!l.evtTools.common.isMobile()),preserveDrawingBuffer:!0}),this._threeRenderer.shadowMap.enabled=!0,this._threeRenderer.shadowMap.type=THREE.PCFSoftShadowMap,this._threeRenderer.useLegacyLights=!0,this._threeRenderer.autoClear=!1,this._threeRenderer.pixelRatio=window.devicePixelRatio,this._threeRenderer.setSize(this._game.getGameResolutionWidth(),this._game.getGameResolutionHeight()),this._pixiRenderer=new PIXI.Renderer({width:this._game.getGameResolutionWidth(),height:this._game.getGameResolutionHeight(),view:e,context:this._threeRenderer.getContext(),clearBeforeRender:!1,preserveDrawingBuffer:!0,antialias:!1,backgroundAlpha:0})):this._pixiRenderer=PIXI.autoDetectRenderer({width:this._game.getGameResolutionWidth(),height:this._game.getGameResolutionHeight(),view:e,preserveDrawingBuffer:!0,antialias:!1}),this._pixiRenderer.plugins.accessibility.destroy(),delete this._pixiRenderer.plugins.accessibility}initializeCanvas(e){this._gameCanvas=e,e.style.position="absolute",e.tabIndex=1,e.style.userSelect="none",e.style.outline="none";const n=document.createElement("div");n.style.position="absolute",n.style.overflow="hidden",n.style.outline="none",n.style.pointerEvents="none",n.addEventListener("scroll",i=>{n.scrollLeft=0,n.scrollTop=0,i.preventDefault()}),e.addEventListener("pointerdown",()=>{e.focus()}),n.style["-webkit-user-select"]="none",e.parentNode?.appendChild(n),this._domElementsContainer=n,this._resizeCanvas(),this._game.getScaleMode()==="nearest"&&(e.style["image-rendering"]="-moz-crisp-edges",e.style["image-rendering"]="-webkit-optimize-contrast",e.style["image-rendering"]="-webkit-crisp-edges",e.style["image-rendering"]="pixelated"),this._game.getPixelsRounding()&&(PIXI.settings.ROUND_PIXELS=!0),window.addEventListener("resize",()=>{this._game.onWindowInnerSizeChanged(),this._resizeCanvas()}),e.focus()}static getWindowInnerWidth(){return typeof window!="undefined"?window.innerWidth:800}static getWindowInnerHeight(){return typeof window!="undefined"?window.innerHeight:800}updateRendererSize(){this._resizeCanvas()}_setupOrientation(){if(typeof window=="undefined"||!window.screen||!window.screen.orientation)return;const e=this._game.getGameData().properties.orientation;try{if(e==="default"){const n=window.screen.orientation.unlock();n&&n.catch(()=>{})}else window.screen.orientation.lock(e).catch(()=>{})}catch(n){d.error("Unexpected error while setting up orientation: ",n)}}_resizeCanvas(){if(!this._pixiRenderer||!this._domElementsContainer)return;(this._pixiRenderer.width!==this._game.getGameResolutionWidth()||this._pixiRenderer.height!==this._game.getGameResolutionHeight())&&(this._pixiRenderer.resize(this._game.getGameResolutionWidth(),this._game.getGameResolutionHeight()),this._threeRenderer&&this._threeRenderer.setSize(this._game.getGameResolutionWidth(),this._game.getGameResolutionHeight()));const e=this._forceFullscreen||this._isFullPage||this._isFullscreen;let n=this._game.getGameResolutionWidth(),i=this._game.getGameResolutionHeight(),o=window.innerWidth-this._marginLeft-this._marginRight,a=window.innerHeight-this._marginTop-this._marginBottom;if(o<0&&(o=0),a<0&&(a=0),e&&!this._keepRatio)n=o,i=a;else if(e&&this._keepRatio||n>o||i>a){let h=o/n;i*h>a&&(h=a/i),n*=h,i*=h}this._gameCanvas&&(this._gameCanvas.style.top=this._marginTop+(a-i)/2+"px",this._gameCanvas.style.left=this._marginLeft+(o-n)/2+"px",this._gameCanvas.style.width=n+"px",this._gameCanvas.style.height=i+"px"),this._domElementsContainer.style.top=this._marginTop+(a-i)/2+"px",this._domElementsContainer.style.left=this._marginLeft+(o-n)/2+"px",this._domElementsContainer.style.width=n+"px",this._domElementsContainer.style.height=i+"px",this._canvasWidth=n,this._canvasHeight=i}keepAspectRatio(e){this._keepRatio!==e&&(this._keepRatio=e,this._resizeCanvas())}setMargins(e,n,i,o){this._throwIfDisposed(),!(this._marginTop===e&&this._marginRight===n&&this._marginBottom===i&&this._marginLeft===o)&&(this._marginTop=e,this._marginRight=n,this._marginBottom=i,this._marginLeft=o,this._resizeCanvas())}setWindowSize(e,n){this._throwIfDisposed();const i=this.getElectronRemote();if(i){const o=i.getCurrentWindow();try{o&&o.setContentSize(e,n)}catch(a){d.error(`Window size setting to width ${e} and height ${n} failed. See error:`,a)}}else d.warn("Window size can't be changed on this platform.")}centerWindow(){this._throwIfDisposed();const e=this.getElectronRemote();if(e){const n=e.getCurrentWindow();try{n&&n.center()}catch(i){d.error("Window centering failed. See error:",i)}}else d.warn("Window can't be centered on this platform.")}setFullScreen(e){if(this._throwIfDisposed(),!this._forceFullscreen&&this._isFullscreen!==e){this._isFullscreen=!!e;const n=this.getElectronRemote();if(n){const i=n.getCurrentWindow();try{i&&i.setFullScreen(this._isFullscreen)}catch(o){d.error(`Full screen setting to ${this._isFullscreen} failed. See error:`,o)}}else this._isFullscreen?document.documentElement.requestFullscreen?document.documentElement.requestFullscreen():document.documentElement.mozRequestFullScreen?document.documentElement.mozRequestFullScreen():document.documentElement.webkitRequestFullScreen&&document.documentElement.webkitRequestFullScreen():document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen();this._resizeCanvas()}}isFullScreen(){const e=this.getElectronRemote();if(e)try{return e.getCurrentWindow().isFullScreen()}catch(n){return d.error("Full screen detection failed. See error:",n),!1}return this._isFullscreen||window.screen.height===window.innerHeight}requestPointerLock(e){if(!this._gameCanvas||this._pointerLockReasons.has(e))return!1;this._pointerLockReasons.add(e);try{return this._gameCanvas.requestPointerLock(),!0}catch(n){return d.error("Failed to request pointer lock:",n),!1}}exitPointerLock(e){this._pointerLockReasons.delete(e),document.pointerLockElement&&this._pointerLockReasons.size===0&&document.exitPointerLock()}isPointerLocked(){return document.pointerLockElement===this._gameCanvas}convertCanvasToDomElementContainerCoords(e,n){const i=n||[0,0];return i[0]=e[0]*this._canvasWidth/this._game.getGameResolutionWidth(),i[1]=e[1]*this._canvasHeight/this._game.getGameResolutionHeight(),i}getCanvasToDomElementContainerHeightScale(){return(this._canvasHeight||1)/this._game.getGameResolutionHeight()}convertPageToGameCoords(e,n){const i=this._gameCanvas;if(!i)return[0,0];const o=[e-i.offsetLeft,n-i.offsetTop];return o[0]*=this._game.getGameResolutionWidth()/(this._canvasWidth||1),o[1]*=this._game.getGameResolutionHeight()/(this._canvasHeight||1),o}bindStandardEvents(e,n,i){this._throwIfDisposed();const o=this._gameCanvas;if(!o)return;const a=t=>{const s=t.pageX-o.offsetLeft,r=t.pageY-o.offsetTop;return 0<=s&&s<(this._canvasWidth||1)&&0<=r&&r<(this._canvasHeight||1)};(function(){isNaN(o.offsetLeft)&&(o.offsetLeft=0,o.offsetTop=0),isNaN(i.body.scrollLeft)&&(i.body.scrollLeft=0,i.body.scrollTop=0),(i.documentElement===void 0||i.documentElement===null)&&(i.documentElement={}),isNaN(i.documentElement.scrollLeft)&&(i.documentElement.scrollLeft=0,i.documentElement.scrollTop=0),isNaN(o.offsetLeft)&&(o.offsetLeft=0,o.offsetTop=0)})();const h=()=>!(i.activeElement===o||i.activeElement===i.body||i.activeElement===null),f=t=>!(t.target===o||t.target===i.body);i.onkeydown=t=>{h()||(p&&t.code!=="MetaLeft"&&t.code!=="MetaRight"&&(t.metaKey?c.set(t.code,{keyCode:t.keyCode,location:t.location}):c.delete(t.code)),g.includes(t.keyCode)&&t.preventDefault(),this._game.isInGameEdition()&&t.preventDefault(),!t.repeat&&e.onKeyPressed(t.keyCode,t.location))},i.onkeyup=t=>{if(!h()){if(p&&(t.code==="MetaLeft"||t.code==="MetaRight")){for(const{location:s,keyCode:r}of c.values())e.onKeyReleased(r,s);c.clear()}this._game.isInGameEdition()&&t.preventDefault(),g.includes(t.keyCode)&&t.preventDefault(),e.onKeyReleased(t.keyCode,t.location)}};function _(t){switch(t){case 1:return l.InputManager.MOUSE_MIDDLE_BUTTON;case 2:return l.InputManager.MOUSE_RIGHT_BUTTON}return t}o.onmousemove=t=>{const s=this.convertPageToGameCoords(t.pageX,t.pageY);e.onMouseMove(s[0],s[1],{movementX:t.movementX,movementY:t.movementY})},o.onmousedown=t=>{const s=this.convertPageToGameCoords(t.pageX,t.pageY);return e.onMouseMove(s[0],s[1]),e.onMouseButtonPressed(_(t.button)),n.focus!==void 0&&n.focus(),!1},o.onmouseup=function(t){return e.onMouseButtonReleased(_(t.button)),!1},o.onmouseleave=function(t){e.onMouseLeave()},o.onmouseenter=function(t){e.onMouseEnter();const s=[l.InputManager.MOUSE_LEFT_BUTTON,l.InputManager.MOUSE_RIGHT_BUTTON,l.InputManager.MOUSE_MIDDLE_BUTTON,l.InputManager.MOUSE_BACK_BUTTON,l.InputManager.MOUSE_FORWARD_BUTTON];for(let r=0,u=s.length;r{if(!f(t)&&(t.preventDefault(),t.changedTouches))for(let s=0;s{if(!f(t)){if(t.preventDefault(),t.changedTouches)for(let s=0;s{this._nextFrameId=requestAnimationFrame(i);const a=n?o-n:0;n=o,e(a)||cancelAnimationFrame(this._nextFrameId)};requestAnimationFrame(i)}stopGameLoop(){cancelAnimationFrame(this._nextFrameId)}getPIXIRenderer(){return this._pixiRenderer}getThreeRenderer(){return this._threeRenderer}getDomElementContainer(){return this._domElementsContainer}openURL(e){if(typeof window!="undefined"){const n=this.getElectron();n?n.shell.openExternal(e):typeof window.cordova!="undefined"&&typeof window.cordova.InAppBrowser!="undefined"?window.cordova.InAppBrowser.open(e,"_system","location=yes"):window.open(e,"_blank")}}stopGame(){const e=this.getElectronRemote();if(e){const n=e.getCurrentWindow();if(n)try{n.close()}catch(i){d.error("Window closing failed. See error:",i)}}else typeof navigator!="undefined"&&navigator.app&&navigator.app.exitApp&&navigator.app.exitApp()}dispose(e){this._pixiRenderer?.destroy(),this._threeRenderer?.dispose(),this._pixiRenderer=null,this._threeRenderer=null,e&&this._gameCanvas&&this._gameCanvas.parentNode?.removeChild(this._gameCanvas),this._gameCanvas=null,this._domElementsContainer?.parentNode?.removeChild(this._domElementsContainer),this._domElementsContainer=null,this._wasDisposed=!0}getCanvas(){return this._gameCanvas}isWebGLSupported(){return!!this._pixiRenderer&&this._pixiRenderer.type===PIXI.RENDERER_TYPE.WEBGL}getElectron(){return typeof require=="function"?require("electron"):null}getGame(){return this._game}_throwIfDisposed(){if(this._wasDisposed)throw"The RuntimeGameRenderer has been disposed and should not be used anymore."}}l.RuntimeGamePixiRenderer=w,l.RuntimeGameRenderer=w})(gdjs||(gdjs={})); +//# sourceMappingURL=runtimegame-pixi-renderer.js.map diff --git a/Export/pixi-renderers/runtimescene-pixi-renderer.js b/Export/pixi-renderers/runtimescene-pixi-renderer.js new file mode 100644 index 0000000..f3785b3 --- /dev/null +++ b/Export/pixi-renderers/runtimescene-pixi-renderer.js @@ -0,0 +1,3 @@ +var gdjs;(function(d){class m{constructor(t,e){this._profilerText=null;this._showCursorAtNextRender=!1;this._threeRenderer=null;this._layerRenderingMetrics={rendered2DLayersCount:0,rendered3DLayersCount:0};this._backgroundColor=null;this._runtimeGameRenderer=e,this._runtimeScene=t,this._pixiContainer=new PIXI.Container,this._pixiContainer.sortableChildren=!0,this._threeRenderer=this._runtimeGameRenderer?this._runtimeGameRenderer.getThreeRenderer():null}onGameResolutionResized(){const t=this._runtimeGameRenderer?this._runtimeGameRenderer.getPIXIRenderer():null;if(!t)return;const e=this._runtimeScene.getGame();this._pixiContainer.scale.x=t.width/e.getGameResolutionWidth(),this._pixiContainer.scale.y=t.height/e.getGameResolutionHeight();for(const r of this._runtimeScene._orderedLayers)r.getRenderer().onGameResolutionResized()}onSceneUnloaded(){}render(){const t=this._runtimeGameRenderer;if(!t)return;const e=t.getPIXIRenderer();if(!e)return;const r=this._threeRenderer;if(!(r&&r.xr.isPresenting)){if(this._layerRenderingMetrics.rendered2DLayersCount=0,this._layerRenderingMetrics.rendered3DLayersCount=0,r){r.info.autoReset=!1,r.info.reset();let n=!0,s=!0;r.resetState();for(let l=0;l({collision:!1,move_axis:[0,0]}),S=()=>({collision:!1,closeX:0,closeY:0,closeSqDist:0,farX:0,farY:0,farSqDist:0,edgeX:0,edgeY:0}),F={minMaxA:[0,0],minMaxB:[0,0],edge:[0,0],axis:[0,0],move_axis:[0,0],result:D()},R={p:[0,0],q:[0,0],r:[0,0],s:[0,0],deltaQP:[0,0],axis:[0,0],result:S()},c=class{constructor(){this.vertices=[];this.edges=[];this.center=[0,0]}move(t,e){for(let o=0,i=this.vertices.length;o=e?this.vertices[0]:this.vertices[t+1];this.edges[t][0]=i[0]-o[0],this.edges[t][1]=i[1]-o[1]}}isConvex(){this.computeEdges();const t=this.edges.length;if(t<3)return!1;const e=this.edges[0][0]*this.edges[0+1][1]-this.edges[0][1]*this.edges[0+1][0]>0;for(let i=1;i0!==e)return!1;return this.edges[t-1][0]*this.edges[0][1]-this.edges[t-1][1]*this.edges[0][0]>0===e}computeCenter(){this.center[0]=0,this.center[1]=0;const t=this.vertices.length;for(let e=0;e0||r===0&&o)return s.collision=!1,s.move_axis[0]=0,s.move_axis[1]=0,s;const h=Math.abs(r);hy)return s;if(s.collision=!0,u===0)return s.closeX=e,s.closeY=o,s.closeSqDist=0,s.farX=e,s.farY=o,s.farSqDist=0,s.edgeX=f[0],s.edgeY=f[1],s;const q=Y/Math.abs(u),T=y/Math.abs(u);return s.closeX=e+q*a[0],s.closeY=o+q*a[1],s.closeSqDist=q*q*(a[0]*a[0]+a[1]*a[1]),s.farX=e+T*a[0],s.farY=o+T*a[1],s.farSqDist=T*T*(a[0]*a[0]+a[1]*a[1]),s.edgeX=f[0],s.edgeY=f[1],s}else if(d!==0&&0<=x&&x<=1&&0<=M&&M<=1){const r=n[0]+x*a[0],h=n[1]+x*a[1],u=(r-e)*(r-e)+(h-o)*(h-o);uo[1]&&(o[1]=i)}static distance(t,e,o,i){return to!=g[1]>o&&e<(g[0]-n[0])*(o-n[1])/(g[1]-n[1])+n[0]&&(i=!i)}return i}static copyCollisionTestResult(t,e){e.collision=t.collision,e.move_axis[0]=t.move_axis[0],e.move_axis[1]=t.move_axis[1]}static copyRaycastTestResult(t,e){e.collision=t.collision,e.closeX=t.closeX,e.closeY=t.closeY,e.closeSqDist=t.closeSqDist,e.farX=t.farX,e.farY=t.farY,e.farSqDist=t.farSqDist,e.edgeX=t.edgeX,e.edgeY=t.edgeY}};let C=c;C.makeNewCollisionTestResult=D,C.makeNewRaycastTestResult=S,b.Polygon=C})(gdjs||(gdjs={})); +//# sourceMappingURL=polygon.js.map diff --git a/Export/profiler.js b/Export/profiler.js new file mode 100644 index 0000000..c170532 --- /dev/null +++ b/Export/profiler.js @@ -0,0 +1,2 @@ +var gdjs;(function(m){class a{constructor(){this._framesMeasures=[];this._currentFrameIndex=0;this._currentFrameMeasure={parent:null,time:0,lastStartTime:0,subsections:{}};this._currentSection=null;this._maxFramesCount=600;this._framesCount=0;for(;this._framesMeasures.lengththis._maxFramesCount&&(this._framesCount=this._maxFramesCount),this._framesMeasures[this._currentFrameIndex]=this._currentFrameMeasure,this._currentFrameIndex++,this._currentFrameIndex>=this._maxFramesCount&&(this._currentFrameIndex=0)}static _addAverageSectionTimes(t,e,r,o){e.time=(e.time||0)+t.time/r;for(const s in t.subsections)if(t.subsections.hasOwnProperty(s)){const n=e.subsections,i=n[s]=n[s]||{parent:e,time:0,subsections:{}};a._addAverageSectionTimes(t.subsections[s],i,r,o)}}getFramesAverageMeasures(){const t={parent:null,time:0,lastStartTime:0,subsections:{}};for(let e=0;enew Promise(e=>setTimeout(e,u)),g=u=>u.usedResources.map(e=>e.name);let l=null;const m=()=>{if(l)return l;l=[];try{new CompressionStream("gzip"),l.push("cs:gzip")}catch{}try{new CompressionStream("deflate"),l.push("cs:deflate")}catch{}return l},p=()=>{try{const e=new URL(location.href).searchParams.get("runtimeGameStatus");if(!e)return null;const t=JSON.parse(e);return{isPaused:!!t.isPaused,isInGameEdition:!!t.isInGameEdition,sceneName:""+t.sceneName,injectedExternalLayoutName:""+t.injectedExternalLayoutName,skipCreatingInstancesFromScene:!!t.skipCreatingInstancesFromScene,eventsBasedObjectType:t.eventsBasedObjectType,eventsBasedObjectVariantName:t.eventsBasedObjectVariantName,editorId:t.editorId,editorCamera3D:t.editorCamera3D}}catch{return null}};class _{constructor(e,t){this._sceneAndExtensionsData=[];this._displayedLoadingScreen=null;this._notifyScenesForGameResolutionResize=!1;this._paused=!1;this._hasJustResumed=!1;this._sessionMetricsInitialized=!1;this._disableMetrics=!1;this._wasDisposed=!1;this.getPlatformInfo=()=>({isCordova:!!window.cordova,devicePlatform:typeof device!="undefined"&&device.platform||"",navigatorPlatform:typeof navigator!="undefined"?navigator.platform:"",hasTouch:typeof navigator!="undefined"?!!navigator.maxTouchPoints&&navigator.maxTouchPoints>2:!1,supportedCompressionMethods:m()});if(this._options=t||{},this._isPreview=this._options.isPreview||!1,this._isPreview){const s=p();s&&(this._options.initialRuntimeGameStatus=s)}this._isInGameEdition=this._options.initialRuntimeGameStatus?.isInGameEdition||!1,this._variables=new n.VariablesContainer(e.variables),this._variablesByExtensionName=new Map;for(const s of e.eventsFunctionsExtensions)s.globalVariables.length>0&&this._variablesByExtensionName.set(s.name,new n.VariablesContainer(s.globalVariables));this._eventsBasedObjectDatas=new Map,this._data=e,this._updateSceneAndExtensionsData(),n.Variable.useDeprecatedZeroAsDefaultStringVariable=!!e.properties.useDeprecatedZeroAsDefaultStringVariable,this._sceneResourcesPreloading=this._data.properties.sceneResourcesPreloading||"at-startup",this._sceneResourcesUnloading=this._data.properties.sceneResourcesUnloading||"never",this._resourcesLoader=new n.ResourceLoader(this,e.resources.resources,g(e),e.layouts),this._inGameEditor=this._isInGameEdition?new n.InGameEditor(this,e,this._options.inGameEditorSettings||null):null,this._debuggerClient=n.DebuggerClient?new n.DebuggerClient(this):null,this._effectsManager=new n.EffectsManager,this._maxFPS=this._data.properties.maxFPS,this._minFPS=this._data.properties.minFPS,this._gameResolutionWidth=this._data.properties.windowWidth,this._gameResolutionHeight=this._data.properties.windowHeight,this._originalWidth=this._gameResolutionWidth,this._originalHeight=this._gameResolutionHeight,this._resizeMode=this._data.properties.sizeOnStartupMode,this._adaptGameResolutionAtRuntime=this._data.properties.adaptGameResolutionAtRuntime,this._scaleMode=e.properties.scaleMode||"linear",this._pixelsRounding=this._data.properties.pixelsRounding,this._antialiasingMode=this._data.properties.antialiasingMode,this._isAntialisingEnabledOnMobile=this._data.properties.antialisingEnabledOnMobile,this._renderer=new n.RuntimeGameRenderer(this,this._options.forceFullscreen||!1),this._watermark=new n.watermark.RuntimeWatermark(this,e.properties.authorUsernames,this._data.properties.watermark),this._sceneStack=new n.SceneStack(this),this._inputManager=new n.InputManager,this._captureManager=n.CaptureManager?new n.CaptureManager(this._renderer,this._options.captureOptions||{}):null,this._sessionId=null,this._playerId=null,this._embeddedResourcesMappings=new Map,this._updateEmbeddedResourcesMappings(),this.isUsingGDevelopDevelopmentEnvironment()&&c.info("This game will run on the development version of GDevelop APIs.")}setProjectData(e){this._inGameEditor&&this._inGameEditor.onProjectDataChange(e),this._data=e,this._updateEmbeddedResourcesMappings(),this._updateSceneAndExtensionsData(),this._resourcesLoader.setResources(e.resources.resources,g(e),e.layouts)}_updateSceneAndExtensionsData(){const e=this._data.eventsFunctionsExtensions.filter(t=>t.sceneVariables.length>0);if(this._sceneAndExtensionsData=this._data.layouts.map(t=>({sceneData:t,usedExtensionsWithVariablesData:e})),this._eventsBasedObjectDatas.clear(),this._data.eventsFunctionsExtensions)for(const t of this._data.eventsFunctionsExtensions)for(const s of t.eventsBasedObjects)this._eventsBasedObjectDatas.set(t.name+"::"+s.name,s)}_updateEmbeddedResourcesMappings(){this._embeddedResourcesMappings.clear();for(const e of this._data.resources.resources)if(!!e.metadata)try{const t=JSON.parse(e.metadata);t?.embeddedResourcesMapping&&this._embeddedResourcesMappings.set(e.name,t.embeddedResourcesMapping)}catch{c.error("Some metadata of resources can not be successfully parsed.")}}getAdditionalOptions(){return this._options}getRenderer(){return this._renderer}getVariables(){return this._variables}getVariablesForExtension(e){return this._variablesByExtensionName.get(e)||null}getResourceLoader(){return this._resourcesLoader}getSoundManager(){return this._resourcesLoader.getSoundManager()}getImageManager(){return this._resourcesLoader.getImageManager()}getFontManager(){return this._resourcesLoader.getFontManager()}getBitmapFontManager(){return this._resourcesLoader.getBitmapFontManager()}getJsonManager(){return this._resourcesLoader.getJsonManager()}getModel3DManager(){return this._resourcesLoader.getModel3DManager()}getSpineManager(){return this._resourcesLoader.getSpineManager()}getSpineAtlasManager(){return this._resourcesLoader.getSpineAtlasManager()}getInputManager(){return this._inputManager}getEffectsManager(){return this._effectsManager}getGameData(){return this._data}getEventsBasedObjectData(e){const t=this._eventsBasedObjectDatas.get(e);return t||(c.error('The game has no events-based object of the type "'+e+'"'),null)}getEventsBasedObjectVariantData(e,t){const s=this.getEventsBasedObjectData(e);return s?n.RuntimeGame._getEventsBasedObjectVariantData(s,t):null}static _getEventsBasedObjectVariantData(e,t){if(e.defaultVariant||(e.defaultVariant={...e,name:""}),e.defaultVariant.instances.length==0)return e.defaultVariant;let i=e.defaultVariant;for(let a=0;a{await this._resourcesLoader.loadGlobalAndFirstSceneResources(e,i),this._resourcesLoader.loadAllSceneInBackground()},t),n.getAllAsynchronouslyLoadingLibraryPromise()])}catch(s){throw this._debuggerClient&&this._debuggerClient.onUncaughtException(s),s}}async loadSceneAssets(e,t){await this._loadAssetsWithLoadingScreen(!1,async s=>{await this._resourcesLoader.loadAndProcessSceneResources(e,s)},t)}async _loadAssetsWithLoadingScreen(e,t,s){this.pause(!0);const i=new n.LoadingScreenRenderer(this.getRenderer(),this._resourcesLoader.getImageManager(),this._data.properties.loadingScreen,this._data.properties.watermark.showWatermark,e);this._displayedLoadingScreen=i,await t(async(r,o)=>{const d=Math.floor(100*r/o);i.setPercent(d),s&&s(d),i.renderIfNeeded()&&await h(1)}),await i.unload(),this._displayedLoadingScreen=null,this._isInGameEdition||this.pause(!1)}_getFirstSceneName(){const e=this._options.initialRuntimeGameStatus?.sceneName||this._data.firstLayout;return this.hasScene(e)?e:this.getSceneAndExtensionsData().sceneData.name}startGameLoop(){this._throwIfDisposed();try{if(!this.hasScene()){c.error("The game has no scene.");return}this._forceGameResolutionUpdate();const e=this._getFirstSceneName(),t=this._options.initialRuntimeGameStatus?.injectedExternalLayoutName||null;if(this._inGameEditor){const a=this._options.initialRuntimeGameStatus?.eventsBasedObjectType||null,r=this._options.initialRuntimeGameStatus?.eventsBasedObjectVariantName||null,o=this._options.initialRuntimeGameStatus?.editorId||null,d=this._options.initialRuntimeGameStatus?.editorCamera3D||null;this._inGameEditor.switchToSceneOrVariant(o,e,t,a,r,d)}else e&&this.getSceneStack().replace({sceneName:e,externalLayoutName:t===null?void 0:t,clear:!0});this._watermark.displayAtStartup(),this._setupGameVisibilityEvents(),n.inAppTutorialMessage&&n.inAppTutorialMessage.displayInAppTutorialMessage(this,this._options.inAppTutorialMessageInPreview,this._options.inAppTutorialMessagePositionInPreview||"");let s=null,i=0;this._hasJustResumed=!1,this._renderer.startGameLoop(a=>{try{if(this._debuggerClient){const o=(this._inGameEditor||this.getSceneStack()).getCurrentScene();o&&o.getName()!==s&&(s=o.getName(),this._debuggerClient.sendRuntimeGameStatus())}if(this._paused&&this._inGameEditor&&this._inGameEditor.updateTargetFramerate(a),i+=a,this._maxFPS>0&&1e3/i>this._maxFPS+7)return!0;const r=i;if(i=0,this._notifyScenesForGameResolutionResize&&(this._inGameEditor?this._inGameEditor.onGameResolutionResized():this._sceneStack.onGameResolutionResized(),this._notifyScenesForGameResolutionResize=!1),this._paused)this._inGameEditor?this._displayedLoadingScreen||this._inGameEditor.updateAndRender():this._sceneStack.renderWithoutStep();else{if(!this._sceneStack.step(r))return!1;this._hasJustResumed=!1}return this.getInputManager().onFrameEnded(),!0}catch(r){throw this._debuggerClient&&this._debuggerClient.onUncaughtException(r),r}}),setTimeout(()=>{this._setupSessionMetrics()},4e3),this._captureManager&&this._captureManager.setupCaptureOptions(this._isPreview)}catch(e){throw this._debuggerClient&&this._debuggerClient.onUncaughtException(e),e}}dispose(e){this._inGameEditor&&this._inGameEditor.dispose(),this._renderer.stopGameLoop(),this._sceneStack.dispose(),this._renderer.dispose(e),this._resourcesLoader.dispose(),this._wasDisposed=!0}enableMetrics(e){this._disableMetrics=!e,e&&this._setupSessionMetrics()}_setupGameVisibilityEvents(){typeof navigator!="undefined"&&typeof document!="undefined"&&(document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&(this._hasJustResumed=!0)}),window.addEventListener("resume",()=>{this._hasJustResumed=!0},!1))}_setupSessionMetrics(){if(this._sessionMetricsInitialized||this._disableMetrics||this.isPreview()||typeof fetch=="undefined"||!this._data.properties.projectUuid)return;const e="https://api.gdevelop-app.com/analytics";this._playerId=this._makePlayerUuid();let t=0,s=0,i=Date.now();const a=this.getPlatformInfo();fetch(e+"/session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gameId:this._data.properties.projectUuid,playerId:this._playerId,game:{name:this._data.properties.name||"",packageName:this._data.properties.packageName||"",version:this._data.properties.version||"",location:window.location.href},platform:{isCordova:a.isCordova,devicePlatform:a.devicePlatform,navigatorPlatform:a.navigatorPlatform,hasTouch:a.hasTouch}})}).then(o=>{if(!o.ok)throw console.error("Error while creating the session",o),new Error("Error while creating the session");return o}).then(o=>o.text()).then(o=>{this._sessionId=o}).catch(()=>{});const r=()=>{if(!this._sessionId)return;const o=Date.now();if(s+=o-i,i=o,s<5*1e3)return;const d=Math.floor(s/1e3)*1e3;t+=d,s-=d,navigator.sendBeacon(e+"/session-hit",JSON.stringify({gameId:this._data.properties.projectUuid,playerId:this._playerId,sessionId:this._sessionId,duration:Math.floor(t/1e3)}))};if(typeof navigator!="undefined"&&typeof document!="undefined"){document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?i=Date.now():r()}),window.addEventListener("pagehide",r,!1),window.addEventListener("pause",r,!1),window.addEventListener("resume",()=>{i=Date.now()},!1);const o=typeof safari=="object"&&safari.pushNotification,d=/electron/i.test(navigator.userAgent);(o||d)&&window.addEventListener("beforeunload",()=>{r()})}this._sessionMetricsInitialized=!0,this._sessionId=this._sessionId}_makePlayerUuid(){try{const e="GDJS-internal-player-uuid",t=localStorage.getItem(e);if(t)return t;const s=n.makeUuid();return localStorage.setItem(e,s),s}catch{return n.makeUuid()}}getSessionId(){return this._sessionId}getPlayerId(){return this._playerId}onWindowInnerSizeChanged(){this._forceGameResolutionUpdate()}_forceGameResolutionUpdate(){this.setGameResolutionSize(this._gameResolutionWidth,this._gameResolutionHeight)}startCurrentSceneProfiler(e){this._throwIfDisposed();const t=this._sceneStack.getCurrentScene();return t?(t.startProfiler(e),!0):!1}stopCurrentSceneProfiler(){this._throwIfDisposed();const e=this._sceneStack.getCurrentScene();!e||e.stopProfiler()}wasFirstSceneLoaded(){return this._sceneStack.wasFirstSceneLoaded()}getSceneStack(){return this._sceneStack}isPreview(){return this._isPreview}isPaused(){return this._paused}isInGameEdition(){return this._isInGameEdition}getInGameEditor(){return this._inGameEditor}isBehaviorActivatedByDefaultInEditor(e){return this._data.activatedByDefaultInEditorBehaviors?this._data.activatedByDefaultInEditorBehaviors.includes(e):!1}setMaximumFps(e){this._maxFPS=e}isUsingGDevelopDevelopmentEnvironment(){return this._options.environment==="dev"}getExtensionProperty(e,t){for(let s of this._data.properties.extensionProperties)if(s.extension===e&&s.property===t)return s.value;return null}resolveEmbeddedResource(e,t){const s=this._embeddedResourcesMappings.get(e);return s&&s[t]?s[t]:t}getEmbeddedResourcesNames(e){return this._embeddedResourcesMappings.has(e)?Object.keys(this._embeddedResourcesMappings.get(e)):[]}getNetworkSyncData(e){const t={var:e.syncGameVariables===!1?void 0:this._variables.getNetworkSyncData(e),sm:e.syncSounds?this.getSoundManager().getNetworkSyncData():void 0,ss:this._sceneStack.getNetworkSyncData(e)||void 0};if(e.syncGameVariables!==!1){const s={};this._variablesByExtensionName.forEach((i,a)=>{const r=i.getNetworkSyncData(e);r.length&&(s[a]=r)}),t.extVar=s}return(!t.var||t.var.length===0)&&!t.ss&&(!t.extVar||Object.keys(t.extVar).length===0)?null:t}updateFromNetworkSyncData(e,t){if(this._throwIfDisposed(),e.var&&this._variables.updateFromNetworkSyncData(e.var,t),e.sm&&this.getSoundManager().updateFromNetworkSyncData(e.sm),e.ss&&this._sceneStack.updateFromNetworkSyncData(e.ss),e.extVar)for(const s in e.extVar){if(!e.extVar.hasOwnProperty(s))continue;const i=e.extVar[s],a=this.getVariablesForExtension(s);a&&a.updateFromNetworkSyncData(i,t)}}_throwIfDisposed(){if(this._wasDisposed)throw"The RuntimeGame has been disposed and should not be used anymore."}}n.RuntimeGame=_})(gdjs||(gdjs={})); +//# sourceMappingURL=runtimegame.js.map diff --git a/Export/runtimeobject.js b/Export/runtimeobject.js new file mode 100644 index 0000000..49ab33c --- /dev/null +++ b/Export/runtimeobject.js @@ -0,0 +1,2 @@ +var gdjs;(function(n){const C=(x,e,t,i)=>{const s=Math.max(t,x-t),r=Math.max(i,e-i);return Math.pow(s,2)+Math.pow(r,2)},A={moveXArray:[],moveYArray:[]},w={result:n.Polygon.makeNewRaycastTestResult()},F=(x,e,t)=>{if(e.length===0)return e.length=0,t.length=0,!1;if(e.length===1)return x.setPosition(x.getX()+e[0],x.getY()+t[0]),e.length=0,t.length=0,!0;let i=0,s=0;for(let f=0;fi&&(i=y,s=f)}const r=Math.sqrt(i),a=e[s]/r,h=-(t[s]/r),m=a;let c=0,g=0;for(let f=0;f{if(!o.isSyncedOverNetwork()&&!e.syncAllBehaviors)return;const h=o.getNetworkSyncData(e);t[o.getName()]=h});const i=this._variables.getNetworkSyncData({}),s={};for(const o in this._rendererEffects)s[o]=this._rendererEffects[o].getNetworkSyncData();const r={};for(const o in this._timers.items)r[o]=this._timers.items[o].getNetworkSyncData();const a={x:this.x,y:this.y,w:this.getWidth(),h:this.getHeight(),zo:this.zOrder,a:this.angle,hid:this.hidden,lay:this.layer,if:this._instantForces.map(o=>o.getNetworkSyncData()),pfx:this._permanentForceX,pfy:this._permanentForceY,beh:t,var:i,eff:s,tim:r};return e.syncObjectIdentifiers&&(a.n=this.name,this.networkId||(this.networkId=n.makeUuid().substring(0,8)),a.networkId=this.networkId),a}updateFromNetworkSyncData(e,t){if(e.x!==void 0&&this.setX(e.x),e.y!==void 0&&this.setY(e.y),e.w!==void 0&&this.setWidth(e.w),e.h!==void 0&&this.setHeight(e.h),e.zo!==void 0&&this.setZOrder(e.zo),e.a!==void 0&&this.setAngle(e.a),e.hid!==void 0&&this.hidden!==e.hid&&this.hide(e.hid),e.lay!==void 0&&this.layer!==e.lay&&this.setLayer(e.lay),e.if){this.clearForces();for(let i=0,s=e.if.length;is()),this.clearEffects()}onDestroyed(){}onScenePaused(e){}onSceneResumed(e){}getRendererObject(){}get3DRendererObject(){}getName(){return this.name}getNameId(){return this._nameId}getUniqueId(){return this.id}getNetworkId(){return this.networkId}setPosition(e,t){this.setX(e),this.setY(t)}setX(e){e!==this.x&&(this.x=e,this.invalidateHitboxes())}invalidateHitboxes(){this.hitBoxesDirty=!0,this._runtimeScene.onChildrenLocationChanged()}getX(){return this.x}setY(e){e!==this.y&&(this.y=e,this.invalidateHitboxes())}getY(){return this.y}getDrawableX(){return this.getX()}getDrawableY(){return this.getY()}rotateTowardPosition(e,t,i){this.rotateTowardAngle(n.toDegrees(Math.atan2(t-(this.getDrawableY()+this.getCenterY()),e-(this.getDrawableX()+this.getCenterX()))),i)}rotateTowardObject(e,t){e!==null&&this.rotateTowardPosition(e.getDrawableX()+e.getCenterX(),e.getDrawableY()+e.getCenterY(),t)}rotateTowardAngle(e,t){if(t===0){this.setAngle(e);return}const s=n.evtTools.common.angleDifference(this.getAngle(),e)>=0;let r=this.getAngle()+(s?-1:1)*t*this.getElapsedTime()/1e3;n.evtTools.common.angleDifference(r,e)>0^s&&(r=e),this.setAngle(r),this.getAngle()!==r&&this.setAngle(e)}rotate(e){this.setAngle(this.getAngle()+e*this.getElapsedTime()/1e3)}setAngle(e){this.angle!==e&&(this.angle=e,this.invalidateHitboxes())}getAngle(){return this.angle}setLayer(e){if(e===this.layer)return;const t=this._runtimeScene.getLayer(this.layer);this.layer=e;const i=this._runtimeScene.getLayer(this.layer),s=this.getRendererObject();s&&(t.getRenderer().removeRendererObject(s),i.getRenderer().addRendererObject(s,this.zOrder));const r=this.get3DRendererObject();r&&(t.getRenderer().remove3DRendererObject(r),i.getRenderer().add3DRendererObject(r))}getLayer(){return this.layer}isOnLayer(e){return this.layer===e}setZOrder(e){if(e===this.zOrder)return;this.zOrder=e;const t=this.getRendererObject();t&&this._runtimeScene.getLayer(this.layer).getRenderer().changeRendererObjectZOrder(t,e)}getZOrder(){return this.zOrder}getVariables(){return this._variables}static getVariableNumber(e){return e.getAsNumber()}static returnVariable(e){return e}static getVariableString(e){return e.getAsString()}static getVariableChildCount(e){return e.getChildrenCount()}static setVariableNumber(e,t){e.setNumber(t)}static setVariableString(e,t){e.setString(t)}static variableChildExists(e,t){return e.hasChild(t)}static variableRemoveChild(e,t){e.removeChild(t)}static variableClearChildren(e){e.clearChildren()}hasVariable(e){return this._variables.has(e)}getRendererEffects(){return this._rendererEffects}addEffect(e){return this.getRendererObject()?this._runtimeScene.getGame().getEffectsManager().addEffect(e,this._rendererEffects,this):!1}removeEffect(e){return this.getRendererObject()?this._runtimeScene.getGame().getEffectsManager().removeEffect(this._rendererEffects,this,e):!1}clearEffects(){const e=this.getRendererObject();return e?(this._rendererEffects={},this._runtimeScene.getGame().getEffectsManager().clearEffects(e)):!1}setEffectDoubleParameter(e,t,i){return this._runtimeScene.getGame().getEffectsManager().setEffectDoubleParameter(this._rendererEffects,e,t,i)}setEffectStringParameter(e,t,i){return this._runtimeScene.getGame().getEffectsManager().setEffectStringParameter(this._rendererEffects,e,t,i)}setEffectBooleanParameter(e,t,i){return this._runtimeScene.getGame().getEffectsManager().setEffectBooleanParameter(this._rendererEffects,e,t,i)}updateAllEffectParameters(e){return this._runtimeScene.getGame().getEffectsManager().updateAllEffectParameters(this._rendererEffects,e)}enableEffect(e,t){this._runtimeScene.getGame().getEffectsManager().enableEffect(this._rendererEffects,this,e,t)}isEffectEnabled(e){return this._runtimeScene.getGame().getEffectsManager().isEffectEnabled(this._rendererEffects,this,e)}hasEffect(e){return this._runtimeScene.getGame().getEffectsManager().hasEffect(this._rendererEffects,e)}hide(e){e===void 0&&(e=!0),this.hidden=e}isVisible(){return!this.hidden}isHidden(){return this.hidden}getOriginalWidth(){return this.getWidth()}getOriginalHeight(){return this.getHeight()}setWidth(e){}setHeight(e){}getWidth(){return 0}getHeight(){return 0}getCenterX(){return this.getWidth()/2}getCenterY(){return this.getHeight()/2}getCenterXInScene(){return this.getDrawableX()+this.getCenterX()}getCenterYInScene(){return this.getDrawableY()+this.getCenterY()}setCenterPositionInScene(e,t){this.setX(e+this.x-(this.getDrawableX()+this.getCenterX())),this.setY(t+this.y-(this.getDrawableY()+this.getCenterY()))}setCenterXInScene(e){this.setX(e+this.x-(this.getDrawableX()+this.getCenterX()))}setCenterYInScene(e){this.setY(e+this.y-(this.getDrawableY()+this.getCenterY()))}_getRecycledForce(e,t,i){if(l.forcesGarbage.length===0)return new n.Force(e,t,i);{const s=l.forcesGarbage.pop();return s.setX(e),s.setY(t),s.setMultiplier(i),s}}addForce(e,t,i){i===1?(this._permanentForceX+=e,this._permanentForceY+=t):i===0&&this._instantForces.length>0&&this._instantForces[0].getMultiplier()===0?this._instantForces[0].add(e,t):this._instantForces.push(this._getRecycledForce(e,t,i))}addPolarForce(e,t,i){const s=n.toRad(e),r=Math.cos(s)*t,a=Math.sin(s)*t;this.addForce(r,a,i)}addForceTowardPosition(e,t,i,s){const r=Math.atan2(t-(this.getDrawableY()+this.getCenterY()),e-(this.getDrawableX()+this.getCenterX())),a=Math.cos(r)*i,o=Math.sin(r)*i;this.addForce(a,o,s)}addForceTowardObject(e,t,i){e!=null&&this.addForceTowardPosition(e.getDrawableX()+e.getCenterX(),e.getDrawableY()+e.getCenterY(),t,i)}clearForces(){l.forcesGarbage.push.apply(l.forcesGarbage,this._instantForces),this._instantForces.length=0,this._permanentForceX=0,this._permanentForceY=0}hasNoForces(){return this._instantForces.length===0&&this._permanentForceX===0&&this._permanentForceY===0}updateForces(e){for(let t=0;t=t:(this._timers.put(e,new n.Timer(e)),!1)}timerPaused(e){return this._timers.containsKey(e)?this._timers.get(e).isPaused():!1}resetTimer(e){this._timers.containsKey(e)||this._timers.put(e,new n.Timer(e)),this._timers.get(e).reset()}pauseTimer(e){this._timers.containsKey(e)||this._timers.put(e,new n.Timer(e)),this._timers.get(e).setPaused(!0)}unpauseTimer(e){this._timers.containsKey(e)||this._timers.put(e,new n.Timer(e)),this._timers.get(e).setPaused(!1)}removeTimer(e){this._timers.containsKey(e)&&this._timers.remove(e)}getTimerElapsedTimeInSeconds(e){return this._timers.containsKey(e)?this._timers.get(e).getTime()/1e3:0}getTimerElapsedTimeInSecondsOrNaN(e){return this._timers.containsKey(e)?this._timers.get(e).getTime()/1e3:Number.NaN}separateFromObjects(e,t){let i=A.moveXArray,s=A.moveYArray;i.length=0,s.length=0;const r=this.getHitBoxes();let a=null;for(const o of e){if(o.id===this.id)continue;let h;o.isSpatiallyIndexed()?(a||(a=this.getAABB()),h=o.getHitBoxesAround(a.min[0],a.min[1],a.max[0],a.max[1])):h=o.getHitBoxes();for(const m of r)for(const c of h){const g=n.Polygon.collisionTest(m,c,t);g.collision&&(i.push(g.move_axis[0]),s.push(g.move_axis[1]))}}return F(this,i,s)}separateFromObjectsList(e,t){let i=A.moveXArray,s=A.moveYArray;i.length=0,s.length=0;const r=this.getHitBoxes();let a=null;for(const o in e.items)if(e.items.hasOwnProperty(o)){const h=e.items[o];for(const m of h){if(m.id===this.id)continue;let c=m.getHitBoxes(),g=c;c.length>4&&(a||(a=this.getAABB()),g=m.getHitBoxesAround(a.min[0],a.min[1],a.max[0],a.max[1]));for(const v of r)for(const B of g){const b=n.Polygon.collisionTest(v,B,t);b.collision&&(i.push(b.move_axis[0]),s.push(b.move_axis[1]))}}}return F(this,i,s)}getDistanceToObject(e){return Math.sqrt(this.getSqDistanceToObject(e))}getSqDistanceToObject(e){if(e===null)return 0;const t=this.getDrawableX()+this.getCenterX()-(e.getDrawableX()+e.getCenterX()),i=this.getDrawableY()+this.getCenterY()-(e.getDrawableY()+e.getCenterY());return t*t+i*i}getDistanceToPosition(e,t){return Math.sqrt(this.getSqDistanceToPosition(e,t))}getSqDistanceToPosition(e,t){const i=this.getDrawableX()+this.getCenterX()-e,s=this.getDrawableY()+this.getCenterY()-t;return i*i+s*s}getAngleToObject(e){if(e===null)return 0;const t=this.getDrawableX()+this.getCenterX()-(e.getDrawableX()+e.getCenterX()),i=this.getDrawableY()+this.getCenterY()-(e.getDrawableY()+e.getCenterY());return n.toDegrees(Math.atan2(-i,-t))}getXFromAngleAndDistance(e,t){return this.getDrawableX()+this.getCenterX()+t*Math.cos(n.toRad(e))}getYFromAngleAndDistance(e,t){return this.getDrawableY()+this.getCenterY()+t*Math.sin(n.toRad(e))}getAngleToPosition(e,t){const i=this.getDrawableX()+this.getCenterX()-e,s=this.getDrawableY()+this.getCenterY()-t;return n.toDegrees(Math.atan2(-s,-i))}putAround(e,t,i,s){const r=n.toRad(s);this.setCenterXInScene(e+Math.cos(r)*i),this.setCenterYInScene(t+Math.sin(r)*i)}putAroundObject(e,t,i){!e||this.putAround(e.getDrawableX()+e.getCenterX(),e.getDrawableY()+e.getCenterY(),t,i)}separateObjectsWithoutForces(e){const t=n.staticArray(l.prototype.separateObjectsWithoutForces);t.length=0;const i=n.staticArray2(l.prototype.separateObjectsWithoutForces);e.values(i);for(let s=0,r=i.length;st[s].getDrawableX()+t[s].getWidth()&&this.setX(t[s].getDrawableX()+t[s].getWidth()),this.getDrawableY()t[s].getDrawableY()+t[s].getHeight()&&this.setY(t[s].getDrawableY()+t[s].getHeight()))}separateObjectsWithForces(e){const t=n.staticArray(l.prototype.separateObjectsWithForces);t.length=0;const i=n.staticArray2(l.prototype.separateObjectsWithForces);e.values(i);for(let s=0,r=i.length;so+c)return!1;const _=e.getHitBoxesAround(B-c,b-c,B+c,b+c),d=t.getHitBoxesAround(g-o,v-o,g+o,v+o);for(const y of _)if(y!==s){for(const D of d)if(n.Polygon.collisionTest(y,D,i).collision)return!0}return!1}raycastTest(e,t,i,s,r){const a=this.getCenterX(),o=this.getCenterY(),h=C(this.getWidth(),this.getHeight(),a,o),m=(e+i)/2,c=(t+s)/2,g=(i-e)*(i-e)+(s-t)*(s-t),v=this.getDrawableX()+a-m,B=this.getDrawableY()+o-c;let b=w.result;if(b.collision=!1,v*v+B*B>h+g+2*Math.sqrt(g*h))return b;if(r){let p=Number.MAX_VALUE;const f=this.getHitBoxesAround(e,t,i,s);for(const _ of f){const d=n.Polygon.raycastTest(_,e,t,i,s);d.collision&&d.closeSqDistp&&d.farSqDist<=g&&(p=d.farSqDist,n.Polygon.copyRaycastTestResult(d,b))}}return b}insideObject(e,t){return this.hitBoxesDirty&&(this.updateHitBoxes(),this.updateAABB(),this.hitBoxesDirty=!1),this.aabb.min[0]<=e&&this.aabb.max[0]>=e&&this.aabb.min[1]<=t&&this.aabb.max[1]>=t}static distanceTest(e,t,i){return e.getSqDistanceToObject(t)<=i}cursorOnObject(){const e=n.staticArray(l.prototype.cursorOnObject);e.length=2;const t=this.getInstanceContainer(),i=t.getGame().getInputManager(),s=t.getLayer(this.layer),r=s.convertCoords(i.getCursorX(),i.getCursorY(),0,e);if(this.insideObject(r[0],r[1]))return!0;const a=i.getAllTouchIdentifiers();for(let o=0;oi[2]||o.min[1]>i[3]||o.max[0]{const l=i.getNetworkSyncData(e);l&&(s[o]=l)}),t!==void 0&&t!==1&&!this.networkId)return null;const a={var:r,extVar:s,id:this.getOrCreateNetworkId()};if(e.syncSceneVisualProps&&(a.color=this._backgroundColor),e.syncLayers){const i={};for(const o in this._layers.items)i[o]=this._layers.items[o].getNetworkSyncData();a.layers=i}return e.syncSceneTimers&&(a.time=this._timeManager.getNetworkSyncData()),e.syncOnceTriggers&&(a.once=this._onceTriggers.getNetworkSyncData()),n.callbacksRuntimeSceneGetSyncData.forEach(i=>{i(this,a,e)}),e.syncAsyncTasks&&(a.async=this._asyncTasksManager.getNetworkSyncData(e)),a}updateFromNetworkSyncData(e,t){if(e.color!==void 0&&(this._backgroundColor=e.color),e.layers)for(const r in e.layers){const s=e.layers[r];this.hasLayer(r)&&this.getLayer(r).updateFromNetworkSyncData(s)}if(e.var&&this._variables.updateFromNetworkSyncData(e.var,t),e.extVar)for(const r in e.extVar){if(!e.extVar.hasOwnProperty(r))continue;const s=e.extVar[r],a=this._variablesByExtensionName.get(r);a&&a.updateFromNetworkSyncData(s,t)}e.time&&this._timeManager.updateFromNetworkSyncData(e.time),e.once&&this._onceTriggers.updateNetworkSyncData(e.once),n.callbacksRuntimeSceneUpdateFromSyncData.forEach(r=>{r(this,e,t)}),e.async&&this._idToCallbackMap&&this._asyncTasksManager.updateFromNetworkSyncData(e.async,this._idToCallbackMap,this,t)}getOrCreateNetworkId(){if(!this.networkId){const e=n.makeUuid().substring(0,8);this.networkId=e}return this.networkId}}n.RuntimeScene=u;let d;(function(i){i[i.CONTINUE=0]="CONTINUE",i[i.PUSH_SCENE=1]="PUSH_SCENE",i[i.POP_SCENE=2]="POP_SCENE",i[i.REPLACE_SCENE=3]="REPLACE_SCENE",i[i.CLEAR_SCENES=4]="CLEAR_SCENES",i[i.STOP_GAME=5]="STOP_GAME"})(d=n.SceneChangeRequest||(n.SceneChangeRequest={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=runtimescene.js.map diff --git a/Export/runtimewatermark.js b/Export/runtimewatermark.js new file mode 100644 index 0000000..8acd350 --- /dev/null +++ b/Export/runtimewatermark.js @@ -0,0 +1,100 @@ +var gdjs;(function(n){let a;(function(r){class s{constructor(e,t,i){this._linkElement=null;this._containerElement=null;this._backgroundElement=null;this._svgElement=null;this._usernameTextElement=null;this._madeWithTextElement=null;this._resizeObserver=null;this._displayDuration=20;this._changeTextDelay=7;this._fadeInDelayAfterGameLoaded=1;this._fadeDuration=.3;this._fadeOutTimeout=null;this._hideTimeout=null;this._fadeOutFirstTextTimeout=null;this._fadeInSecondTextTimeout=null;this._textFontSize=14;this._logoWidth=56;this._logoHeight=45;this._backgroundHeight=150;this._margin=10;this._gameId=e._data.properties.projectUuid,this._gameRenderer=e.getRenderer(),this._authorUsername=t[0],this._placement=i.placement,this._showAtStartup=i.showWatermark,this._isDevEnvironment=e.isUsingGDevelopDevelopmentEnvironment(),i.showWatermark&&this.addStyle()}displayAtStartup(){this._showAtStartup&&this.display()}display(){const e=this._gameRenderer.getDomElementContainer();e&&(this.addWatermarkToGameContainer(e),this._resizeObserver=new ResizeObserver(()=>{const t=e.getBoundingClientRect();this.onResizeGameContainer(t.height)}),this._resizeObserver.observe(e))}updateFontSize(e){this._textFontSize=Math.max(.025*e,12)}updateLogoSize(e){this._logoWidth=Math.max(.06*e,25),this._logoHeight=Math.round(45/56*this._logoWidth)}updateBackgroundHeight(e){this._backgroundHeight=Math.max(.13*e,45)}updateMargin(e){this._margin=Math.max(.025*e,8)}onResizeGameContainer(e){this.updateFontSize(e),this._madeWithTextElement&&(this._madeWithTextElement.style.fontSize=`${this._textFontSize}px`),this._usernameTextElement&&(this._usernameTextElement.style.fontSize=`${this._textFontSize}px`),this.updateLogoSize(e),this._svgElement&&(this._svgElement.setAttribute("height",this._logoHeight.toString()),this._svgElement.setAttribute("width",this._logoWidth.toString())),this.updateBackgroundHeight(e),this._backgroundElement&&(this._backgroundElement.style.height=`${this._backgroundHeight}px`),this.updateMargin(e),this._linkElement&&this.updateElementMargins(this._linkElement)}addWatermarkToGameContainer(e){const t=e.getBoundingClientRect();this.updateFontSize(t.height),this.updateLogoSize(t.height),this.updateBackgroundHeight(t.height),this._containerElement=this.createDivContainer(),this.createBackground();const i=document.createElement("div");this.generateSVGLogo(t.height),this.createMadeWithTextElement(),this.createUsernameTextElement(),this._linkElement=this.createLinkElement(),this._svgElement&&this._containerElement.appendChild(this._svgElement),this._madeWithTextElement&&i.appendChild(this._madeWithTextElement),this._usernameTextElement&&i.appendChild(this._usernameTextElement),this._containerElement.appendChild(i),this._backgroundElement&&e.appendChild(this._backgroundElement),this._linkElement.append(this._containerElement),e.appendChild(this._linkElement),this.setupAnimations()}createBackground(){this._backgroundElement=document.createElement("div"),this._backgroundElement.setAttribute("id","watermark-background"),this._backgroundElement.style.height=`${this._backgroundHeight}px`,this._backgroundElement.style.opacity="0",this._placement.startsWith("top")?(this._backgroundElement.style.top="0",this._backgroundElement.style.backgroundImage="linear-gradient(180deg, rgba(38, 38, 38, .6) 0%, rgba(38, 38, 38, 0) 100% )"):(this._backgroundElement.style.bottom="0",this._backgroundElement.style.backgroundImage="linear-gradient(0deg, rgba(38, 38, 38, .6) 0%, rgba(38, 38, 38, 0) 100% )")}setupAnimations(){requestAnimationFrame(()=>{setTimeout(()=>{!this._containerElement||!this._backgroundElement||!this._linkElement||(this._containerElement.style.opacity="1",this._backgroundElement.style.opacity="1",this._linkElement.style.pointerEvents="all",this._svgElement&&this._svgElement.classList.add("spinning"))},this._fadeInDelayAfterGameLoaded*1e3)}),this._fadeOutTimeout=setTimeout(()=>{!this._containerElement||!this._backgroundElement||(this._containerElement.style.opacity="0",this._backgroundElement.style.opacity="0",this._hideTimeout=setTimeout(()=>{!this._containerElement||!this._backgroundElement||!this._linkElement||(this._linkElement.style.pointerEvents="none",this._containerElement.style.display="none",this._backgroundElement.style.display="none",this._resizeObserver&&this._resizeObserver.disconnect())},this._fadeDuration*1e3))},(this._fadeInDelayAfterGameLoaded+this._displayDuration)*1e3),this._fadeOutFirstTextTimeout=setTimeout(()=>{const{_madeWithTextElement:e,_usernameTextElement:t}=this;!e||t&&(e.style.opacity="0",this._fadeInSecondTextTimeout=setTimeout(()=>{t.style.lineHeight="normal",t.style.opacity="1",e.style.lineHeight="0"},this._fadeDuration*1e3))},(this._fadeInDelayAfterGameLoaded+this._changeTextDelay)*1e3)}createMadeWithTextElement(){this._madeWithTextElement=document.createElement("span"),this._madeWithTextElement.innerText="Made with GDevelop",this._madeWithTextElement.style.fontSize=`${this._textFontSize}px`}createUsernameTextElement(){!this._authorUsername||(this._usernameTextElement=document.createElement("span"),this._usernameTextElement.innerText=`@${this._authorUsername}`,this._usernameTextElement.style.fontSize=`${this._textFontSize}px`,this._usernameTextElement.style.opacity="0",this._usernameTextElement.style.lineHeight="0")}updateElementMargins(e){switch(this._placement){case"top-left":e.style.top=`${this._margin}px`,e.style.left=`${this._margin}px`;break;case"top-right":e.style.top=`${this._margin}px`,e.style.right=`${this._margin}px`;break;case"bottom-left":e.style.bottom=`${this._margin}px`,e.style.left=`${this._margin}px`;break;case"bottom-right":e.style.bottom=`${this._margin}px`,e.style.right=`${this._margin}px`;break;case"top":e.style.top=`${this._margin}px`,e.style.left="50%",e.style.transform="translate(-50%, 0)";break;case"bottom":default:e.style.bottom=`${this._margin}px`,e.style.left="50%",e.style.transform="translate(-50%, 0)";break}}createLinkElement(){const e=document.createElement("a");e.id="watermark-link";let t=this._authorUsername?new URL(`https://gd.games/${this._authorUsername}`):new URL("https://gd.games");return this._isDevEnvironment?t.searchParams.set("dev","true"):(t.searchParams.set("utm_source","gdevelop-game"),t.searchParams.set("utm_medium","game-watermark"),this._gameId&&t.searchParams.set("utm_campaign",this._gameId)),e.href=t.href,e.target="_blank",this.updateElementMargins(e),e}createDivContainer(){const e=document.createElement("div");return e.setAttribute("id","watermark"),e.style.opacity="0",e}generateSVGLogo(e){this._svgElement=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.updateLogoSize(e),this._svgElement.setAttribute("height",this._logoHeight.toString()),this._svgElement.setAttribute("width",this._logoWidth.toString()),this._svgElement.setAttribute("viewBox","-2 -2 59 48"),this._svgElement.setAttribute("fill","none");const t=document.createElementNS("http://www.w3.org/2000/svg","path"),i=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d","M29.3447 33C25.1061 33 21.0255 31.8475 17.4207 29.3381C14.9081 27.5897 12 23.6418 12 16.9488C12 4.53178 18.3074 0 30.9827 0H53.8027L56 7.07232H32.7217C24.3558 7.07232 19.3813 7.72835 19.3813 16.9488C19.3813 19.9944 20.2354 22.1618 21.9933 23.574C24.9642 25.9612 30.7388 26.0628 34.2673 25.7208C34.2673 25.7208 35.715 21.0394 35.9534 20.2794C36.2327 19.3888 36.1104 19.1763 35.2392 19.1763C33.9808 19.1763 31.7185 19.1763 29.3175 19.1763C27.6349 19.1763 25.9818 18.3247 25.9818 16.2793C25.9818 14.3039 27.5198 13.1573 29.6281 13.1573C33.2786 13.1573 40.7969 13.1573 42.2041 13.1573C44.0489 13.1573 45.9315 13.4233 44.971 16.3601L39.8842 31.8734C39.8845 31.8738 35.7287 33 29.3447 33Z"),i.setAttribute("d","M43.3039 35.3278C40.7894 37.1212 37.0648 38.1124 30.7449 38.1124C19.852 38.1124 11.8797 34.1251 8.62927 26.3952C7.0925 22.7415 7.24041 18.6005 7.24041 13H0.00129513C0.00129513 18.9056 -0.0984386 23.5361 1.45249 27.8011C5.51933 38.989 15.992 45 30.0606 45C43.6783 45 49.3213 41.0443 53 35.3278H43.3039Z"),this._svgElement.appendChild(t),this._svgElement.appendChild(i)}addStyle(){const e=document.createElement("style");e.innerHTML=` + @keyframes spin { + 0% { + transform: rotate(0deg); + } + + 5% { + transform: rotate(-10deg); + animation-timing-function: ease-out; + } + + 17% { + transform: rotate(370deg); + animation-timing-function: ease-in-out; + } + + 20% { + transform: rotate(360deg); + animation-timing-function: ease-in-out; + } + + 100% { + transform: rotate(360deg); + } + } + + #watermark-background { + position: absolute; + pointer-events: none; + width: 100%; + transition-property: opacity; + transition-duration: ${this._fadeDuration}s; + } + + #watermark-link { + all: unset; + position: absolute; + cursor: pointer; + pointer-events: none; + user-select: none; + + /* For Safari */ + -webkit-user-select: none; + } + + #watermark { + display: flex; + flex-direction: row; + align-items: center; + transition-property: opacity; + transition-duration: ${this._fadeDuration}s; + transition-timing-function: ease-out; + } + + #watermark > div { + display: flex; + flex-direction: column; + margin-left: 5px; + } + + #watermark span { + color: white; + font-family: 'Tahoma', 'Gill sans', 'Helvetica', 'Arial'; + font-size: ${this._textFontSize}px; + transition: opacity; + transition-duration: ${this._fadeDuration}s; + + /* For Safari */ + -webkit-transition: opacity; + -webkit-transition-duration: ${this._fadeDuration}s; + } + + #watermark svg.spinning { + animation-name: spin; + animation-direction: normal; + animation-duration: 5s; + animation-iteration-count: 3; + animation-delay: 1.5s; + } + + #watermark svg path { + fill: white; + } + + @media (hover: hover) { + #watermark span { + text-decoration: underline; + text-decoration-style: solid; + text-decoration-color: transparent; + } + + #watermark:hover span { + text-decoration-color: white; + + /* For Safari */ + -webkit-text-decoration-color: white; + } + } + `,document.head.appendChild(e)}}r.RuntimeWatermark=s})(a=n.watermark||(n.watermark={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=runtimewatermark.js.map diff --git a/Export/scenestack.js b/Export/scenestack.js new file mode 100644 index 0000000..7fbbd64 --- /dev/null +++ b/Export/scenestack.js @@ -0,0 +1,2 @@ +var gdjs;(function(r){const l=new r.Logger("Scene stack"),h=new r.Logger("Scene stack - Debug");r.Logger.getDefaultConsoleLoggerOutput().discardGroup("Scene stack - Debug");class d{constructor(e){this._stack=[];this._wasFirstSceneLoaded=!1;this._isNextLayoutLoading=!1;this._sceneStackSyncDataToApply=null;this._wasDisposed=!1;if(!e)throw"SceneStack must be constructed with a gdjs.RuntimeGame.";this._runtimeGame=e}onGameResolutionResized(){for(let e=0;e{this._loadNewScene({sceneName:t,externalLayoutName:c,getExcludedObjectNames:s,skipStoppingSoundsOnStartup:o,skipCreatingInstances:n}),this._isNextLayoutLoading=!1}),null)}_loadNewScene(e){this._throwIfDisposed();const a=new r.RuntimeScene(this._runtimeGame);if(a.loadFromScene(this._runtimeGame.getSceneAndExtensionsData(e.sceneName),{excludedObjectNames:e.getExcludedObjectNames?e.getExcludedObjectNames(a):void 0,skipStoppingSoundsOnStartup:e.skipStoppingSoundsOnStartup,skipCreatingInstances:e.skipCreatingInstances}),this._wasFirstSceneLoaded=!0,e.externalLayoutName){const t=this._runtimeGame.getExternalLayoutData(e.externalLayoutName);t&&a.createObjectsFrom(t.instances,0,0,0,!0)}return this._stack.push(a),a}replace(e,a){const t=a||typeof e=="string"?!1:e.clear,s=typeof e=="string"?e:e.sceneName;if(this._throwIfDisposed(),t)for(;this._stack.length!==0;){let o=this._stack.pop();o&&this._unloadSceneAndPossiblyResources({scene:o,newSceneName:s})}else if(this._stack.length!==0){let o=this._stack.pop();o&&this._unloadSceneAndPossiblyResources({scene:o,newSceneName:s})}return this.push(e)}getCurrentScene(){return this._throwIfDisposed(),this._stack.length===0?null:this._stack[this._stack.length-1]}wasFirstSceneLoaded(){return this._wasFirstSceneLoaded}getAllScenes(){return this._throwIfDisposed(),this._stack}getAllSceneNames(){return this._throwIfDisposed(),this._stack.map(e=>e.getName())}getNetworkSyncData(e){const a=e.playerNumber,t=e.isHost;if(a!==void 0&&!t)return null;const s=[];for(let o=0;on+1&&(h.info(`Unloading ${this._stack.length-(n+1)} scenes after position ${n}.`),this.pop(this._stack.length-(n+1)));const u=this.replace({sceneName:c.name,clear:!1,getExcludedObjectNames:s});u&&(u.networkId=c.networkId),t=!0;continue}if(!i.networkId&&c.networkId&&c.name===i.getName()){h.info(`Scene at position ${n} and name ${i.getName()} has no networkId, let's assume it's the right one and reconcile it with the id ${c.networkId}.`),i.networkId=c.networkId;continue}if(i.networkId!==c.networkId){h.info(`Scene at position ${n} and name ${i.getName()} has a different networkId ${i.networkId} than the expected ${c.networkId}, replacing it.`),this._stack.length>n+1&&(h.info(`Unloading ${this._stack.length-(n+1)} scenes after position ${n}.`),this.pop(this._stack.length-(n+1)));const u=this.replace({sceneName:c.name,clear:!1,getExcludedObjectNames:s});u&&(u.networkId=c.networkId),t=!0;continue}}if(this._stack.length>a.length){const n=this._stack.length-a.length;this.pop(n),t=!0}return t}dispose(){for(;this._stack.length>0;){const e=this._stack.pop();e&&this._unloadSceneAndPossiblyResources({scene:e,newSceneName:null})}this._wasDisposed=!0}_unloadSceneAndPossiblyResources({scene:e,newSceneName:a}){const t=e.getName(),s=e.getResourcesUnloading(),n=(s==="inherit"?this._runtimeGame.getSceneResourcesUnloading():s)==="at-scene-exit"&&a!==e.getName()&&this._stack.every(c=>c.getName()!==t);e.unloadScene(),n&&this._runtimeGame.getResourceLoader().unloadSceneResources({unloadedSceneName:t,newSceneName:a})}_throwIfDisposed(){if(this._wasDisposed)throw"The scene stack has been disposed and should not be used anymore."}}r.SceneStack=d})(gdjs||(gdjs={})); +//# sourceMappingURL=scenestack.js.map diff --git a/Export/splash/gd-logo-light.js b/Export/splash/gd-logo-light.js new file mode 100644 index 0000000..55b931e --- /dev/null +++ b/Export/splash/gd-logo-light.js @@ -0,0 +1,2 @@ +var gdjs;(function(z){z.gdevelopLogo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAvMAAACECAMAAAAqY1S1AAAAPFBMVEUAAAD////////////////////////////////////////////////////////////////////////////YSWgTAAAAE3RSTlMAgN8gYECfv+8QcKCQzzBQrx+wpZQyXAAAEDxJREFUeNrs3Olu6yAQBWCYwWxe7533f9cqilK3qiHY9VZ0vn+REsWSD2iMBxScKQwmaju5nsjLLqICuKfQRNt72Z1TAPcTjCU5iA8K4F5YOzmSUQA3EqKTg1kFcBvceTmcVwA3wVZO0SiAOwhaTtIpgBtoSJJQ3EB9Qic5KG6gNkxyJq0ArjV4ORUpgEuNXk72TwFcqJEV0GcGfx97KYM+M6gDk1wAfWZwnV7KoLiBSmgpg+IGKsFSDk30UAOSNdBED3+ekULUO2ttp3czKoArkLxDNpoBhQjUwkiW70akHepCkuHQ/QjVMZI2sQKojpMUwhwPNWJJcSjjoUpGEloFUCUnyyYFUKUgywiFDVRqlGVYsIFadThZ7zChidYRkXNdHBTcRX/uNM/yk+9dN7LKkLca5cp2odCX3ed6xTb1dv5YqHFeviDLqzq5fY+RcpCTp3mWFLL8q8xHeYhFu37t8Zk3JD+4oTDzM7J4R7K35uTjllgynPlF5kPRLhT7/PbRmWcniyyXZn5GaLjeVzz55BmWrIk3Z/5Z3PhQVNocnPno5wplstb18kJcnPmZxYLCnrqTj0/lZ7T1V93UyyedzLzTGfwavqawtJmzpjPihszPGe718PnHLSW2yaSu49tIQeh35E4+SZKX73sYW58Zb89MFL1psAVDvPmWNZWzJfN6uVvJUCL0yesIYytPHg+zRWhJLFq2CWpZ001Uyk2G32d+xq9M9GFT5l/FTUlpc2jmdWrs8pSYUTLXwS1eEa5QdC6qlwV9fiminE5lPnt/3cbM6zlRCYM82EMzb+TBm/QVen6f+Vnj0Qqya+aDLPmvFgQn68VE5vPPft22zPP843xpc2TmmeThg72zXXMTBKJw5BsWNFnv/15bkzYHBcwIkqZPO792g8KoL3AYAXejkprAPGw08Lq/jVLyy9sNhdvuzHPCQS27Phl7gHk8X5dnvlncBIDbi3m1/5rAR8lUP9w79wJieDpvNBQuuzMvyTtwDHOVjQeYh0OGE5mnixsUrnoyL170NZahKSD6sYnC8p9WagxxwKcyz73nH8m8PG/XJ3mIeTRqVcxLHLeTt+zFPAbJluIjnXkR3zTUqZ2KrT6VeYbK+6eYn6jMi7cwj+ipPMo8iAsEadOFedD5MiNjjzBv484Dp+dNfDLz98c/vZt5Csq3nA6ts2N6HpuC6yrmB7hfljY9mQ+vj+K4GLIfIYosvJpWxD6Z+bt3HPgNw/i5zOs65AM1bpOq8hrm5S4QAhl3Yn7E1b1q6InMp4W/GNBO80czz72SK6rEhzBvT2PeVTCPnpzKPIztAaFBTifmFeUgiapH9cNH1QSasXSR5oOZX+wjmc8+8irjdOZhV0jWo8x71NmStGlnvlVXMJofhQOWSo1XVLmLHP4zfwrz7hxpA+bpDSGYbxA3kDZtzJMdJ7Ta1cwv5dhiT6P/M3+OnrdVzPsq5i8G5x5gHqdqgrTpwbxDfoSqUa/nl0sZysj+Z76e+fbAzXiYeYgbVsW8hy7KS5uezGtUuNcDFkfzAxkHMO9Kr5vF4uM/zLypZh6owmxo/egxnXkHVX6EebShU1na9GTeUNxE6JHuh1nHKi/WJHCA2BzzXAxKDU4Wl6qrQYwl5kfnlce572DeikH54fh+2Kz6PeyUvTNfjdKGzvwIL44wDzxUufPoxTzcPpYX/CCOUpZ+eDlDFw7kCfN2eKJgsOQKqQaLEDPMu/BqwbLePmm3/WH43Us9feMplmBe6toVYoywuHs88jk/oZulDZind/5gni5uSnmqnsxPuGhSP0b2Q/3KGMzz/FhZLVe4ZV6uQDBuQ0CcqjmYzySzqXQ5bNuPmaRWkJm3Pi5yPJ15Tmyf0QsOqX0xorQB8/RoXpl5euwEQMpW5tuHsKgcVD/4r7sJ5kFRcqAEV1HmWoycS3HFfYwnsoZhknLybJ4ZXzMvzOPk3+e6kn+3rb9y097INfNWLWbmWavFJjBvlxrjJynlwDDdsJ152CmfsBRUaQPmKYPBKuYR9Cm/Lmpnnt7FlCGeqH6E5z0D8xIj9VWlC+AKFVFzzO5f48hZ3PI7M+sV8xNOxrlZ0twWh2Fdx80FzO/r+SUmZXH0MRg1ZTkIO+MTlo4sbcA8HTAwT4fTFHR+L+YxYghk5gXND6vQzIN5cJbEXBZXVVzU12Yus167PMZVYOUYN6uTbShMGfVrrvRsDPxFOol5PRu5bkZurczr9Dm1rwFXNGlDZ96DWzB/FRmzNHEDaZMyLzImS8y3hypRh0nMjwFxBTB/P0fnApUb5hWcxu2R8T8uGd+JCI6wnf435PWkWT1iHVaoBuT5gvlEFRk4mDUKzqzHXh+Gkgmd+RQCylxl3CYAlUgb6joYXc3896nMS4VB3op5hCtX5SswD9zKQkRn5Z6I2gm+SU17UPiCqueG2GOOfAjMD2kXQrcvCvNibhc3kiht+jOP6w7ZUXE35tMySEeWmbecT04ZxDW2zF88vIzQ2jKf3KJHKs4QKb4CRKo9uFfsDnFby2XsnMA/r5lnPOm7mrdroq1/ch2kDZF51MRbFfM4ORU8H8182Yxb9xHj70uyaaASVKcG6nCnbG5MgDqU3gWfH9DpKEgT7tnYyDFHZl6l7SkRw/KdvJF0CbPN39pUzczb48xD3LictPk7mdd8o4skGte12JZ05tFVlJgXC7wp3N+FFyoWimi4l+KiLEcy8zJ9gdQcQRxpk4SHDtu8NmobzzNmaWNJQJYWw3P2Ocxr3Egwj5FjogLIzCPIn2deZVKnwj0IGGSrO2ORuBlxzhHmwUvzF0QELbZueKOGYpezmR+OVXabkzZdY5UBJFeMYXPGVBqYwoUYgAZY6cyX451PIF0xQpMy4J8ZsF/O2WffoPoxXzOvoP17UiEvbZqZN5XMY+pCKm3ozL8/VjnE5oSY0IllmN+GKyUeWco8F/4a2MMMUpFVjnlWIKPQ17PnX3f6fVx3pncxz2ks6jlvwTYUA9/f/U4K8CVaoifzCBiRK6Wo8gOgIoqCESyYL8+TojJvaMw/D7799kP+Yl89k2w/5qv2onQzFfr2Hez7zz2AS8ZuejzZm3mPQ0jzRuuZR1TQrwKVYD6ZYsau6mGByPySelUZK90eB2mzmLk/ASj7TsyT5hVkwhwFY7x+N29VzTwmmFczb8H4FsaPmGMmEU1oYl6iZiuQtWZePMbBFoURmEcqzRCDH5+5+/vpiOC8h/lrIXBDXwE11EubaubBeBXzqIcqJ236zyW+kecStzKPcCVQBfPoUoJMxrAYBO/q+elIM2NAeizsNZB7A/Oe9rpJNn3LSNCkTf81I6m4WZcpuzPPI7cpIqiReUykRKASzIOiYHfiNqLMfEAqwfTDrQA/zP0JWHjWgXkijt80dQLqeUVnoqqZh+M8Yb5S3LgE155rAz2xG/puZx6jWMAD5rFwqsT8tRSfxztXsj1m2PBfmaPJn/BLO/O1ssMU5GXZ9A72liht+q8BT6nyubj5B6wBx+W0MY9w5Qi0wTymaNW9h3XkqS4Yqrp7PwdxgzhOX+Zhhsijnl9ZUE5a+osvdqlmHvq7gXmIG0ibvswjP0NdytXKPF76I1AJ5iH4c8xjLcf+fBt5CDa7TJ2PgyPs3uBc3sn8lbrpjJkpxrQa3CTlyO8mpRADIWpTuafTVMd8yrlY0/o37umUZR5QL1c7UplnSLWZQex6XqU+NI1X8Ee3gl9uHHm8h3lHnSg8zOeabGJegYka5tF1DfhTdWeeLugZ5HwL8whXCoC1Yf4LKWACN+OaJIvo6YjMk7R7gzAlHifDNzfhlzzzro15qlCfcgHxM41dapnHIaqaeWCkkZ3szjxacNrmxc3MI7ry1CNgHoQbmxT+XVwnxVnsmk7e0YxB7ozsglr0TSxuvv088xzzGERTmG8X9Dq76fs5lvLafy/ucjk3SJv+zEOVkTYvbmYeVCO7LfN287iFAQCU9bAb6KXZ3RHZsFlvfglzyI4mMIg+m3lPlh6uu7Tp/82FVNw4SJs3MI/IDbkba2feQk+tmAcBmH8vl4Z7tULWLpDH+x6wVZ8hVl/9tMPrLxeJJObs88xDPZ3MvCyuiOgp6dmlhXlF+LYOWdxA2ryHeYHS9q+Pn8E82jWeYx5bLl7dJIRf/mRczLPZtOzMT3IS3izJOt3fZknmUiiz/xBGOBLXR5lnHgeoaRKumXmYoTfEXz2lDZ15hyyqmUd1t1lp0/8bauRmvp35Ednl5tvYH+3d63KqMBSG4WQlIQfCYWbd/71u97Tdyz0a0AAR7ff8pa3WecUQCcx8ZY5q/B7zSfRiMGpmtqqwmUNaic3f3gBClZuX4QXt2Hwu7eiPjN7VNi83iDWbmpf6kpolsRbNT2vXjSD5/7Y2L2G52+aFpZ9iO/c9xP8v3UQ/VdivX7aFKzYGHddis0tLCaV5kWj35l0pywOjJ1XfvKGqeyKXBzdyFkKb5pWXw9jyQ+qa51HPTFrr5IrFuqS1tkYVRNm+v/j13NSO/DOroDTvoatv3gX5C1ubd3wRkqR6fPNyCB7GpUek+88D9pGeOkvYEm831TYfsyxW2da8HMvIaQwtmpdXPIzlBwwGzR+ovCJkvJ9kz1sFVdd8tCTJ79F85h+uXfPyaamL7+lJoflD6fIa72N29V1V8y4H/uKj2qd5JwcYDZuX4yJy919ZrdD8jTY7+lyqMh82tJGpOnsl6W4Ii4MuuUZr2VSeqO2Wm7eLzHXIwRY5JfLtSdijDvwlKTR/NL10v+L9BzhBrTdf5p26p2a2SNJz5ZdmnZXmF3X3/zD57kLe08EpNH+r1Y4+jOqA6ruq5mWCeMfmnWxp07wwVLwMH5pvQNdc18D0gatMtc2H7JTY0LwIUmOj5oWl+59iaL6B2ot5ROurhjYVzdPQJclhn+ZlcOOaNi/k9ZNvQdF8I4mfil6YNDwX/JCdWmFuRLXKPEDdioUNsn1dfPBno7oVp+wHurheWll+nrCj4dnohbE98QNoznZUACfhuCJ6YSY9D3xXIN/lNJmoAE4lcxGN6jHROZv0N2vt5PBxDOcVicuSAvg8jhdkjEzgA2VeQBikwAcaeIlWAJ/GBF5CkwL4MI6XdRjgwKfRjOrhl8ncsvrRU9mAqSJooudVnVMbyTo4fCcALxcHXkfWbH8gHXhJpwAKWkYvvDWbi8f3AXAOEv0Kn0ZVtvG0e5yACWXtoxfU2WfjNMkH/gtfgMGJ9PyE4PPk4kO5T2n+2zuSh/PR/CzynbbO3V+K5GzKsrB/3awA1rw+eqmfBv+DiAI/DTPz8AqO+FUIycNLmIFfY8AsJTzuNOObfzCwgbcyEjfXI3l4pZh5P5ikhLdgiBsKWJUCJ2DbVe9x9AqnYDI3EXDyMJyG6fkWdvLw0Q6vnpwCOBfTE1/BsAZ+AzvwIShhTh7OajxgZ+8xqoFzm/rA+yGNXTy8AdfTTsFjFw9vY5QFT3XCnDA3Ce/m0v3ANahLWOEN7yq6lH14vPY5J4cRPLy/OE4pz34oxB9omDttcUcp+ETRjO5ishfuYjQIvak/vlvA3mF1abkAAAAASUVORK5CYII="})(gdjs||(gdjs={})); +//# sourceMappingURL=gd-logo-light.js.map diff --git a/Export/spriteruntimeobject.js b/Export/spriteruntimeobject.js new file mode 100644 index 0000000..4b0eb6c --- /dev/null +++ b/Export/spriteruntimeobject.js @@ -0,0 +1,2 @@ +var gdjs;(function(n){class r extends n.RuntimeObject{constructor(t,e,i){super(t,e,i);this._scaleX=1;this._scaleY=1;this._blendMode=0;this._flippedX=!1;this._flippedY=!1;this.opacity=255;this._preScale=1;this._animationFrameDirty=!0;this._updateIfNotVisible=!!e.updateIfNotVisible,this._preScale=e.preScale||1,this._renderer=new n.SpriteRuntimeObjectRenderer(this,t),this._animator=new n.SpriteAnimator(e.animations,n.SpriteRuntimeObjectRenderer.getAnimationFrameTextureManager(t.getGame().getImageManager())),this._updateAnimationFrame(),this.onCreated()}reinitialize(t){super.reinitialize(t);const e=this.getInstanceContainer();this._animator.reinitialize(t.animations),this._scaleX=1,this._scaleY=1,this._blendMode=0,this._flippedX=!1,this._flippedY=!1,this.opacity=255,this._updateIfNotVisible=!!t.updateIfNotVisible,this._preScale=t.preScale||1,this._renderer.reinitialize(this,e),this._updateAnimationFrame(),this.onCreated()}updateFromObjectData(t,e){return this._preScale=e.preScale||1,this._animator.updateFromObjectData(t.animations,e.animations),this._updateIfNotVisible=!!e.updateIfNotVisible,this._updateAnimationFrame(),this.invalidateHitboxes(),!0}getNetworkSyncData(t){return{...super.getNetworkSyncData(t),anim:this._animator.getNetworkSyncData(),ifx:this.isFlippedX(),ify:this.isFlippedY(),sx:this._scaleX,sy:this._scaleY,op:this.opacity,color:this.getColor()}}updateFromNetworkSyncData(t,e){super.updateFromNetworkSyncData(t,e),t.ifx!==void 0&&this.flipX(t.ifx),t.ify!==void 0&&this.flipY(t.ify),t.sx!==void 0&&this.setScaleX(Math.abs(t.sx)),t.sy!==void 0&&this.setScaleY(Math.abs(t.sy)),t.op!==void 0&&this.setOpacity(t.op),t.anim&&(this._animator.updateFromNetworkSyncData(t.anim),this._updateAnimationFrame()),(t.ifx!==void 0||t.ify!==void 0||t.sx!==void 0||t.sy!==void 0||t.anim!==void 0)&&this.invalidateHitboxes(),t.color!==void 0&&this.setColor(t.color)}extraInitializationFromInitialInstance(t){if(t.numberProperties)for(let e=0,i=t.numberProperties.length;e=this.hitBoxes.length&&this.hitBoxes.push(new n.Polygon);for(let i=0;i=this.hitBoxes[e].vertices.length&&this.hitBoxes[e].vertices.push([0,0]),this._transformToGlobal(t.customHitBoxes[e].vertices[i][0],t.customHitBoxes[e].vertices[i][1],this.hitBoxes[e].vertices[i]);this.hitBoxes[e].vertices.length=t.customHitBoxes[e].vertices.length}this.hitBoxes.length=t.customHitBoxes.length}}setAnimation(t){this.setAnimationIndex(t)}setAnimationIndex(t){this._animator.setAnimationIndex(t)&&(this._renderer.update(),this._animationFrameDirty=!0,this.invalidateHitboxes())}setAnimationName(t){this._animator.setAnimationName(t)&&(this._renderer.update(),this._animationFrameDirty=!0,this.invalidateHitboxes())}getAnimation(){return this.getAnimationIndex()}getAnimationIndex(){return this._animator.getAnimationIndex()}getAnimationName(){return this._animator.getAnimationName()}isCurrentAnimationName(t){return this.getAnimationName()===t}setDirectionOrAngle(t){const e=this._animator.setDirectionOrAngle(this.angle,t);e!==null&&(this.angle=e,this._renderer.update(),this._animationFrameDirty=!0,this.invalidateHitboxes(),this._renderer.updateAngle())}getDirectionOrAngle(){return this._animator.getDirectionOrAngle(this.angle)}setAnimationFrame(t){this._animator.setAnimationFrameIndex(t)&&(this._animationFrameDirty=!0,this.invalidateHitboxes())}getAnimationFrame(){return this._animator.getAnimationFrameIndex()}getAnimationElapsedTime(){return this._animator.getAnimationElapsedTime()}setAnimationElapsedTime(t){this._animator.setAnimationElapsedTime(t)&&(this._animationFrameDirty=!0,this.invalidateHitboxes())}getAnimationDuration(){return this._animator.getAnimationDuration()}getAnimationFrameCount(){return this._animator.getAnimationFrameCount()}hasAnimationEndedLegacy(){return this._animator.hasAnimationEndedLegacy()}hasAnimationEnded2(){return this._animator.hasAnimationEnded()}hasAnimationEnded(){return this._animator.hasAnimationEnded()}animationPaused(){return this._animator.isAnimationPaused()}isAnimationPaused(){return this._animator.isAnimationPaused()}pauseAnimation(){this._animator.pauseAnimation()}playAnimation(){this._animator.resumeAnimation()}resumeAnimation(){this._animator.resumeAnimation()}getAnimationSpeedScale(){return this._animator.getAnimationSpeedScale()}setAnimationSpeedScale(t){this._animator.setAnimationSpeedScale(t)}getPointX(t){const e=this._animator.getCurrentFrame();if(t.length===0||e===null)return this.getX();const i=e.getPoint(t),a=n.staticArray(r.prototype.getPointX);return this._transformToGlobal(i.x,i.y,a),a[0]}getPointY(t){const e=this._animator.getCurrentFrame();if(t.length===0||e===null)return this.getY();const i=e.getPoint(t),a=n.staticArray(r.prototype.getPointY);return this._transformToGlobal(i.x,i.y,a),a[1]}getPointPosition(t){const e=this._animator.getCurrentFrame();if(t.length===0||e===null)return[this.getX(),this.getY()];const i=e.getPoint(t),a=n.staticArray(r.prototype.getPointX);return this._transformToGlobal(i.x,i.y,a),[a[0],a[1]]}_transformToGlobal(t,e,i){const a=this._animator.getCurrentFrame();let s=a.center.x,o=a.center.y;this._flippedX&&(t=t+(s-t)*2),this._flippedY&&(e=e+(o-e)*2);const h=Math.abs(this._scaleX*this._preScale),l=Math.abs(this._scaleY*this._preScale);t*=h,e*=l,s*=h,o*=l;const d=this.angle/180*Math.PI,m=Math.cos(d),p=Math.sin(d),u=t-s,g=e-o;t=s+m*u-p*g,e=o+p*u+m*g,i.length=2,i[0]=t+(this.x-a.origin.x*h),i[1]=e+(this.y-a.origin.y*l)}getDrawableX(){const t=this._animator.getCurrentFrame();if(t===null)return this.x;const e=Math.abs(this._scaleX*this._preScale);return this._flippedX?this.x+(-t.origin.x-this.getCurrentFrameWidth()+2*t.center.x)*e:this.x-t.origin.x*e}getDrawableY(){const t=this._animator.getCurrentFrame();if(t===null)return this.y;const e=Math.abs(this._scaleY*this._preScale);return this._flippedY?this.y+(-t.origin.y-this.getCurrentFrameHeight()+2*t.center.y)*e:this.y-t.origin.y*e}getCenterX(){const t=this._animator.getCurrentFrame(),e=this.getCurrentFrameWidth(),i=t?t.center.x:e/2;return this._flippedX?(e-i)*Math.abs(this._scaleX*this._preScale):i*Math.abs(this._scaleX*this._preScale)}getCenterY(){const t=this._animator.getCurrentFrame(),e=this.getCurrentFrameHeight(),i=t?t.center.y:e/2;return this._flippedY?(e-i)*Math.abs(this._scaleY*this._preScale):i*Math.abs(this._scaleY*this._preScale)}setX(t){t!==this.x&&(this.x=t,this.invalidateHitboxes(),this._renderer.updateX())}setY(t){t!==this.y&&(this.y=t,this.invalidateHitboxes(),this._renderer.updateY())}setAngle(t){const e=this._animator.setAngle(this.angle,t);e!==null&&(this.angle=e,this.invalidateHitboxes(),this._renderer.updateAngle())}getAngle(){return this._animator.getAngle(this.angle)}setBlendMode(t){this._blendMode!==t&&(this._blendMode=t,this._renderer.update())}getBlendMode(){return this._blendMode}setOpacity(t){t<0&&(t=0),t>255&&(t=255),this.opacity=t,this._renderer.updateOpacity()}getOpacity(){return this.opacity}hide(t){t===void 0&&(t=!0),this.hidden=t,this._renderer.updateVisibility()}setColor(t){this._renderer.setColor(t)}getColor(){return this._renderer.getColor()}flipX(t){t!==this._flippedX&&(this._scaleX*=-1,this._flippedX=t,this.invalidateHitboxes(),this._renderer.update())}flipY(t){t!==this._flippedY&&(this._scaleY*=-1,this._flippedY=t,this.invalidateHitboxes(),this._renderer.update())}isFlippedX(){return this._flippedX}isFlippedY(){return this._flippedY}getWidth(){return this._animationFrameDirty&&this._updateAnimationFrame(),this._renderer.getWidth()}getHeight(){return this._animationFrameDirty&&this._updateAnimationFrame(),this._renderer.getHeight()}setWidth(t){const e=this.getOriginalWidth();e!==0&&this.setScaleX(t/e)}setHeight(t){const e=this.getOriginalHeight();e!==0&&this.setScaleY(t/e)}setSize(t,e){this.setWidth(t),this.setHeight(e)}getOriginalWidth(){return this.getCurrentFrameWidth()*this._preScale}getOriginalHeight(){return this.getCurrentFrameHeight()*this._preScale}getCurrentFrameWidth(){return this._animationFrameDirty&&this._updateAnimationFrame(),this._renderer.getUnscaledWidth()}getCurrentFrameHeight(){return this._animationFrameDirty&&this._updateAnimationFrame(),this._renderer.getUnscaledHeight()}setScale(t){t<0&&(t=0),!(t===Math.abs(this._scaleX)&&t===Math.abs(this._scaleY))&&(this._scaleX=t*(this._flippedX?-1:1),this._scaleY=t*(this._flippedY?-1:1),this._renderer.update(),this.invalidateHitboxes())}setScaleX(t){t<0&&(t=0),t!==Math.abs(this._scaleX)&&(this._scaleX=t*(this._flippedX?-1:1),this._renderer.update(),this.invalidateHitboxes())}setScaleY(t){t<0&&(t=0),t!==Math.abs(this._scaleY)&&(this._scaleY=t*(this._flippedY?-1:1),this._renderer.update(),this.invalidateHitboxes())}getScaleMean(){return(Math.abs(this._scaleX)+Math.abs(this._scaleY))/2}getScale(){const t=Math.abs(this._scaleX),e=Math.abs(this._scaleY);return t===e?t:Math.sqrt(t*e)}getScaleY(){return Math.abs(this._scaleY)}getScaleX(){return Math.abs(this._scaleX)}turnTowardObject(t){return this.rotateTowardObject(t,0)}}n.SpriteRuntimeObject=r,n.registerObject("Sprite",n.SpriteRuntimeObject),r.supportsReinitialization=!0})(gdjs||(gdjs={})); +//# sourceMappingURL=spriteruntimeobject.js.map diff --git a/Export/timemanager.js b/Export/timemanager.js new file mode 100644 index 0000000..8f03c5c --- /dev/null +++ b/Export/timemanager.js @@ -0,0 +1,2 @@ +var gdjs;(function(r){class a{constructor(){this._elapsedTime=0;this._timeScale=1;this._timeFromStart=0;this._firstFrame=!0;this._timers=new Hashtable;this._firstUpdateDone=!1;this.reset()}reset(){this._elapsedTime=0,this._timeScale=1,this._timeFromStart=0,this._firstFrame=!0,this._timers=new Hashtable}update(e,i){this._firstUpdateDone&&(this._firstFrame=!1),this._firstUpdateDone=!0,this._elapsedTime=Math.min(e,1e3/i),this._elapsedTime*=this._timeScale;for(const t in this._timers.items)this._timers.items.hasOwnProperty(t)&&this._timers.items[t].updateTime(this._elapsedTime);this._timeFromStart+=this._elapsedTime}setTimeScale(e){e>=0&&(this._timeScale=e)}getNetworkSyncData(){const e=new Hashtable;return Object.entries(this._timers.items).forEach(([i,t])=>{e.put(i,t.getNetworkSyncData())}),{elapsedTime:this._elapsedTime,timeScale:this._timeScale,timeFromStart:this._timeFromStart,firstFrame:this._firstFrame,timers:e,firstUpdateDone:this._firstUpdateDone}}updateFromNetworkSyncData(e){e.elapsedTime!==void 0&&(this._elapsedTime=e.elapsedTime),e.timeScale!==void 0&&(this._timeScale=e.timeScale),e.timeFromStart!==void 0&&(this._timeFromStart=e.timeFromStart),e.firstFrame!==void 0&&(this._firstFrame=e.firstFrame),e.timers!==void 0&&(this._timers.clear(),Object.entries(e.timers.items).forEach(([i,t])=>{const s=new r.Timer(t.name);s.updateFromNetworkSyncData(t),this._timers.put(i,s)})),e.firstUpdateDone!==void 0&&(this._firstUpdateDone=e.firstUpdateDone)}getTimeScale(){return this._timeScale}getTimeFromStart(){return this._timeFromStart}isFirstFrame(){return this._firstFrame}getElapsedTime(){return this._elapsedTime}addTimer(e){this._timers.put(e,new r.Timer(e))}hasTimer(e){return this._timers.containsKey(e)}getTimer(e){return this._timers.get(e)}removeTimer(e){this._timers.containsKey(e)&&this._timers.remove(e)}}r.TimeManager=a})(gdjs||(gdjs={})); +//# sourceMappingURL=timemanager.js.map diff --git a/Export/timer.js b/Export/timer.js new file mode 100644 index 0000000..43fbef9 --- /dev/null +++ b/Export/timer.js @@ -0,0 +1,2 @@ +var gdjs;(function(i){class t{constructor(e){this._time=0;this._paused=!1;this._name=e}getName(){return this._name}getTime(){return this._time}updateTime(e){this._paused||(this._time+=e)}setTime(e){this._time=e}reset(){this.setTime(0)}setPaused(e){this._paused=e}isPaused(){return this._paused}getNetworkSyncData(){return{name:this._name,time:this._time,paused:this._paused}}updateFromNetworkSyncData(e){this._time=e.time,this._paused=e.paused}}i.Timer=t})(gdjs||(gdjs={})); +//# sourceMappingURL=timer.js.map diff --git a/Export/variable.js b/Export/variable.js new file mode 100644 index 0000000..cc758fd --- /dev/null +++ b/Export/variable.js @@ -0,0 +1,2 @@ +var gdjs;(function(n){const l=new n.Logger("Variables");class h{constructor(e){this._type="number";this._value=0;this._str="0";this._bool=!1;this._children={};this._childrenArray=[];this._undefinedInContainer=!1;this._playerNumber=0;this.reinitialize(e)}reinitialize(e){if(this._type="number",this._value=0,this._str="0",this._bool=!1,this._children={},this._childrenArray=[],this._undefinedInContainer=!1,e!==void 0){if(this._type=e.type||"number",this._type==="number")this._value=parseFloat(e.value||"0"),this._value!==this._value&&(this._value=0);else if(this._type==="string")this._str=n.Variable.useDeprecatedZeroAsDefaultStringVariable?""+e.value||"0":e.value!==void 0?""+e.value:"";else if(this._type==="boolean")this._bool=!!e.value;else if(this._type==="structure"){if(e.children!==void 0)for(var t=0,r=e.children.length;t{const i=r.getType(),s=i==="structure"||i==="array"?"":r.getValue(),a=r.getPlayerOwnership();r.isUndefinedInContainer()||a===null||t.push({name:"",value:s,type:i,children:this.getStructureNetworkSyncData(r),owner:a})}),t}if(e.getType()==="structure"){const t=e.getAllChildren();if(!t)return;const r=[];return Object.entries(t).forEach(([i,s])=>{const a=s.getType(),o=a==="structure"||a==="array"?"":s.getValue(),u=s.getPlayerOwnership();s.isUndefinedInContainer()||u===null||r.push({name:i,value:o,type:a,children:this.getStructureNetworkSyncData(s),owner:u})}),r}}updateFromNetworkSyncData(e,t){const r=e.owner,i=n.Variable.getVariableDataFromNetworkSyncData(e);if(!(t.shouldExcludeVariableFromUpdate&&t.shouldExcludeVariableFromUpdate(this))){if(!t.ignoreVariableOwnership){const s=n.multiplayer.getCurrentPlayerNumber(),a=this.getPlayerOwnership();if(s===a)return;r&&r!==a&&this.setPlayerOwnership(r)}this.reinitialize(i)}}fromJSObject(e){if(e===null)this.setString("null");else if(typeof e=="number")Number.isNaN(e)?(l.warn("Variables cannot be set to NaN, setting it to 0."),this.setNumber(0)):this.setNumber(e);else if(typeof e=="string")this.setString(e);else if(typeof e!="undefined")if(typeof e=="boolean")this.setBoolean(e);else if(Array.isArray(e)){this.castTo("array"),this.clearChildren();for(const r in e)this.getChild(r).fromJSObject(e[r])}else if(typeof e=="object"){this.castTo("structure"),this.clearChildren();for(var t in e)e.hasOwnProperty(t)&&this.getChild(t).fromJSObject(e[t])}else typeof e=="symbol"?this.setString(e.toString()):typeof e=="bigint"?(e>Number.MAX_SAFE_INTEGER&&l.warn("Error while converting JS variable to GDevelop variable: Integers bigger than "+Number.MAX_SAFE_INTEGER+" aren't supported by GDevelop variables, it will be reduced to that size."),this.setNumber(parseInt(e,10))):typeof e=="function"?l.error("Error while converting JS variable to GDevelop variable: Impossible to set variable value to a function."):l.error("Error while converting JS variable to GDevelop variable: Cannot identify type of object "+e);return this}fromJSON(e){try{var t=JSON.parse(e)}catch(r){return l.error("Unable to parse JSON: "+e+r),this}return this.fromJSObject(t),this}toJSObject(){switch(this._type){case"string":return this.getAsString();case"number":return this.getAsNumber();case"boolean":return this.getAsBoolean();case"structure":const e={};for(const r in this._children)e[r]=this._children[r].toJSObject();return e;case"array":const t=[];for(const r of this._childrenArray)t.push(r===void 0?void 0:r.toJSObject());return t}}isPrimitive(){return n.Variable.isPrimitive(this._type)}clone(){return n.Variable.copy(this,new n.Variable)}setUndefinedInContainer(){this._undefinedInContainer=!0}isUndefinedInContainer(){return this._undefinedInContainer}castTo(e){if(e==="string")this.setString(this.getAsString());else if(e==="number")this.setNumber(this.getAsNumber());else if(e==="boolean")this.setBoolean(this.getAsBoolean());else if(e==="structure"){if(this._type==="structure")return;this._children=this.getAllChildren(),this._type="structure"}else if(e==="array"){if(this._type==="array")return;this._childrenArray=this.getAllChildrenArray(),this._type="array"}}getChild(e){return this._type==="array"?this.getChildAt(Number.isInteger(e)?e:parseInt(e,10)||0):(this._type!=="structure"&&this.castTo("structure"),this.getChildNamed(""+e))}getChildNamed(e){const t=this._children[e];return t??(this._children[e]=new n.Variable)}addChild(e,t){return this._type!=="structure"&&this.castTo("structure"),this._children[e]=t,this}hasChild(e){return this._type==="structure"&&this._children.hasOwnProperty(e)}removeChild(e){this._type==="structure"&&delete this._children[e]}clearChildren(){this._children={},this._childrenArray=[]}replaceChildren(e){this._type="structure",this._children=e}replaceChildrenArray(e){this._type="array",this._childrenArray=e}getAsNumber(){if(this._type!=="number"){let e=0;return this._type==="string"?e=parseFloat(this._str):this._type==="boolean"&&(e=this._bool?1:0),e===e?e:0}return this._value}setNumber(e){this._type="number",e=parseFloat(e),this._value=e===e?e:0}getAsString(){return this._type!=="string"?this._type==="number"?this._value.toString():this._type==="boolean"?this._bool?"true":"false":this._type==="structure"?"[Structure]":this._type==="array"?"[Array]":"":this._str}setString(e){this._type="string",this._str=""+e}getAsNumberOrString(){return this._type==="number"?this._value:this.getAsString()}getAsBoolean(){return this._type!=="boolean"?this._type==="number"?this._value!==0:this._type==="string"?this._str!=="0"&&this._str!==""&&this._str!=="false":!0:this._bool}setBoolean(e){this._type="boolean",this._bool=!!e}toggle(){this.setBoolean(!this.getAsBoolean())}setValue(e){this._type==="string"?this.setString(e):this._type==="number"?this.setNumber(e):this._type==="boolean"&&this.setBoolean(e)}getValue(){return this._type==="number"?this.getAsNumber():this._type==="boolean"?this.getAsBoolean():this.getAsString()}isStructure(){return this._type==="structure"}isNumber(){return this._type==="number"}getType(){return this._type}getAllChildren(){return this._type==="structure"?this._children:this._type==="array"?Object.assign({},this._childrenArray):{}}getAllChildrenArray(){return this._type==="structure"?Object.values(this._children):this._type==="array"?this._childrenArray:[]}getChildrenCount(){return this._type==="structure"?Object.keys(this._children).length:this._type==="array"?this._childrenArray.length:0}add(e){this.setNumber(this.getAsNumber()+e)}sub(e){this.setNumber(this.getAsNumber()-e)}mul(e){this.setNumber(this.getAsNumber()*e)}div(e){this.setNumber(this.getAsNumber()/e)}concatenateString(e){this.setString(this.getAsString()+e)}concatenate(e){this.setString(this.getAsString()+e)}getChildAt(e){return this._type!=="array"&&this.castTo("array"),(this._childrenArray[e]===void 0||this._childrenArray[e]===null)&&(this._childrenArray[e]=new n.Variable),this._childrenArray[e]}removeAtIndex(e){this._type==="array"&&this._childrenArray.splice(e,1)}pushVariableCopy(e){this._type!=="array"&&this.castTo("array"),this._childrenArray.push(e.clone())}_pushVariable(e){this._type!=="array"&&this.castTo("array"),this._childrenArray.push(e)}pushValue(e){this._type!=="array"&&this.castTo("array"),this._childrenArray.push(new n.Variable({type:typeof e,value:e}))}getPlayerOwnership(){return this._playerNumber}setPlayerOwnership(e){this._playerNumber=e}disableSynchronization(){this._playerNumber=null}}h.useDeprecatedZeroAsDefaultStringVariable=!1,h.getVariableDataFromNetworkSyncData=e=>({name:e.name,value:e.value,type:e.type,children:e.children?e.children.map(t=>n.Variable.getVariableDataFromNetworkSyncData(t)):void 0}),n.Variable=h})(gdjs||(gdjs={})); +//# sourceMappingURL=variable.js.map diff --git a/Export/variablescontainer.js b/Export/variablescontainer.js new file mode 100644 index 0000000..bab15d2 --- /dev/null +++ b/Export/variablescontainer.js @@ -0,0 +1,2 @@ +var gdjs;(function(o){const s=class{constructor(r){this._variablesArray=[];this._variables=new Hashtable,r!==void 0&&this.initFrom(r)}initFrom(r,e){e===void 0&&(e=!1),e||(s._deletedVars=s._deletedVars||[],this._variables.keys(s._deletedVars));const a=this;let t=0;for(let n=0;n=this._variablesArray.length){let e=new o.Variable;return this._variables.put("",e),e}else{let e=this._variablesArray[r];return e.isUndefinedInContainer()&&e.reinitialize(),e}}has(r){const e=this._variables.get(r);return!!e&&!e.isUndefinedInContainer()}hasVariable(r){const e=this._variablesArray.find(a=>a===r);return!!e&&!e.isUndefinedInContainer()}getVariableNameInContainerByLoopingThroughAllVariables(r){const e=this._variables.items;for(const a in e)if(e.hasOwnProperty(a)&&e[a]===r)return a;return null}getVariablePathInContainerByLoopingThroughAllVariables(r,e=null){const a=e||this._variables.items;for(const t in a)if(a.hasOwnProperty(t)){const n=a[t];if(n===r)return[t];if(n.getType()==="structure"){const i=n.getAllChildren(),l=this.getVariablePathInContainerByLoopingThroughAllVariables(r,i);if(l)return[t,...l]}}return null}getVariableFromPath(r){let e=this._variables.items;for(let a=0;a{const i=this._variables.get(t).getNetworkSyncData(r);i&&e.push({name:t,...i})}),e}updateFromNetworkSyncData(r,e){const a=this;for(let t=0;to.VariablesContainer.badVariable,toJSObject:()=>0,fromJSObject:()=>o.VariablesContainer.badVariable,reinitialize:()=>{},addChild:()=>o.VariablesContainer.badVariable,castTo:()=>{},clearChildren:()=>{},clone:()=>o.VariablesContainer.badVariable,getChildrenCount:()=>0,replaceChildren:()=>{},replaceChildrenArray:()=>{},getType:function(){return"number"},isPrimitive:function(){return!0},setValue:()=>{},toggle:()=>{},getValue:()=>0,getChild:()=>o.VariablesContainer.badVariable,getChildAt:()=>o.VariablesContainer.badVariable,getChildNamed:()=>o.VariablesContainer.badVariable,hasChild:function(){return!1},isStructure:function(){return!1},isNumber:function(){return!0},removeChild:function(){},setNumber:function(){},setString:function(){},setBoolean:function(){},getAsString:function(){return"0"},getAsNumber:function(){return 0},getAsNumberOrString:function(){return 0},getAsBoolean:function(){return!1},getAllChildren:function(){return{}},getAllChildrenArray:function(){return[]},pushVariableCopy:()=>{},_pushVariable:()=>{},pushValue:()=>{},removeAtIndex:function(){},add:function(){},sub:function(){},mul:function(){},div:function(){},concatenate:function(){},concatenateString:function(){},setUndefinedInContainer:function(){},isUndefinedInContainer:function(){return!0},getPlayerOwnership:function(){return 0},setPlayerOwnership:function(){},disableSynchronization:function(){},getNetworkSyncData:function(){},getStructureNetworkSyncData:function(){return[]},updateFromNetworkSyncData:function(){}},o.VariablesContainer=u})(gdjs||(gdjs={})); +//# sourceMappingURL=variablescontainer.js.map diff --git a/MultiplayerTest01.json b/MultiplayerTest01.json new file mode 100644 index 0000000..37388b0 --- /dev/null +++ b/MultiplayerTest01.json @@ -0,0 +1,14681 @@ +{ + "firstLayout": "Login", + "gdVersion": { + "build": 274, + "major": 5, + "minor": 6, + "revision": 0 + }, + "initialGDVersion": "5.6.274", + "properties": { + "adaptGameResolutionAtRuntime": true, + "antialiasingMode": "MSAA", + "antialisingEnabledOnMobile": false, + "folderProject": false, + "orientation": "landscape", + "packageName": "com.example.gamename", + "pixelsRounding": true, + "projectUuid": "95fbe47f-9217-4b08-9d51-4fe99f117474", + "scaleMode": "nearest", + "sizeOnStartupMode": "adaptWidth", + "templateSlug": "", + "version": "1.0.0", + "name": "MultiplayerTest01", + "description": "", + "author": "", + "windowWidth": 1280, + "windowHeight": 720, + "latestCompilationDirectory": "", + "maxFPS": 60, + "minFPS": 20, + "verticalSync": false, + "platformSpecificAssets": {}, + "loadingScreen": { + "backgroundColor": 0, + "backgroundFadeInDuration": 0.2, + "backgroundImageResourceName": "", + "gdevelopLogoStyle": "light", + "logoAndProgressFadeInDuration": 0.2, + "logoAndProgressLogoFadeInDelay": 0, + "minDuration": 1.5, + "progressBarColor": 16777215, + "progressBarHeight": 20, + "progressBarMaxWidth": 200, + "progressBarMinWidth": 40, + "progressBarWidthPercent": 30, + "showGDevelopSplash": true, + "showProgressBar": true + }, + "watermark": { + "placement": "bottom-left", + "showWatermark": true + }, + "authorIds": [], + "authorUsernames": [], + "categories": [], + "playableDevices": [], + "extensionProperties": [], + "platforms": [ + { + "name": "GDevelop JS platform" + } + ], + "currentPlatform": "GDevelop JS platform" + }, + "resources": { + "resources": [ + { + "file": "assets/8BitOperatorPlus8Regular_Edited.png", + "kind": "image", + "metadata": "", + "name": "assets\\8BitOperatorPlus8Regular_Edited.png", + "smoothed": false, + "userAdded": false, + "origin": { + "identifier": "https://asset-resources.gdevelop.io/public-resources/Menu buttons/Pixel art/15c1797cbcb41c3a753b6bbb21cfa60284cfaf81c9891c3abf78a8e0e1cacf59_8BitOperatorPlus8Regular_Edited.png", + "name": "8BitOperatorPlus8Regular_Edited.png" + } + }, + { + "file": "assets/Small Blue Button_Hovered.png", + "kind": "image", + "metadata": "", + "name": "assets\\Small Blue Button_Hovered.png", + "smoothed": false, + "userAdded": false, + "origin": { + "identifier": "https://asset-resources.gdevelop.io/public-resources/Menu buttons/Pixel art/f80ae062891a0a4612c0160ed931165461392019f89a8545f28c195f645ebc48_Small Blue Button_Hovered.png", + "name": "Small Blue Button_Hovered.png" + } + }, + { + "file": "assets/Small Blue Button_Idle.png", + "kind": "image", + "metadata": "", + "name": "assets\\Small Blue Button_Idle.png", + "smoothed": false, + "userAdded": false, + "origin": { + "identifier": "https://asset-resources.gdevelop.io/public-resources/Menu buttons/Pixel art/c22b15c77047f1545806141e1129900bdc985d191b7ab5ebaae834a90c270ed2_Small Blue Button_Idle.png", + "name": "Small Blue Button_Idle.png" + } + }, + { + "file": "assets/Small Blue Button_Pressed.png", + "kind": "image", + "metadata": "", + "name": "assets\\Small Blue Button_Pressed.png", + "smoothed": false, + "userAdded": false, + "origin": { + "identifier": "https://asset-resources.gdevelop.io/public-resources/Menu buttons/Pixel art/9e01b09016c6a200b53a55cac3cf34f083785eb6b9f55de490a71ad352858b36_Small Blue Button_Pressed.png", + "name": "Small Blue Button_Pressed.png" + } + }, + { + "file": "assets/8BitOperatorPlus8Regular_Edited.fnt", + "kind": "bitmapFont", + "metadata": "", + "name": "assets\\8BitOperatorPlus8Regular_Edited.fnt", + "userAdded": false, + "origin": { + "identifier": "https://asset-resources.gdevelop.io/public-resources/Menu buttons/Pixel art/6b410f07a3a02e721a49d41795e84b56707ef28ac4d095d55f1fd1093760e134_8BitOperatorPlus8Regular_Edited.fnt", + "name": "8BitOperatorPlus8Regular_Edited.fnt" + } + }, + { + "file": "assets/NewSprite.png", + "kind": "image", + "metadata": "{\"extension\":\".png\"}", + "name": "NewSprite", + "smoothed": false, + "userAdded": false + }, + { + "file": "assets/NewSprite2.png", + "kind": "image", + "metadata": "{\"extension\":\".png\"}", + "name": "NewSprite2", + "smoothed": false, + "userAdded": false + }, + { + "file": "assets/NewSprite3.png", + "kind": "image", + "metadata": "{\"extension\":\".png\"}", + "name": "NewSprite3", + "smoothed": false, + "userAdded": false + }, + { + "file": "assets/01Down.png", + "kind": "image", + "metadata": "{\"extension\":\".png\",\"localFilePath\":\"assets/01Down.png\"}", + "name": "01Down", + "smoothed": false, + "userAdded": false + }, + { + "file": "assets/01Down2.png", + "kind": "image", + "metadata": "{\"extension\":\".png\",\"localFilePath\":\"assets/01Down2.png\"}", + "name": "01Down2", + "smoothed": false, + "userAdded": false + }, + { + "file": "assets/01Down3.png", + "kind": "image", + "metadata": "{\"extension\":\".png\",\"localFilePath\":\"assets/01Down3.png\"}", + "name": "01Down3", + "smoothed": false, + "userAdded": false + }, + { + "file": "assets/01Down4.png", + "kind": "image", + "metadata": "{\"extension\":\".png\"}", + "name": "01Down4", + "smoothed": false, + "userAdded": false + }, + { + "file": "assets/01Down5.png", + "kind": "image", + "metadata": "{\"extension\":\".png\"}", + "name": "01Down5", + "smoothed": false, + "userAdded": false + }, + { + "file": "assets/01Down6.png", + "kind": "image", + "metadata": "{\"extension\":\".png\"}", + "name": "01Down6", + "smoothed": false, + "userAdded": false + }, + { + "file": "assets/01Down7.png", + "kind": "image", + "metadata": "{\"extension\":\".png\"}", + "name": "01Down7", + "smoothed": false, + "userAdded": false + }, + { + "file": "assets/01Down8.png", + "kind": "image", + "metadata": "{\"extension\":\".png\"}", + "name": "01Down8", + "smoothed": false, + "userAdded": false + }, + { + "file": "assets/01Left.png", + "kind": "image", + "metadata": "{\"extension\":\".png\"}", + "name": "01Left", + "smoothed": false, + "userAdded": false + }, + { + "file": "assets/01Left2.png", + "kind": "image", + "metadata": "{\"extension\":\".png\"}", + "name": "01Left2", + "smoothed": false, + "userAdded": false + }, + { + "file": "assets/01Left3.png", + "kind": "image", + "metadata": "{\"extension\":\".png\"}", + "name": "01Left3", + "smoothed": false, + "userAdded": false + }, + { + "file": "assets/01Left4.png", + "kind": "image", + "metadata": "{\"extension\":\".png\"}", + "name": "01Left4", + "smoothed": false, + "userAdded": false + }, + { + "file": "assets/01Up.png", + "kind": "image", + "metadata": "{\"extension\":\".png\"}", + "name": "01Up", + "smoothed": false, + "userAdded": false + }, + { + "file": "assets/01Up2.png", + "kind": "image", + "metadata": "{\"extension\":\".png\"}", + "name": "01Up2", + "smoothed": false, + "userAdded": false + }, + { + "file": "assets/01Up3.png", + "kind": "image", + "metadata": "{\"extension\":\".png\"}", + "name": "01Up3", + "smoothed": false, + "userAdded": false + }, + { + "file": "assets/01Up4.png", + "kind": "image", + "metadata": "{\"extension\":\".png\"}", + "name": "01Up4", + "smoothed": false, + "userAdded": false + } + ] + }, + "objects": [ + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "spr_player", + "persistentUuid": "d03a1af6-4615-4ebe-92c5-a2678ed69ba6", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [ + { + "name": "player_id", + "persistentUuid": "946a6f26-ee26-4e20-811d-9674dc90ace4", + "type": "number", + "value": 0 + } + ], + "effects": [], + "behaviors": [ + { + "name": "TopDownMovement", + "type": "TopDownMovementBehavior::TopDownMovementBehavior", + "acceleration": 99999, + "allowDiagonals": false, + "angleOffset": 0, + "angularMaxSpeed": 180, + "customIsometryAngle": 30, + "deceleration": 99999, + "ignoreDefaultControls": false, + "maxSpeed": 200, + "movementAngleOffset": 0, + "rotateObject": false, + "useLegacyTurnBack": false, + "viewpoint": "TopDown" + } + ], + "animations": [ + { + "name": "NewSprite", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "metadata": "{\"pskl\":{}}", + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "NewSprite2", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 0 + }, + { + "x": 64, + "y": 0 + }, + { + "x": 64, + "y": 64 + }, + { + "x": 0, + "y": 64 + } + ] + ] + } + ] + } + ] + } + ] + }, + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "spr_otherPlayers", + "persistentUuid": "1a256d41-16be-45af-a2c0-d555c42c2cb0", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [ + { + "name": "player_id", + "persistentUuid": "d4f11f2a-8cdb-4dd0-a45c-393c3de1719a", + "type": "number", + "value": 0 + } + ], + "effects": [], + "behaviors": [ + { + "name": "TopDownMovement", + "type": "TopDownMovementBehavior::TopDownMovementBehavior", + "acceleration": 99999, + "allowDiagonals": false, + "angleOffset": 0, + "angularMaxSpeed": 180, + "customIsometryAngle": 30, + "deceleration": 99999, + "ignoreDefaultControls": true, + "maxSpeed": 200, + "movementAngleOffset": 0, + "rotateObject": false, + "useLegacyTurnBack": false, + "viewpoint": "TopDown" + } + ], + "animations": [ + { + "name": "NewSprite", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "metadata": "{\"pskl\":{}}", + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "NewSprite2", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 0 + }, + { + "x": 64, + "y": 0 + }, + { + "x": 64, + "y": 64 + }, + { + "x": 0, + "y": 64 + } + ] + ] + } + ] + } + ] + } + ] + }, + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "spr_door", + "persistentUuid": "8b7cf3ce-40c8-4a17-925a-0c70b66838a4", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [ + { + "name": "var_doorway", + "persistentUuid": "06f73534-50b8-404f-9883-0d70149713d7", + "type": "string", + "value": "000001" + } + ], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "NewSprite", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "metadata": "{\"pskl\":{}}", + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "NewSprite3", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 4, + "y": 3 + }, + { + "x": 62, + "y": 3 + }, + { + "x": 62, + "y": 60 + }, + { + "x": 4, + "y": 60 + } + ] + ] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "80b9ddd78c8727888bb53c7524f443682746667b1ba493c223114c04e7661bbf", + "name": "btn_Logout", + "persistentUuid": "c920ea77-7ccf-456f-aabb-496c1250d6f1", + "type": "PanelSpriteButton::PanelSpriteButton", + "variant": "Small Blue Button", + "variables": [], + "effects": [], + "behaviors": [], + "content": { + "LabelText": "Log Out", + "PressedLabelOffsetY": 2 + } + }, + { + "assetStoreId": "80b9ddd78c8727888bb53c7524f443682746667b1ba493c223114c04e7661bbf", + "name": "btn_Fullscreen", + "persistentUuid": "56fd8b1d-175c-4840-97fe-f76e7d829e9f", + "type": "PanelSpriteButton::PanelSpriteButton", + "variant": "Small Blue Button", + "variables": [], + "effects": [], + "behaviors": [], + "content": { + "LabelText": "[ ]", + "PressedLabelOffsetY": 2 + } + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "spr_player" + }, + { + "objectName": "spr_otherPlayers" + }, + { + "objectName": "spr_door" + }, + { + "objectName": "btn_Logout" + }, + { + "objectName": "btn_Fullscreen" + } + ] + }, + "objectsGroups": [], + "variables": [ + { + "name": "var_playerInfo", + "persistentUuid": "1fb97af7-5f6a-4907-9164-628713a29d54", + "type": "structure", + "children": [] + }, + { + "name": "var_jsonAddress", + "persistentUuid": "78b897a8-e843-4a0c-be02-63ddb7f70eae", + "type": "string", + "value": "http://192.168.3.250:3000" + }, + { + "name": "var_mqttAddress", + "persistentUuid": "0048bbcb-0ca6-4b6e-a90e-be2218ce7a47", + "type": "string", + "value": "192.168.3.250:9001" + }, + { + "name": "var_RTC", + "persistentUuid": "1ba271fb-6df8-4662-8e0c-d6554e2702c9", + "type": "structure", + "children": [] + }, + { + "name": "var_date", + "persistentUuid": "7a18cea8-1a20-46d8-a276-77880277c26a", + "type": "number", + "value": 0 + } + ], + "layouts": [ + { + "b": 255, + "disableInputWhenNotFocused": true, + "mangledName": "Login", + "name": "Login", + "r": 247, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 249, + "uiSettings": { + "grid": true, + "gridType": "rectangular", + "gridWidth": 16, + "gridHeight": 16, + "gridDepth": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridOffsetZ": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": true, + "zoomFactor": 0.8416428125373118, + "windowMask": false, + "selectedLayer": "", + "gameEditorMode": "instances-editor" + }, + "objectsGroups": [], + "variables": [ + { + "name": "var_username", + "persistentUuid": "43ebc160-5d2f-4769-8bab-6f2b03b0006b", + "type": "string", + "value": "" + }, + { + "name": "var_password", + "persistentUuid": "714571eb-af1a-4f97-aead-d7b9f5de9afb", + "type": "string", + "value": "" + }, + { + "name": "var_jsonReply", + "persistentUuid": "2898cef6-8fdf-4718-bf6b-1cdb5e030acb", + "type": "string", + "value": "" + }, + { + "name": "var_jsonParse", + "persistentUuid": "5b1b0b96-6ef9-411f-bc42-b287f548f2b6", + "type": "structure", + "children": [] + } + ], + "instances": [ + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "txtbx_Username", + "persistentUuid": "632731bc-b1bd-4383-9acd-12cd653efcdf", + "width": 0, + "x": 480, + "y": 192, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "txtbx_Password", + "persistentUuid": "44c2f0bc-a292-45be-8cf5-c4d8893b1ed3", + "width": 0, + "x": 480, + "y": 288, + "zOrder": 2, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "btn_Login", + "persistentUuid": "b3d700fe-d3d1-4e3c-8961-1305b2ae4168", + "width": 0, + "x": 560, + "y": 384, + "zOrder": 3, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "btn_Register", + "persistentUuid": "9b8441ec-dfee-4296-bdd5-6e1b0425d56d", + "width": 0, + "x": 560, + "y": 480, + "zOrder": 4, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "txt_lblServerStatus", + "persistentUuid": "2b11514e-c2b0-4bbe-b292-93c3240449d2", + "width": 0, + "x": 32, + "y": 640, + "zOrder": 5, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "txt_lblMQTTStatus", + "persistentUuid": "c02d52f2-3e7a-45ec-ab25-e274a2aba45b", + "width": 0, + "x": 32, + "y": 672, + "zOrder": 6, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "txt_ServerStatus", + "persistentUuid": "178406cc-fe38-44d9-ab83-fac3479e6cba", + "width": 0, + "x": 112, + "y": 640, + "zOrder": 7, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "txt_MQTTStatus", + "persistentUuid": "c4ecc711-8ead-4310-b1b4-4e528d66eab6", + "width": 0, + "x": 112, + "y": 672, + "zOrder": 8, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "txt_gameTitle", + "persistentUuid": "9a6eb8ef-3e39-479e-9631-b2e2cc1fa161", + "width": 0, + "x": 320, + "y": 84, + "zOrder": 10, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "txt_date", + "persistentUuid": "d824c9ba-8961-4047-ba4c-13e66b8f44d3", + "width": 0, + "x": 32, + "y": 16, + "zOrder": 12, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "objects": [ + { + "assetStoreId": "", + "name": "txtbx_Username", + "persistentUuid": "c3ee77af-838b-4e52-84e5-9edfdec72fdf", + "type": "TextInput::TextInputObject", + "variables": [], + "effects": [], + "behaviors": [], + "content": { + "initialValue": "", + "placeholder": "Username", + "fontResourceName": "", + "fontSize": 20, + "inputType": "text", + "textColor": "0;0;0", + "fillColor": "255;255;255", + "fillOpacity": 255, + "borderColor": "0;0;0", + "borderOpacity": 255, + "borderWidth": 1, + "readOnly": false, + "disabled": false, + "spellCheck": false, + "paddingX": 2, + "paddingY": 1, + "textAlign": "left", + "maxLength": 0 + } + }, + { + "assetStoreId": "", + "name": "txtbx_Password", + "persistentUuid": "ffd66276-22b2-46bc-bc58-2010837dc5f2", + "type": "TextInput::TextInputObject", + "variables": [], + "effects": [], + "behaviors": [], + "content": { + "initialValue": "", + "placeholder": "Password", + "fontResourceName": "", + "fontSize": 20, + "inputType": "password", + "textColor": "0;0;0", + "fillColor": "255;255;255", + "fillOpacity": 255, + "borderColor": "0;0;0", + "borderOpacity": 255, + "borderWidth": 1, + "readOnly": false, + "disabled": false, + "spellCheck": false, + "paddingX": 2, + "paddingY": 1, + "textAlign": "left", + "maxLength": 0 + } + }, + { + "assetStoreId": "80b9ddd78c8727888bb53c7524f443682746667b1ba493c223114c04e7661bbf", + "name": "btn_Login", + "persistentUuid": "ae3aaba7-ff4b-463f-bb17-eb233ab5a68c", + "type": "PanelSpriteButton::PanelSpriteButton", + "variant": "Small Blue Button", + "variables": [], + "effects": [], + "behaviors": [], + "content": { + "LabelText": "Login", + "PressedLabelOffsetY": 2 + } + }, + { + "assetStoreId": "80b9ddd78c8727888bb53c7524f443682746667b1ba493c223114c04e7661bbf", + "name": "btn_Register", + "persistentUuid": "548a436e-bc77-426e-9048-9501732084ed", + "type": "PanelSpriteButton::PanelSpriteButton", + "variant": "Small Blue Button", + "variables": [], + "effects": [], + "behaviors": [], + "content": { + "LabelText": "Register", + "PressedLabelOffsetY": 2 + } + }, + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "txt_lblServerStatus", + "persistentUuid": "e45fe9f3-cdc8-4d58-9e6a-ba2b71e3e734", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "Server:", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": { + "b": 0, + "g": 0, + "r": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "Server:", + "font": "", + "textAlignment": "left", + "verticalTextAlignment": "top", + "characterSize": 20, + "lineHeight": 0, + "color": "0;0;0" + } + }, + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "txt_lblMQTTStatus", + "persistentUuid": "a5dcdfbf-e3c2-4853-a7a2-113be9442012", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "Broker:", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": { + "b": 0, + "g": 0, + "r": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "Broker:", + "font": "", + "textAlignment": "left", + "verticalTextAlignment": "top", + "characterSize": 20, + "lineHeight": 0, + "color": "0;0;0" + } + }, + { + "assetStoreId": "", + "bold": true, + "italic": false, + "name": "txt_ServerStatus", + "persistentUuid": "0f4b8881-8813-490b-9b44-21561d04f0c4", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "OFFLINE", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": { + "b": 0, + "g": 0, + "r": 255 + }, + "content": { + "bold": true, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "OFFLINE", + "font": "", + "textAlignment": "left", + "verticalTextAlignment": "top", + "characterSize": 20, + "lineHeight": 0, + "color": "255;0;0" + } + }, + { + "assetStoreId": "", + "bold": true, + "italic": false, + "name": "txt_MQTTStatus", + "persistentUuid": "3dd0f168-5e38-4ae4-955c-1eb13063c3bc", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "OFFLINE", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": { + "b": 0, + "g": 0, + "r": 255 + }, + "content": { + "bold": true, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "OFFLINE", + "font": "", + "textAlignment": "left", + "verticalTextAlignment": "top", + "characterSize": 20, + "lineHeight": 0, + "color": "255;0;0" + } + }, + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "txt_debug", + "persistentUuid": "00343022-da8d-4af2-8a21-4e1dd750735a", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "Text", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": { + "b": 0, + "g": 0, + "r": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "Text", + "font": "", + "textAlignment": "left", + "verticalTextAlignment": "top", + "characterSize": 20, + "lineHeight": 0, + "color": "0;0;0" + } + }, + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "txt_gameTitle", + "persistentUuid": "574c3ce1-cb11-4dab-a2ec-f195258ed913", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "SQUARE GAME: MULTIPLAYER!", + "font": "", + "textAlignment": "left", + "characterSize": 40, + "color": { + "b": 0, + "g": 0, + "r": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "SQUARE GAME: MULTIPLAYER!", + "font": "", + "textAlignment": "left", + "verticalTextAlignment": "top", + "characterSize": 40, + "lineHeight": 0, + "color": "0;0;0" + } + }, + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "txt_date", + "persistentUuid": "604cf4c5-d211-4b59-bc56-bdf7bf611ca7", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "Date", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": { + "b": 0, + "g": 0, + "r": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "Date", + "font": "", + "textAlignment": "left", + "verticalTextAlignment": "top", + "characterSize": 20, + "lineHeight": 0, + "color": "0;0;0" + } + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "txtbx_Username" + }, + { + "objectName": "txtbx_Password" + }, + { + "objectName": "btn_Login" + }, + { + "objectName": "btn_Register" + }, + { + "objectName": "txt_lblServerStatus" + }, + { + "objectName": "txt_ServerStatus" + }, + { + "objectName": "txt_lblMQTTStatus" + }, + { + "objectName": "txt_MQTTStatus" + }, + { + "objectName": "txt_debug" + }, + { + "objectName": "txt_gameTitle" + }, + { + "objectName": "txt_date" + } + ] + }, + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "RegisterButton", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsClicked" + }, + "parameters": [ + "btn_Register", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Scene" + }, + "parameters": [ + "", + "\"Register\"", + "" + ] + } + ] + } + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Server Status", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "MQTT::connect" + }, + "parameters": [ + "", + "var_mqttAddress", + "\"\"", + "", + "" + ] + }, + { + "type": { + "value": "SendAsyncRequest" + }, + "parameters": [ + "var_jsonAddress+\"/users\"", + "", + "\"GET\"", + "", + "var_jsonReply", + "" + ] + }, + { + "type": { + "value": "SendAsyncRequest" + }, + "parameters": [ + "var_jsonAddress+\"/server\"", + "", + "\"GET\"", + "", + "var_jsonReply", + "" + ] + }, + { + "type": { + "value": "Wait" + }, + "parameters": [ + ".1" + ] + }, + { + "type": { + "value": "JSONToVariableStructure2" + }, + "parameters": [ + "var_jsonReply", + "var_RTC" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_jsonReply", + "!=", + "\"[]\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "txt_ServerStatus", + "Text", + "=", + "\"ONLINE\"" + ] + }, + { + "type": { + "value": "TextObject::ChangeColor" + }, + "parameters": [ + "txt_ServerStatus", + "\"0;255;0\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "MQTT::isConnected" + }, + "parameters": [ + "", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "txt_MQTTStatus", + "Text", + "=", + "\"ONLINE\"" + ] + }, + { + "type": { + "value": "TextObject::ChangeColor" + }, + "parameters": [ + "txt_MQTTStatus", + "\"0;255;0\"" + ] + } + ] + } + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Log In", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsClicked" + }, + "parameters": [ + "btn_Login", + "" + ] + }, + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::Value" + }, + "parameters": [ + "txtbx_Username", + "Text", + "!=", + "\"\"" + ] + }, + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::Value" + }, + "parameters": [ + "txtbx_Password", + "Text", + "!=", + "\"\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "var_username", + "=", + "txtbx_Username.Text::Value()" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "var_password", + "=", + "txtbx_Password.Text::Value()" + ] + }, + { + "type": { + "value": "SendAsyncRequest" + }, + "parameters": [ + "var_jsonAddress+\"/users?username=\" + var_username +\"&password=\" + var_password", + "", + "\"GET\"", + "", + "var_jsonReply", + "" + ] + }, + { + "type": { + "value": "Wait" + }, + "parameters": [ + ".1" + ] + }, + { + "type": { + "value": "JSONToVariableStructure2" + }, + "parameters": [ + "var_jsonReply", + "var_jsonParse" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_jsonParse[0].username", + "=", + "var_username" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_jsonParse[0].password", + "=", + "var_password" + ] + } + ], + "actions": [ + { + "type": { + "value": "JSONToVariableStructure2" + }, + "parameters": [ + "var_jsonReply", + "var_playerInfo" + ] + }, + { + "type": { + "value": "SendAsyncRequest" + }, + "parameters": [ + "var_jsonAddress+\"/users/\"+var_playerInfo[0].id", + "\"{\\\"online\\\":true}\"", + "\"PATCH\"", + "\"application/json\"", + "", + "" + ] + }, + { + "type": { + "value": "Scene" + }, + "parameters": [ + "", + "\"Logged in\"", + "" + ] + } + ] + } + ], + "parameters": [] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsClicked" + }, + "parameters": [ + "btn_Fullscreen", + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "IsFullScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetFullScreen" + }, + "parameters": [ + "", + "yes", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "IsFullScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetFullScreen" + }, + "parameters": [ + "", + "no", + "" + ] + } + ] + } + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Date/Time", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "txt_date", + "Text", + "=", + "var_RTC[\"hour\"]+\":\"+var_RTC[\"minute\"]" + ] + } + ] + } + ], + "parameters": [] + } + ], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera2DPlaneMaxDrawingDistance": 5000, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "followBaseLayerCamera": false, + "isLightingLayer": false, + "isLocked": false, + "name": "", + "renderingType": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [ + { + "effectType": "Scene3D::HemisphereLight", + "name": "3D Ambient Hemisphere Light", + "doubleParameters": { + "elevation": 40, + "intensity": 0.33, + "rotation": 300 + }, + "stringParameters": { + "groundColor": "127;127;127", + "skyColor": "255;255;255", + "top": "Z+" + }, + "booleanParameters": {} + }, + { + "effectType": "Scene3D::DirectionalLight", + "name": "3D Sun Light", + "doubleParameters": { + "distanceFromCamera": 1500, + "elevation": 40, + "frustumSize": 4000, + "intensity": 0.75, + "minimumShadowBias": 0, + "rotation": 300 + }, + "stringParameters": { + "color": "255;255;255", + "shadowQuality": "medium", + "top": "Z+" + }, + "booleanParameters": { + "isCastingShadow": true + } + } + ] + } + ], + "behaviorsSharedData": [ + { + "name": "Animation", + "type": "AnimatableCapability::AnimatableBehavior" + }, + { + "name": "Effect", + "type": "EffectCapability::EffectBehavior" + }, + { + "name": "Flippable", + "type": "FlippableCapability::FlippableBehavior" + }, + { + "name": "Opacity", + "type": "OpacityCapability::OpacityBehavior" + }, + { + "name": "Resizable", + "type": "ResizableCapability::ResizableBehavior" + }, + { + "name": "Scale", + "type": "ScalableCapability::ScalableBehavior" + }, + { + "name": "Text", + "type": "TextContainerCapability::TextContainerBehavior" + }, + { + "name": "TopDownMovement", + "type": "TopDownMovementBehavior::TopDownMovementBehavior" + } + ] + }, + { + "b": 255, + "disableInputWhenNotFocused": true, + "mangledName": "Register", + "name": "Register", + "r": 247, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 249, + "uiSettings": { + "grid": true, + "gridType": "rectangular", + "gridWidth": 16, + "gridHeight": 16, + "gridDepth": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridOffsetZ": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": true, + "zoomFactor": 1.528913289223325, + "windowMask": false, + "selectedLayer": "", + "gameEditorMode": "instances-editor" + }, + "objectsGroups": [], + "variables": [ + { + "name": "var_password01", + "persistentUuid": "9b38d1eb-2fc4-4744-b61a-b901092ab536", + "type": "string", + "value": "" + }, + { + "name": "var_password02", + "persistentUuid": "73bfe239-ff40-4b6f-8505-ea724078f6ee", + "type": "string", + "value": "" + }, + { + "name": "var_username", + "persistentUuid": "79b2dd33-921b-4817-9e5c-ebaa38a21834", + "type": "string", + "value": "" + }, + { + "name": "var_jsonReply", + "persistentUuid": "e4d7e8bd-3595-4aef-9ec7-0fb470bb3ecd", + "type": "string", + "value": "[]" + }, + { + "name": "var_jsonParse", + "persistentUuid": "8a602891-d0e3-4492-a2b0-14d0f4fe64fb", + "type": "array", + "children": [] + }, + { + "name": "var_colorGen", + "persistentUuid": "5381318f-fa30-4456-8351-f814f8ecadbd", + "type": "string", + "value": "" + } + ], + "instances": [ + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "txtbx_regUsername", + "persistentUuid": "66377f44-b1e3-4eab-a9c0-bc3752017e4e", + "width": 0, + "x": 480, + "y": 322, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "txtbx_regPassword01", + "persistentUuid": "b2099cad-5ab7-4a38-b939-31869e362657", + "width": 0, + "x": 480, + "y": 368, + "zOrder": 2, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "btn_regRegister", + "persistentUuid": "41a1f2cd-107b-4058-8bc6-eb51487ac180", + "width": 0, + "x": 560, + "y": 480, + "zOrder": 4, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "txt_RegMessageUser", + "persistentUuid": "4b4c3bd0-ffdf-440c-97a6-1992a4ae80d8", + "width": 0, + "x": 512, + "y": 649, + "zOrder": 5, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "btn_Back", + "persistentUuid": "af79ebf6-4ccf-4335-bab9-df40fbb263d8", + "width": 0, + "x": 560, + "y": 560, + "zOrder": 6, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "spr_sqaure", + "persistentUuid": "9c413fc9-26ab-4cc4-b4c8-b84a8ac651ef", + "width": 0, + "x": 592, + "y": 112, + "zOrder": 8, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "btn_NewColor", + "persistentUuid": "248ac7e7-6ac9-4c9f-a7ec-a83df84e6d27", + "width": 0, + "x": 560, + "y": 224, + "zOrder": 9, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "txtbx_regPassword02", + "persistentUuid": "7106be72-f61f-4ab7-8659-4b87a1b8668b", + "width": 0, + "x": 480, + "y": 416, + "zOrder": 11, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "txt_RegMessagePassword", + "persistentUuid": "16a3c795-1cfa-4633-bc35-3a823ceaf916", + "width": 0, + "x": 517, + "y": 688, + "zOrder": 12, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "txt_RegMessageSuccess", + "persistentUuid": "268fa5ba-bfd7-467f-80e6-1bf428f66436", + "width": 0, + "x": 521, + "y": 617, + "zOrder": 13, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "objects": [ + { + "assetStoreId": "", + "name": "txtbx_regUsername", + "persistentUuid": "5bfb2de7-1947-4660-b896-ccac584f70f5", + "type": "TextInput::TextInputObject", + "variables": [], + "effects": [], + "behaviors": [], + "content": { + "initialValue": "", + "placeholder": "Username", + "fontResourceName": "", + "fontSize": 20, + "inputType": "text", + "textColor": "0;0;0", + "fillColor": "255;255;255", + "fillOpacity": 255, + "borderColor": "0;0;0", + "borderOpacity": 255, + "borderWidth": 1, + "readOnly": false, + "disabled": false, + "spellCheck": false, + "paddingX": 2, + "paddingY": 1, + "textAlign": "left", + "maxLength": 0 + } + }, + { + "assetStoreId": "", + "name": "txtbx_regPassword01", + "persistentUuid": "e32982f7-fc73-4866-9b15-fd09d926a819", + "type": "TextInput::TextInputObject", + "variables": [], + "effects": [], + "behaviors": [], + "content": { + "initialValue": "", + "placeholder": "Password", + "fontResourceName": "", + "fontSize": 20, + "inputType": "password", + "textColor": "0;0;0", + "fillColor": "255;255;255", + "fillOpacity": 255, + "borderColor": "0;0;0", + "borderOpacity": 255, + "borderWidth": 1, + "readOnly": false, + "disabled": false, + "spellCheck": false, + "paddingX": 2, + "paddingY": 1, + "textAlign": "left", + "maxLength": 0 + } + }, + { + "assetStoreId": "80b9ddd78c8727888bb53c7524f443682746667b1ba493c223114c04e7661bbf", + "name": "btn_regRegister", + "persistentUuid": "f4f70ee8-da7b-4666-8780-a69ad9879791", + "type": "PanelSpriteButton::PanelSpriteButton", + "variant": "Small Blue Button", + "variables": [], + "effects": [], + "behaviors": [], + "content": { + "LabelText": "Register", + "PressedLabelOffsetY": 2 + } + }, + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "txt_RegMessageUser", + "persistentUuid": "cb2b72b5-1e20-4241-b4e3-3406a240cb33", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "Username is not available", + "font": "", + "textAlignment": "center", + "characterSize": 20, + "color": { + "b": 0, + "g": 0, + "r": 255 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "Username is not available", + "font": "", + "textAlignment": "center", + "verticalTextAlignment": "top", + "characterSize": 20, + "lineHeight": 0, + "color": "255;0;0" + } + }, + { + "assetStoreId": "80b9ddd78c8727888bb53c7524f443682746667b1ba493c223114c04e7661bbf", + "name": "btn_Back", + "persistentUuid": "a735af63-2e06-4548-a596-7eb24268783a", + "type": "PanelSpriteButton::PanelSpriteButton", + "variant": "Small Blue Button", + "variables": [], + "effects": [], + "behaviors": [], + "content": { + "LabelText": "Back", + "PressedLabelOffsetY": 2 + } + }, + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "txt_JSONReply", + "persistentUuid": "cde1bbef-cbc8-4fc3-9d5b-d0f2c9e02dec", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "[]", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": { + "b": 0, + "g": 0, + "r": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "[]", + "font": "", + "textAlignment": "left", + "verticalTextAlignment": "top", + "characterSize": 20, + "lineHeight": 0, + "color": "0;0;0" + } + }, + { + "adaptCollisionMaskAutomatically": true, + "assetStoreId": "", + "name": "spr_sqaure", + "persistentUuid": "8e29f65a-9088-4d1e-b7b8-b947d7f9b407", + "type": "Sprite", + "updateIfNotVisible": false, + "variables": [], + "effects": [], + "behaviors": [], + "animations": [ + { + "name": "NewSprite", + "useMultipleDirections": false, + "directions": [ + { + "looping": false, + "metadata": "{\"pskl\":{}}", + "timeBetweenFrames": 0.08, + "sprites": [ + { + "hasCustomCollisionMask": true, + "image": "NewSprite", + "points": [], + "originPoint": { + "name": "origine", + "x": 0, + "y": 0 + }, + "centerPoint": { + "automatic": true, + "name": "centre", + "x": 0, + "y": 0 + }, + "customCollisionMask": [ + [ + { + "x": 0, + "y": 0 + }, + { + "x": 64, + "y": 0 + }, + { + "x": 64, + "y": 64 + }, + { + "x": 0, + "y": 64 + } + ] + ] + } + ] + } + ] + } + ] + }, + { + "assetStoreId": "80b9ddd78c8727888bb53c7524f443682746667b1ba493c223114c04e7661bbf", + "name": "btn_NewColor", + "persistentUuid": "5428983b-7262-40a0-9d70-e7b3aa5d0175", + "type": "PanelSpriteButton::PanelSpriteButton", + "variant": "Small Blue Button", + "variables": [], + "effects": [], + "behaviors": [], + "content": { + "LabelText": "New Color", + "PressedLabelOffsetY": 2 + } + }, + { + "assetStoreId": "", + "name": "txtbx_regPassword02", + "persistentUuid": "5f39eff0-637f-46e3-b032-923b512aaa70", + "type": "TextInput::TextInputObject", + "variables": [], + "effects": [], + "behaviors": [], + "content": { + "initialValue": "", + "placeholder": "Repeat Password", + "fontResourceName": "", + "fontSize": 20, + "inputType": "password", + "textColor": "0;0;0", + "fillColor": "255;255;255", + "fillOpacity": 255, + "borderColor": "0;0;0", + "borderOpacity": 255, + "borderWidth": 1, + "readOnly": false, + "disabled": false, + "spellCheck": false, + "paddingX": 2, + "paddingY": 1, + "textAlign": "left", + "maxLength": 0 + } + }, + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "txt_RegMessagePassword", + "persistentUuid": "366c40cc-d4d1-4858-8b9c-5c959e69c941", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "Passwords do not match", + "font": "", + "textAlignment": "center", + "characterSize": 20, + "color": { + "b": 0, + "g": 0, + "r": 255 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "Passwords do not match", + "font": "", + "textAlignment": "center", + "verticalTextAlignment": "top", + "characterSize": 20, + "lineHeight": 0, + "color": "255;0;0" + } + }, + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "txt_RegMessageSuccess", + "persistentUuid": "bb5d6c4b-2eb6-4005-a464-2d3392769eb1", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "Registration Successful!", + "font": "", + "textAlignment": "center", + "characterSize": 20, + "color": { + "b": 0, + "g": 255, + "r": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "Registration Successful!", + "font": "", + "textAlignment": "center", + "verticalTextAlignment": "top", + "characterSize": 20, + "lineHeight": 0, + "color": "0;255;0" + } + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "txtbx_regUsername" + }, + { + "objectName": "spr_sqaure" + }, + { + "objectName": "txtbx_regPassword01" + }, + { + "objectName": "txtbx_regPassword02" + }, + { + "objectName": "btn_regRegister" + }, + { + "objectName": "btn_Back" + }, + { + "objectName": "btn_NewColor" + }, + { + "objectName": "txt_RegMessageUser" + }, + { + "objectName": "txt_RegMessageSuccess" + }, + { + "objectName": "txt_RegMessagePassword" + }, + { + "objectName": "txt_JSONReply" + } + ] + }, + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Hide Registration Message/Random Color Gen", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Hide" + }, + "parameters": [ + "txt_RegMessageUser" + ] + }, + { + "type": { + "value": "Hide" + }, + "parameters": [ + "txt_RegMessagePassword" + ] + }, + { + "type": { + "value": "Hide" + }, + "parameters": [ + "txt_RegMessageSuccess" + ] + }, + { + "type": { + "value": "SetCenterX" + }, + "parameters": [ + "txt_RegMessageUser", + "=", + "btn_Back.CenterX()" + ] + }, + { + "type": { + "value": "SetCenterX" + }, + "parameters": [ + "txt_RegMessagePassword", + "=", + "btn_Back.CenterX()" + ] + }, + { + "type": { + "value": "SetCenterX" + }, + "parameters": [ + "txt_RegMessageSuccess", + "=", + "btn_Back.CenterX()" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "var_colorGen", + "=", + "ToString(RandomInRange(0,255)) + \";\" + ToString(RandomInRange(0,255)) + \";\" + ToString(RandomInRange(0,255))" + ] + }, + { + "type": { + "value": "ChangeColor" + }, + "parameters": [ + "spr_sqaure", + "var_colorGen" + ] + } + ] + } + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Back Button", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsClicked" + }, + "parameters": [ + "btn_Back", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Scene" + }, + "parameters": [ + "", + "\"Login\"", + "" + ] + } + ] + } + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "folded": true, + "name": "Register Button", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Check if username exists" + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::Value" + }, + "parameters": [ + "txtbx_regUsername", + "Text", + "!=", + "\"\"" + ] + }, + { + "type": { + "inverted": true, + "value": "TextInput::TextInputObject::Focused" + }, + "parameters": [ + "txtbx_regUsername" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "var_username", + "=", + "txtbx_regUsername.Text::Value()" + ] + }, + { + "type": { + "value": "SendAsyncRequest" + }, + "parameters": [ + "var_jsonAddress+\"/users?username=\" + var_username", + "", + "\"GET\"", + "", + "var_jsonReply", + "" + ] + }, + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "txt_JSONReply", + "Text", + "=", + "var_jsonReply" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Password Match" + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "TextInput::TextInputObject::Focused" + }, + "parameters": [ + "txtbx_regPassword01" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "var_password01", + "=", + "txtbx_regPassword01.Text::Value()" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "var_password02", + "=", + "txtbx_regPassword02.Text::Value()" + ] + } + ], + "events": [ + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_password01", + "!=", + "var_password02" + ] + } + ], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "txt_RegMessagePassword", + "Text", + "=", + "\"Password do not match\"" + ] + }, + { + "type": { + "value": "Show" + }, + "parameters": [ + "txt_RegMessagePassword", + "" + ] + }, + { + "type": { + "value": "TextObject::ChangeColor" + }, + "parameters": [ + "txt_RegMessagePassword", + "\"255;0;0\"" + ] + }, + { + "type": { + "value": "SetCenterX" + }, + "parameters": [ + "txt_RegMessagePassword", + "=", + "btn_Back.CenterX()" + ] + } + ] + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Else", + "conditions": [], + "actions": [ + { + "type": { + "value": "Hide" + }, + "parameters": [ + "txt_RegMessagePassword" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "If username does not exist, write to database" + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsClicked" + }, + "parameters": [ + "btn_regRegister", + "" + ] + }, + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::Value" + }, + "parameters": [ + "txtbx_regUsername", + "Text", + "!=", + "\"\"" + ] + }, + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::Value" + }, + "parameters": [ + "txtbx_regPassword01", + "Text", + "!=", + "\"\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_jsonReply", + "=", + "\"[]\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "var_password01", + "=", + "txtbx_regPassword01.Text::Value()" + ] + }, + { + "type": { + "value": "SendAsyncRequest" + }, + "parameters": [ + "var_jsonAddress+\"/users\"", + "\"{\\\"username\\\":\\\"\" + var_username + \"\\\",\\\"password\\\":\\\"\" + var_password01 + \"\\\",\\\"color\\\":\\\"\" + var_colorGen+ \"\\\",\\\"room\\\":\\\"000000\\\"}\"", + "\"POST\"", + "\"application/json\"", + "", + "" + ] + }, + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "txt_RegMessageUser", + "Text", + "=", + "\"Registration Successful! Please Log In\"" + ] + }, + { + "type": { + "value": "Show" + }, + "parameters": [ + "txt_RegMessageUser", + "" + ] + }, + { + "type": { + "value": "Wait" + }, + "parameters": [ + "3" + ] + }, + { + "type": { + "value": "Scene" + }, + "parameters": [ + "", + "\"Login\"", + "" + ] + } + ] + } + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Randomize Color", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsClicked" + }, + "parameters": [ + "btn_NewColor", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "var_colorGen", + "=", + "ToString(RandomInRange(0,255)) + \";\" + ToString(RandomInRange(0,255)) + \";\" + ToString(RandomInRange(0,255))" + ] + }, + { + "type": { + "value": "ChangeColor" + }, + "parameters": [ + "spr_sqaure", + "var_colorGen" + ] + } + ] + } + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Registration", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsClicked" + }, + "parameters": [ + "btn_regRegister", + "" + ] + }, + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::Value" + }, + "parameters": [ + "txtbx_regUsername", + "Text", + "!=", + "\"\"" + ] + }, + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::Value" + }, + "parameters": [ + "txtbx_regPassword01", + "Text", + "!=", + "\"\"" + ] + }, + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::Value" + }, + "parameters": [ + "txtbx_regPassword02", + "Text", + "!=", + "\"\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "var_username", + "=", + "txtbx_regUsername.Text::Value()" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "var_password01", + "=", + "txtbx_regPassword01.Text::Value()" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "var_password02", + "=", + "txtbx_regPassword02.Text::Value()" + ] + }, + { + "type": { + "value": "SendAsyncRequest" + }, + "parameters": [ + "var_jsonAddress+\"/users?username=\" + var_username", + "", + "\"GET\"", + "", + "var_jsonReply", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_password01", + "!=", + "var_password02" + ] + } + ], + "actions": [ + { + "type": { + "value": "Show" + }, + "parameters": [ + "txt_RegMessagePassword", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Else", + "conditions": [], + "actions": [ + { + "type": { + "value": "Hide" + }, + "parameters": [ + "txt_RegMessagePassword" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_jsonReply", + "!=", + "\"[]\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Show" + }, + "parameters": [ + "txt_RegMessageUser", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Else", + "conditions": [], + "actions": [ + { + "type": { + "value": "Hide" + }, + "parameters": [ + "txt_RegMessageUser" + ] + }, + { + "type": { + "value": "Show" + }, + "parameters": [ + "txt_RegMessageSuccess", + "" + ] + }, + { + "type": { + "value": "SendAsyncRequest" + }, + "parameters": [ + "var_jsonAddress+\"/users\"", + "\"{\\\"username\\\":\\\"\" + var_username + \"\\\",\\\"password\\\":\\\"\" + var_password01 + \"\\\",\\\"color\\\":\\\"\" + var_colorGen + \"\\\",\\\"room\\\":\\\"000000\\\",\\\"last_room\\\":\\\"000000\\\"}\"", + "\"POST\"", + "\"application/json\"", + "", + "" + ] + }, + { + "type": { + "value": "Wait" + }, + "parameters": [ + "3" + ] + }, + { + "type": { + "value": "Scene" + }, + "parameters": [ + "", + "\"Login\"", + "" + ] + } + ] + } + ] + } + ] + } + ], + "parameters": [] + } + ], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera2DPlaneMaxDrawingDistance": 5000, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "followBaseLayerCamera": false, + "isLightingLayer": false, + "isLocked": false, + "name": "", + "renderingType": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [ + { + "effectType": "Scene3D::HemisphereLight", + "name": "3D Ambient Hemisphere Light", + "doubleParameters": { + "elevation": 40, + "intensity": 0.33, + "rotation": 300 + }, + "stringParameters": { + "groundColor": "127;127;127", + "skyColor": "255;255;255", + "top": "Z+" + }, + "booleanParameters": {} + }, + { + "effectType": "Scene3D::DirectionalLight", + "name": "3D Sun Light", + "doubleParameters": { + "distanceFromCamera": 1500, + "elevation": 40, + "frustumSize": 4000, + "intensity": 0.75, + "minimumShadowBias": 0, + "rotation": 300 + }, + "stringParameters": { + "color": "255;255;255", + "shadowQuality": "medium", + "top": "Z+" + }, + "booleanParameters": { + "isCastingShadow": true + } + } + ] + } + ], + "behaviorsSharedData": [ + { + "name": "Animation", + "type": "AnimatableCapability::AnimatableBehavior" + }, + { + "name": "Effect", + "type": "EffectCapability::EffectBehavior" + }, + { + "name": "Flippable", + "type": "FlippableCapability::FlippableBehavior" + }, + { + "name": "Opacity", + "type": "OpacityCapability::OpacityBehavior" + }, + { + "name": "Resizable", + "type": "ResizableCapability::ResizableBehavior" + }, + { + "name": "Scale", + "type": "ScalableCapability::ScalableBehavior" + }, + { + "name": "Text", + "type": "TextContainerCapability::TextContainerBehavior" + }, + { + "name": "TopDownMovement", + "type": "TopDownMovementBehavior::TopDownMovementBehavior" + } + ] + }, + { + "b": 255, + "disableInputWhenNotFocused": true, + "mangledName": "Logged_32in", + "name": "Logged in", + "r": 247, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 249, + "uiSettings": { + "grid": true, + "gridType": "rectangular", + "gridWidth": 16, + "gridHeight": 16, + "gridDepth": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridOffsetZ": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": true, + "zoomFactor": 0.546875, + "windowMask": false, + "selectedLayer": "", + "gameEditorMode": "instances-editor" + }, + "objectsGroups": [], + "variables": [ + { + "name": "password01", + "persistentUuid": "9b38d1eb-2fc4-4744-b61a-b901092ab536", + "type": "string", + "value": "" + }, + { + "name": "password02", + "persistentUuid": "73bfe239-ff40-4b6f-8505-ea724078f6ee", + "type": "string", + "value": "" + }, + { + "name": "username", + "persistentUuid": "79b2dd33-921b-4817-9e5c-ebaa38a21834", + "type": "string", + "value": "" + }, + { + "name": "var_jsonReply", + "persistentUuid": "e4d7e8bd-3595-4aef-9ec7-0fb470bb3ecd", + "type": "string", + "value": "" + }, + { + "name": "var_jsonParsed", + "persistentUuid": "a00f1f38-a6b3-4bd6-a53c-f2f3e63a9055", + "type": "array", + "children": [] + } + ], + "instances": [ + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "txt_loggedIn", + "persistentUuid": "f1b704b5-1bb2-4076-9230-0c0f7551a2d0", + "width": 0, + "x": 576, + "y": 336, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "objects": [ + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "txt_loggedIn", + "persistentUuid": "886a7a42-1339-4fc5-971d-67526b782479", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "LOGGED IN!", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": { + "b": 0, + "g": 0, + "r": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "LOGGED IN!", + "font": "", + "textAlignment": "left", + "verticalTextAlignment": "top", + "characterSize": 20, + "lineHeight": 0, + "color": "0;0;0" + } + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "txt_loggedIn" + } + ] + }, + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Wait" + }, + "parameters": [ + "3" + ] + }, + { + "type": { + "value": "Scene" + }, + "parameters": [ + "", + "var_playerInfo[0].room", + "" + ] + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera2DPlaneMaxDrawingDistance": 5000, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "followBaseLayerCamera": false, + "isLightingLayer": false, + "isLocked": false, + "name": "", + "renderingType": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [ + { + "effectType": "Scene3D::HemisphereLight", + "name": "3D Ambient Hemisphere Light", + "doubleParameters": { + "elevation": 40, + "intensity": 0.33, + "rotation": 300 + }, + "stringParameters": { + "groundColor": "127;127;127", + "skyColor": "255;255;255", + "top": "Z+" + }, + "booleanParameters": {} + }, + { + "effectType": "Scene3D::DirectionalLight", + "name": "3D Sun Light", + "doubleParameters": { + "distanceFromCamera": 1500, + "elevation": 40, + "frustumSize": 4000, + "intensity": 0.75, + "minimumShadowBias": 0, + "rotation": 300 + }, + "stringParameters": { + "color": "255;255;255", + "shadowQuality": "medium", + "top": "Z+" + }, + "booleanParameters": { + "isCastingShadow": true + } + } + ] + } + ], + "behaviorsSharedData": [ + { + "name": "Animation", + "type": "AnimatableCapability::AnimatableBehavior" + }, + { + "name": "Effect", + "type": "EffectCapability::EffectBehavior" + }, + { + "name": "Flippable", + "type": "FlippableCapability::FlippableBehavior" + }, + { + "name": "Opacity", + "type": "OpacityCapability::OpacityBehavior" + }, + { + "name": "Resizable", + "type": "ResizableCapability::ResizableBehavior" + }, + { + "name": "Scale", + "type": "ScalableCapability::ScalableBehavior" + }, + { + "name": "Text", + "type": "TextContainerCapability::TextContainerBehavior" + }, + { + "name": "TopDownMovement", + "type": "TopDownMovementBehavior::TopDownMovementBehavior" + } + ] + }, + { + "b": 255, + "disableInputWhenNotFocused": true, + "mangledName": "_4800000", + "name": "000000", + "r": 247, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 249, + "uiSettings": { + "grid": true, + "gridType": "rectangular", + "gridWidth": 16, + "gridHeight": 16, + "gridDepth": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridOffsetZ": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": true, + "zoomFactor": 0.6672773998330006, + "windowMask": false, + "selectedLayer": "", + "gameEditorMode": "instances-editor" + }, + "objectsGroups": [], + "variables": [ + { + "name": "var_mqttParse", + "persistentUuid": "62bd9deb-3848-4176-9eef-2adf2b38198b", + "type": "structure", + "children": [] + }, + { + "name": "var_jsonParse", + "persistentUuid": "0563153c-5ac3-487f-ab2a-050e5b806bc7", + "type": "structure", + "children": [] + }, + { + "name": "var_jsonReply", + "persistentUuid": "f4f4161d-90a5-4937-abfe-755a64fb6f2f", + "type": "string", + "value": "" + }, + { + "name": "var_child", + "persistentUuid": "457c6438-da2b-4d26-af01-34653736b679", + "type": "structure", + "children": [] + }, + { + "name": "var_childName", + "persistentUuid": "a7769c54-2f75-4661-bd4f-af2bf1d036d3", + "type": "string", + "value": "" + } + ], + "instances": [ + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "spr_door", + "persistentUuid": "1691a9cb-54f2-444c-9c3f-38f4edf26eb6", + "width": 0, + "x": 1168, + "y": 352, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "txt_debug", + "persistentUuid": "9ba688b3-55ca-4771-8b64-7c7e4ff5efac", + "width": 0, + "x": 112, + "y": 624, + "zOrder": 2, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "btn_Logout", + "persistentUuid": "acb3eb14-97fe-4a1c-b4c5-f01b9c7c6eeb", + "width": 0, + "x": 16, + "y": 16, + "zOrder": 3, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "objects": [ + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "txt_debug", + "persistentUuid": "73e827f1-d8f8-45e5-95f5-ff8a2715886b", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "Text", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": { + "b": 0, + "g": 0, + "r": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "Text", + "font": "", + "textAlignment": "left", + "verticalTextAlignment": "top", + "characterSize": 20, + "lineHeight": 0, + "color": "0;0;0" + } + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "txt_debug" + } + ] + }, + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Scene Start", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Spawn Logic" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_playerInfo[0].last_room", + "=", + "\"null\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "spr_player", + "var_playerInfo[0].x", + "var_playerInfo[0].y", + "" + ] + }, + { + "type": { + "value": "SetNumberObjectVariable" + }, + "parameters": [ + "spr_player", + "player_id", + "=", + "var_playerInfo[0].id" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_playerInfo[0].last_room", + "=", + "\"000000\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "spr_player", + "560", + "352", + "" + ] + }, + { + "type": { + "value": "SetNumberObjectVariable" + }, + "parameters": [ + "spr_player", + "player_id", + "=", + "var_playerInfo[0].id" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_playerInfo[0].last_room", + "=", + "\"000001\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "spr_player", + "1088", + "352", + "" + ] + }, + { + "type": { + "value": "SetNumberObjectVariable" + }, + "parameters": [ + "spr_player", + "player_id", + "=", + "var_playerInfo[0].id" + ] + } + ] + } + ] + } + ], + "parameters": [] + }, + { + "type": "BuiltinCommonInstructions::Link", + "include": { + "includeConfig": 0 + }, + "target": "Functions" + } + ], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera2DPlaneMaxDrawingDistance": 5000, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "followBaseLayerCamera": false, + "isLightingLayer": false, + "isLocked": false, + "name": "", + "renderingType": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [ + { + "effectType": "Scene3D::HemisphereLight", + "name": "3D Ambient Hemisphere Light", + "doubleParameters": { + "elevation": 40, + "intensity": 0.33, + "rotation": 300 + }, + "stringParameters": { + "groundColor": "127;127;127", + "skyColor": "255;255;255", + "top": "Z+" + }, + "booleanParameters": {} + }, + { + "effectType": "Scene3D::DirectionalLight", + "name": "3D Sun Light", + "doubleParameters": { + "distanceFromCamera": 1500, + "elevation": 40, + "frustumSize": 4000, + "intensity": 0.75, + "minimumShadowBias": 0, + "rotation": 300 + }, + "stringParameters": { + "color": "255;255;255", + "shadowQuality": "medium", + "top": "Z+" + }, + "booleanParameters": { + "isCastingShadow": true + } + } + ] + } + ], + "behaviorsSharedData": [ + { + "name": "Animation", + "type": "AnimatableCapability::AnimatableBehavior" + }, + { + "name": "Effect", + "type": "EffectCapability::EffectBehavior" + }, + { + "name": "Flippable", + "type": "FlippableCapability::FlippableBehavior" + }, + { + "name": "Opacity", + "type": "OpacityCapability::OpacityBehavior" + }, + { + "name": "Resizable", + "type": "ResizableCapability::ResizableBehavior" + }, + { + "name": "Scale", + "type": "ScalableCapability::ScalableBehavior" + }, + { + "name": "Text", + "type": "TextContainerCapability::TextContainerBehavior" + }, + { + "name": "TopDownMovement", + "type": "TopDownMovementBehavior::TopDownMovementBehavior" + } + ] + }, + { + "b": 255, + "disableInputWhenNotFocused": true, + "mangledName": "_4800001", + "name": "000001", + "r": 247, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 249, + "uiSettings": { + "grid": true, + "gridType": "rectangular", + "gridWidth": 16, + "gridHeight": 16, + "gridDepth": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridOffsetZ": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": true, + "zoomFactor": 0.6672773998329975, + "windowMask": false, + "selectedLayer": "", + "gameEditorMode": "instances-editor" + }, + "objectsGroups": [], + "variables": [ + { + "name": "var_jsonReply", + "persistentUuid": "600e1cff-2b6c-4e86-aa45-0926f9210a1d", + "type": "string", + "value": "" + }, + { + "name": "var_jsonParse", + "persistentUuid": "9b38abfa-427b-4c21-bd59-ddc7057a418e", + "type": "structure", + "children": [] + }, + { + "name": "var_mqttParse", + "persistentUuid": "5c8c99af-3003-442d-bd7f-d123dea72ac4", + "type": "structure", + "children": [] + }, + { + "name": "var_child", + "persistentUuid": "fb409cbe-b641-4d67-9c0e-d640b65f7cbe", + "type": "structure", + "children": [] + }, + { + "name": "var_childName", + "persistentUuid": "dc06c4ec-9998-46e8-97b5-0ae6d6088f1e", + "type": "string", + "value": "" + } + ], + "instances": [ + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "spr_door", + "persistentUuid": "1691a9cb-54f2-444c-9c3f-38f4edf26eb6", + "width": 0, + "x": 32, + "y": 352, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [ + { + "name": "var_doorway", + "type": "string", + "value": "000000" + } + ] + }, + { + "angle": 0, + "customSize": false, + "height": 0, + "keepRatio": true, + "layer": "", + "name": "btn_Logout", + "persistentUuid": "7c951776-884b-4af0-a13a-97e5ee085499", + "width": 0, + "x": 16, + "y": 16, + "zOrder": 3, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "objects": [ + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "txt_debug", + "persistentUuid": "9ec31fcd-7fdb-4daa-88e5-561ccee06c4c", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "Text", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": { + "b": 0, + "g": 0, + "r": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "Text", + "font": "", + "textAlignment": "left", + "verticalTextAlignment": "top", + "characterSize": 20, + "lineHeight": 0, + "color": "0;0;0" + } + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "txt_debug" + } + ] + }, + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Scene Start", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Spawn Logic" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_playerInfo[0].last_room", + "=", + "\"null\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "spr_player", + "var_playerInfo[0].x", + "var_playerInfo[0].y", + "" + ] + }, + { + "type": { + "value": "SetNumberObjectVariable" + }, + "parameters": [ + "spr_player", + "player_id", + "=", + "var_playerInfo[0].id" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_playerInfo[0].last_room", + "=", + "\"000001\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "spr_player", + "1088", + "352", + "" + ] + }, + { + "type": { + "value": "SetNumberObjectVariable" + }, + "parameters": [ + "spr_player", + "player_id", + "=", + "var_playerInfo[0].id" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_playerInfo[0].last_room", + "=", + "\"000000\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "spr_player", + "112", + "352", + "" + ] + } + ] + } + ] + } + ], + "parameters": [] + }, + { + "type": "BuiltinCommonInstructions::Link", + "include": { + "includeConfig": 0 + }, + "target": "Functions" + } + ], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera2DPlaneMaxDrawingDistance": 5000, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "followBaseLayerCamera": false, + "isLightingLayer": false, + "isLocked": false, + "name": "", + "renderingType": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [ + { + "effectType": "Scene3D::HemisphereLight", + "name": "3D Ambient Hemisphere Light", + "doubleParameters": { + "elevation": 40, + "intensity": 0.33, + "rotation": 300 + }, + "stringParameters": { + "groundColor": "127;127;127", + "skyColor": "255;255;255", + "top": "Z+" + }, + "booleanParameters": {} + }, + { + "effectType": "Scene3D::DirectionalLight", + "name": "3D Sun Light", + "doubleParameters": { + "distanceFromCamera": 1500, + "elevation": 40, + "frustumSize": 4000, + "intensity": 0.75, + "minimumShadowBias": 0, + "rotation": 300 + }, + "stringParameters": { + "color": "255;255;255", + "shadowQuality": "medium", + "top": "Z+" + }, + "booleanParameters": { + "isCastingShadow": true + } + } + ] + } + ], + "behaviorsSharedData": [ + { + "name": "Animation", + "type": "AnimatableCapability::AnimatableBehavior" + }, + { + "name": "Effect", + "type": "EffectCapability::EffectBehavior" + }, + { + "name": "Flippable", + "type": "FlippableCapability::FlippableBehavior" + }, + { + "name": "Opacity", + "type": "OpacityCapability::OpacityBehavior" + }, + { + "name": "Resizable", + "type": "ResizableCapability::ResizableBehavior" + }, + { + "name": "Scale", + "type": "ScalableCapability::ScalableBehavior" + }, + { + "name": "Text", + "type": "TextContainerCapability::TextContainerBehavior" + }, + { + "name": "TopDownMovement", + "type": "TopDownMovementBehavior::TopDownMovementBehavior" + } + ] + }, + { + "b": 255, + "disableInputWhenNotFocused": true, + "mangledName": "Functions", + "name": "Functions", + "r": 247, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 249, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridDepth": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridOffsetZ": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.546875, + "windowMask": false, + "selectedLayer": "", + "gameEditorMode": "instances-editor" + }, + "objectsGroups": [], + "variables": [ + { + "name": "var_jsonReply", + "persistentUuid": "e04c3e03-0cb7-4e3d-8f02-7bd32268195c", + "type": "string", + "value": "" + }, + { + "name": "var_jsonParse", + "persistentUuid": "becd4ac5-49ec-4fd7-b926-45259680bb42", + "type": "structure", + "children": [] + }, + { + "name": "var_mqttParse", + "persistentUuid": "b4fe2c70-e8ab-4665-9d0a-7126bb52f64b", + "type": "structure", + "children": [] + }, + { + "name": "var_child", + "persistentUuid": "64d0682b-fde0-404e-9b34-17034c997c4c", + "type": "structure", + "children": [] + }, + { + "name": "var_childName", + "persistentUuid": "792ced2c-6b39-44d1-8550-02127dd84b45", + "type": "string", + "value": "" + } + ], + "instances": [], + "objects": [ + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "txt_debug", + "persistentUuid": "29da99d2-6fb0-4d86-841b-b57124673767", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [], + "string": "Text", + "font": "", + "textAlignment": "left", + "characterSize": 20, + "color": { + "b": 0, + "g": 0, + "r": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "Text", + "font": "", + "textAlignment": "left", + "verticalTextAlignment": "top", + "characterSize": 20, + "lineHeight": 0, + "color": "0;0;0" + } + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "txt_debug" + } + ] + }, + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Scene Start", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneJustBegins" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ChangeColor" + }, + "parameters": [ + "spr_player", + "var_playerInfo[0].color" + ] + }, + { + "type": { + "value": "SendAsyncRequest" + }, + "parameters": [ + "var_jsonAddress+\"/users/\"+var_playerInfo[0].id", + "\"{\\\"x\\\":\\\"\" + ToString(round(spr_player.X()))+ \"\\\",\\\"y\\\":\\\"\" + ToString(round(spr_player.Y())) + \"\\\"}\"", + "\"PATCH\"", + "\"application/json\"", + "", + "" + ] + }, + { + "type": { + "value": "SendAsyncRequest" + }, + "parameters": [ + "var_jsonAddress+\"/users?online=true&room=\"+CurrentSceneName()", + "", + "\"GET\"", + "", + "var_jsonReply", + "" + ] + }, + { + "type": { + "value": "Wait" + }, + "parameters": [ + ".1" + ] + }, + { + "type": { + "value": "JSONToVariableStructure2" + }, + "parameters": [ + "var_jsonReply", + "var_jsonParse" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::ForEachChildVariable", + "iterableVariableName": "var_jsonParse", + "valueIteratorVariableName": "var_child", + "keyIteratorVariableName": "var_childName", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_child[\"id\"]", + "!=", + "var_playerInfo[0].id" + ] + } + ], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "spr_otherPlayers", + "var_child[\"x\"]", + "var_child[\"y\"]", + "" + ] + }, + { + "type": { + "value": "ChangeColor" + }, + "parameters": [ + "spr_otherPlayers", + "var_child[\"color\"]" + ] + }, + { + "type": { + "value": "SetNumberObjectVariable" + }, + "parameters": [ + "spr_otherPlayers", + "player_id", + "=", + "var_child[\"id\"]" + ] + } + ] + } + ] + } + ] + } + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "MQTT", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "MQTT::isConnected" + }, + "parameters": [ + "", + "" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "MQTT::subscribe" + }, + "parameters": [ + "", + "\"/game/rooms/\"+CurrentSceneName()", + "", + "no", + "" + ] + }, + { + "type": { + "value": "MQTT::publish" + }, + "parameters": [ + "", + "\"{\\\"type\\\":\\\"join\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"x\\\":\" + ToString(round(spr_player.X())) + \",\\\"y\\\":\" + ToString(round(spr_player.Y())) + \",\\\"color\\\":\\\"\" + var_playerInfo[0].color + \"\\\"}\"", + "\"/game/rooms/\"+CurrentSceneName()", + "", + "", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "MQTT on button press" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "TopDownMovementBehavior::IsMoving" + }, + "parameters": [ + "spr_player", + "TopDownMovement" + ] + }, + { + "type": { + "value": "TopDownMovementBehavior::TopDownMovementBehavior::IsMovementAngleAround" + }, + "parameters": [ + "spr_player", + "TopDownMovement", + "0", + "0" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "MQTT::publish" + }, + "parameters": [ + "", + "\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"right\\\"}\"", + "\"/game/rooms/\"+CurrentSceneName()", + "", + "", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "TopDownMovementBehavior::IsMoving" + }, + "parameters": [ + "spr_player", + "TopDownMovement" + ] + }, + { + "type": { + "value": "TopDownMovementBehavior::TopDownMovementBehavior::IsMovementAngleAround" + }, + "parameters": [ + "spr_player", + "TopDownMovement", + "90", + "0" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "MQTT::publish" + }, + "parameters": [ + "", + "\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"down\\\"}\"", + "\"/game/rooms/\"+CurrentSceneName()", + "", + "", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "TopDownMovementBehavior::IsMoving" + }, + "parameters": [ + "spr_player", + "TopDownMovement" + ] + }, + { + "type": { + "value": "TopDownMovementBehavior::TopDownMovementBehavior::IsMovementAngleAround" + }, + "parameters": [ + "spr_player", + "TopDownMovement", + "180", + "0" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "MQTT::publish" + }, + "parameters": [ + "", + "\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"left\\\"}\"", + "\"/game/rooms/\"+CurrentSceneName()", + "", + "", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "TopDownMovementBehavior::IsMoving" + }, + "parameters": [ + "spr_player", + "TopDownMovement" + ] + }, + { + "type": { + "value": "TopDownMovementBehavior::TopDownMovementBehavior::IsMovementAngleAround" + }, + "parameters": [ + "spr_player", + "TopDownMovement", + "270", + "0" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "MQTT::publish" + }, + "parameters": [ + "", + "\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"up\\\"}\"", + "\"/game/rooms/\"+CurrentSceneName()", + "", + "", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "TopDownMovementBehavior::IsMoving" + }, + "parameters": [ + "spr_player", + "TopDownMovement" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "MQTT::publish" + }, + "parameters": [ + "", + "\"{\\\"type\\\":\\\"move_stop\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"x\\\":\" + ToString(round(spr_player.X())) + \",\\\"y\\\":\" + ToString(round(spr_player.Y())) + \"}\"", + "\"/game/rooms/\"+CurrentSceneName()", + "", + "", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "MQTT::onMessage" + }, + "parameters": [ + "", + "\"/game/rooms/\"+CurrentSceneName()", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "JSONToVariableStructure2" + }, + "parameters": [ + "MQTT::GetLastMessage(\"/game/rooms/\"+CurrentSceneName())", + "var_mqttParse" + ] + }, + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "txt_debug", + "Text", + "=", + "MQTT::GetLastMessage(\"/game/rooms/\"+CurrentSceneName())" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_mqttParse[\"player_id\"]", + "!=", + "var_playerInfo[0].id" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_mqttParse[\"type\"]", + "=", + "\"move_start\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_mqttParse[\"direction\"]", + "=", + "\"right\"" + ] + }, + { + "type": { + "value": "NumberObjectVariable" + }, + "parameters": [ + "spr_otherPlayers", + "player_id", + "=", + "var_mqttParse[\"player_id\"]" + ] + } + ], + "actions": [ + { + "type": { + "value": "ClearForces" + }, + "parameters": [ + "spr_otherPlayers" + ] + }, + { + "type": { + "value": "AddForceXY" + }, + "parameters": [ + "spr_otherPlayers", + "200", + "0", + "1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_mqttParse[\"type\"]", + "=", + "\"move_start\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_mqttParse[\"direction\"]", + "=", + "\"left\"" + ] + }, + { + "type": { + "value": "NumberObjectVariable" + }, + "parameters": [ + "spr_otherPlayers", + "player_id", + "=", + "var_mqttParse[\"player_id\"]" + ] + } + ], + "actions": [ + { + "type": { + "value": "ClearForces" + }, + "parameters": [ + "spr_otherPlayers" + ] + }, + { + "type": { + "value": "AddForceXY" + }, + "parameters": [ + "spr_otherPlayers", + "-200", + "0", + "1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_mqttParse[\"type\"]", + "=", + "\"move_start\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_mqttParse[\"direction\"]", + "=", + "\"up\"" + ] + }, + { + "type": { + "value": "NumberObjectVariable" + }, + "parameters": [ + "spr_otherPlayers", + "player_id", + "=", + "var_mqttParse[\"player_id\"]" + ] + } + ], + "actions": [ + { + "type": { + "value": "ClearForces" + }, + "parameters": [ + "spr_otherPlayers" + ] + }, + { + "type": { + "value": "AddForceXY" + }, + "parameters": [ + "spr_otherPlayers", + "0", + "-200", + "1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_mqttParse[\"type\"]", + "=", + "\"move_start\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_mqttParse[\"direction\"]", + "=", + "\"down\"" + ] + }, + { + "type": { + "value": "NumberObjectVariable" + }, + "parameters": [ + "spr_otherPlayers", + "player_id", + "=", + "var_mqttParse[\"player_id\"]" + ] + } + ], + "actions": [ + { + "type": { + "value": "ClearForces" + }, + "parameters": [ + "spr_otherPlayers" + ] + }, + { + "type": { + "value": "AddForceXY" + }, + "parameters": [ + "spr_otherPlayers", + "0", + "200", + "1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_mqttParse[\"type\"]", + "=", + "\"move_stop\"" + ] + }, + { + "type": { + "value": "NumberObjectVariable" + }, + "parameters": [ + "spr_otherPlayers", + "player_id", + "=", + "var_mqttParse[\"player_id\"]" + ] + } + ], + "actions": [ + { + "type": { + "value": "ClearForces" + }, + "parameters": [ + "spr_otherPlayers" + ] + }, + { + "type": { + "value": "SetXY" + }, + "parameters": [ + "spr_otherPlayers", + "=", + "var_mqttParse[\"x\"]", + "=", + "var_mqttParse[\"y\"]" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_mqttParse[\"type\"]", + "=", + "\"join\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "spr_otherPlayers", + "var_mqttParse[\"x\"]", + "var_mqttParse[\"y\"]", + "" + ] + }, + { + "type": { + "value": "SetNumberObjectVariable" + }, + "parameters": [ + "spr_otherPlayers", + "player_id", + "=", + "var_mqttParse[\"player_id\"]" + ] + }, + { + "type": { + "value": "ChangeColor" + }, + "parameters": [ + "spr_otherPlayers", + "var_mqttParse[\"color\"]" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "var_mqttParse[\"type\"]", + "=", + "\"leave\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::ForEach", + "object": "spr_otherPlayers", + "conditions": [ + { + "type": { + "value": "NumberObjectVariable" + }, + "parameters": [ + "spr_otherPlayers", + "player_id", + "=", + "var_mqttParse[\"player_id\"]" + ] + } + ], + "actions": [ + { + "type": { + "value": "Delete" + }, + "parameters": [ + "spr_otherPlayers", + "" + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Doorways", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionNP" + }, + "parameters": [ + "spr_player", + "spr_door", + "", + "", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "var_playerInfo[0].last_room", + "=", + "var_playerInfo[0].room" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "var_playerInfo[0].room", + "=", + "spr_door.var_doorway" + ] + }, + { + "type": { + "value": "SendAsyncRequest" + }, + "parameters": [ + "var_jsonAddress+\"/users/\"+var_playerInfo[0].id", + "\"{\\\"room\\\":\\\"\" + var_playerInfo[0].room + \"\\\",\\\"last_room\\\":\\\"\" + var_playerInfo[0].last_room + \"\\\"}\"", + "\"PATCH\"", + "\"application/json\"", + "", + "" + ] + }, + { + "type": { + "value": "MQTT::publish" + }, + "parameters": [ + "", + "\"{\\\"type\\\":\\\"leave\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \"}\"", + "\"/game/rooms/\"+CurrentSceneName()", + "", + "", + "" + ] + }, + { + "type": { + "value": "Scene" + }, + "parameters": [ + "", + "spr_door.var_doorway", + "" + ] + } + ] + } + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Log Out", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsClicked" + }, + "parameters": [ + "btn_Logout", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SendAsyncRequest" + }, + "parameters": [ + "var_jsonAddress+\"/users/\"+var_playerInfo[0].id", + "\"{\\\"online\\\":false,\\\"last_room\\\":\\\"null\\\",\\\"x\\\":\" + ToString(round(spr_player.X())) + \",\\\"y\\\":\" + ToString(round(spr_player.Y())) + \"}\"", + "\"PATCH\"", + "\"application/json\"", + "", + "" + ] + }, + { + "type": { + "value": "MQTT::publish" + }, + "parameters": [ + "", + "\"{\\\"type\\\":\\\"leave\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \"}\"", + "\"/game/rooms/\"+CurrentSceneName()", + "", + "", + "" + ] + }, + { + "type": { + "value": "Scene" + }, + "parameters": [ + "", + "\"Login\"", + "" + ] + } + ] + } + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Update XY", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "TopDownMovementBehavior::IsMoving" + }, + "parameters": [ + "spr_player", + "TopDownMovement" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "SendAsyncRequest" + }, + "parameters": [ + "var_jsonAddress+\"/users/\"+var_playerInfo[0].id", + "\"{\\\"x\\\":\\\"\" + ToString(round(spr_player.X()))+ \"\\\",\\\"y\\\":\\\"\" + ToString(round(spr_player.Y())) + \"\\\"}\"", + "\"PATCH\"", + "\"application/json\"", + "", + "" + ] + } + ] + } + ], + "parameters": [] + } + ], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera2DPlaneMaxDrawingDistance": 5000, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "followBaseLayerCamera": false, + "isLightingLayer": false, + "isLocked": false, + "name": "", + "renderingType": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [ + { + "effectType": "Scene3D::HemisphereLight", + "name": "3D Ambient Hemisphere Light", + "doubleParameters": { + "elevation": 40, + "intensity": 0.33, + "rotation": 300 + }, + "stringParameters": { + "groundColor": "127;127;127", + "skyColor": "255;255;255", + "top": "Z+" + }, + "booleanParameters": {} + }, + { + "effectType": "Scene3D::DirectionalLight", + "name": "3D Sun Light", + "doubleParameters": { + "distanceFromCamera": 1500, + "elevation": 40, + "frustumSize": 4000, + "intensity": 0.75, + "minimumShadowBias": 0, + "rotation": 300 + }, + "stringParameters": { + "color": "255;255;255", + "shadowQuality": "medium", + "top": "Z+" + }, + "booleanParameters": { + "isCastingShadow": true + } + } + ] + } + ], + "behaviorsSharedData": [ + { + "name": "Animation", + "type": "AnimatableCapability::AnimatableBehavior" + }, + { + "name": "Effect", + "type": "EffectCapability::EffectBehavior" + }, + { + "name": "Flippable", + "type": "FlippableCapability::FlippableBehavior" + }, + { + "name": "Opacity", + "type": "OpacityCapability::OpacityBehavior" + }, + { + "name": "Resizable", + "type": "ResizableCapability::ResizableBehavior" + }, + { + "name": "Scale", + "type": "ScalableCapability::ScalableBehavior" + }, + { + "name": "Text", + "type": "TextContainerCapability::TextContainerBehavior" + }, + { + "name": "TopDownMovement", + "type": "TopDownMovementBehavior::TopDownMovementBehavior" + } + ] + }, + { + "b": 255, + "disableInputWhenNotFocused": true, + "mangledName": "Sprite_32Test", + "name": "Sprite Test", + "r": 247, + "standardSortMethod": true, + "stopSoundsOnStartup": true, + "title": "", + "v": 249, + "uiSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridDepth": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridOffsetZ": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 0.546875, + "windowMask": false, + "selectedLayer": "", + "gameEditorMode": "instances-editor" + }, + "objectsGroups": [], + "variables": [], + "instances": [], + "objects": [], + "objectsFolderStructure": { + "folderName": "__ROOT" + }, + "events": [], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera2DPlaneMaxDrawingDistance": 5000, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "followBaseLayerCamera": false, + "isLightingLayer": false, + "isLocked": false, + "name": "", + "renderingType": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [ + { + "effectType": "Scene3D::HemisphereLight", + "name": "3D Ambient Hemisphere Light", + "doubleParameters": { + "elevation": 40, + "intensity": 0.33, + "rotation": 300 + }, + "stringParameters": { + "groundColor": "127;127;127", + "skyColor": "255;255;255", + "top": "Z+" + }, + "booleanParameters": {} + }, + { + "effectType": "Scene3D::DirectionalLight", + "name": "3D Sun Light", + "doubleParameters": { + "distanceFromCamera": 1500, + "elevation": 40, + "frustumSize": 4000, + "intensity": 0.75, + "minimumShadowBias": 0, + "rotation": 300 + }, + "stringParameters": { + "color": "255;255;255", + "shadowQuality": "medium", + "top": "Z+" + }, + "booleanParameters": { + "isCastingShadow": true + } + } + ] + } + ], + "behaviorsSharedData": [ + { + "name": "Animation", + "type": "AnimatableCapability::AnimatableBehavior" + }, + { + "name": "Effect", + "type": "EffectCapability::EffectBehavior" + }, + { + "name": "Flippable", + "type": "FlippableCapability::FlippableBehavior" + }, + { + "name": "Opacity", + "type": "OpacityCapability::OpacityBehavior" + }, + { + "name": "Resizable", + "type": "ResizableCapability::ResizableBehavior" + }, + { + "name": "Scale", + "type": "ScalableCapability::ScalableBehavior" + }, + { + "name": "TopDownMovement", + "type": "TopDownMovementBehavior::TopDownMovementBehavior" + } + ] + } + ], + "externalEvents": [], + "eventsFunctionsExtensions": [ + { + "author": "Arthur Pacaud (@arthuro555)", + "category": "Network", + "dimension": "", + "extensionNamespace": "", + "fullName": "MQTT Client (advanced)", + "gdevelopVersion": ">=5.5.222", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLW1lc3NhZ2UtZmxhc2giIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMjIgNEMyMiAyLjkgMjEuMSAyIDIwIDJINEMyLjkgMiAyIDIuOSAyIDRWMjJMNiAxOEgxNVYxMEgyMlY0TTIyLjUgMTZIMjAuM0wyMiAxMkgxN1YxOEgxOVYyM0wyMi41IDE2WiIgLz48L3N2Zz4=", + "name": "MQTT", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/message-flash.svg", + "shortDescription": "MQTT client: connect to broker, publish/subscribe topics, send/receive messages.", + "version": "1.0.1", + "description": [ + "This extension wraps [MQTT.js](https://github.com/mqttjs/MQTT.js) to allow connections to a MQTT server and communication via pub/sub. The only transport method is Websockets. Make sure to use a broker that support those!", + "", + "## Dataloss", + "", + "The dataloss let you chose how to handle data. Due to how the GDevelop event loop is made, only one message per topic can be processed per frame. When dataloss is on, when you get 2 messages from one topic in one frame, only the latest one is remembered. When it is off, the first message is processed and the second is queued for the next frame.", + "", + "## QoS (Quality of service)", + "", + "Here is how QoS works:", + "", + " - QoS 0 (received at most once): The packet is sent, and that's it. There is no validation about whether it has been received.", + " - QoS 1 (received at least once): The packet is sent and stored as long as the client has not received a confirmation from the server. MQTT ensures that it will be received, but there can be duplicates.", + " - QoS 2 (received exactly once): Same as QoS 1 but there is no duplicates.", + "", + "About data consumption: QoS 2 will consume more than QoS 1, which will consume more than QoS 0.", + "", + "## Test Broker", + "", + "You can find a free test broker server over at https://test.mosquitto.org/ - keep in mind, anyone can read and write data sent there, and it offers no uptime guarantees!" + ], + "origin": { + "identifier": "MQTT", + "name": "gdevelop-extension-store" + }, + "tags": [ + "mqtt", + "iot", + "connection", + "networking", + "pubsub", + "messaging", + "online", + "connect", + "multiplayer", + "send", + "message", + "recieve", + "notify", + "notification", + "home assistant", + "smart home", + "control" + ], + "authorIds": [ + "ZgrsWuRTAkXgeuPV9bo0zuEcA2w1" + ], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [], + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onFirstSceneLoaded", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/**", + " * @typedef MQTTEvent Corresponds to a message coming from a subcribed topic.", + " * @property {boolean} loss Descibes how to handle multiple packages in one frame.", + " * @property {string || Array} data The last message received by that event.", + " */", + "", + "/**", + " * The mqtt tools", + " * @namespace", + " */", + "gdjs.evtTools.mqtt = {", + " /** The current connection to the MQTT broker server */", + " connection: null,", + " /** ", + " * The last error that occured ", + " * @type {string}", + " */", + " lastError: \"\",", + " /**", + " * A list of events triggered.", + " * @type {Object.}", + " */", + " events: {},", + " empty: Symbol(\"No event\"),", + "};", + "", + "// MQTT.js: https://github.com/mqttjs/MQTT.js (v5.10.3)", + "window.mqtt=(()=>{var ys=Object.defineProperty;var Kg=Object.getOwnPropertyDescriptor;var Gg=Object.getOwnPropertyNames;var Qg=Object.prototype.hasOwnProperty;var _e=(t,e)=>()=>(t&&(e=t(t=0)),e);var M=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Jt=(t,e)=>{for(var r in e)ys(t,r,{get:e[r],enumerable:!0})},Yg=(t,e,r,i)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let n of Gg(e))!Qg.call(t,n)&&n!==r&&ys(t,n,{get:()=>e[n],enumerable:!(i=Kg(e,n))||i.enumerable});return t};var X=t=>Yg(ys({},\"__esModule\",{value:!0}),t);var _=_e(()=>{});var B={};Jt(B,{_debugEnd:()=>yu,_debugProcess:()=>gu,_events:()=>Ou,_eventsCount:()=>xu,_exiting:()=>Yl,_fatalExceptions:()=>cu,_getActiveHandles:()=>eu,_getActiveRequests:()=>Zl,_kill:()=>ru,_linkedBinding:()=>Gl,_maxListeners:()=>ku,_preload_modules:()=>Cu,_rawDebug:()=>zl,_startProfilerIdleNotifier:()=>bu,_stopProfilerIdleNotifier:()=>wu,_tickCallback:()=>pu,abort:()=>Eu,addListener:()=>Mu,allowedNodeEnvironmentFlags:()=>lu,arch:()=>xl,argv:()=>Ul,argv0:()=>Ru,assert:()=>uu,binding:()=>Fl,chdir:()=>Hl,config:()=>Jl,cpuUsage:()=>$i,cwd:()=>$l,debugPort:()=>Tu,default:()=>$u,dlopen:()=>Xl,domain:()=>Ql,emit:()=>Du,emitWarning:()=>jl,env:()=>Ll,execArgv:()=>Nl,execPath:()=>Iu,exit:()=>ou,features:()=>fu,hasUncaughtExceptionCaptureCallback:()=>du,hrtime:()=>Wi,kill:()=>su,listeners:()=>Wu,memoryUsage:()=>nu,moduleLoadList:()=>Kl,nextTick:()=>Pl,off:()=>Uu,on:()=>wt,once:()=>Lu,openStdin:()=>au,pid:()=>Su,platform:()=>Ml,ppid:()=>Au,prependListener:()=>ju,prependOnceListener:()=>Fu,reallyExit:()=>tu,release:()=>Vl,removeAllListeners:()=>qu,removeListener:()=>Nu,resourceUsage:()=>iu,setSourceMapsEnabled:()=>Bu,setUncaughtExceptionCaptureCallback:()=>hu,stderr:()=>mu,stdin:()=>vu,stdout:()=>_u,title:()=>Ol,umask:()=>Wl,uptime:()=>Pu,version:()=>ql,versions:()=>Dl});function _s(t){throw new Error(\"Node.js process \"+t+\" is not supported by JSPM core outside of Node.js\")}function Jg(){!Lr||!Xt||(Lr=!1,Xt.length?bt=Xt.concat(bt):Fi=-1,bt.length&&Bl())}function Bl(){if(!Lr){var t=setTimeout(Jg,0);Lr=!0;for(var e=bt.length;e;){for(Xt=bt,bt=[];++Fi1)for(var r=1;r{_();v();m();bt=[],Lr=!1,Fi=-1;kl.prototype.run=function(){this.fun.apply(null,this.array)};Ol=\"browser\",xl=\"x64\",Ml=\"browser\",Ll={PATH:\"/usr/bin\",LANG:navigator.language+\".UTF-8\",PWD:\"/\",HOME:\"/home\",TMP:\"/tmp\"},Ul=[\"/usr/bin/node\"],Nl=[],ql=\"v16.8.0\",Dl={},jl=function(t,e){console.warn((e?e+\": \":\"\")+t)},Fl=function(t){_s(\"binding\")},Wl=function(t){return 0},$l=function(){return\"/\"},Hl=function(t){},Vl={name:\"node\",sourceUrl:\"\",headersUrl:\"\",libUrl:\"\"};zl=Ee,Kl=[];Ql={},Yl=!1,Jl={};tu=Ee,ru=Ee,$i=function(){return{}},iu=$i,nu=$i,su=Ee,ou=Ee,au=Ee,lu={};fu={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},cu=Ee,hu=Ee;pu=Ee,gu=Ee,yu=Ee,bu=Ee,wu=Ee,_u=void 0,mu=void 0,vu=void 0,Eu=Ee,Su=2,Au=1,Iu=\"/bin/usr/node\",Tu=9229,Ru=\"node\",Cu=[],Bu=Ee,Lt={now:typeof performance<\"u\"?performance.now.bind(performance):void 0,timing:typeof performance<\"u\"?performance.timing:void 0};Lt.now===void 0&&(bs=Date.now(),Lt.timing&&Lt.timing.navigationStart&&(bs=Lt.timing.navigationStart),Lt.now=()=>Date.now()-bs);ws=1e9;Wi.bigint=function(t){var e=Wi(t);return typeof BigInt>\"u\"?e[0]*ws+e[1]:BigInt(e[0]*ws)+BigInt(e[1])};ku=10,Ou={},xu=0;Mu=wt,Lu=wt,Uu=wt,Nu=wt,qu=wt,Du=Ee,ju=wt,Fu=wt;$u={version:ql,versions:Dl,arch:xl,platform:Ml,release:Vl,_rawDebug:zl,moduleLoadList:Kl,binding:Fl,_linkedBinding:Gl,_events:Ou,_eventsCount:xu,_maxListeners:ku,on:wt,addListener:Mu,once:Lu,off:Uu,removeListener:Nu,removeAllListeners:qu,emit:Du,prependListener:ju,prependOnceListener:Fu,listeners:Wu,domain:Ql,_exiting:Yl,config:Jl,dlopen:Xl,uptime:Pu,_getActiveRequests:Zl,_getActiveHandles:eu,reallyExit:tu,_kill:ru,cpuUsage:$i,resourceUsage:iu,memoryUsage:nu,kill:su,exit:ou,openStdin:au,allowedNodeEnvironmentFlags:lu,assert:uu,features:fu,_fatalExceptions:cu,setUncaughtExceptionCaptureCallback:hu,hasUncaughtExceptionCaptureCallback:du,emitWarning:jl,nextTick:Pl,_tickCallback:pu,_debugProcess:gu,_debugEnd:yu,_startProfilerIdleNotifier:bu,_stopProfilerIdleNotifier:wu,stdout:_u,stdin:vu,stderr:mu,abort:Eu,umask:Wl,chdir:Hl,cwd:$l,env:Ll,title:Ol,argv:Ul,execArgv:Nl,pid:Su,ppid:Au,execPath:Iu,debugPort:Tu,hrtime:Wi,argv0:Ru,_preload_modules:Cu,setSourceMapsEnabled:Bu}});var m=_e(()=>{Hu()});var me={};Jt(me,{Buffer:()=>x,INSPECT_MAX_BYTES:()=>ty,default:()=>Ut,kMaxLength:()=>ry});function Xg(){if(Vu)return ci;Vu=!0,ci.byteLength=a,ci.toByteArray=c,ci.fromByteArray=g;for(var t=[],e=[],r=typeof Uint8Array<\"u\"?Uint8Array:Array,i=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",n=0,o=i.length;n0)throw new Error(\"Invalid string. Length must be a multiple of 4\");var S=y.indexOf(\"=\");S===-1&&(S=w);var E=S===w?0:4-S%4;return[S,E]}function a(y){var w=s(y),S=w[0],E=w[1];return(S+E)*3/4-E}function l(y,w,S){return(w+S)*3/4-S}function c(y){var w,S=s(y),E=S[0],I=S[1],C=new r(l(y,E,I)),R=0,U=I>0?E-4:E,N;for(N=0;N>16&255,C[R++]=w>>8&255,C[R++]=w&255;return I===2&&(w=e[y.charCodeAt(N)]<<2|e[y.charCodeAt(N+1)]>>4,C[R++]=w&255),I===1&&(w=e[y.charCodeAt(N)]<<10|e[y.charCodeAt(N+1)]<<4|e[y.charCodeAt(N+2)]>>2,C[R++]=w>>8&255,C[R++]=w&255),C}function h(y){return t[y>>18&63]+t[y>>12&63]+t[y>>6&63]+t[y&63]}function d(y,w,S){for(var E,I=[],C=w;CU?U:R+C));return E===1?(w=y[S-1],I.push(t[w>>2]+t[w<<4&63]+\"==\")):E===2&&(w=(y[S-2]<<8)+y[S-1],I.push(t[w>>10]+t[w>>4&63]+t[w<<2&63]+\"=\")),I.join(\"\")}return ci}function Zg(){if(zu)return Hi;zu=!0;return Hi.read=function(t,e,r,i,n){var o,s,a=n*8-i-1,l=(1<>1,h=-7,d=r?n-1:0,g=r?-1:1,y=t[e+d];for(d+=g,o=y&(1<<-h)-1,y>>=-h,h+=a;h>0;o=o*256+t[e+d],d+=g,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=i;h>0;s=s*256+t[e+d],d+=g,h-=8);if(o===0)o=1-c;else{if(o===l)return s?NaN:(y?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-c}return(y?-1:1)*s*Math.pow(2,o-i)},Hi.write=function(t,e,r,i,n,o){var s,a,l,c=o*8-n-1,h=(1<>1,g=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=i?0:o-1,w=i?1:-1,S=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+d>=1?e+=g/l:e+=g*Math.pow(2,1-d),e*l>=2&&(s++,l/=2),s+d>=h?(a=0,s=h):s+d>=1?(a=(e*l-1)*Math.pow(2,n),s=s+d):(a=e*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;t[r+y]=a&255,y+=w,a/=256,n-=8);for(s=s<0;t[r+y]=s&255,y+=w,s/=256,c-=8);t[r+y-w]|=S*128},Hi}function ey(){if(Ku)return Zt;Ku=!0;let t=Xg(),e=Zg(),r=typeof Symbol==\"function\"&&typeof Symbol.for==\"function\"?Symbol.for(\"nodejs.util.inspect.custom\"):null;Zt.Buffer=s,Zt.SlowBuffer=I,Zt.INSPECT_MAX_BYTES=50;let i=2147483647;Zt.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=n(),!s.TYPED_ARRAY_SUPPORT&&typeof console<\"u\"&&typeof console.error==\"function\"&&console.error(\"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.\");function n(){try{let p=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(p,u),p.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,\"parent\",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,\"offset\",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(p){if(p>i)throw new RangeError('The value \"'+p+'\" is invalid for option \"size\"');let u=new Uint8Array(p);return Object.setPrototypeOf(u,s.prototype),u}function s(p,u,f){if(typeof p==\"number\"){if(typeof u==\"string\")throw new TypeError('The \"string\" argument must be of type string. Received type number');return h(p)}return a(p,u,f)}s.poolSize=8192;function a(p,u,f){if(typeof p==\"string\")return d(p,u);if(ArrayBuffer.isView(p))return y(p);if(p==null)throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof p);if(Ye(p,ArrayBuffer)||p&&Ye(p.buffer,ArrayBuffer)||typeof SharedArrayBuffer<\"u\"&&(Ye(p,SharedArrayBuffer)||p&&Ye(p.buffer,SharedArrayBuffer)))return w(p,u,f);if(typeof p==\"number\")throw new TypeError('The \"value\" argument must not be of type number. Received type number');let b=p.valueOf&&p.valueOf();if(b!=null&&b!==p)return s.from(b,u,f);let A=S(p);if(A)return A;if(typeof Symbol<\"u\"&&Symbol.toPrimitive!=null&&typeof p[Symbol.toPrimitive]==\"function\")return s.from(p[Symbol.toPrimitive](\"string\"),u,f);throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof p)}s.from=function(p,u,f){return a(p,u,f)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(p){if(typeof p!=\"number\")throw new TypeError('\"size\" argument must be of type number');if(p<0)throw new RangeError('The value \"'+p+'\" is invalid for option \"size\"')}function c(p,u,f){return l(p),p<=0?o(p):u!==void 0?typeof f==\"string\"?o(p).fill(u,f):o(p).fill(u):o(p)}s.alloc=function(p,u,f){return c(p,u,f)};function h(p){return l(p),o(p<0?0:E(p)|0)}s.allocUnsafe=function(p){return h(p)},s.allocUnsafeSlow=function(p){return h(p)};function d(p,u){if((typeof u!=\"string\"||u===\"\")&&(u=\"utf8\"),!s.isEncoding(u))throw new TypeError(\"Unknown encoding: \"+u);let f=C(p,u)|0,b=o(f),A=b.write(p,u);return A!==f&&(b=b.slice(0,A)),b}function g(p){let u=p.length<0?0:E(p.length)|0,f=o(u);for(let b=0;b=i)throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\"+i.toString(16)+\" bytes\");return p|0}function I(p){return+p!=p&&(p=0),s.alloc(+p)}s.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==s.prototype},s.compare=function(u,f){if(Ye(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),Ye(f,Uint8Array)&&(f=s.from(f,f.offset,f.byteLength)),!s.isBuffer(u)||!s.isBuffer(f))throw new TypeError('The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array');if(u===f)return 0;let b=u.length,A=f.length;for(let T=0,P=Math.min(b,A);TA.length?(s.isBuffer(P)||(P=s.from(P)),P.copy(A,T)):Uint8Array.prototype.set.call(A,P,T);else if(s.isBuffer(P))P.copy(A,T);else throw new TypeError('\"list\" argument must be an Array of Buffers');T+=P.length}return A};function C(p,u){if(s.isBuffer(p))return p.length;if(ArrayBuffer.isView(p)||Ye(p,ArrayBuffer))return p.byteLength;if(typeof p!=\"string\")throw new TypeError('The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof p);let f=p.length,b=arguments.length>2&&arguments[2]===!0;if(!b&&f===0)return 0;let A=!1;for(;;)switch(u){case\"ascii\":case\"latin1\":case\"binary\":return f;case\"utf8\":case\"utf-8\":return ps(p).length;case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return f*2;case\"hex\":return f>>>1;case\"base64\":return Cl(p).length;default:if(A)return b?-1:ps(p).length;u=(\"\"+u).toLowerCase(),A=!0}}s.byteLength=C;function R(p,u,f){let b=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((f===void 0||f>this.length)&&(f=this.length),f<=0)||(f>>>=0,u>>>=0,f<=u))return\"\";for(p||(p=\"utf8\");;)switch(p){case\"hex\":return qg(this,u,f);case\"utf8\":case\"utf-8\":return Pr(this,u,f);case\"ascii\":return hs(this,u,f);case\"latin1\":case\"binary\":return Ng(this,u,f);case\"base64\":return ge(this,u,f);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return Dg(this,u,f);default:if(b)throw new TypeError(\"Unknown encoding: \"+p);p=(p+\"\").toLowerCase(),b=!0}}s.prototype._isBuffer=!0;function U(p,u,f){let b=p[u];p[u]=p[f],p[f]=b}s.prototype.swap16=function(){let u=this.length;if(u%2!==0)throw new RangeError(\"Buffer size must be a multiple of 16-bits\");for(let f=0;ff&&(u+=\" ... \"),\"\"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(u,f,b,A,T){if(Ye(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),!s.isBuffer(u))throw new TypeError('The \"target\" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(f===void 0&&(f=0),b===void 0&&(b=u?u.length:0),A===void 0&&(A=0),T===void 0&&(T=this.length),f<0||b>u.length||A<0||T>this.length)throw new RangeError(\"out of range index\");if(A>=T&&f>=b)return 0;if(A>=T)return-1;if(f>=b)return 1;if(f>>>=0,b>>>=0,A>>>=0,T>>>=0,this===u)return 0;let P=T-A,$=b-f,se=Math.min(P,$),te=this.slice(A,T),oe=u.slice(f,b);for(let J=0;J2147483647?f=2147483647:f<-2147483648&&(f=-2147483648),f=+f,gs(f)&&(f=A?0:p.length-1),f<0&&(f=p.length+f),f>=p.length){if(A)return-1;f=p.length-1}else if(f<0)if(A)f=0;else return-1;if(typeof u==\"string\"&&(u=s.from(u,b)),s.isBuffer(u))return u.length===0?-1:W(p,u,f,b,A);if(typeof u==\"number\")return u=u&255,typeof Uint8Array.prototype.indexOf==\"function\"?A?Uint8Array.prototype.indexOf.call(p,u,f):Uint8Array.prototype.lastIndexOf.call(p,u,f):W(p,[u],f,b,A);throw new TypeError(\"val must be string, number or Buffer\")}function W(p,u,f,b,A){let T=1,P=p.length,$=u.length;if(b!==void 0&&(b=String(b).toLowerCase(),b===\"ucs2\"||b===\"ucs-2\"||b===\"utf16le\"||b===\"utf-16le\")){if(p.length<2||u.length<2)return-1;T=2,P/=2,$/=2,f/=2}function se(oe,J){return T===1?oe[J]:oe.readUInt16BE(J*T)}let te;if(A){let oe=-1;for(te=f;teP&&(f=P-$),te=f;te>=0;te--){let oe=!0;for(let J=0;J<$;J++)if(se(p,te+J)!==se(u,J)){oe=!1;break}if(oe)return te}return-1}s.prototype.includes=function(u,f,b){return this.indexOf(u,f,b)!==-1},s.prototype.indexOf=function(u,f,b){return N(this,u,f,b,!0)},s.prototype.lastIndexOf=function(u,f,b){return N(this,u,f,b,!1)};function K(p,u,f,b){f=Number(f)||0;let A=p.length-f;b?(b=Number(b),b>A&&(b=A)):b=A;let T=u.length;b>T/2&&(b=T/2);let P;for(P=0;P>>0,isFinite(b)?(b=b>>>0,A===void 0&&(A=\"utf8\")):(A=b,b=void 0);else throw new Error(\"Buffer.write(string, encoding, offset[, length]) is no longer supported\");let T=this.length-f;if((b===void 0||b>T)&&(b=T),u.length>0&&(b<0||f<0)||f>this.length)throw new RangeError(\"Attempt to write outside buffer bounds\");A||(A=\"utf8\");let P=!1;for(;;)switch(A){case\"hex\":return K(this,u,f,b);case\"utf8\":case\"utf-8\":return z(this,u,f,b);case\"ascii\":case\"latin1\":case\"binary\":return Q(this,u,f,b);case\"base64\":return pe(this,u,f,b);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return Yt(this,u,f,b);default:if(P)throw new TypeError(\"Unknown encoding: \"+A);A=(\"\"+A).toLowerCase(),P=!0}},s.prototype.toJSON=function(){return{type:\"Buffer\",data:Array.prototype.slice.call(this._arr||this,0)}};function ge(p,u,f){return u===0&&f===p.length?t.fromByteArray(p):t.fromByteArray(p.slice(u,f))}function Pr(p,u,f){f=Math.min(p.length,f);let b=[],A=u;for(;A239?4:T>223?3:T>191?2:1;if(A+$<=f){let se,te,oe,J;switch($){case 1:T<128&&(P=T);break;case 2:se=p[A+1],(se&192)===128&&(J=(T&31)<<6|se&63,J>127&&(P=J));break;case 3:se=p[A+1],te=p[A+2],(se&192)===128&&(te&192)===128&&(J=(T&15)<<12|(se&63)<<6|te&63,J>2047&&(J<55296||J>57343)&&(P=J));break;case 4:se=p[A+1],te=p[A+2],oe=p[A+3],(se&192)===128&&(te&192)===128&&(oe&192)===128&&(J=(T&15)<<18|(se&63)<<12|(te&63)<<6|oe&63,J>65535&&J<1114112&&(P=J))}}P===null?(P=65533,$=1):P>65535&&(P-=65536,b.push(P>>>10&1023|55296),P=56320|P&1023),b.push(P),A+=$}return Or(b)}let kr=4096;function Or(p){let u=p.length;if(u<=kr)return String.fromCharCode.apply(String,p);let f=\"\",b=0;for(;bb)&&(f=b);let A=\"\";for(let T=u;Tb&&(u=b),f<0?(f+=b,f<0&&(f=0)):f>b&&(f=b),ff)throw new RangeError(\"Trying to access beyond buffer length\")}s.prototype.readUintLE=s.prototype.readUIntLE=function(u,f,b){u=u>>>0,f=f>>>0,b||ye(u,f,this.length);let A=this[u],T=1,P=0;for(;++P>>0,f=f>>>0,b||ye(u,f,this.length);let A=this[u+--f],T=1;for(;f>0&&(T*=256);)A+=this[u+--f]*T;return A},s.prototype.readUint8=s.prototype.readUInt8=function(u,f){return u=u>>>0,f||ye(u,1,this.length),this[u]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(u,f){return u=u>>>0,f||ye(u,2,this.length),this[u]|this[u+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(u,f){return u=u>>>0,f||ye(u,2,this.length),this[u]<<8|this[u+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(u,f){return u=u>>>0,f||ye(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(u,f){return u=u>>>0,f||ye(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},s.prototype.readBigUInt64LE=Mt(function(u){u=u>>>0,Mr(u,\"offset\");let f=this[u],b=this[u+7];(f===void 0||b===void 0)&&fi(u,this.length-8);let A=f+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24,T=this[++u]+this[++u]*2**8+this[++u]*2**16+b*2**24;return BigInt(A)+(BigInt(T)<>>0,Mr(u,\"offset\");let f=this[u],b=this[u+7];(f===void 0||b===void 0)&&fi(u,this.length-8);let A=f*2**24+this[++u]*2**16+this[++u]*2**8+this[++u],T=this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+b;return(BigInt(A)<>>0,f=f>>>0,b||ye(u,f,this.length);let A=this[u],T=1,P=0;for(;++P=T&&(A-=Math.pow(2,8*f)),A},s.prototype.readIntBE=function(u,f,b){u=u>>>0,f=f>>>0,b||ye(u,f,this.length);let A=f,T=1,P=this[u+--A];for(;A>0&&(T*=256);)P+=this[u+--A]*T;return T*=128,P>=T&&(P-=Math.pow(2,8*f)),P},s.prototype.readInt8=function(u,f){return u=u>>>0,f||ye(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},s.prototype.readInt16LE=function(u,f){u=u>>>0,f||ye(u,2,this.length);let b=this[u]|this[u+1]<<8;return b&32768?b|4294901760:b},s.prototype.readInt16BE=function(u,f){u=u>>>0,f||ye(u,2,this.length);let b=this[u+1]|this[u]<<8;return b&32768?b|4294901760:b},s.prototype.readInt32LE=function(u,f){return u=u>>>0,f||ye(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},s.prototype.readInt32BE=function(u,f){return u=u>>>0,f||ye(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},s.prototype.readBigInt64LE=Mt(function(u){u=u>>>0,Mr(u,\"offset\");let f=this[u],b=this[u+7];(f===void 0||b===void 0)&&fi(u,this.length-8);let A=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(b<<24);return(BigInt(A)<>>0,Mr(u,\"offset\");let f=this[u],b=this[u+7];(f===void 0||b===void 0)&&fi(u,this.length-8);let A=(f<<24)+this[++u]*2**16+this[++u]*2**8+this[++u];return(BigInt(A)<>>0,f||ye(u,4,this.length),e.read(this,u,!0,23,4)},s.prototype.readFloatBE=function(u,f){return u=u>>>0,f||ye(u,4,this.length),e.read(this,u,!1,23,4)},s.prototype.readDoubleLE=function(u,f){return u=u>>>0,f||ye(u,8,this.length),e.read(this,u,!0,52,8)},s.prototype.readDoubleBE=function(u,f){return u=u>>>0,f||ye(u,8,this.length),e.read(this,u,!1,52,8)};function Ce(p,u,f,b,A,T){if(!s.isBuffer(p))throw new TypeError('\"buffer\" argument must be a Buffer instance');if(u>A||up.length)throw new RangeError(\"Index out of range\")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(u,f,b,A){if(u=+u,f=f>>>0,b=b>>>0,!A){let $=Math.pow(2,8*b)-1;Ce(this,u,f,b,$,0)}let T=1,P=0;for(this[f]=u&255;++P>>0,b=b>>>0,!A){let $=Math.pow(2,8*b)-1;Ce(this,u,f,b,$,0)}let T=b-1,P=1;for(this[f+T]=u&255;--T>=0&&(P*=256);)this[f+T]=u/P&255;return f+b},s.prototype.writeUint8=s.prototype.writeUInt8=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,1,255,0),this[f]=u&255,f+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,2,65535,0),this[f]=u&255,this[f+1]=u>>>8,f+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,2,65535,0),this[f]=u>>>8,this[f+1]=u&255,f+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,4,4294967295,0),this[f+3]=u>>>24,this[f+2]=u>>>16,this[f+1]=u>>>8,this[f]=u&255,f+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,4,4294967295,0),this[f]=u>>>24,this[f+1]=u>>>16,this[f+2]=u>>>8,this[f+3]=u&255,f+4};function vl(p,u,f,b,A){Rl(u,b,A,p,f,7);let T=Number(u&BigInt(4294967295));p[f++]=T,T=T>>8,p[f++]=T,T=T>>8,p[f++]=T,T=T>>8,p[f++]=T;let P=Number(u>>BigInt(32)&BigInt(4294967295));return p[f++]=P,P=P>>8,p[f++]=P,P=P>>8,p[f++]=P,P=P>>8,p[f++]=P,f}function El(p,u,f,b,A){Rl(u,b,A,p,f,7);let T=Number(u&BigInt(4294967295));p[f+7]=T,T=T>>8,p[f+6]=T,T=T>>8,p[f+5]=T,T=T>>8,p[f+4]=T;let P=Number(u>>BigInt(32)&BigInt(4294967295));return p[f+3]=P,P=P>>8,p[f+2]=P,P=P>>8,p[f+1]=P,P=P>>8,p[f]=P,f+8}s.prototype.writeBigUInt64LE=Mt(function(u,f=0){return vl(this,u,f,BigInt(0),BigInt(\"0xffffffffffffffff\"))}),s.prototype.writeBigUInt64BE=Mt(function(u,f=0){return El(this,u,f,BigInt(0),BigInt(\"0xffffffffffffffff\"))}),s.prototype.writeIntLE=function(u,f,b,A){if(u=+u,f=f>>>0,!A){let se=Math.pow(2,8*b-1);Ce(this,u,f,b,se-1,-se)}let T=0,P=1,$=0;for(this[f]=u&255;++T>0)-$&255;return f+b},s.prototype.writeIntBE=function(u,f,b,A){if(u=+u,f=f>>>0,!A){let se=Math.pow(2,8*b-1);Ce(this,u,f,b,se-1,-se)}let T=b-1,P=1,$=0;for(this[f+T]=u&255;--T>=0&&(P*=256);)u<0&&$===0&&this[f+T+1]!==0&&($=1),this[f+T]=(u/P>>0)-$&255;return f+b},s.prototype.writeInt8=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,1,127,-128),u<0&&(u=255+u+1),this[f]=u&255,f+1},s.prototype.writeInt16LE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,2,32767,-32768),this[f]=u&255,this[f+1]=u>>>8,f+2},s.prototype.writeInt16BE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,2,32767,-32768),this[f]=u>>>8,this[f+1]=u&255,f+2},s.prototype.writeInt32LE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,4,2147483647,-2147483648),this[f]=u&255,this[f+1]=u>>>8,this[f+2]=u>>>16,this[f+3]=u>>>24,f+4},s.prototype.writeInt32BE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[f]=u>>>24,this[f+1]=u>>>16,this[f+2]=u>>>8,this[f+3]=u&255,f+4},s.prototype.writeBigInt64LE=Mt(function(u,f=0){return vl(this,u,f,-BigInt(\"0x8000000000000000\"),BigInt(\"0x7fffffffffffffff\"))}),s.prototype.writeBigInt64BE=Mt(function(u,f=0){return El(this,u,f,-BigInt(\"0x8000000000000000\"),BigInt(\"0x7fffffffffffffff\"))});function Sl(p,u,f,b,A,T){if(f+b>p.length)throw new RangeError(\"Index out of range\");if(f<0)throw new RangeError(\"Index out of range\")}function Al(p,u,f,b,A){return u=+u,f=f>>>0,A||Sl(p,u,f,4),e.write(p,u,f,b,23,4),f+4}s.prototype.writeFloatLE=function(u,f,b){return Al(this,u,f,!0,b)},s.prototype.writeFloatBE=function(u,f,b){return Al(this,u,f,!1,b)};function Il(p,u,f,b,A){return u=+u,f=f>>>0,A||Sl(p,u,f,8),e.write(p,u,f,b,52,8),f+8}s.prototype.writeDoubleLE=function(u,f,b){return Il(this,u,f,!0,b)},s.prototype.writeDoubleBE=function(u,f,b){return Il(this,u,f,!1,b)},s.prototype.copy=function(u,f,b,A){if(!s.isBuffer(u))throw new TypeError(\"argument should be a Buffer\");if(b||(b=0),!A&&A!==0&&(A=this.length),f>=u.length&&(f=u.length),f||(f=0),A>0&&A=this.length)throw new RangeError(\"Index out of range\");if(A<0)throw new RangeError(\"sourceEnd out of bounds\");A>this.length&&(A=this.length),u.length-f>>0,b=b===void 0?this.length:b>>>0,u||(u=0);let T;if(typeof u==\"number\")for(T=f;T2**32?A=Tl(String(f)):typeof f==\"bigint\"&&(A=String(f),(f>BigInt(2)**BigInt(32)||f<-(BigInt(2)**BigInt(32)))&&(A=Tl(A)),A+=\"n\"),b+=` It must be ${u}. Received ${A}`,b},RangeError);function Tl(p){let u=\"\",f=p.length,b=p[0]===\"-\"?1:0;for(;f>=b+4;f-=3)u=`_${p.slice(f-3,f)}${u}`;return`${p.slice(0,f)}${u}`}function jg(p,u,f){Mr(u,\"offset\"),(p[u]===void 0||p[u+f]===void 0)&&fi(u,p.length-(f+1))}function Rl(p,u,f,b,A,T){if(p>f||p3?u===0||u===BigInt(0)?$=`>= 0${P} and < 2${P} ** ${(T+1)*8}${P}`:$=`>= -(2${P} ** ${(T+1)*8-1}${P}) and < 2 ** ${(T+1)*8-1}${P}`:$=`>= ${u}${P} and <= ${f}${P}`,new xr.ERR_OUT_OF_RANGE(\"value\",$,p)}jg(b,A,T)}function Mr(p,u){if(typeof p!=\"number\")throw new xr.ERR_INVALID_ARG_TYPE(u,\"number\",p)}function fi(p,u,f){throw Math.floor(p)!==p?(Mr(p,f),new xr.ERR_OUT_OF_RANGE(f||\"offset\",\"an integer\",p)):u<0?new xr.ERR_BUFFER_OUT_OF_BOUNDS:new xr.ERR_OUT_OF_RANGE(f||\"offset\",`>= ${f?1:0} and <= ${u}`,p)}let Fg=/[^+/0-9A-Za-z-_]/g;function Wg(p){if(p=p.split(\"=\")[0],p=p.trim().replace(Fg,\"\"),p.length<2)return\"\";for(;p.length%4!==0;)p=p+\"=\";return p}function ps(p,u){u=u||1/0;let f,b=p.length,A=null,T=[];for(let P=0;P55295&&f<57344){if(!A){if(f>56319){(u-=3)>-1&&T.push(239,191,189);continue}else if(P+1===b){(u-=3)>-1&&T.push(239,191,189);continue}A=f;continue}if(f<56320){(u-=3)>-1&&T.push(239,191,189),A=f;continue}f=(A-55296<<10|f-56320)+65536}else A&&(u-=3)>-1&&T.push(239,191,189);if(A=null,f<128){if((u-=1)<0)break;T.push(f)}else if(f<2048){if((u-=2)<0)break;T.push(f>>6|192,f&63|128)}else if(f<65536){if((u-=3)<0)break;T.push(f>>12|224,f>>6&63|128,f&63|128)}else if(f<1114112){if((u-=4)<0)break;T.push(f>>18|240,f>>12&63|128,f>>6&63|128,f&63|128)}else throw new Error(\"Invalid code point\")}return T}function $g(p){let u=[];for(let f=0;f>8,A=f%256,T.push(A),T.push(b);return T}function Cl(p){return t.toByteArray(Wg(p))}function ji(p,u,f,b){let A;for(A=0;A=u.length||A>=p.length);++A)u[A+f]=p[A];return A}function Ye(p,u){return p instanceof u||p!=null&&p.constructor!=null&&p.constructor.name!=null&&p.constructor.name===u.name}function gs(p){return p!==p}let Vg=function(){let p=\"0123456789abcdef\",u=new Array(256);for(let f=0;f<16;++f){let b=f*16;for(let A=0;A<16;++A)u[b+A]=p[f]+p[A]}return u}();function Mt(p){return typeof BigInt>\"u\"?zg:p}function zg(){throw new Error(\"BigInt not supported\")}return Zt}var ci,Vu,Hi,zu,Zt,Ku,Ut,x,ty,ry,be=_e(()=>{_();v();m();ci={},Vu=!1;Hi={},zu=!1;Zt={},Ku=!1;Ut=ey();Ut.Buffer;Ut.SlowBuffer;Ut.INSPECT_MAX_BYTES;Ut.kMaxLength;x=Ut.Buffer,ty=Ut.INSPECT_MAX_BYTES,ry=Ut.kMaxLength});var v=_e(()=>{be()});var Gu=M(vs=>{\"use strict\";_();v();m();Object.defineProperty(vs,\"__esModule\",{value:!0});var ms=class{constructor(e){this.aliasToTopic={},this.max=e}put(e,r){return r===0||r>this.max?!1:(this.aliasToTopic[r]=e,this.length=Object.keys(this.aliasToTopic).length,!0)}getTopicByAlias(e){return this.aliasToTopic[e]}clear(){this.aliasToTopic={}}};vs.default=ms});var ce=M((AA,Qu)=>{\"use strict\";_();v();m();Qu.exports={ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Uint8Array}});var Je=M((kA,Ss)=>{\"use strict\";_();v();m();var iy=(be(),X(me)),ny=Object.getPrototypeOf(async function(){}).constructor,Yu=globalThis.Blob||iy.Blob,sy=typeof Yu<\"u\"?function(e){return e instanceof Yu}:function(e){return!1},Es=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r=\"\";for(let i=0;i{t=i,e=n}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((i,...n)=>i?r(i):e(...n))})},debuglog(){return function(){}},format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,i]){let n=e.shift();return i===\"f\"?n.toFixed(6):i===\"j\"?JSON.stringify(n):i===\"s\"&&typeof n==\"object\"?`${n.constructor!==Object?n.constructor.name:\"\"} {}`.trim():n.toString()})},inspect(t){switch(typeof t){case\"string\":if(t.includes(\"'\"))if(t.includes('\"')){if(!t.includes(\"`\")&&!t.includes(\"${\"))return`\\`${t}\\``}else return`\"${t}\"`;return`'${t}'`;case\"number\":return isNaN(t)?\"NaN\":Object.is(t,-0)?String(t):t;case\"bigint\":return`${String(t)}n`;case\"boolean\":case\"undefined\":return String(t);case\"object\":return\"{}\"}},types:{isAsyncFunction(t){return t instanceof ny},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:sy};Ss.exports.promisify.custom=Symbol.for(\"nodejs.util.promisify.custom\")});var zi=M((qA,Vi)=>{\"use strict\";_();v();m();var{AbortController:Ju,AbortSignal:oy}=typeof self<\"u\"?self:typeof window<\"u\"?window:void 0;Vi.exports=Ju;Vi.exports.AbortSignal=oy;Vi.exports.default=Ju});var Ae=M((VA,ef)=>{\"use strict\";_();v();m();var{format:ay,inspect:Ki,AggregateError:ly}=Je(),uy=globalThis.AggregateError||ly,fy=Symbol(\"kIsNodeError\"),cy=[\"string\",\"function\",\"number\",\"object\",\"Function\",\"Object\",\"boolean\",\"bigint\",\"symbol\"],hy=/^([A-Z][a-z0-9]*)+$/,dy=\"__node_internal_\",Gi={};function er(t,e){if(!t)throw new Gi.ERR_INTERNAL_ASSERTION(e)}function Xu(t){let e=\"\",r=t.length,i=t[0]===\"-\"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function py(t,e,r){if(typeof e==\"function\")return er(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let i=(e.match(/%[dfijoOs]/g)||[]).length;return er(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:ay(e,...r)}function ve(t,e,r){r||(r=Error);class i extends r{constructor(...o){super(py(t,e,o))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=t,i.prototype[fy]=!0,Gi[t]=i}function Zu(t){let e=dy+t.name;return Object.defineProperty(t,\"name\",{value:e}),t}function gy(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new uy([e,t],e.message);return r.code=e.code,r}return t||e}var As=class extends Error{constructor(e=\"The operation was aborted\",r=void 0){if(r!==void 0&&typeof r!=\"object\")throw new Gi.ERR_INVALID_ARG_TYPE(\"options\",\"Object\",r);super(e,r),this.code=\"ABORT_ERR\",this.name=\"AbortError\"}};ve(\"ERR_ASSERTION\",\"%s\",Error);ve(\"ERR_INVALID_ARG_TYPE\",(t,e,r)=>{er(typeof t==\"string\",\"'name' must be a string\"),Array.isArray(e)||(e=[e]);let i=\"The \";t.endsWith(\" argument\")?i+=`${t} `:i+=`\"${t}\" ${t.includes(\".\")?\"property\":\"argument\"} `,i+=\"must be \";let n=[],o=[],s=[];for(let l of e)er(typeof l==\"string\",\"All expected entries have to be of type string\"),cy.includes(l)?n.push(l.toLowerCase()):hy.test(l)?o.push(l):(er(l!==\"object\",'The value \"object\" should be written as \"Object\"'),s.push(l));if(o.length>0){let l=n.indexOf(\"object\");l!==-1&&(n.splice(n,l,1),o.push(\"Object\"))}if(n.length>0){switch(n.length){case 1:i+=`of type ${n[0]}`;break;case 2:i+=`one of type ${n[0]} or ${n[1]}`;break;default:{let l=n.pop();i+=`one of type ${n.join(\", \")}, or ${l}`}}(o.length>0||s.length>0)&&(i+=\" or \")}if(o.length>0){switch(o.length){case 1:i+=`an instance of ${o[0]}`;break;case 2:i+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let l=o.pop();i+=`an instance of ${o.join(\", \")}, or ${l}`}}s.length>0&&(i+=\" or \")}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(i+=\"an \"),i+=`${s[0]}`;break;case 2:i+=`one of ${s[0]} or ${s[1]}`;break;default:{let l=s.pop();i+=`one of ${s.join(\", \")}, or ${l}`}}if(r==null)i+=`. Received ${r}`;else if(typeof r==\"function\"&&r.name)i+=`. Received function ${r.name}`;else if(typeof r==\"object\"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)i+=`. Received an instance of ${r.constructor.name}`;else{let l=Ki(r,{depth:-1});i+=`. Received ${l}`}}else{let l=Ki(r,{colors:!1});l.length>25&&(l=`${l.slice(0,25)}...`),i+=`. Received type ${typeof r} (${l})`}return i},TypeError);ve(\"ERR_INVALID_ARG_VALUE\",(t,e,r=\"is invalid\")=>{let i=Ki(e);return i.length>128&&(i=i.slice(0,128)+\"...\"),`The ${t.includes(\".\")?\"property\":\"argument\"} '${t}' ${r}. Received ${i}`},TypeError);ve(\"ERR_INVALID_RETURN_VALUE\",(t,e,r)=>{var i;let n=r!=null&&(i=r.constructor)!==null&&i!==void 0&&i.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the \"${e}\" function but got ${n}.`},TypeError);ve(\"ERR_MISSING_ARGS\",(...t)=>{er(t.length>0,\"At least one arg needs to be specified\");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(i=>`\"${i}\"`).join(\" or \"),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let i=t.pop();e+=`The ${t.join(\", \")}, and ${i} arguments`}break}return`${e} must be specified`},TypeError);ve(\"ERR_OUT_OF_RANGE\",(t,e,r)=>{er(e,'Missing \"range\" argument');let i;return Number.isInteger(r)&&Math.abs(r)>2**32?i=Xu(String(r)):typeof r==\"bigint\"?(i=String(r),(r>2n**32n||r<-(2n**32n))&&(i=Xu(i)),i+=\"n\"):i=Ki(r),`The value of \"${t}\" is out of range. It must be ${e}. Received ${i}`},RangeError);ve(\"ERR_MULTIPLE_CALLBACK\",\"Callback called multiple times\",Error);ve(\"ERR_METHOD_NOT_IMPLEMENTED\",\"The %s method is not implemented\",Error);ve(\"ERR_STREAM_ALREADY_FINISHED\",\"Cannot call %s after a stream was finished\",Error);ve(\"ERR_STREAM_CANNOT_PIPE\",\"Cannot pipe, not readable\",Error);ve(\"ERR_STREAM_DESTROYED\",\"Cannot call %s after a stream was destroyed\",Error);ve(\"ERR_STREAM_NULL_VALUES\",\"May not write null values to stream\",TypeError);ve(\"ERR_STREAM_PREMATURE_CLOSE\",\"Premature close\",Error);ve(\"ERR_STREAM_PUSH_AFTER_EOF\",\"stream.push() after EOF\",Error);ve(\"ERR_STREAM_UNSHIFT_AFTER_END_EVENT\",\"stream.unshift() after end event\",Error);ve(\"ERR_STREAM_WRITE_AFTER_END\",\"write after end\",Error);ve(\"ERR_UNKNOWN_ENCODING\",\"Unknown encoding: %s\",TypeError);ef.exports={AbortError:As,aggregateTwoErrors:Zu(gy),hideStackFrames:Zu,codes:Gi}});var hi=M((XA,ff)=>{\"use strict\";_();v();m();var{ArrayIsArray:Ts,ArrayPrototypeIncludes:sf,ArrayPrototypeJoin:of,ArrayPrototypeMap:yy,NumberIsInteger:Rs,NumberIsNaN:by,NumberMAX_SAFE_INTEGER:wy,NumberMIN_SAFE_INTEGER:_y,NumberParseInt:my,ObjectPrototypeHasOwnProperty:vy,RegExpPrototypeExec:af,String:Ey,StringPrototypeToUpperCase:Sy,StringPrototypeTrim:Ay}=ce(),{hideStackFrames:Ue,codes:{ERR_SOCKET_BAD_PORT:Iy,ERR_INVALID_ARG_TYPE:Ie,ERR_INVALID_ARG_VALUE:Ur,ERR_OUT_OF_RANGE:tr,ERR_UNKNOWN_SIGNAL:tf}}=Ae(),{normalizeEncoding:Ty}=Je(),{isAsyncFunction:Ry,isArrayBufferView:Cy}=Je().types,rf={};function By(t){return t===(t|0)}function Py(t){return t===t>>>0}var ky=/^[0-7]+$/,Oy=\"must be a 32-bit unsigned integer or an octal string\";function xy(t,e,r){if(typeof t>\"u\"&&(t=r),typeof t==\"string\"){if(af(ky,t)===null)throw new Ur(e,t,Oy);t=my(t,8)}return lf(t,e),t}var My=Ue((t,e,r=_y,i=wy)=>{if(typeof t!=\"number\")throw new Ie(e,\"number\",t);if(!Rs(t))throw new tr(e,\"an integer\",t);if(ti)throw new tr(e,`>= ${r} && <= ${i}`,t)}),Ly=Ue((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!=\"number\")throw new Ie(e,\"number\",t);if(!Rs(t))throw new tr(e,\"an integer\",t);if(ti)throw new tr(e,`>= ${r} && <= ${i}`,t)}),lf=Ue((t,e,r=!1)=>{if(typeof t!=\"number\")throw new Ie(e,\"number\",t);if(!Rs(t))throw new tr(e,\"an integer\",t);let i=r?1:0,n=4294967295;if(tn)throw new tr(e,`>= ${i} && <= ${n}`,t)});function Cs(t,e){if(typeof t!=\"string\")throw new Ie(e,\"string\",t)}function Uy(t,e,r=void 0,i){if(typeof t!=\"number\")throw new Ie(e,\"number\",t);if(r!=null&&ti||(r!=null||i!=null)&&by(t))throw new tr(e,`${r!=null?`>= ${r}`:\"\"}${r!=null&&i!=null?\" && \":\"\"}${i!=null?`<= ${i}`:\"\"}`,t)}var Ny=Ue((t,e,r)=>{if(!sf(r,t)){let n=\"must be one of: \"+of(yy(r,o=>typeof o==\"string\"?`'${o}'`:Ey(o)),\", \");throw new Ur(e,t,n)}});function uf(t,e){if(typeof t!=\"boolean\")throw new Ie(e,\"boolean\",t)}function Is(t,e,r){return t==null||!vy(t,e)?r:t[e]}var qy=Ue((t,e,r=null)=>{let i=Is(r,\"allowArray\",!1),n=Is(r,\"allowFunction\",!1);if(!Is(r,\"nullable\",!1)&&t===null||!i&&Ts(t)||typeof t!=\"object\"&&(!n||typeof t!=\"function\"))throw new Ie(e,\"Object\",t)}),Dy=Ue((t,e)=>{if(t!=null&&typeof t!=\"object\"&&typeof t!=\"function\")throw new Ie(e,\"a dictionary\",t)}),Bs=Ue((t,e,r=0)=>{if(!Ts(t))throw new Ie(e,\"Array\",t);if(t.length{if(!Cy(t))throw new Ie(e,[\"Buffer\",\"TypedArray\",\"DataView\"],t)});function Hy(t,e){let r=Ty(e),i=t.length;if(r===\"hex\"&&i%2!==0)throw new Ur(\"encoding\",e,`is invalid for data of length ${i}`)}function Vy(t,e=\"Port\",r=!0){if(typeof t!=\"number\"&&typeof t!=\"string\"||typeof t==\"string\"&&Ay(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new Iy(e,t,r);return t|0}var zy=Ue((t,e)=>{if(t!==void 0&&(t===null||typeof t!=\"object\"||!(\"aborted\"in t)))throw new Ie(e,\"AbortSignal\",t)}),Ky=Ue((t,e)=>{if(typeof t!=\"function\")throw new Ie(e,\"Function\",t)}),Gy=Ue((t,e)=>{if(typeof t!=\"function\"||Ry(t))throw new Ie(e,\"Function\",t)}),Qy=Ue((t,e)=>{if(t!==void 0)throw new Ie(e,\"undefined\",t)});function Yy(t,e,r){if(!sf(r,t))throw new Ie(e,`('${of(r,\"|\")}')`,t)}var Jy=/^(?:<[^>]*>)(?:\\s*;\\s*[^;\"\\s]+(?:=(\")?[^;\"\\s]*\\1)?)*$/;function nf(t,e){if(typeof t>\"u\"||!af(Jy,t))throw new Ur(e,t,'must be an array or string of format \"; rel=preload; as=style\"')}function Xy(t){if(typeof t==\"string\")return nf(t,\"hints\"),t;if(Ts(t)){let e=t.length,r=\"\";if(e===0)return r;for(let i=0;i; rel=preload; as=style\"')}ff.exports={isInt32:By,isUint32:Py,parseFileMode:xy,validateArray:Bs,validateStringArray:jy,validateBooleanArray:Fy,validateBoolean:uf,validateBuffer:$y,validateDictionary:Dy,validateEncoding:Hy,validateFunction:Ky,validateInt32:Ly,validateInteger:My,validateNumber:Uy,validateObject:qy,validateOneOf:Ny,validatePlainFunction:Gy,validatePort:Vy,validateSignalName:Wy,validateString:Cs,validateUint32:lf,validateUndefined:Qy,validateUnion:Yy,validateAbortSignal:zy,validateLinkHeaderValue:Xy}});var Nt=M((sI,pf)=>{_();v();m();var ae=pf.exports={},Xe,Ze;function Ps(){throw new Error(\"setTimeout has not been defined\")}function ks(){throw new Error(\"clearTimeout has not been defined\")}(function(){try{typeof setTimeout==\"function\"?Xe=setTimeout:Xe=Ps}catch{Xe=Ps}try{typeof clearTimeout==\"function\"?Ze=clearTimeout:Ze=ks}catch{Ze=ks}})();function cf(t){if(Xe===setTimeout)return setTimeout(t,0);if((Xe===Ps||!Xe)&&setTimeout)return Xe=setTimeout,setTimeout(t,0);try{return Xe(t,0)}catch{try{return Xe.call(null,t,0)}catch{return Xe.call(this,t,0)}}}function Zy(t){if(Ze===clearTimeout)return clearTimeout(t);if((Ze===ks||!Ze)&&clearTimeout)return Ze=clearTimeout,clearTimeout(t);try{return Ze(t)}catch{try{return Ze.call(null,t)}catch{return Ze.call(this,t)}}}var _t=[],Nr=!1,rr,Qi=-1;function eb(){!Nr||!rr||(Nr=!1,rr.length?_t=rr.concat(_t):Qi=-1,_t.length&&hf())}function hf(){if(!Nr){var t=cf(eb);Nr=!0;for(var e=_t.length;e;){for(rr=_t,_t=[];++Qi1)for(var r=1;r{\"use strict\";_();v();m();var{Symbol:Yi,SymbolAsyncIterator:gf,SymbolIterator:yf,SymbolFor:bf}=ce(),wf=Yi(\"kDestroyed\"),_f=Yi(\"kIsErrored\"),Os=Yi(\"kIsReadable\"),mf=Yi(\"kIsDisturbed\"),tb=bf(\"nodejs.webstream.isClosedPromise\"),rb=bf(\"nodejs.webstream.controllerErrorFunction\");function Ji(t,e=!1){var r;return!!(t&&typeof t.pipe==\"function\"&&typeof t.on==\"function\"&&(!e||typeof t.pause==\"function\"&&typeof t.resume==\"function\")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function Xi(t){var e;return!!(t&&typeof t.write==\"function\"&&typeof t.on==\"function\"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function ib(t){return!!(t&&typeof t.pipe==\"function\"&&t._readableState&&typeof t.on==\"function\"&&typeof t.write==\"function\")}function et(t){return t&&(t._readableState||t._writableState||typeof t.write==\"function\"&&typeof t.on==\"function\"||typeof t.pipe==\"function\"&&typeof t.on==\"function\")}function vf(t){return!!(t&&!et(t)&&typeof t.pipeThrough==\"function\"&&typeof t.getReader==\"function\"&&typeof t.cancel==\"function\")}function Ef(t){return!!(t&&!et(t)&&typeof t.getWriter==\"function\"&&typeof t.abort==\"function\")}function Sf(t){return!!(t&&!et(t)&&typeof t.readable==\"object\"&&typeof t.writable==\"object\")}function nb(t){return vf(t)||Ef(t)||Sf(t)}function sb(t,e){return t==null?!1:e===!0?typeof t[gf]==\"function\":e===!1?typeof t[yf]==\"function\":typeof t[gf]==\"function\"||typeof t[yf]==\"function\"}function Zi(t){if(!et(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!!(t.destroyed||t[wf]||i!=null&&i.destroyed)}function Af(t){if(!Xi(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!=\"boolean\"?null:e.ended}function ob(t,e){if(!Xi(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!=\"boolean\"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function ab(t){if(!Ji(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!=\"boolean\"?null:e.ended}function If(t,e){if(!Ji(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!=\"boolean\"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function Tf(t){return t&&t[Os]!=null?t[Os]:typeof t?.readable!=\"boolean\"?null:Zi(t)?!1:Ji(t)&&t.readable&&!If(t)}function Rf(t){return typeof t?.writable!=\"boolean\"?null:Zi(t)?!1:Xi(t)&&t.writable&&!Af(t)}function lb(t,e){return et(t)?Zi(t)?!0:!(e?.readable!==!1&&Tf(t)||e?.writable!==!1&&Rf(t)):null}function ub(t){var e,r;return et(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function fb(t){var e,r;return et(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function cb(t){if(!et(t))return null;if(typeof t.closed==\"boolean\")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed==\"boolean\"||typeof r?.closed==\"boolean\"?e?.closed||r?.closed:typeof t._closed==\"boolean\"&&Cf(t)?t._closed:null}function Cf(t){return typeof t._closed==\"boolean\"&&typeof t._defaultKeepAlive==\"boolean\"&&typeof t._removedConnection==\"boolean\"&&typeof t._removedContLen==\"boolean\"}function Bf(t){return typeof t._sent100==\"boolean\"&&Cf(t)}function hb(t){var e;return typeof t._consuming==\"boolean\"&&typeof t._dumped==\"boolean\"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function db(t){if(!et(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!i&&Bf(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}function pb(t){var e;return!!(t&&((e=t[mf])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function gb(t){var e,r,i,n,o,s,a,l,c,h;return!!(t&&((e=(r=(i=(n=(o=(s=t[_f])!==null&&s!==void 0?s:t.readableErrored)!==null&&o!==void 0?o:t.writableErrored)!==null&&n!==void 0?n:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&i!==void 0?i:(l=t._writableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&r!==void 0?r:(c=t._readableState)===null||c===void 0?void 0:c.errored)!==null&&e!==void 0?e:!((h=t._writableState)===null||h===void 0)&&h.errored))}Pf.exports={kDestroyed:wf,isDisturbed:pb,kIsDisturbed:mf,isErrored:gb,kIsErrored:_f,isReadable:Tf,kIsReadable:Os,kIsClosedPromise:tb,kControllerErrorFunction:rb,isClosed:cb,isDestroyed:Zi,isDuplexNodeStream:ib,isFinished:lb,isIterable:sb,isReadableNodeStream:Ji,isReadableStream:vf,isReadableEnded:ab,isReadableFinished:If,isReadableErrored:fb,isNodeStream:et,isWebStream:nb,isWritable:Rf,isWritableNodeStream:Xi,isWritableStream:Ef,isWritableEnded:Af,isWritableFinished:ob,isWritableErrored:ub,isServerRequest:hb,isServerResponse:Bf,willEmitClose:db,isTransformStream:Sf}});var vt=M((_I,Ns)=>{_();v();m();var qt=Nt(),{AbortError:Df,codes:yb}=Ae(),{ERR_INVALID_ARG_TYPE:bb,ERR_STREAM_PREMATURE_CLOSE:kf}=yb,{kEmptyObject:Ms,once:Ls}=Je(),{validateAbortSignal:wb,validateFunction:_b,validateObject:mb,validateBoolean:vb}=hi(),{Promise:Eb,PromisePrototypeThen:Sb}=ce(),{isClosed:Ab,isReadable:Of,isReadableNodeStream:xs,isReadableStream:Ib,isReadableFinished:xf,isReadableErrored:Mf,isWritable:Lf,isWritableNodeStream:Uf,isWritableStream:Tb,isWritableFinished:Nf,isWritableErrored:qf,isNodeStream:Rb,willEmitClose:Cb,kIsClosedPromise:Bb}=tt();function Pb(t){return t.setHeader&&typeof t.abort==\"function\"}var Us=()=>{};function jf(t,e,r){var i,n;if(arguments.length===2?(r=e,e=Ms):e==null?e=Ms:mb(e,\"options\"),_b(r,\"callback\"),wb(e.signal,\"options.signal\"),r=Ls(r),Ib(t)||Tb(t))return kb(t,e,r);if(!Rb(t))throw new bb(\"stream\",[\"ReadableStream\",\"WritableStream\",\"Stream\"],t);let o=(i=e.readable)!==null&&i!==void 0?i:xs(t),s=(n=e.writable)!==null&&n!==void 0?n:Uf(t),a=t._writableState,l=t._readableState,c=()=>{t.writable||g()},h=Cb(t)&&xs(t)===o&&Uf(t)===s,d=Nf(t,!1),g=()=>{d=!0,t.destroyed&&(h=!1),!(h&&(!t.readable||o))&&(!o||y)&&r.call(t)},y=xf(t,!1),w=()=>{y=!0,t.destroyed&&(h=!1),!(h&&(!t.writable||s))&&(!s||d)&&r.call(t)},S=N=>{r.call(t,N)},E=Ab(t),I=()=>{E=!0;let N=qf(t)||Mf(t);if(N&&typeof N!=\"boolean\")return r.call(t,N);if(o&&!y&&xs(t,!0)&&!xf(t,!1))return r.call(t,new kf);if(s&&!d&&!Nf(t,!1))return r.call(t,new kf);r.call(t)},C=()=>{E=!0;let N=qf(t)||Mf(t);if(N&&typeof N!=\"boolean\")return r.call(t,N);r.call(t)},R=()=>{t.req.on(\"finish\",g)};Pb(t)?(t.on(\"complete\",g),h||t.on(\"abort\",I),t.req?R():t.on(\"request\",R)):s&&!a&&(t.on(\"end\",c),t.on(\"close\",c)),!h&&typeof t.aborted==\"boolean\"&&t.on(\"aborted\",I),t.on(\"end\",w),t.on(\"finish\",g),e.error!==!1&&t.on(\"error\",S),t.on(\"close\",I),E?qt.nextTick(I):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?h||qt.nextTick(C):(!o&&(!h||Of(t))&&(d||Lf(t)===!1)||!s&&(!h||Lf(t))&&(y||Of(t)===!1)||l&&t.req&&t.aborted)&&qt.nextTick(C);let U=()=>{r=Us,t.removeListener(\"aborted\",I),t.removeListener(\"complete\",g),t.removeListener(\"abort\",I),t.removeListener(\"request\",R),t.req&&t.req.removeListener(\"finish\",g),t.removeListener(\"end\",c),t.removeListener(\"close\",c),t.removeListener(\"finish\",g),t.removeListener(\"end\",w),t.removeListener(\"error\",S),t.removeListener(\"close\",I)};if(e.signal&&!E){let N=()=>{let W=r;U(),W.call(t,new Df(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)qt.nextTick(N);else{let W=r;r=Ls((...K)=>{e.signal.removeEventListener(\"abort\",N),W.apply(t,K)}),e.signal.addEventListener(\"abort\",N)}}return U}function kb(t,e,r){let i=!1,n=Us;if(e.signal)if(n=()=>{i=!0,r.call(t,new Df(void 0,{cause:e.signal.reason}))},e.signal.aborted)qt.nextTick(n);else{let s=r;r=Ls((...a)=>{e.signal.removeEventListener(\"abort\",n),s.apply(t,a)}),e.signal.addEventListener(\"abort\",n)}let o=(...s)=>{i||qt.nextTick(()=>r.apply(t,s))};return Sb(t[Bb].promise,o,o),Us}function Ob(t,e){var r;let i=!1;return e===null&&(e=Ms),(r=e)!==null&&r!==void 0&&r.cleanup&&(vb(e.cleanup,\"cleanup\"),i=e.cleanup),new Eb((n,o)=>{let s=jf(t,e,a=>{i&&s(),a?o(a):n()})})}Ns.exports=jf;Ns.exports.finished=Ob});var ir=M((TI,Gf)=>{\"use strict\";_();v();m();var rt=Nt(),{aggregateTwoErrors:xb,codes:{ERR_MULTIPLE_CALLBACK:Mb},AbortError:Lb}=Ae(),{Symbol:$f}=ce(),{kDestroyed:Ub,isDestroyed:Nb,isFinished:qb,isServerRequest:Db}=tt(),Hf=$f(\"kDestroy\"),qs=$f(\"kConstruct\");function Vf(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function jb(t,e){let r=this._readableState,i=this._writableState,n=i||r;return i!=null&&i.destroyed||r!=null&&r.destroyed?(typeof e==\"function\"&&e(),this):(Vf(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?Ff(this,t,e):this.once(Hf,function(o){Ff(this,xb(o,t),e)}),this)}function Ff(t,e,r){let i=!1;function n(o){if(i)return;i=!0;let s=t._readableState,a=t._writableState;Vf(o,a,s),a&&(a.closed=!0),s&&(s.closed=!0),typeof r==\"function\"&&r(o),o?rt.nextTick(Fb,t,o):rt.nextTick(zf,t)}try{t._destroy(e||null,n)}catch(o){n(o)}}function Fb(t,e){Ds(t,e),zf(t)}function zf(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit(\"close\")}function Ds(t,e){let r=t._readableState,i=t._writableState;i!=null&&i.errorEmitted||r!=null&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit(\"error\",e))}function Wb(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function js(t,e,r){let i=t._readableState,n=t._writableState;if(n!=null&&n.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||n!=null&&n.autoDestroy?t.destroy(e):e&&(e.stack,n&&!n.errored&&(n.errored=e),i&&!i.errored&&(i.errored=e),r?rt.nextTick(Ds,t,e):Ds(t,e))}function $b(t,e){if(typeof t._construct!=\"function\")return;let r=t._readableState,i=t._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),t.once(qs,e),!(t.listenerCount(qs)>1)&&rt.nextTick(Hb,t)}function Hb(t){let e=!1;function r(i){if(e){js(t,i??new Mb);return}e=!0;let n=t._readableState,o=t._writableState,s=o||n;n&&(n.constructed=!0),o&&(o.constructed=!0),s.destroyed?t.emit(Hf,i):i?js(t,i,!0):rt.nextTick(Vb,t)}try{t._construct(i=>{rt.nextTick(r,i)})}catch(i){rt.nextTick(r,i)}}function Vb(t){t.emit(qs)}function Wf(t){return t?.setHeader&&typeof t.abort==\"function\"}function Kf(t){t.emit(\"close\")}function zb(t,e){t.emit(\"error\",e),rt.nextTick(Kf,t)}function Kb(t,e){!t||Nb(t)||(!e&&!qb(t)&&(e=new Lb),Db(t)?(t.socket=null,t.destroy(e)):Wf(t)?t.abort():Wf(t.req)?t.req.abort():typeof t.destroy==\"function\"?t.destroy(e):typeof t.close==\"function\"?t.close():e?rt.nextTick(zb,t,e):rt.nextTick(Kf,t),t.destroyed||(t[Ub]=!0))}Gf.exports={construct:$b,destroyer:Kb,destroy:jb,undestroy:Wb,errorOrDestroy:js}});function Y(){Y.init.call(this)}function en(t){if(typeof t!=\"function\")throw new TypeError('The \"listener\" argument must be of type Function. Received type '+typeof t)}function nc(t){return t._maxListeners===void 0?Y.defaultMaxListeners:t._maxListeners}function Xf(t,e,r,i){var n,o,s,a;if(en(r),(o=t._events)===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit(\"newListener\",e,r.listener?r.listener:r),o=t._events),s=o[e]),s===void 0)s=o[e]=r,++t._eventsCount;else if(typeof s==\"function\"?s=o[e]=i?[r,s]:[s,r]:i?s.unshift(r):s.push(r),(n=nc(t))>0&&s.length>n&&!s.warned){s.warned=!0;var l=new Error(\"Possible EventEmitter memory leak detected. \"+s.length+\" \"+String(e)+\" listeners added. Use emitter.setMaxListeners() to increase limit\");l.name=\"MaxListenersExceededWarning\",l.emitter=t,l.type=e,l.count=s.length,a=l,console&&console.warn&&console.warn(a)}return t}function Gb(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Zf(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=Gb.bind(i);return n.listener=r,i.wrapFn=n,n}function ec(t,e,r){var i=t._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n==\"function\"?r?[n.listener||n]:[n]:r?function(o){for(var s=new Array(o.length),a=0;a{_();v();m();qr=typeof Reflect==\"object\"?Reflect:null,Qf=qr&&typeof qr.apply==\"function\"?qr.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};ic=qr&&typeof qr.ownKeys==\"function\"?qr.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};Yf=Number.isNaN||function(t){return t!=t};rc=Y,Y.EventEmitter=Y,Y.prototype._events=void 0,Y.prototype._eventsCount=0,Y.prototype._maxListeners=void 0;Jf=10;Object.defineProperty(Y,\"defaultMaxListeners\",{enumerable:!0,get:function(){return Jf},set:function(t){if(typeof t!=\"number\"||t<0||Yf(t))throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received '+t+\".\");Jf=t}}),Y.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Y.prototype.setMaxListeners=function(t){if(typeof t!=\"number\"||t<0||Yf(t))throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received '+t+\".\");return this._maxListeners=t,this},Y.prototype.getMaxListeners=function(){return nc(this)},Y.prototype.emit=function(t){for(var e=[],r=1;r0&&(o=e[0]),o instanceof Error)throw o;var s=new Error(\"Unhandled error.\"+(o?\" (\"+o.message+\")\":\"\"));throw s.context=o,s}var a=n[t];if(a===void 0)return!1;if(typeof a==\"function\")Qf(a,this,e);else{var l=a.length,c=sc(a,l);for(r=0;r=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,n=o;break}if(n<0)return this;n===0?r.shift():function(a,l){for(;l+1=0;i--)this.removeListener(t,e[i]);return this},Y.prototype.listeners=function(t){return ec(this,t,!0)},Y.prototype.rawListeners=function(t){return ec(this,t,!1)},Y.listenerCount=function(t,e){return typeof t.listenerCount==\"function\"?t.listenerCount(e):tc.call(t,e)},Y.prototype.listenerCount=tc,Y.prototype.eventNames=function(){return this._eventsCount>0?ic(this._events):[]};Be=rc;Be.EventEmitter;Be.defaultMaxListeners;Be.init;Be.listenerCount;Be.EventEmitter;Be.defaultMaxListeners;Be.init;Be.listenerCount});var nr={};Jt(nr,{EventEmitter:()=>Qb,default:()=>Be,defaultMaxListeners:()=>Yb,init:()=>Jb,listenerCount:()=>Xb,on:()=>Zb,once:()=>ew});var Qb,Yb,Jb,Xb,Zb,ew,sr=_e(()=>{_();v();m();Fs();Fs();Be.once=function(t,e){return new Promise((r,i)=>{function n(...s){o!==void 0&&t.removeListener(\"error\",o),r(s)}let o;e!==\"error\"&&(o=s=>{t.removeListener(name,n),i(s)},t.once(\"error\",o)),t.once(e,n)})};Be.on=function(t,e){let r=[],i=[],n=null,o=!1,s={async next(){let c=r.shift();if(c)return createIterResult(c,!1);if(n){let h=Promise.reject(n);return n=null,h}return o?createIterResult(void 0,!0):new Promise((h,d)=>i.push({resolve:h,reject:d}))},async return(){t.removeListener(e,a),t.removeListener(\"error\",l),o=!0;for(let c of i)c.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(c){n=c,t.removeListener(e,a),t.removeListener(\"error\",l)},[Symbol.asyncIterator](){return this}};return t.on(e,a),t.on(\"error\",l),s;function a(...c){let h=i.shift();h?h.resolve(createIterResult(c,!1)):r.push(c)}function l(c){o=!0;let h=i.shift();h?h.reject(c):n=c,s.return()}};({EventEmitter:Qb,defaultMaxListeners:Yb,init:Jb,listenerCount:Xb,on:Zb,once:ew}=Be)});var nn=M((GI,ac)=>{\"use strict\";_();v();m();var{ArrayIsArray:tw,ObjectSetPrototypeOf:oc}=ce(),{EventEmitter:tn}=(sr(),X(nr));function rn(t){tn.call(this,t)}oc(rn.prototype,tn.prototype);oc(rn,tn);rn.prototype.pipe=function(t,e){let r=this;function i(h){t.writable&&t.write(h)===!1&&r.pause&&r.pause()}r.on(\"data\",i);function n(){r.readable&&r.resume&&r.resume()}t.on(\"drain\",n),!t._isStdio&&(!e||e.end!==!1)&&(r.on(\"end\",s),r.on(\"close\",a));let o=!1;function s(){o||(o=!0,t.end())}function a(){o||(o=!0,typeof t.destroy==\"function\"&&t.destroy())}function l(h){c(),tn.listenerCount(this,\"error\")===0&&this.emit(\"error\",h)}Ws(r,\"error\",l),Ws(t,\"error\",l);function c(){r.removeListener(\"data\",i),t.removeListener(\"drain\",n),r.removeListener(\"end\",s),r.removeListener(\"close\",a),r.removeListener(\"error\",l),t.removeListener(\"error\",l),r.removeListener(\"end\",c),r.removeListener(\"close\",c),t.removeListener(\"close\",c)}return r.on(\"end\",c),r.on(\"close\",c),t.on(\"close\",c),t.emit(\"pipe\",r),t};function Ws(t,e,r){if(typeof t.prependListener==\"function\")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):tw(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}ac.exports={Stream:rn,prependListener:Ws}});var di=M((tT,sn)=>{\"use strict\";_();v();m();var{AbortError:lc,codes:rw}=Ae(),{isNodeStream:uc,isWebStream:iw,kControllerErrorFunction:nw}=tt(),sw=vt(),{ERR_INVALID_ARG_TYPE:fc}=rw,ow=(t,e)=>{if(typeof t!=\"object\"||!(\"aborted\"in t))throw new fc(e,\"AbortSignal\",t)};sn.exports.addAbortSignal=function(e,r){if(ow(e,\"signal\"),!uc(r)&&!iw(r))throw new fc(\"stream\",[\"ReadableStream\",\"WritableStream\",\"Stream\"],r);return sn.exports.addAbortSignalNoValidate(e,r)};sn.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!=\"object\"||!(\"aborted\"in t))return e;let r=uc(e)?()=>{e.destroy(new lc(void 0,{cause:t.reason}))}:()=>{e[nw](new lc(void 0,{cause:t.reason}))};return t.aborted?r():(t.addEventListener(\"abort\",r),sw(e,()=>t.removeEventListener(\"abort\",r))),e}});var dc=M((uT,hc)=>{\"use strict\";_();v();m();var{StringPrototypeSlice:cc,SymbolIterator:aw,TypedArrayPrototypeSet:on,Uint8Array:lw}=ce(),{Buffer:$s}=(be(),X(me)),{inspect:uw}=Je();hc.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return\"\";let r=this.head,i=\"\"+r.data;for(;(r=r.next)!==null;)i+=e+r.data;return i}concat(e){if(this.length===0)return $s.alloc(0);let r=$s.allocUnsafe(e>>>0),i=this.head,n=0;for(;i;)on(r,i.data,n),n+=i.data.length,i=i.next;return r}consume(e,r){let i=this.head.data;if(eo.length)r+=o,e-=o.length;else{e===o.length?(r+=o,++n,i.next?this.head=i.next:this.head=this.tail=null):(r+=cc(o,0,e),this.head=i,i.data=cc(o,e));break}++n}while((i=i.next)!==null);return this.length-=n,r}_getBuffer(e){let r=$s.allocUnsafe(e),i=e,n=this.head,o=0;do{let s=n.data;if(e>s.length)on(r,s,i-e),e-=s.length;else{e===s.length?(on(r,s,i-e),++o,n.next?this.head=n.next:this.head=this.tail=null):(on(r,new lw(s.buffer,s.byteOffset,e),i-e),this.head=n,n.data=s.slice(e));break}++o}while((n=n.next)!==null);return this.length-=o,r}[Symbol.for(\"nodejs.util.inspect.custom\")](e,r){return uw(this,{...r,depth:0,customInspect:!1})}}});var an=M((yT,gc)=>{\"use strict\";_();v();m();var{MathFloor:fw,NumberIsInteger:cw}=ce(),{ERR_INVALID_ARG_VALUE:hw}=Ae().codes;function dw(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function pc(t){return t?16:16*1024}function pw(t,e,r,i){let n=dw(e,i,r);if(n!=null){if(!cw(n)||n<0){let o=i?`options.${r}`:\"options.highWaterMark\";throw new hw(o,n)}return fw(n)}return pc(t.objectMode)}gc.exports={getHighWaterMark:pw,getDefaultHighWaterMark:pc}});function wc(t){var e=t.length;if(e%4>0)throw new Error(\"Invalid string. Length must be a multiple of 4\");var r=t.indexOf(\"=\");return r===-1&&(r=e),[r,r===e?0:4-r%4]}function gw(t,e,r){for(var i,n,o=[],s=e;s>18&63]+$e[n>>12&63]+$e[n>>6&63]+$e[63&n]);return o.join(\"\")}function Et(t){if(t>2147483647)throw new RangeError('The value \"'+t+'\" is invalid for option \"size\"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,O.prototype),e}function O(t,e,r){if(typeof t==\"number\"){if(typeof e==\"string\")throw new TypeError('The \"string\" argument must be of type string. Received type number');return Ks(t)}return Cc(t,e,r)}function Cc(t,e,r){if(typeof t==\"string\")return function(o,s){if(typeof s==\"string\"&&s!==\"\"||(s=\"utf8\"),!O.isEncoding(s))throw new TypeError(\"Unknown encoding: \"+s);var a=0|Pc(o,s),l=Et(a),c=l.write(o,s);return c!==a&&(l=l.slice(0,c)),l}(t,e);if(ArrayBuffer.isView(t))return Hs(t);if(t==null)throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof t);if(St(t,ArrayBuffer)||t&&St(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<\"u\"&&(St(t,SharedArrayBuffer)||t&&St(t.buffer,SharedArrayBuffer)))return mc(t,e,r);if(typeof t==\"number\")throw new TypeError('The \"value\" argument must not be of type number. Received type number');var i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return O.from(i,e,r);var n=function(o){if(O.isBuffer(o)){var s=0|Ys(o.length),a=Et(s);return a.length===0||o.copy(a,0,0,s),a}if(o.length!==void 0)return typeof o.length!=\"number\"||Js(o.length)?Et(0):Hs(o);if(o.type===\"Buffer\"&&Array.isArray(o.data))return Hs(o.data)}(t);if(n)return n;if(typeof Symbol<\"u\"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]==\"function\")return O.from(t[Symbol.toPrimitive](\"string\"),e,r);throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof t)}function Bc(t){if(typeof t!=\"number\")throw new TypeError('\"size\" argument must be of type number');if(t<0)throw new RangeError('The value \"'+t+'\" is invalid for option \"size\"')}function Ks(t){return Bc(t),Et(t<0?0:0|Ys(t))}function Hs(t){for(var e=t.length<0?0:0|Ys(t.length),r=Et(e),i=0;i=2147483647)throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\"+2147483647 .toString(16)+\" bytes\");return 0|t}function Pc(t,e){if(O.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||St(t,ArrayBuffer))return t.byteLength;if(typeof t!=\"string\")throw new TypeError('The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;for(var n=!1;;)switch(e){case\"ascii\":case\"latin1\":case\"binary\":return r;case\"utf8\":case\"utf-8\":return Gs(t).length;case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return 2*r;case\"hex\":return r>>>1;case\"base64\":return Mc(t).length;default:if(n)return i?-1:Gs(t).length;e=(\"\"+e).toLowerCase(),n=!0}}function bw(t,e,r){var i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0)<=(e>>>=0))return\"\";for(t||(t=\"utf8\");;)switch(t){case\"hex\":return Tw(this,e,r);case\"utf8\":case\"utf-8\":return Oc(this,e,r);case\"ascii\":return Aw(this,e,r);case\"latin1\":case\"binary\":return Iw(this,e,r);case\"base64\":return Sw(this,e,r);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return Rw(this,e,r);default:if(i)throw new TypeError(\"Unknown encoding: \"+t);t=(t+\"\").toLowerCase(),i=!0}}function ar(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function vc(t,e,r,i,n){if(t.length===0)return-1;if(typeof r==\"string\"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Js(r=+r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if(typeof e==\"string\"&&(e=O.from(e,i)),O.isBuffer(e))return e.length===0?-1:Ec(t,e,r,i,n);if(typeof e==\"number\")return e&=255,typeof Uint8Array.prototype.indexOf==\"function\"?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Ec(t,[e],r,i,n);throw new TypeError(\"val must be string, number or Buffer\")}function Ec(t,e,r,i,n){var o,s=1,a=t.length,l=e.length;if(i!==void 0&&((i=String(i).toLowerCase())===\"ucs2\"||i===\"ucs-2\"||i===\"utf16le\"||i===\"utf-16le\")){if(t.length<2||e.length<2)return-1;s=2,a/=2,l/=2,r/=2}function c(y,w){return s===1?y[w]:y.readUInt16BE(w*s)}if(n){var h=-1;for(o=r;oa&&(r=a-l),o=r;o>=0;o--){for(var d=!0,g=0;gn&&(i=n):i=n;var o=e.length;i>o/2&&(i=o/2);for(var s=0;s>8,l=s%256,c.push(l),c.push(a);return c}(e,t.length-r),t,r,i)}function Sw(t,e,r){return e===0&&r===t.length?zs.fromByteArray(t):zs.fromByteArray(t.slice(e,r))}function Oc(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:c>223?3:c>191?2:1;if(n+d<=r)switch(d){case 1:c<128&&(h=c);break;case 2:(192&(o=t[n+1]))==128&&(l=(31&c)<<6|63&o)>127&&(h=l);break;case 3:o=t[n+1],s=t[n+2],(192&o)==128&&(192&s)==128&&(l=(15&c)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(h=l);break;case 4:o=t[n+1],s=t[n+2],a=t[n+3],(192&o)==128&&(192&s)==128&&(192&a)==128&&(l=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(h=l)}h===null?(h=65533,d=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h),n+=d}return function(g){var y=g.length;if(y<=4096)return String.fromCharCode.apply(String,g);for(var w=\"\",S=0;Si)&&(r=i);for(var n=\"\",o=e;or)throw new RangeError(\"Trying to access beyond buffer length\")}function Pe(t,e,r,i,n,o){if(!O.isBuffer(t))throw new TypeError('\"buffer\" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError(\"Index out of range\")}function xc(t,e,r,i,n,o){if(r+i>t.length)throw new RangeError(\"Index out of range\");if(r<0)throw new RangeError(\"Index out of range\")}function Sc(t,e,r,i,n){return e=+e,r>>>=0,n||xc(t,0,r,4),Dr.write(t,e,r,i,23,4),r+4}function Ac(t,e,r,i,n){return e=+e,r>>>=0,n||xc(t,0,r,8),Dr.write(t,e,r,i,52,8),r+8}function Gs(t,e){var r;e=e||1/0;for(var i=t.length,n=null,o=[],s=0;s55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error(\"Invalid code point\");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Mc(t){return zs.toByteArray(function(e){if((e=(e=e.split(\"=\")[0]).trim().replace(Cw,\"\")).length<2)return\"\";for(;e.length%4!=0;)e+=\"=\";return e}(t))}function cn(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function St(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Js(t){return t!=t}function Ic(t,e){for(var r in t)e[r]=t[r]}function lr(t,e,r){return it(t,e,r)}function pi(t){var e;switch(this.encoding=function(r){var i=function(n){if(!n)return\"utf8\";for(var o;;)switch(n){case\"utf8\":case\"utf-8\":return\"utf8\";case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return\"utf16le\";case\"latin1\":case\"binary\":return\"latin1\";case\"base64\":case\"ascii\":case\"hex\":return n;default:if(o)return;n=(\"\"+n).toLowerCase(),o=!0}}(r);if(typeof i!=\"string\"&&(Qs.isEncoding===Tc||!Tc(r)))throw new Error(\"Unknown encoding: \"+r);return i||r}(t),this.encoding){case\"utf16le\":this.text=Ow,this.end=xw,e=4;break;case\"utf8\":this.fillLast=kw,e=4;break;case\"base64\":this.text=Mw,this.end=Lw,e=3;break;default:return this.write=Uw,this.end=Nw,void 0}this.lastNeed=0,this.lastTotal=0,this.lastChar=Qs.allocUnsafe(e)}function Vs(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function kw(t){var e=this.lastTotal-this.lastNeed,r=function(i,n,o){if((192&n[0])!=128)return i.lastNeed=0,\"\\uFFFD\";if(i.lastNeed>1&&n.length>1){if((192&n[1])!=128)return i.lastNeed=1,\"\\uFFFD\";if(i.lastNeed>2&&n.length>2&&(192&n[2])!=128)return i.lastNeed=2,\"\\uFFFD\"}}(this,t);return r!==void 0?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length,void 0)}function Ow(t,e){if((t.length-e)%2==0){var r=t.toString(\"utf16le\",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString(\"utf16le\",e,t.length-1)}function xw(t){var e=t&&t.length?this.write(t):\"\";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString(\"utf16le\",0,r)}return e}function Mw(t,e){var r=(t.length-e)%3;return r===0?t.toString(\"base64\",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString(\"base64\",e,t.length-r))}function Lw(t){var e=t&&t.length?this.write(t):\"\";return this.lastNeed?e+this.lastChar.toString(\"base64\",0,3-this.lastNeed):e}function Uw(t){return t.toString(this.encoding)}function Nw(t){return t&&t.length?this.write(t):\"\"}var Rc,$e,Oe,yc,ln,or,bc,yw,At,zs,Dr,_c,Cw,Bw,un,fn,it,Pw,ur,Qs,Tc,Xs=_e(()=>{_();v();m();for(Rc={byteLength:function(t){var e=wc(t),r=e[0],i=e[1];return 3*(r+i)/4-i},toByteArray:function(t){var e,r,i=wc(t),n=i[0],o=i[1],s=new yc(function(c,h,d){return 3*(h+d)/4-d}(0,n,o)),a=0,l=o>0?n-4:n;for(r=0;r>16&255,s[a++]=e>>8&255,s[a++]=255&e;return o===2&&(e=Oe[t.charCodeAt(r)]<<2|Oe[t.charCodeAt(r+1)]>>4,s[a++]=255&e),o===1&&(e=Oe[t.charCodeAt(r)]<<10|Oe[t.charCodeAt(r+1)]<<4|Oe[t.charCodeAt(r+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s},fromByteArray:function(t){for(var e,r=t.length,i=r%3,n=[],o=0,s=r-i;os?s:o+16383));return i===1?(e=t[r-1],n.push($e[e>>2]+$e[e<<4&63]+\"==\")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push($e[e>>10]+$e[e>>4&63]+$e[e<<2&63]+\"=\")),n.join(\"\")}},$e=[],Oe=[],yc=typeof Uint8Array<\"u\"?Uint8Array:Array,ln=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",or=0,bc=ln.length;or>1,h=-7,d=r?n-1:0,g=r?-1:1,y=t[e+d];for(d+=g,o=y&(1<<-h)-1,y>>=-h,h+=a;h>0;o=256*o+t[e+d],d+=g,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=i;h>0;s=256*s+t[e+d],d+=g,h-=8);if(o===0)o=1-c;else{if(o===l)return s?NaN:1/0*(y?-1:1);s+=Math.pow(2,i),o-=c}return(y?-1:1)*s*Math.pow(2,o-i)},write:function(t,e,r,i,n,o){var s,a,l,c=8*o-n-1,h=(1<>1,g=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=i?0:o-1,w=i?1:-1,S=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+d>=1?g/l:g*Math.pow(2,1-d))*l>=2&&(s++,l/=2),s+d>=h?(a=0,s=h):s+d>=1?(a=(e*l-1)*Math.pow(2,n),s+=d):(a=e*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;t[r+y]=255&a,y+=w,a/=256,n-=8);for(s=s<0;t[r+y]=255&s,y+=w,s/=256,c-=8);t[r+y-w]|=128*S}},At={},zs=Rc,Dr=yw,_c=typeof Symbol==\"function\"&&typeof Symbol.for==\"function\"?Symbol.for(\"nodejs.util.inspect.custom\"):null;At.Buffer=O,At.SlowBuffer=function(t){return+t!=t&&(t=0),O.alloc(+t)},At.INSPECT_MAX_BYTES=50;At.kMaxLength=2147483647,O.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}(),O.TYPED_ARRAY_SUPPORT||typeof console>\"u\"||typeof console.error!=\"function\"||console.error(\"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.\"),Object.defineProperty(O.prototype,\"parent\",{enumerable:!0,get:function(){if(O.isBuffer(this))return this.buffer}}),Object.defineProperty(O.prototype,\"offset\",{enumerable:!0,get:function(){if(O.isBuffer(this))return this.byteOffset}}),O.poolSize=8192,O.from=function(t,e,r){return Cc(t,e,r)},Object.setPrototypeOf(O.prototype,Uint8Array.prototype),Object.setPrototypeOf(O,Uint8Array),O.alloc=function(t,e,r){return function(i,n,o){return Bc(i),i<=0?Et(i):n!==void 0?typeof o==\"string\"?Et(i).fill(n,o):Et(i).fill(n):Et(i)}(t,e,r)},O.allocUnsafe=function(t){return Ks(t)},O.allocUnsafeSlow=function(t){return Ks(t)},O.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==O.prototype},O.compare=function(t,e){if(St(t,Uint8Array)&&(t=O.from(t,t.offset,t.byteLength)),St(e,Uint8Array)&&(e=O.from(e,e.offset,e.byteLength)),!O.isBuffer(t)||!O.isBuffer(e))throw new TypeError('The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,i=e.length,n=0,o=Math.min(r,i);ne&&(t+=\" ... \"),\"\"},_c&&(O.prototype[_c]=O.prototype.inspect),O.prototype.compare=function(t,e,r,i,n){if(St(t,Uint8Array)&&(t=O.from(t,t.offset,t.byteLength)),!O.isBuffer(t))throw new TypeError('The \"target\" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),n===void 0&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError(\"out of range index\");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(n>>>=0)-(i>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),l=this.slice(i,n),c=t.slice(e,r),h=0;h>>=0,isFinite(r)?(r>>>=0,i===void 0&&(i=\"utf8\")):(i=r,r=void 0)}var n=this.length-e;if((r===void 0||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError(\"Attempt to write outside buffer bounds\");i||(i=\"utf8\");for(var o=!1;;)switch(i){case\"hex\":return ww(this,t,e,r);case\"utf8\":case\"utf-8\":return _w(this,t,e,r);case\"ascii\":return kc(this,t,e,r);case\"latin1\":case\"binary\":return mw(this,t,e,r);case\"base64\":return vw(this,t,e,r);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return Ew(this,t,e,r);default:if(o)throw new TypeError(\"Unknown encoding: \"+i);i=(\"\"+i).toLowerCase(),o=!0}},O.prototype.toJSON=function(){return{type:\"Buffer\",data:Array.prototype.slice.call(this._arr||this,0)}};O.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=e===void 0?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||we(t,e,this.length);for(var i=this[t],n=1,o=0;++o>>=0,e>>>=0,r||we(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},O.prototype.readUInt8=function(t,e){return t>>>=0,e||we(t,1,this.length),this[t]},O.prototype.readUInt16LE=function(t,e){return t>>>=0,e||we(t,2,this.length),this[t]|this[t+1]<<8},O.prototype.readUInt16BE=function(t,e){return t>>>=0,e||we(t,2,this.length),this[t]<<8|this[t+1]},O.prototype.readUInt32LE=function(t,e){return t>>>=0,e||we(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},O.prototype.readUInt32BE=function(t,e){return t>>>=0,e||we(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},O.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||we(t,e,this.length);for(var i=this[t],n=1,o=0;++o=(n*=128)&&(i-=Math.pow(2,8*e)),i},O.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||we(t,e,this.length);for(var i=e,n=1,o=this[t+--i];i>0&&(n*=256);)o+=this[t+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*e)),o},O.prototype.readInt8=function(t,e){return t>>>=0,e||we(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},O.prototype.readInt16LE=function(t,e){t>>>=0,e||we(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},O.prototype.readInt16BE=function(t,e){t>>>=0,e||we(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},O.prototype.readInt32LE=function(t,e){return t>>>=0,e||we(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},O.prototype.readInt32BE=function(t,e){return t>>>=0,e||we(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},O.prototype.readFloatLE=function(t,e){return t>>>=0,e||we(t,4,this.length),Dr.read(this,t,!0,23,4)},O.prototype.readFloatBE=function(t,e){return t>>>=0,e||we(t,4,this.length),Dr.read(this,t,!1,23,4)},O.prototype.readDoubleLE=function(t,e){return t>>>=0,e||we(t,8,this.length),Dr.read(this,t,!0,52,8)},O.prototype.readDoubleBE=function(t,e){return t>>>=0,e||we(t,8,this.length),Dr.read(this,t,!1,52,8)},O.prototype.writeUIntLE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||Pe(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,i||Pe(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[e+n]=255&t;--n>=0&&(o*=256);)this[e+n]=t/o&255;return e+r},O.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,1,255,0),this[e]=255&t,e+1},O.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},O.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},O.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},O.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},O.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);Pe(this,t,e,r,n-1,-n)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+r},O.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);Pe(this,t,e,r,n-1,-n)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&a===0&&this[e+o+1]!==0&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},O.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},O.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},O.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},O.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},O.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},O.prototype.writeFloatLE=function(t,e,r){return Sc(this,t,e,!0,r)},O.prototype.writeFloatBE=function(t,e,r){return Sc(this,t,e,!1,r)},O.prototype.writeDoubleLE=function(t,e,r){return Ac(this,t,e,!0,r)},O.prototype.writeDoubleBE=function(t,e,r){return Ac(this,t,e,!1,r)},O.prototype.copy=function(t,e,r,i){if(!O.isBuffer(t))throw new TypeError(\"argument should be a Buffer\");if(r||(r=0),i||i===0||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError(\"Index out of range\");if(i<0)throw new RangeError(\"sourceEnd out of bounds\");i>this.length&&(i=this.length),t.length-e=0;--o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,i),e);return n},O.prototype.fill=function(t,e,r,i){if(typeof t==\"string\"){if(typeof e==\"string\"?(i=e,e=0,r=this.length):typeof r==\"string\"&&(i=r,r=this.length),i!==void 0&&typeof i!=\"string\")throw new TypeError(\"encoding must be a string\");if(typeof i==\"string\"&&!O.isEncoding(i))throw new TypeError(\"Unknown encoding: \"+i);if(t.length===1){var n=t.charCodeAt(0);(i===\"utf8\"&&n<128||i===\"latin1\")&&(t=n)}}else typeof t==\"number\"?t&=255:typeof t==\"boolean\"&&(t=Number(t));if(e<0||this.length>>=0,r=r===void 0?this.length:r>>>0,t||(t=0),typeof t==\"number\")for(o=e;o=0?(l>0&&(n.lastNeed=l-1),l):--a=0?(l>0&&(n.lastNeed=l-2),l):--a=0?(l>0&&(l===2?l=0:n.lastNeed=l-3),l):0}(this,t,e);if(!this.lastNeed)return t.toString(\"utf8\",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString(\"utf8\",e,i)},pi.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};ur.StringDecoder;ur.StringDecoder});var Lc={};Jt(Lc,{StringDecoder:()=>qw,default:()=>ur});var qw,Uc=_e(()=>{_();v();m();Xs();Xs();qw=ur.StringDecoder});var Zs=M((qT,jc)=>{\"use strict\";_();v();m();var Nc=Nt(),{PromisePrototypeThen:Dw,SymbolAsyncIterator:qc,SymbolIterator:Dc}=ce(),{Buffer:jw}=(be(),X(me)),{ERR_INVALID_ARG_TYPE:Fw,ERR_STREAM_NULL_VALUES:Ww}=Ae().codes;function $w(t,e,r){let i;if(typeof e==\"string\"||e instanceof jw)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let n;if(e&&e[qc])n=!0,i=e[qc]();else if(e&&e[Dc])n=!1,i=e[Dc]();else throw new Fw(\"iterable\",[\"Iterable\"],e);let o=new t({objectMode:!0,highWaterMark:1,...r}),s=!1;o._read=function(){s||(s=!0,l())},o._destroy=function(c,h){Dw(a(c),()=>Nc.nextTick(h,c),d=>Nc.nextTick(h,d||c))};async function a(c){let h=c!=null,d=typeof i.throw==\"function\";if(h&&d){let{value:g,done:y}=await i.throw(c);if(await g,y)return}if(typeof i.return==\"function\"){let{value:g}=await i.return();await g}}async function l(){for(;;){try{let{value:c,done:h}=n?await i.next():i.next();if(h)o.push(null);else{let d=c&&typeof c.then==\"function\"?await c:c;if(d===null)throw s=!1,new Ww;if(o.push(d))continue;s=!1}}catch(c){o.destroy(c)}break}}return o}jc.exports=$w});var gi=M((VT,Zc)=>{_();v();m();var He=Nt(),{ArrayPrototypeIndexOf:Hw,NumberIsInteger:Vw,NumberIsNaN:zw,NumberParseInt:Kw,ObjectDefineProperties:$c,ObjectKeys:Gw,ObjectSetPrototypeOf:Hc,Promise:Qw,SafeSet:Yw,SymbolAsyncIterator:Jw,Symbol:Xw}=ce();Zc.exports=F;F.ReadableState=so;var{EventEmitter:Zw}=(sr(),X(nr)),{Stream:Dt,prependListener:e_}=nn(),{Buffer:eo}=(be(),X(me)),{addAbortSignal:t_}=di(),r_=vt(),H=Je().debuglog(\"stream\",t=>{H=t}),i_=dc(),Fr=ir(),{getHighWaterMark:n_,getDefaultHighWaterMark:s_}=an(),{aggregateTwoErrors:Fc,codes:{ERR_INVALID_ARG_TYPE:o_,ERR_METHOD_NOT_IMPLEMENTED:a_,ERR_OUT_OF_RANGE:l_,ERR_STREAM_PUSH_AFTER_EOF:u_,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:f_}}=Ae(),{validateObject:c_}=hi(),fr=Xw(\"kPaused\"),{StringDecoder:Vc}=(Uc(),X(Lc)),h_=Zs();Hc(F.prototype,Dt.prototype);Hc(F,Dt);var to=()=>{},{errorOrDestroy:jr}=Fr;function so(t,e,r){typeof r!=\"boolean\"&&(r=e instanceof nt()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.readableObjectMode)),this.highWaterMark=t?n_(this,t,\"readableHighWaterMark\",r):s_(!1),this.buffer=new i_,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[fr]=null,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=t&&t.defaultEncoding||\"utf8\",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Vc(t.encoding),this.encoding=t.encoding)}function F(t){if(!(this instanceof F))return new F(t);let e=this instanceof nt();this._readableState=new so(t,this,e),t&&(typeof t.read==\"function\"&&(this._read=t.read),typeof t.destroy==\"function\"&&(this._destroy=t.destroy),typeof t.construct==\"function\"&&(this._construct=t.construct),t.signal&&!e&&t_(t.signal,this)),Dt.call(this,t),Fr.construct(this,()=>{this._readableState.needReadable&&hn(this,this._readableState)})}F.prototype.destroy=Fr.destroy;F.prototype._undestroy=Fr.undestroy;F.prototype._destroy=function(t,e){e(t)};F.prototype[Zw.captureRejectionSymbol]=function(t){this.destroy(t)};F.prototype.push=function(t,e){return zc(this,t,e,!1)};F.prototype.unshift=function(t,e){return zc(this,t,e,!0)};function zc(t,e,r,i){H(\"readableAddChunk\",e);let n=t._readableState,o;if(n.objectMode||(typeof e==\"string\"?(r=r||n.defaultEncoding,n.encoding!==r&&(i&&n.encoding?e=eo.from(e,r).toString(n.encoding):(e=eo.from(e,r),r=\"\"))):e instanceof eo?r=\"\":Dt._isUint8Array(e)?(e=Dt._uint8ArrayToBuffer(e),r=\"\"):e!=null&&(o=new o_(\"chunk\",[\"string\",\"Buffer\",\"Uint8Array\"],e))),o)jr(t,o);else if(e===null)n.reading=!1,g_(t,n);else if(n.objectMode||e&&e.length>0)if(i)if(n.endEmitted)jr(t,new f_);else{if(n.destroyed||n.errored)return!1;ro(t,n,e,!0)}else if(n.ended)jr(t,new u_);else{if(n.destroyed||n.errored)return!1;n.reading=!1,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?ro(t,n,e,!1):hn(t,n)):ro(t,n,e,!1)}else i||(n.reading=!1,hn(t,n));return!n.ended&&(n.length0?(e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit(\"data\",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&dn(t)),hn(t,e)}F.prototype.isPaused=function(){let t=this._readableState;return t[fr]===!0||t.flowing===!1};F.prototype.setEncoding=function(t){let e=new Vc(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,i=\"\";for(let n of r)i+=e.write(n);return r.clear(),i!==\"\"&&r.push(i),this._readableState.length=i.length,this};var d_=1073741824;function p_(t){if(t>d_)throw new l_(\"size\",\"<= 1GiB\",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Wc(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:zw(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}F.prototype.read=function(t){H(\"read\",t),t===void 0?t=NaN:Vw(t)||(t=Kw(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=p_(t)),t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return H(\"read: emitReadable\",e.length,e.ended),e.length===0&&e.ended?io(this):dn(this),null;if(t=Wc(t,e),t===0&&e.ended)return e.length===0&&io(this),null;let i=e.needReadable;if(H(\"need readable\",i),(e.length===0||e.length-t0?n=Jc(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&io(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit(\"data\",n)),n};function g_(t,e){if(H(\"onEofChunk\"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?dn(t):(e.needReadable=!1,e.emittedReadable=!0,Kc(t))}}function dn(t){let e=t._readableState;H(\"emitReadable\",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(H(\"emitReadable\",e.flowing),e.emittedReadable=!0,He.nextTick(Kc,t))}function Kc(t){let e=t._readableState;H(\"emitReadable_\",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit(\"readable\"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Qc(t)}function hn(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,He.nextTick(y_,t,e))}function y_(t,e){for(;!e.reading&&!e.ended&&(e.length1&&i.pipes.includes(t)&&(H(\"false write response, pause\",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),r.pause()),l||(l=b_(r,t),t.on(\"drain\",l))}r.on(\"data\",g);function g(I){H(\"ondata\");let C=t.write(I);H(\"dest.write\",C),C===!1&&d()}function y(I){if(H(\"onerror\",I),E(),t.removeListener(\"error\",y),t.listenerCount(\"error\")===0){let C=t._writableState||t._readableState;C&&!C.errorEmitted?jr(t,I):t.emit(\"error\",I)}}e_(t,\"error\",y);function w(){t.removeListener(\"finish\",S),E()}t.once(\"close\",w);function S(){H(\"onfinish\"),t.removeListener(\"close\",w),E()}t.once(\"finish\",S);function E(){H(\"unpipe\"),r.unpipe(t)}return t.emit(\"pipe\",r),t.writableNeedDrain===!0?i.flowing&&d():i.flowing||(H(\"pipe resume\"),r.resume()),t};function b_(t,e){return function(){let i=t._readableState;i.awaitDrainWriters===e?(H(\"pipeOnDrain\",1),i.awaitDrainWriters=null):i.multiAwaitDrain&&(H(\"pipeOnDrain\",i.awaitDrainWriters.size),i.awaitDrainWriters.delete(e)),(!i.awaitDrainWriters||i.awaitDrainWriters.size===0)&&t.listenerCount(\"data\")&&t.resume()}}F.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let n=e.pipes;e.pipes=[],this.pause();for(let o=0;o0,i.flowing!==!1&&this.resume()):t===\"readable\"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,H(\"on readable\",i.length,i.reading),i.length?dn(this):i.reading||He.nextTick(w_,this)),r};F.prototype.addListener=F.prototype.on;F.prototype.removeListener=function(t,e){let r=Dt.prototype.removeListener.call(this,t,e);return t===\"readable\"&&He.nextTick(Gc,this),r};F.prototype.off=F.prototype.removeListener;F.prototype.removeAllListeners=function(t){let e=Dt.prototype.removeAllListeners.apply(this,arguments);return(t===\"readable\"||t===void 0)&&He.nextTick(Gc,this),e};function Gc(t){let e=t._readableState;e.readableListening=t.listenerCount(\"readable\")>0,e.resumeScheduled&&e[fr]===!1?e.flowing=!0:t.listenerCount(\"data\")>0?t.resume():e.readableListening||(e.flowing=null)}function w_(t){H(\"readable nexttick read 0\"),t.read(0)}F.prototype.resume=function(){let t=this._readableState;return t.flowing||(H(\"resume\"),t.flowing=!t.readableListening,__(this,t)),t[fr]=!1,this};function __(t,e){e.resumeScheduled||(e.resumeScheduled=!0,He.nextTick(m_,t,e))}function m_(t,e){H(\"resume\",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit(\"resume\"),Qc(t),e.flowing&&!e.reading&&t.read(0)}F.prototype.pause=function(){return H(\"call pause flowing=%j\",this._readableState.flowing),this._readableState.flowing!==!1&&(H(\"pause\"),this._readableState.flowing=!1,this.emit(\"pause\")),this._readableState[fr]=!0,this};function Qc(t){let e=t._readableState;for(H(\"flow\",e.flowing);e.flowing&&t.read()!==null;);}F.prototype.wrap=function(t){let e=!1;t.on(\"data\",i=>{!this.push(i)&&t.pause&&(e=!0,t.pause())}),t.on(\"end\",()=>{this.push(null)}),t.on(\"error\",i=>{jr(this,i)}),t.on(\"close\",()=>{this.destroy()}),t.on(\"destroy\",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=Gw(t);for(let i=1;i{n=s?Fc(n,s):null,r(),r=to});try{for(;;){let s=t.destroyed?null:t.read();if(s!==null)yield s;else{if(n)throw n;if(n===null)return;await new Qw(i)}}}catch(s){throw n=Fc(n,s),n}finally{(n||e?.destroyOnReturn!==!1)&&(n===void 0||t._readableState.autoDestroy)?Fr.destroyer(t,null):(t.off(\"readable\",i),o())}}$c(F.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});$c(so.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[fr]!==!1},set(t){this[fr]=!!t}}});F._fromList=Jc;function Jc(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(\"\"):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function io(t){let e=t._readableState;H(\"endReadable\",e.endEmitted),e.endEmitted||(e.ended=!0,He.nextTick(E_,e,t))}function E_(t,e){if(H(\"endReadableNT\",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit(\"end\"),e.writable&&e.allowHalfOpen===!1)He.nextTick(S_,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function S_(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}F.from=function(t,e){return h_(F,t,e)};var no;function Xc(){return no===void 0&&(no={}),no}F.fromWeb=function(t,e){return Xc().newStreamReadableFromReadableStream(t,e)};F.toWeb=function(t,e){return Xc().newReadableStreamFromStreamReadable(t,e)};F.wrap=function(t,e){var r,i;return new F({objectMode:(r=(i=t.readableObjectMode)!==null&&i!==void 0?i:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(n,o){Fr.destroyer(t,n),o(n)}}).wrap(t)}});var ho=M((XT,ch)=>{_();v();m();var cr=Nt(),{ArrayPrototypeSlice:rh,Error:A_,FunctionPrototypeSymbolHasInstance:ih,ObjectDefineProperty:nh,ObjectDefineProperties:I_,ObjectSetPrototypeOf:sh,StringPrototypeToLowerCase:T_,Symbol:R_,SymbolHasInstance:C_}=ce();ch.exports=ie;ie.WritableState=wi;var{EventEmitter:B_}=(sr(),X(nr)),yi=nn().Stream,{Buffer:pn}=(be(),X(me)),bn=ir(),{addAbortSignal:P_}=di(),{getHighWaterMark:k_,getDefaultHighWaterMark:O_}=an(),{ERR_INVALID_ARG_TYPE:x_,ERR_METHOD_NOT_IMPLEMENTED:M_,ERR_MULTIPLE_CALLBACK:oh,ERR_STREAM_CANNOT_PIPE:L_,ERR_STREAM_DESTROYED:bi,ERR_STREAM_ALREADY_FINISHED:U_,ERR_STREAM_NULL_VALUES:N_,ERR_STREAM_WRITE_AFTER_END:q_,ERR_UNKNOWN_ENCODING:ah}=Ae().codes,{errorOrDestroy:Wr}=bn;sh(ie.prototype,yi.prototype);sh(ie,yi);function lo(){}var $r=R_(\"kOnFinished\");function wi(t,e,r){typeof r!=\"boolean\"&&(r=e instanceof nt()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?k_(this,t,\"writableHighWaterMark\",r):O_(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let i=!!(t&&t.decodeStrings===!1);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||\"utf8\",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=j_.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,yn(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[$r]=[]}function yn(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}wi.prototype.getBuffer=function(){return rh(this.buffered,this.bufferedIndex)};nh(wi.prototype,\"bufferedRequestCount\",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function ie(t){let e=this instanceof nt();if(!e&&!ih(ie,this))return new ie(t);this._writableState=new wi(t,this,e),t&&(typeof t.write==\"function\"&&(this._write=t.write),typeof t.writev==\"function\"&&(this._writev=t.writev),typeof t.destroy==\"function\"&&(this._destroy=t.destroy),typeof t.final==\"function\"&&(this._final=t.final),typeof t.construct==\"function\"&&(this._construct=t.construct),t.signal&&P_(t.signal,this)),yi.call(this,t),bn.construct(this,()=>{let r=this._writableState;r.writing||fo(this,r),co(this,r)})}nh(ie,C_,{__proto__:null,value:function(t){return ih(this,t)?!0:this!==ie?!1:t&&t._writableState instanceof wi}});ie.prototype.pipe=function(){Wr(this,new L_)};function lh(t,e,r,i){let n=t._writableState;if(typeof r==\"function\")i=r,r=n.defaultEncoding;else{if(!r)r=n.defaultEncoding;else if(r!==\"buffer\"&&!pn.isEncoding(r))throw new ah(r);typeof i!=\"function\"&&(i=lo)}if(e===null)throw new N_;if(!n.objectMode)if(typeof e==\"string\")n.decodeStrings!==!1&&(e=pn.from(e,r),r=\"buffer\");else if(e instanceof pn)r=\"buffer\";else if(yi._isUint8Array(e))e=yi._uint8ArrayToBuffer(e),r=\"buffer\";else throw new x_(\"chunk\",[\"string\",\"Buffer\",\"Uint8Array\"],e);let o;return n.ending?o=new q_:n.destroyed&&(o=new bi(\"write\")),o?(cr.nextTick(i,o),Wr(t,o,!0),o):(n.pendingcb++,D_(t,n,e,r,i))}ie.prototype.write=function(t,e,r){return lh(this,t,e,r)===!0};ie.prototype.cork=function(){this._writableState.corked++};ie.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||fo(this,t))};ie.prototype.setDefaultEncoding=function(e){if(typeof e==\"string\"&&(e=T_(e)),!pn.isEncoding(e))throw new ah(e);return this._writableState.defaultEncoding=e,this};function D_(t,e,r,i,n){let o=e.objectMode?1:r.length;e.length+=o;let s=e.lengthr.bufferedIndex&&fo(t,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===n?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:n,stream:t,state:r},cr.nextTick(F_,r.afterWriteTickInfo)):uh(t,r,1,n))}function F_({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,uh(t,e,r,i)}function uh(t,e,r,i){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit(\"drain\"));r-- >0;)e.pendingcb--,i();e.destroyed&&uo(e),co(t,e)}function uo(t){if(t.writing)return;for(let n=t.bufferedIndex;n1&&t._writev){e.pendingcb-=o-1;let a=e.allNoop?lo:c=>{for(let h=s;h256?(r.splice(0,s),e.bufferedIndex=0):e.bufferedIndex=s}e.bufferProcessing=!1}ie.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new M_(\"_write()\")};ie.prototype._writev=null;ie.prototype.end=function(t,e,r){let i=this._writableState;typeof t==\"function\"?(r=t,t=null,e=null):typeof e==\"function\"&&(r=e,e=null);let n;if(t!=null){let o=lh(this,t,e);o instanceof A_&&(n=o)}return i.corked&&(i.corked=1,this.uncork()),n||(!i.errored&&!i.ending?(i.ending=!0,co(this,i,!0),i.ended=!0):i.finished?n=new U_(\"end\"):i.destroyed&&(n=new bi(\"end\"))),typeof r==\"function\"&&(n||i.finished?cr.nextTick(r,n):i[$r].push(r)),this};function gn(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function W_(t,e){let r=!1;function i(n){if(r){Wr(t,n??oh());return}if(r=!0,e.pendingcb--,n){let o=e[$r].splice(0);for(let s=0;s{gn(n)?ao(i,n):n.pendingcb--},t,e)):gn(e)&&(e.pendingcb++,ao(t,e))))}function ao(t,e){e.pendingcb--,e.finished=!0;let r=e[$r].splice(0);for(let i=0;i{_();v();m();var po=Nt(),V_=(be(),X(me)),{isReadable:z_,isWritable:K_,isIterable:hh,isNodeStream:G_,isReadableNodeStream:dh,isWritableNodeStream:ph,isDuplexNodeStream:Q_}=tt(),gh=vt(),{AbortError:vh,codes:{ERR_INVALID_ARG_TYPE:Y_,ERR_INVALID_RETURN_VALUE:yh}}=Ae(),{destroyer:Hr}=ir(),J_=nt(),X_=gi(),{createDeferredPromise:bh}=Je(),wh=Zs(),_h=globalThis.Blob||V_.Blob,Z_=typeof _h<\"u\"?function(e){return e instanceof _h}:function(e){return!1},e0=globalThis.AbortController||zi().AbortController,{FunctionPrototypeCall:mh}=ce(),hr=class extends J_{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};Eh.exports=function t(e,r){if(Q_(e))return e;if(dh(e))return wn({readable:e});if(ph(e))return wn({writable:e});if(G_(e))return wn({writable:!1,readable:!1});if(typeof e==\"function\"){let{value:n,write:o,final:s,destroy:a}=t0(e);if(hh(n))return wh(hr,n,{objectMode:!0,write:o,final:s,destroy:a});let l=n?.then;if(typeof l==\"function\"){let c,h=mh(l,n,d=>{if(d!=null)throw new yh(\"nully\",\"body\",d)},d=>{Hr(c,d)});return c=new hr({objectMode:!0,readable:!1,write:o,final(d){s(async()=>{try{await h,po.nextTick(d,null)}catch(g){po.nextTick(d,g)}})},destroy:a})}throw new yh(\"Iterable, AsyncIterable or AsyncFunction\",r,n)}if(Z_(e))return t(e.arrayBuffer());if(hh(e))return wh(hr,e,{objectMode:!0,writable:!1});if(typeof e?.writable==\"object\"||typeof e?.readable==\"object\"){let n=e!=null&&e.readable?dh(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?ph(e?.writable)?e?.writable:t(e.writable):void 0;return wn({readable:n,writable:o})}let i=e?.then;if(typeof i==\"function\"){let n;return mh(i,e,o=>{o!=null&&n.push(o),n.push(null)},o=>{Hr(n,o)}),n=new hr({objectMode:!0,writable:!1,read(){}})}throw new Y_(r,[\"Blob\",\"ReadableStream\",\"WritableStream\",\"Stream\",\"Iterable\",\"AsyncIterable\",\"Function\",\"{ readable, writable } pair\",\"Promise\"],e)};function t0(t){let{promise:e,resolve:r}=bh(),i=new e0,n=i.signal;return{value:t(async function*(){for(;;){let s=e;e=null;let{chunk:a,done:l,cb:c}=await s;if(po.nextTick(c),l)return;if(n.aborted)throw new vh(void 0,{cause:n.reason});({promise:e,resolve:r}=bh()),yield a}}(),{signal:n}),write(s,a,l){let c=r;r=null,c({chunk:s,done:!1,cb:l})},final(s){let a=r;r=null,a({done:!0,cb:s})},destroy(s,a){i.abort(),a(s)}}}function wn(t){let e=t.readable&&typeof t.readable.read!=\"function\"?X_.wrap(t.readable):t.readable,r=t.writable,i=!!z_(e),n=!!K_(r),o,s,a,l,c;function h(d){let g=l;l=null,g?g(d):d&&c.destroy(d)}return c=new hr({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&(gh(r,d=>{n=!1,d&&Hr(e,d),h(d)}),c._write=function(d,g,y){r.write(d,g)?y():o=y},c._final=function(d){r.end(),s=d},r.on(\"drain\",function(){if(o){let d=o;o=null,d()}}),r.on(\"finish\",function(){if(s){let d=s;s=null,d()}})),i&&(gh(e,d=>{i=!1,d&&Hr(e,d),h(d)}),e.on(\"readable\",function(){if(a){let d=a;a=null,d()}}),e.on(\"end\",function(){c.push(null)}),c._read=function(){for(;;){let d=e.read();if(d===null){a=c._read;return}if(!c.push(d))return}}),c._destroy=function(d,g){!d&&l!==null&&(d=new vh),a=null,o=null,s=null,l===null?g(d):(l=g,Hr(r,d),Hr(e,d))},c}});var nt=M((h2,Th)=>{\"use strict\";_();v();m();var{ObjectDefineProperties:r0,ObjectGetOwnPropertyDescriptor:It,ObjectKeys:i0,ObjectSetPrototypeOf:Ah}=ce();Th.exports=Ve;var bo=gi(),Ne=ho();Ah(Ve.prototype,bo.prototype);Ah(Ve,bo);{let t=i0(Ne.prototype);for(let e=0;e{\"use strict\";_();v();m();var{ObjectSetPrototypeOf:Rh,Symbol:n0}=ce();Ch.exports=Tt;var{ERR_METHOD_NOT_IMPLEMENTED:s0}=Ae().codes,_o=nt(),{getHighWaterMark:o0}=an();Rh(Tt.prototype,_o.prototype);Rh(Tt,_o);var _i=n0(\"kCallback\");function Tt(t){if(!(this instanceof Tt))return new Tt(t);let e=t?o0(this,t,\"readableHighWaterMark\",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),_o.call(this,t),this._readableState.sync=!1,this[_i]=null,t&&(typeof t.transform==\"function\"&&(this._transform=t.transform),typeof t.flush==\"function\"&&(this._flush=t.flush)),this.on(\"prefinish\",a0)}function wo(t){typeof this._flush==\"function\"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}function a0(){this._final!==wo&&wo.call(this)}Tt.prototype._final=wo;Tt.prototype._transform=function(t,e,r){throw new s0(\"_transform()\")};Tt.prototype._write=function(t,e,r){let i=this._readableState,n=this._writableState,o=i.length;this._transform(t,e,(s,a)=>{if(s){r(s);return}a!=null&&this.push(a),n.ended||o===i.length||i.length{\"use strict\";_();v();m();var{ObjectSetPrototypeOf:Bh}=ce();Ph.exports=Vr;var vo=mo();Bh(Vr.prototype,vo.prototype);Bh(Vr,vo);function Vr(t){if(!(this instanceof Vr))return new Vr(t);vo.call(this,t)}Vr.prototype._transform=function(t,e,r){r(null,t)}});var En=M((x2,Lh)=>{_();v();m();var mi=Nt(),{ArrayIsArray:l0,Promise:u0,SymbolAsyncIterator:f0}=ce(),vn=vt(),{once:c0}=Je(),h0=ir(),kh=nt(),{aggregateTwoErrors:d0,codes:{ERR_INVALID_ARG_TYPE:Po,ERR_INVALID_RETURN_VALUE:So,ERR_MISSING_ARGS:p0,ERR_STREAM_DESTROYED:g0,ERR_STREAM_PREMATURE_CLOSE:y0},AbortError:b0}=Ae(),{validateFunction:w0,validateAbortSignal:_0}=hi(),{isIterable:dr,isReadable:Ao,isReadableNodeStream:mn,isNodeStream:Oh,isTransformStream:zr,isWebStream:m0,isReadableStream:Io,isReadableEnded:v0}=tt(),E0=globalThis.AbortController||zi().AbortController,To,Ro;function xh(t,e,r){let i=!1;t.on(\"close\",()=>{i=!0});let n=vn(t,{readable:e,writable:r},o=>{i=!o});return{destroy:o=>{i||(i=!0,h0.destroyer(t,o||new g0(\"pipe\")))},cleanup:n}}function S0(t){return w0(t[t.length-1],\"streams[stream.length - 1]\"),t.pop()}function Co(t){if(dr(t))return t;if(mn(t))return A0(t);throw new Po(\"val\",[\"Readable\",\"Iterable\",\"AsyncIterable\"],t)}async function*A0(t){Ro||(Ro=gi()),yield*Ro.prototype[f0].call(t)}async function _n(t,e,r,{end:i}){let n,o=null,s=c=>{if(c&&(n=c),o){let h=o;o=null,h()}},a=()=>new u0((c,h)=>{n?h(n):o=()=>{n?h(n):c()}});e.on(\"drain\",s);let l=vn(e,{readable:!1},s);try{e.writableNeedDrain&&await a();for await(let c of t)e.write(c)||await a();i&&e.end(),await a(),r()}catch(c){r(n!==c?d0(n,c):c)}finally{l(),e.off(\"drain\",s)}}async function Bo(t,e,r,{end:i}){zr(e)&&(e=e.writable);let n=e.getWriter();try{for await(let o of t)await n.ready,n.write(o).catch(()=>{});await n.ready,i&&await n.close(),r()}catch(o){try{await n.abort(o),r(o)}catch(s){r(s)}}}function I0(...t){return Mh(t,c0(S0(t)))}function Mh(t,e,r){if(t.length===1&&l0(t[0])&&(t=t[0]),t.length<2)throw new p0(\"streams\");let i=new E0,n=i.signal,o=r?.signal,s=[];_0(o,\"options.signal\");function a(){y(new b0)}o?.addEventListener(\"abort\",a);let l,c,h=[],d=0;function g(C){y(C,--d===0)}function y(C,R){if(C&&(!l||l.code===\"ERR_STREAM_PREMATURE_CLOSE\")&&(l=C),!(!l&&!R)){for(;h.length;)h.shift()(l);o?.removeEventListener(\"abort\",a),i.abort(),R&&(l||s.forEach(U=>U()),mi.nextTick(e,l,c))}}let w;for(let C=0;C0,W=U||r?.end!==!1,K=C===t.length-1;if(Oh(R)){let z=function(Q){Q&&Q.name!==\"AbortError\"&&Q.code!==\"ERR_STREAM_PREMATURE_CLOSE\"&&g(Q)};var I=z;if(W){let{destroy:Q,cleanup:pe}=xh(R,U,N);h.push(Q),Ao(R)&&K&&s.push(pe)}R.on(\"error\",z),Ao(R)&&K&&s.push(()=>{R.removeListener(\"error\",z)})}if(C===0)if(typeof R==\"function\"){if(w=R({signal:n}),!dr(w))throw new So(\"Iterable, AsyncIterable or Stream\",\"source\",w)}else dr(R)||mn(R)||zr(R)?w=R:w=kh.from(R);else if(typeof R==\"function\"){if(zr(w)){var S;w=Co((S=w)===null||S===void 0?void 0:S.readable)}else w=Co(w);if(w=R(w,{signal:n}),U){if(!dr(w,!0))throw new So(\"AsyncIterable\",`transform[${C-1}]`,w)}else{var E;To||(To=Eo());let z=new To({objectMode:!0}),Q=(E=w)===null||E===void 0?void 0:E.then;if(typeof Q==\"function\")d++,Q.call(w,ge=>{c=ge,ge!=null&&z.write(ge),W&&z.end(),mi.nextTick(g)},ge=>{z.destroy(ge),mi.nextTick(g,ge)});else if(dr(w,!0))d++,_n(w,z,g,{end:W});else if(Io(w)||zr(w)){let ge=w.readable||w;d++,_n(ge,z,g,{end:W})}else throw new So(\"AsyncIterable or Promise\",\"destination\",w);w=z;let{destroy:pe,cleanup:Yt}=xh(w,!1,!0);h.push(pe),K&&s.push(Yt)}}else if(Oh(R)){if(mn(w)){d+=2;let z=T0(w,R,g,{end:W});Ao(R)&&K&&s.push(z)}else if(zr(w)||Io(w)){let z=w.readable||w;d++,_n(z,R,g,{end:W})}else if(dr(w))d++,_n(w,R,g,{end:W});else throw new Po(\"val\",[\"Readable\",\"Iterable\",\"AsyncIterable\",\"ReadableStream\",\"TransformStream\"],w);w=R}else if(m0(R)){if(mn(w))d++,Bo(Co(w),R,g,{end:W});else if(Io(w)||dr(w))d++,Bo(w,R,g,{end:W});else if(zr(w))d++,Bo(w.readable,R,g,{end:W});else throw new Po(\"val\",[\"Readable\",\"Iterable\",\"AsyncIterable\",\"ReadableStream\",\"TransformStream\"],w);w=R}else w=kh.from(R)}return(n!=null&&n.aborted||o!=null&&o.aborted)&&mi.nextTick(a),w}function T0(t,e,r,{end:i}){let n=!1;if(e.on(\"close\",()=>{n||r(new y0)}),t.pipe(e,{end:!1}),i){let s=function(){n=!0,e.end()};var o=s;v0(t)?mi.nextTick(s):t.once(\"end\",s)}else r();return vn(t,{readable:!0,writable:!1},s=>{let a=t._readableState;s&&s.code===\"ERR_STREAM_PREMATURE_CLOSE\"&&a&&a.ended&&!a.errored&&!a.errorEmitted?t.once(\"end\",r).once(\"error\",r):r(s)}),vn(e,{readable:!1,writable:!0},r)}Lh.exports={pipelineImpl:Mh,pipeline:I0}});var Oo=M((j2,Fh)=>{\"use strict\";_();v();m();var{pipeline:R0}=En(),Sn=nt(),{destroyer:C0}=ir(),{isNodeStream:An,isReadable:Uh,isWritable:Nh,isWebStream:ko,isTransformStream:pr,isWritableStream:qh,isReadableStream:Dh}=tt(),{AbortError:B0,codes:{ERR_INVALID_ARG_VALUE:jh,ERR_MISSING_ARGS:P0}}=Ae(),k0=vt();Fh.exports=function(...e){if(e.length===0)throw new P0(\"streams\");if(e.length===1)return Sn.from(e[0]);let r=[...e];if(typeof e[0]==\"function\"&&(e[0]=Sn.from(e[0])),typeof e[e.length-1]==\"function\"){let y=e.length-1;e[y]=Sn.from(e[y])}for(let y=0;y0&&!(Nh(e[y])||qh(e[y])||pr(e[y])))throw new jh(`streams[${y}]`,r[y],\"must be writable\")}let i,n,o,s,a;function l(y){let w=s;s=null,w?w(y):y?a.destroy(y):!g&&!d&&a.destroy()}let c=e[0],h=R0(e,l),d=!!(Nh(c)||qh(c)||pr(c)),g=!!(Uh(h)||Dh(h)||pr(h));if(a=new Sn({writableObjectMode:!!(c!=null&&c.writableObjectMode),readableObjectMode:!!(h!=null&&h.writableObjectMode),writable:d,readable:g}),d){if(An(c))a._write=function(w,S,E){c.write(w,S)?E():i=E},a._final=function(w){c.end(),n=w},c.on(\"drain\",function(){if(i){let w=i;i=null,w()}});else if(ko(c)){let S=(pr(c)?c.writable:c).getWriter();a._write=async function(E,I,C){try{await S.ready,S.write(E).catch(()=>{}),C()}catch(R){C(R)}},a._final=async function(E){try{await S.ready,S.close().catch(()=>{}),n=E}catch(I){E(I)}}}let y=pr(h)?h.readable:h;k0(y,()=>{if(n){let w=n;n=null,w()}})}if(g){if(An(h))h.on(\"readable\",function(){if(o){let y=o;o=null,y()}}),h.on(\"end\",function(){a.push(null)}),a._read=function(){for(;;){let y=h.read();if(y===null){o=a._read;return}if(!a.push(y))return}};else if(ko(h)){let w=(pr(h)?h.readable:h).getReader();a._read=async function(){for(;;)try{let{value:S,done:E}=await w.read();if(!a.push(S))return;if(E){a.push(null);return}}catch{return}}}}return a._destroy=function(y,w){!y&&s!==null&&(y=new B0),o=null,i=null,n=null,s===null?w(y):(s=w,An(h)&&C0(h,y))},a}});var Qh=M((K2,Lo)=>{\"use strict\";_();v();m();var Vh=globalThis.AbortController||zi().AbortController,{codes:{ERR_INVALID_ARG_VALUE:O0,ERR_INVALID_ARG_TYPE:vi,ERR_MISSING_ARGS:x0,ERR_OUT_OF_RANGE:M0},AbortError:st}=Ae(),{validateAbortSignal:gr,validateInteger:L0,validateObject:yr}=hi(),U0=ce().Symbol(\"kWeak\"),{finished:N0}=vt(),q0=Oo(),{addAbortSignalNoValidate:D0}=di(),{isWritable:j0,isNodeStream:F0}=tt(),{ArrayPrototypePush:W0,MathFloor:$0,Number:H0,NumberIsNaN:V0,Promise:Wh,PromiseReject:$h,PromisePrototypeThen:z0,Symbol:zh}=ce(),In=zh(\"kEmpty\"),Hh=zh(\"kEof\");function K0(t,e){if(e!=null&&yr(e,\"options\"),e?.signal!=null&&gr(e.signal,\"options.signal\"),F0(t)&&!j0(t))throw new O0(\"stream\",t,\"must be writable\");let r=q0(this,t);return e!=null&&e.signal&&D0(e.signal,r),r}function Tn(t,e){if(typeof t!=\"function\")throw new vi(\"fn\",[\"Function\",\"AsyncFunction\"],t);e!=null&&yr(e,\"options\"),e?.signal!=null&&gr(e.signal,\"options.signal\");let r=1;return e?.concurrency!=null&&(r=$0(e.concurrency)),L0(r,\"concurrency\",1),async function*(){var n,o;let s=new Vh,a=this,l=[],c=s.signal,h={signal:c},d=()=>s.abort();e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted&&d(),e==null||(o=e.signal)===null||o===void 0||o.addEventListener(\"abort\",d);let g,y,w=!1;function S(){w=!0}async function E(){try{for await(let R of a){var I;if(w)return;if(c.aborted)throw new st;try{R=t(R,h)}catch(U){R=$h(U)}R!==In&&(typeof((I=R)===null||I===void 0?void 0:I.catch)==\"function\"&&R.catch(S),l.push(R),g&&(g(),g=null),!w&&l.length&&l.length>=r&&await new Wh(U=>{y=U}))}l.push(Hh)}catch(R){let U=$h(R);z0(U,void 0,S),l.push(U)}finally{var C;w=!0,g&&(g(),g=null),e==null||(C=e.signal)===null||C===void 0||C.removeEventListener(\"abort\",d)}}E();try{for(;;){for(;l.length>0;){let I=await l[0];if(I===Hh)return;if(c.aborted)throw new st;I!==In&&(yield I),l.shift(),y&&(y(),y=null)}await new Wh(I=>{g=I})}}finally{s.abort(),w=!0,y&&(y(),y=null)}}.call(this)}function G0(t=void 0){return t!=null&&yr(t,\"options\"),t?.signal!=null&&gr(t.signal,\"options.signal\"),async function*(){let r=0;for await(let n of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new st({cause:t.signal.reason});yield[r++,n]}}.call(this)}async function Kh(t,e=void 0){for await(let r of Mo.call(this,t,e))return!0;return!1}async function Q0(t,e=void 0){if(typeof t!=\"function\")throw new vi(\"fn\",[\"Function\",\"AsyncFunction\"],t);return!await Kh.call(this,async(...r)=>!await t(...r),e)}async function Y0(t,e){for await(let r of Mo.call(this,t,e))return r}async function J0(t,e){if(typeof t!=\"function\")throw new vi(\"fn\",[\"Function\",\"AsyncFunction\"],t);async function r(i,n){return await t(i,n),In}for await(let i of Tn.call(this,r,e));}function Mo(t,e){if(typeof t!=\"function\")throw new vi(\"fn\",[\"Function\",\"AsyncFunction\"],t);async function r(i,n){return await t(i,n)?i:In}return Tn.call(this,r,e)}var xo=class extends x0{constructor(){super(\"reduce\"),this.message=\"Reduce of an empty stream requires an initial value\"}};async function X0(t,e,r){var i;if(typeof t!=\"function\")throw new vi(\"reducer\",[\"Function\",\"AsyncFunction\"],t);r!=null&&yr(r,\"options\"),r?.signal!=null&&gr(r.signal,\"options.signal\");let n=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){let c=new st(void 0,{cause:r.signal.reason});throw this.once(\"error\",()=>{}),await N0(this.destroy(c)),c}let o=new Vh,s=o.signal;if(r!=null&&r.signal){let c={once:!0,[U0]:this};r.signal.addEventListener(\"abort\",()=>o.abort(),c)}let a=!1;try{for await(let c of this){var l;if(a=!0,r!=null&&(l=r.signal)!==null&&l!==void 0&&l.aborted)throw new st;n?e=await t(e,c,{signal:s}):(e=c,n=!0)}if(!a&&!n)throw new xo}finally{o.abort()}return e}async function Z0(t){t!=null&&yr(t,\"options\"),t?.signal!=null&&gr(t.signal,\"options.signal\");let e=[];for await(let i of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new st(void 0,{cause:t.signal.reason});W0(e,i)}return e}function em(t,e){let r=Tn.call(this,t,e);return async function*(){for await(let n of r)yield*n}.call(this)}function Gh(t){if(t=H0(t),V0(t))return 0;if(t<0)throw new M0(\"number\",\">= 0\",t);return t}function tm(t,e=void 0){return e!=null&&yr(e,\"options\"),e?.signal!=null&&gr(e.signal,\"options.signal\"),t=Gh(t),async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new st;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new st;t--<=0&&(yield o)}}.call(this)}function rm(t,e=void 0){return e!=null&&yr(e,\"options\"),e?.signal!=null&&gr(e.signal,\"options.signal\"),t=Gh(t),async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new st;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new st;if(t-- >0)yield o;else return}}.call(this)}Lo.exports.streamReturningOperators={asIndexedPairs:G0,drop:tm,filter:Mo,flatMap:em,map:Tn,take:rm,compose:K0};Lo.exports.promiseReturningOperators={every:Q0,forEach:J0,reduce:X0,toArray:Z0,some:Kh,find:Y0}});var Uo=M((eR,Yh)=>{\"use strict\";_();v();m();var{ArrayPrototypePop:im,Promise:nm}=ce(),{isIterable:sm,isNodeStream:om,isWebStream:am}=tt(),{pipelineImpl:lm}=En(),{finished:um}=vt();No();function fm(...t){return new nm((e,r)=>{let i,n,o=t[t.length-1];if(o&&typeof o==\"object\"&&!om(o)&&!sm(o)&&!am(o)){let s=im(t);i=s.signal,n=s.end}lm(t,(s,a)=>{s?r(s):e(a)},{signal:i,end:n})})}Yh.exports={finished:um,pipeline:fm}});var No=M((aR,sd)=>{_();v();m();var{Buffer:cm}=(be(),X(me)),{ObjectDefineProperty:Rt,ObjectKeys:Zh,ReflectApply:ed}=ce(),{promisify:{custom:td}}=Je(),{streamReturningOperators:Jh,promiseReturningOperators:Xh}=Qh(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:rd}}=Ae(),hm=Oo(),{pipeline:id}=En(),{destroyer:dm}=ir(),nd=vt(),qo=Uo(),Do=tt(),le=sd.exports=nn().Stream;le.isDisturbed=Do.isDisturbed;le.isErrored=Do.isErrored;le.isReadable=Do.isReadable;le.Readable=gi();for(let t of Zh(Jh)){let r=function(...i){if(new.target)throw rd();return le.Readable.from(ed(e,this,i))};jo=r;let e=Jh[t];Rt(r,\"name\",{__proto__:null,value:e.name}),Rt(r,\"length\",{__proto__:null,value:e.length}),Rt(le.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var jo;for(let t of Zh(Xh)){let r=function(...n){if(new.target)throw rd();return ed(e,this,n)};jo=r;let e=Xh[t];Rt(r,\"name\",{__proto__:null,value:e.name}),Rt(r,\"length\",{__proto__:null,value:e.length}),Rt(le.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var jo;le.Writable=ho();le.Duplex=nt();le.Transform=mo();le.PassThrough=Eo();le.pipeline=id;var{addAbortSignal:pm}=di();le.addAbortSignal=pm;le.finished=nd;le.destroy=dm;le.compose=hm;Rt(le,\"promises\",{__proto__:null,configurable:!0,enumerable:!0,get(){return qo}});Rt(id,td,{__proto__:null,enumerable:!0,get(){return qo.pipeline}});Rt(nd,td,{__proto__:null,enumerable:!0,get(){return qo.finished}});le.Stream=le;le._isUint8Array=function(e){return e instanceof Uint8Array};le._uint8ArrayToBuffer=function(e){return cm.from(e.buffer,e.byteOffset,e.byteLength)}});var jt=M((pR,ue)=>{\"use strict\";_();v();m();var he=No(),gm=Uo(),ym=he.Readable.destroy;ue.exports=he.Readable;ue.exports._uint8ArrayToBuffer=he._uint8ArrayToBuffer;ue.exports._isUint8Array=he._isUint8Array;ue.exports.isDisturbed=he.isDisturbed;ue.exports.isErrored=he.isErrored;ue.exports.isReadable=he.isReadable;ue.exports.Readable=he.Readable;ue.exports.Writable=he.Writable;ue.exports.Duplex=he.Duplex;ue.exports.Transform=he.Transform;ue.exports.PassThrough=he.PassThrough;ue.exports.addAbortSignal=he.addAbortSignal;ue.exports.finished=he.finished;ue.exports.destroy=he.destroy;ue.exports.destroy=ym;ue.exports.pipeline=he.pipeline;ue.exports.compose=he.compose;Object.defineProperty(he,\"promises\",{configurable:!0,enumerable:!0,get(){return gm}});ue.exports.Stream=he.Stream;ue.exports.default=ue.exports});var od=M((vR,Fo)=>{_();v();m();typeof Object.create==\"function\"?Fo.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Fo.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}});var ud=M((CR,ld)=>{\"use strict\";_();v();m();var{Buffer:ze}=(be(),X(me)),ad=Symbol.for(\"BufferList\");function ee(t){if(!(this instanceof ee))return new ee(t);ee._init.call(this,t)}ee._init=function(e){Object.defineProperty(this,ad,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)};ee.prototype._new=function(e){return new ee(e)};ee.prototype._offset=function(e){if(e===0)return[0,0];let r=0;for(let i=0;ithis.length||e<0)return;let r=this._offset(e);return this._bufs[r[0]][r[1]]};ee.prototype.slice=function(e,r){return typeof e==\"number\"&&e<0&&(e+=this.length),typeof r==\"number\"&&r<0&&(r+=this.length),this.copy(null,0,e,r)};ee.prototype.copy=function(e,r,i,n){if((typeof i!=\"number\"||i<0)&&(i=0),(typeof n!=\"number\"||n>this.length)&&(n=this.length),i>=this.length||n<=0)return e||ze.alloc(0);let o=!!e,s=this._offset(i),a=n-i,l=a,c=o&&r||0,h=s[1];if(i===0&&n===this.length){if(!o)return this._bufs.length===1?this._bufs[0]:ze.concat(this._bufs,this.length);for(let d=0;dg)this._bufs[d].copy(e,c,h),c+=g;else{this._bufs[d].copy(e,c,h,h+l),c+=g;break}l-=g,h&&(h=0)}return e.length>c?e.slice(0,c):e};ee.prototype.shallowSlice=function(e,r){if(e=e||0,r=typeof r!=\"number\"?this.length:r,e<0&&(e+=this.length),r<0&&(r+=this.length),e===r)return this._new();let i=this._offset(e),n=this._offset(r),o=this._bufs.slice(i[0],n[0]+1);return n[1]===0?o.pop():o[o.length-1]=o[o.length-1].slice(0,n[1]),i[1]!==0&&(o[0]=o[0].slice(i[1])),this._new(o)};ee.prototype.toString=function(e,r,i){return this.slice(r,i).toString(e)};ee.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;)if(e>=this._bufs[0].length)e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}return this};ee.prototype.duplicate=function(){let e=this._new();for(let r=0;rthis.length?this.length:e;let i=this._offset(e),n=i[0],o=i[1];for(;n=t.length){let l=s.indexOf(t,o);if(l!==-1)return this._reverseOffset([n,l]);o=s.length-t.length+1}else{let l=this._reverseOffset([n,o]);if(this._match(l,t))return l;o++}o=0}return-1};ee.prototype._match=function(t,e){if(this.length-t{\"use strict\";_();v();m();var Wo=jt().Duplex,bm=od(),Ei=ud();function Se(t){if(!(this instanceof Se))return new Se(t);if(typeof t==\"function\"){this._callback=t;let e=function(i){this._callback&&(this._callback(i),this._callback=null)}.bind(this);this.on(\"pipe\",function(i){i.on(\"error\",e)}),this.on(\"unpipe\",function(i){i.removeListener(\"error\",e)}),t=null}Ei._init.call(this,t),Wo.call(this)}bm(Se,Wo);Object.assign(Se.prototype,Ei.prototype);Se.prototype._new=function(e){return new Se(e)};Se.prototype._write=function(e,r,i){this._appendBuffer(e),typeof i==\"function\"&&i()};Se.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)};Se.prototype.end=function(e){Wo.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)};Se.prototype._destroy=function(e,r){this._bufs.length=0,this.length=0,r(e)};Se.prototype._isBufferList=function(e){return e instanceof Se||e instanceof Ei||Se.isBufferList(e)};Se.isBufferList=Ei.isBufferList;Rn.exports=Se;Rn.exports.BufferListStream=Se;Rn.exports.BufferList=Ei});var hd=M((WR,cd)=>{_();v();m();var $o=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}};cd.exports=$o});var Ho=M((QR,dd)=>{_();v();m();var L=dd.exports,{Buffer:ke}=(be(),X(me));L.types={0:\"reserved\",1:\"connect\",2:\"connack\",3:\"publish\",4:\"puback\",5:\"pubrec\",6:\"pubrel\",7:\"pubcomp\",8:\"subscribe\",9:\"suback\",10:\"unsubscribe\",11:\"unsuback\",12:\"pingreq\",13:\"pingresp\",14:\"disconnect\",15:\"auth\"};L.requiredHeaderFlags={1:0,2:0,4:0,5:0,6:2,7:0,8:2,9:0,10:2,11:0,12:0,13:0,14:0,15:0};L.requiredHeaderFlagsErrors={};for(let t in L.requiredHeaderFlags){let e=L.requiredHeaderFlags[t];L.requiredHeaderFlagsErrors[t]=\"Invalid header flag bits, must be 0x\"+e.toString(16)+\" for \"+L.types[t]+\" packet\"}L.codes={};for(let t in L.types){let e=L.types[t];L.codes[e]=t}L.CMD_SHIFT=4;L.CMD_MASK=240;L.DUP_MASK=8;L.QOS_MASK=3;L.QOS_SHIFT=1;L.RETAIN_MASK=1;L.VARBYTEINT_MASK=127;L.VARBYTEINT_FIN_MASK=128;L.VARBYTEINT_MAX=268435455;L.SESSIONPRESENT_MASK=1;L.SESSIONPRESENT_HEADER=ke.from([L.SESSIONPRESENT_MASK]);L.CONNACK_HEADER=ke.from([L.codes.connack<[0,1].map(r=>[0,1].map(i=>{let n=ke.alloc(1);return n.writeUInt8(L.codes[t]<ke.from([t]));L.EMPTY={pingreq:ke.from([L.codes.pingreq<<4,0]),pingresp:ke.from([L.codes.pingresp<<4,0]),disconnect:ke.from([L.codes.disconnect<<4,0])};L.MQTT5_PUBACK_PUBREC_CODES={0:\"Success\",16:\"No matching subscribers\",128:\"Unspecified error\",131:\"Implementation specific error\",135:\"Not authorized\",144:\"Topic Name invalid\",145:\"Packet identifier in use\",151:\"Quota exceeded\",153:\"Payload format invalid\"};L.MQTT5_PUBREL_PUBCOMP_CODES={0:\"Success\",146:\"Packet Identifier not found\"};L.MQTT5_SUBACK_CODES={0:\"Granted QoS 0\",1:\"Granted QoS 1\",2:\"Granted QoS 2\",128:\"Unspecified error\",131:\"Implementation specific error\",135:\"Not authorized\",143:\"Topic Filter invalid\",145:\"Packet Identifier in use\",151:\"Quota exceeded\",158:\"Shared Subscriptions not supported\",161:\"Subscription Identifiers not supported\",162:\"Wildcard Subscriptions not supported\"};L.MQTT5_UNSUBACK_CODES={0:\"Success\",17:\"No subscription existed\",128:\"Unspecified error\",131:\"Implementation specific error\",135:\"Not authorized\",143:\"Topic Filter invalid\",145:\"Packet Identifier in use\"};L.MQTT5_DISCONNECT_CODES={0:\"Normal disconnection\",4:\"Disconnect with Will Message\",128:\"Unspecified error\",129:\"Malformed Packet\",130:\"Protocol Error\",131:\"Implementation specific error\",135:\"Not authorized\",137:\"Server busy\",139:\"Server shutting down\",141:\"Keep Alive timeout\",142:\"Session taken over\",143:\"Topic Filter invalid\",144:\"Topic Name invalid\",147:\"Receive Maximum exceeded\",148:\"Topic Alias invalid\",149:\"Packet too large\",150:\"Message rate too high\",151:\"Quota exceeded\",152:\"Administrative action\",153:\"Payload format invalid\",154:\"Retain not supported\",155:\"QoS not supported\",156:\"Use another server\",157:\"Server moved\",158:\"Shared Subscriptions not supported\",159:\"Connection rate exceeded\",160:\"Maximum connect time\",161:\"Subscription Identifiers not supported\",162:\"Wildcard Subscriptions not supported\"};L.MQTT5_AUTH_CODES={0:\"Success\",24:\"Continue authentication\",25:\"Re-authenticate\"}});var gd=M((rC,pd)=>{_();v();m();var Kr=1e3,Gr=Kr*60,Qr=Gr*60,br=Qr*24,wm=br*7,_m=br*365.25;pd.exports=function(t,e){e=e||{};var r=typeof t;if(r===\"string\"&&t.length>0)return mm(t);if(r===\"number\"&&isFinite(t))return e.long?Em(t):vm(t);throw new Error(\"val is not a non-empty string or a valid number. val=\"+JSON.stringify(t))};function mm(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),i=(e[2]||\"ms\").toLowerCase();switch(i){case\"years\":case\"year\":case\"yrs\":case\"yr\":case\"y\":return r*_m;case\"weeks\":case\"week\":case\"w\":return r*wm;case\"days\":case\"day\":case\"d\":return r*br;case\"hours\":case\"hour\":case\"hrs\":case\"hr\":case\"h\":return r*Qr;case\"minutes\":case\"minute\":case\"mins\":case\"min\":case\"m\":return r*Gr;case\"seconds\":case\"second\":case\"secs\":case\"sec\":case\"s\":return r*Kr;case\"milliseconds\":case\"millisecond\":case\"msecs\":case\"msec\":case\"ms\":return r;default:return}}}}function vm(t){var e=Math.abs(t);return e>=br?Math.round(t/br)+\"d\":e>=Qr?Math.round(t/Qr)+\"h\":e>=Gr?Math.round(t/Gr)+\"m\":e>=Kr?Math.round(t/Kr)+\"s\":t+\"ms\"}function Em(t){var e=Math.abs(t);return e>=br?Cn(t,e,br,\"day\"):e>=Qr?Cn(t,e,Qr,\"hour\"):e>=Gr?Cn(t,e,Gr,\"minute\"):e>=Kr?Cn(t,e,Kr,\"second\"):t+\" ms\"}function Cn(t,e,r,i){var n=e>=r*1.5;return Math.round(t/r)+\" \"+i+(n?\"s\":\"\")}});var bd=M((uC,yd)=>{_();v();m();function Sm(t){r.debug=r,r.default=r,r.coerce=l,r.disable=o,r.enable=n,r.enabled=s,r.humanize=gd(),r.destroy=c,Object.keys(t).forEach(h=>{r[h]=t[h]}),r.names=[],r.skips=[],r.formatters={};function e(h){let d=0;for(let g=0;g{if(W===\"%%\")return\"%\";U++;let z=r.formatters[K];if(typeof z==\"function\"){let Q=E[U];W=z.call(I,Q),E.splice(U,1),U--}return W}),r.formatArgs.call(I,E),(I.log||r.log).apply(I,E)}return S.namespace=h,S.useColors=r.useColors(),S.color=r.selectColor(h),S.extend=i,S.destroy=r.destroy,Object.defineProperty(S,\"enabled\",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(y!==r.namespaces&&(y=r.namespaces,w=r.enabled(h)),w),set:E=>{g=E}}),typeof r.init==\"function\"&&r.init(S),S}function i(h,d){let g=r(this.namespace+(typeof d>\"u\"?\":\":d)+h);return g.log=this.log,g}function n(h){r.save(h),r.namespaces=h,r.names=[],r.skips=[];let d,g=(typeof h==\"string\"?h:\"\").split(/[\\s,]+/),y=g.length;for(d=0;d\"-\"+d)].join(\",\");return r.enable(\"\"),h}function s(h){if(h[h.length-1]===\"*\")return!0;let d,g;for(d=0,g=r.skips.length;d{_();v();m();xe.formatArgs=Im;xe.save=Tm;xe.load=Rm;xe.useColors=Am;xe.storage=Cm();xe.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn(\"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.\"))}})();xe.colors=[\"#0000CC\",\"#0000FF\",\"#0033CC\",\"#0033FF\",\"#0066CC\",\"#0066FF\",\"#0099CC\",\"#0099FF\",\"#00CC00\",\"#00CC33\",\"#00CC66\",\"#00CC99\",\"#00CCCC\",\"#00CCFF\",\"#3300CC\",\"#3300FF\",\"#3333CC\",\"#3333FF\",\"#3366CC\",\"#3366FF\",\"#3399CC\",\"#3399FF\",\"#33CC00\",\"#33CC33\",\"#33CC66\",\"#33CC99\",\"#33CCCC\",\"#33CCFF\",\"#6600CC\",\"#6600FF\",\"#6633CC\",\"#6633FF\",\"#66CC00\",\"#66CC33\",\"#9900CC\",\"#9900FF\",\"#9933CC\",\"#9933FF\",\"#99CC00\",\"#99CC33\",\"#CC0000\",\"#CC0033\",\"#CC0066\",\"#CC0099\",\"#CC00CC\",\"#CC00FF\",\"#CC3300\",\"#CC3333\",\"#CC3366\",\"#CC3399\",\"#CC33CC\",\"#CC33FF\",\"#CC6600\",\"#CC6633\",\"#CC9900\",\"#CC9933\",\"#CCCC00\",\"#CCCC33\",\"#FF0000\",\"#FF0033\",\"#FF0066\",\"#FF0099\",\"#FF00CC\",\"#FF00FF\",\"#FF3300\",\"#FF3333\",\"#FF3366\",\"#FF3399\",\"#FF33CC\",\"#FF33FF\",\"#FF6600\",\"#FF6633\",\"#FF9900\",\"#FF9933\",\"#FFCC00\",\"#FFCC33\"];function Am(){return typeof window<\"u\"&&window.process&&(window.process.type===\"renderer\"||window.process.__nwjs)?!0:typeof navigator<\"u\"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)?!1:typeof document<\"u\"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<\"u\"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<\"u\"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<\"u\"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/)}function Im(t){if(t[0]=(this.useColors?\"%c\":\"\")+this.namespace+(this.useColors?\" %c\":\" \")+t[0]+(this.useColors?\"%c \":\" \")+\"+\"+Bn.exports.humanize(this.diff),!this.useColors)return;let e=\"color: \"+this.color;t.splice(1,0,e,\"color: inherit\");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,n=>{n!==\"%%\"&&(r++,n===\"%c\"&&(i=r))}),t.splice(i,0,e)}xe.log=console.debug||console.log||(()=>{});function Tm(t){try{t?xe.storage.setItem(\"debug\",t):xe.storage.removeItem(\"debug\")}catch{}}function Rm(){let t;try{t=xe.storage.getItem(\"debug\")}catch{}return!t&&typeof B<\"u\"&&\"env\"in B&&(t=B.env.DEBUG),t}function Cm(){try{return localStorage}catch{}}Bn.exports=bd()(xe);var{formatters:Bm}=Bn.exports;Bm.j=function(t){try{return JSON.stringify(t)}catch(e){return\"[UnexpectedJSONParseError]: \"+e.message}}});var md=M((EC,_d)=>{_();v();m();var Pm=fd(),{EventEmitter:km}=(sr(),X(nr)),wd=hd(),V=Ho(),D=ot()(\"mqtt-packet:parser\"),Vo=class t extends km{constructor(){super(),this.parser=this.constructor.parser}static parser(e){return this instanceof t?(this.settings=e||{},this._states=[\"_parseHeader\",\"_parseLength\",\"_parsePayload\",\"_newPacket\"],this._resetState(),this):new t().parser(e)}_resetState(){D(\"_resetState: resetting packet, error, _list, and _stateCounter\"),this.packet=new wd,this.error=null,this._list=Pm(),this._stateCounter=0}parse(e){for(this.error&&this._resetState(),this._list.append(e),D(\"parse: current state: %s\",this._states[this._stateCounter]);(this.packet.length!==-1||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,D(\"parse: state complete. _stateCounter is now: %d\",this._stateCounter),D(\"parse: packet.length: %d, buffer list length: %d\",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return D(\"parse: exited while loop. packet: %d, buffer list length: %d\",this.packet.length,this._list.length),this._list.length}_parseHeader(){let e=this._list.readUInt8(0),r=e>>V.CMD_SHIFT;this.packet.cmd=V.types[r];let i=e&15,n=V.requiredHeaderFlags[r];return n!=null&&i!==n?this._emitError(new Error(V.requiredHeaderFlagsErrors[r])):(this.packet.retain=(e&V.RETAIN_MASK)!==0,this.packet.qos=e>>V.QOS_SHIFT&V.QOS_MASK,this.packet.qos>2?this._emitError(new Error(\"Packet must not have both QoS bits set to 1\")):(this.packet.dup=(e&V.DUP_MASK)!==0,D(\"_parseHeader: packet: %o\",this.packet),this._list.consume(1),!0))}_parseLength(){let e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),D(\"_parseLength %d\",e.value),!!e}_parsePayload(){D(\"_parsePayload: payload %O\",this._list);let e=!1;if(this.packet.length===0||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case\"connect\":this._parseConnect();break;case\"connack\":this._parseConnack();break;case\"publish\":this._parsePublish();break;case\"puback\":case\"pubrec\":case\"pubrel\":case\"pubcomp\":this._parseConfirmation();break;case\"subscribe\":this._parseSubscribe();break;case\"suback\":this._parseSuback();break;case\"unsubscribe\":this._parseUnsubscribe();break;case\"unsuback\":this._parseUnsuback();break;case\"pingreq\":case\"pingresp\":break;case\"disconnect\":this._parseDisconnect();break;case\"auth\":this._parseAuth();break;default:this._emitError(new Error(\"Not supported\"))}e=!0}return D(\"_parsePayload complete result: %s\",e),e}_parseConnect(){D(\"_parseConnect\");let e,r,i,n,o={},s=this.packet,a=this._parseString();if(a===null)return this._emitError(new Error(\"Cannot parse protocolId\"));if(a!==\"MQTT\"&&a!==\"MQIsdp\")return this._emitError(new Error(\"Invalid protocolId\"));if(s.protocolId=a,this._pos>=this._list.length)return this._emitError(new Error(\"Packet too short\"));if(s.protocolVersion=this._list.readUInt8(this._pos),s.protocolVersion>=128&&(s.bridgeMode=!0,s.protocolVersion=s.protocolVersion-128),s.protocolVersion!==3&&s.protocolVersion!==4&&s.protocolVersion!==5)return this._emitError(new Error(\"Invalid protocol version\"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error(\"Packet too short\"));if(this._list.readUInt8(this._pos)&1)return this._emitError(new Error(\"Connect flag bit 0 must be 0, but got 1\"));o.username=this._list.readUInt8(this._pos)&V.USERNAME_MASK,o.password=this._list.readUInt8(this._pos)&V.PASSWORD_MASK,o.will=this._list.readUInt8(this._pos)&V.WILL_FLAG_MASK;let l=!!(this._list.readUInt8(this._pos)&V.WILL_RETAIN_MASK),c=(this._list.readUInt8(this._pos)&V.WILL_QOS_MASK)>>V.WILL_QOS_SHIFT;if(o.will)s.will={},s.will.retain=l,s.will.qos=c;else{if(l)return this._emitError(new Error(\"Will Retain Flag must be set to zero when Will Flag is set to 0\"));if(c)return this._emitError(new Error(\"Will QoS must be set to zero when Will Flag is set to 0\"))}if(s.clean=(this._list.readUInt8(this._pos)&V.CLEAN_SESSION_MASK)!==0,this._pos++,s.keepalive=this._parseNum(),s.keepalive===-1)return this._emitError(new Error(\"Packet too short\"));if(s.protocolVersion===5){let d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(s.properties=d)}let h=this._parseString();if(h===null)return this._emitError(new Error(\"Packet too short\"));if(s.clientId=h,D(\"_parseConnect: packet.clientId: %s\",s.clientId),o.will){if(s.protocolVersion===5){let d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(s.will.properties=d)}if(e=this._parseString(),e===null)return this._emitError(new Error(\"Cannot parse will topic\"));if(s.will.topic=e,D(\"_parseConnect: packet.will.topic: %s\",s.will.topic),r=this._parseBuffer(),r===null)return this._emitError(new Error(\"Cannot parse will payload\"));s.will.payload=r,D(\"_parseConnect: packet.will.paylaod: %s\",s.will.payload)}if(o.username){if(n=this._parseString(),n===null)return this._emitError(new Error(\"Cannot parse username\"));s.username=n,D(\"_parseConnect: packet.username: %s\",s.username)}if(o.password){if(i=this._parseBuffer(),i===null)return this._emitError(new Error(\"Cannot parse password\"));s.password=i}return this.settings=s,D(\"_parseConnect: complete\"),s}_parseConnack(){D(\"_parseConnack\");let e=this.packet;if(this._list.length<1)return null;let r=this._list.readUInt8(this._pos++);if(r>1)return this._emitError(new Error(\"Invalid connack flags, bits 7-1 must be set to 0\"));if(e.sessionPresent=!!(r&V.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?e.reasonCode=this._list.readUInt8(this._pos++):e.reasonCode=0;else{if(this._list.length<2)return null;e.returnCode=this._list.readUInt8(this._pos++)}if(e.returnCode===-1||e.reasonCode===-1)return this._emitError(new Error(\"Cannot parse return code\"));if(this.settings.protocolVersion===5){let i=this._parseProperties();Object.getOwnPropertyNames(i).length&&(e.properties=i)}D(\"_parseConnack: complete\")}_parsePublish(){D(\"_parsePublish\");let e=this.packet;if(e.topic=this._parseString(),e.topic===null)return this._emitError(new Error(\"Cannot parse topic\"));if(!(e.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}e.payload=this._list.slice(this._pos,e.length),D(\"_parsePublish: payload from buffer list: %o\",e.payload)}}_parseSubscribe(){D(\"_parseSubscribe\");let e=this.packet,r,i,n,o,s,a,l;if(e.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(e.properties=c)}if(e.length<=0)return this._emitError(new Error(\"Malformed subscribe, no payload specified\"));for(;this._pos=e.length)return this._emitError(new Error(\"Malformed Subscribe Payload\"));if(i=this._parseByte(),this.settings.protocolVersion===5){if(i&192)return this._emitError(new Error(\"Invalid subscribe topic flag bits, bits 7-6 must be 0\"))}else if(i&252)return this._emitError(new Error(\"Invalid subscribe topic flag bits, bits 7-2 must be 0\"));if(n=i&V.SUBSCRIBE_OPTIONS_QOS_MASK,n>2)return this._emitError(new Error(\"Invalid subscribe QoS, must be <= 2\"));if(a=(i>>V.SUBSCRIBE_OPTIONS_NL_SHIFT&V.SUBSCRIBE_OPTIONS_NL_MASK)!==0,s=(i>>V.SUBSCRIBE_OPTIONS_RAP_SHIFT&V.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,o=i>>V.SUBSCRIBE_OPTIONS_RH_SHIFT&V.SUBSCRIBE_OPTIONS_RH_MASK,o>2)return this._emitError(new Error(\"Invalid retain handling, must be <= 2\"));l={topic:r,qos:n},this.settings.protocolVersion===5?(l.nl=a,l.rap=s,l.rh=o):this.settings.bridgeMode&&(l.rh=0,l.rap=!0,l.nl=!0),D(\"_parseSubscribe: push subscription `%s` to subscription\",l),e.subscriptions.push(l)}}}_parseSuback(){D(\"_parseSuback\");let e=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}if(e.length<=0)return this._emitError(new Error(\"Malformed suback, no payload specified\"));for(;this._pos2&&r!==128)return this._emitError(new Error(\"Invalid suback QoS, must be 0, 1, 2 or 128\"));this.packet.granted.push(r)}}}_parseUnsubscribe(){D(\"_parseUnsubscribe\");let e=this.packet;if(e.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}if(e.length<=0)return this._emitError(new Error(\"Malformed unsubscribe, no payload specified\"));for(;this._pos2){switch(e.reasonCode=this._parseByte(),this.packet.cmd){case\"puback\":case\"pubrec\":if(!V.MQTT5_PUBACK_PUBREC_CODES[e.reasonCode])return this._emitError(new Error(\"Invalid \"+this.packet.cmd+\" reason code\"));break;case\"pubrel\":case\"pubcomp\":if(!V.MQTT5_PUBREL_PUBCOMP_CODES[e.reasonCode])return this._emitError(new Error(\"Invalid \"+this.packet.cmd+\" reason code\"));break}D(\"_parseConfirmation: packet.reasonCode `%d`\",e.reasonCode)}else e.reasonCode=0;if(e.length>3){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}}return!0}_parseDisconnect(){let e=this.packet;if(D(\"_parseDisconnect\"),this.settings.protocolVersion===5){this._list.length>0?(e.reasonCode=this._parseByte(),V.MQTT5_DISCONNECT_CODES[e.reasonCode]||this._emitError(new Error(\"Invalid disconnect reason code\"))):e.reasonCode=0;let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}return D(\"_parseDisconnect result: true\"),!0}_parseAuth(){D(\"_parseAuth\");let e=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error(\"Not supported auth packet for this version MQTT\"));if(e.reasonCode=this._parseByte(),!V.MQTT5_AUTH_CODES[e.reasonCode])return this._emitError(new Error(\"Invalid auth reason code\"));let r=this._parseProperties();return Object.getOwnPropertyNames(r).length&&(e.properties=r),D(\"_parseAuth: result: true\"),!0}_parseMessageId(){let e=this.packet;return e.messageId=this._parseNum(),e.messageId===null?(this._emitError(new Error(\"Cannot parse messageId\")),!1):(D(\"_parseMessageId: packet.messageId %d\",e.messageId),!0)}_parseString(e){let r=this._parseNum(),i=r+this._pos;if(r===-1||i>this._list.length||i>this.packet.length)return null;let n=this._list.toString(\"utf8\",this._pos,i);return this._pos+=r,D(\"_parseString: result: %s\",n),n}_parseStringPair(){return D(\"_parseStringPair\"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){let e=this._parseNum(),r=e+this._pos;if(e===-1||r>this._list.length||r>this.packet.length)return null;let i=this._list.slice(this._pos,r);return this._pos+=e,D(\"_parseBuffer: result: %o\",i),i}_parseNum(){if(this._list.length-this._pos<2)return-1;let e=this._list.readUInt16BE(this._pos);return this._pos+=2,D(\"_parseNum: result: %s\",e),e}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;let e=this._list.readUInt32BE(this._pos);return this._pos+=4,D(\"_parse4ByteNum: result: %s\",e),e}_parseVarByteNum(e){D(\"_parseVarByteNum\");let r=4,i=0,n=1,o=0,s=!1,a,l=this._pos?this._pos:0;for(;i=i&&this._emitError(new Error(\"Invalid variable byte integer\")),l&&(this._pos+=i),s?e?s={bytes:i,value:o}:s=o:s=!1,D(\"_parseVarByteNum: result: %o\",s),s}_parseByte(){let e;return this._pos{_();v();m();var{Buffer:Si}=(be(),X(me)),Om=65536,vd={},xm=Si.isBuffer(Si.from([1,2]).subarray(0,1));function Ed(t){let e=Si.allocUnsafe(2);return e.writeUInt8(t>>8,0),e.writeUInt8(t&255,0+1),e}function Mm(){for(let t=0;t0&&(r=r|128),n.writeUInt8(r,i++);while(t>0&&i<4);return t>0&&(i=0),xm?n.subarray(0,i):n.slice(0,i)}function Um(t){let e=Si.allocUnsafe(4);return e.writeUInt32BE(t,0),e}Sd.exports={cache:vd,generateCache:Mm,generateNumber:Ed,genBufVariableByteInt:Lm,generate4ByteBuffer:Um}});var Id=M((UC,zo)=>{\"use strict\";_();v();m();typeof B>\"u\"||!B.version||B.version.indexOf(\"v0.\")===0||B.version.indexOf(\"v1.\")===0&&B.version.indexOf(\"v1.8.\")!==0?zo.exports={nextTick:Nm}:zo.exports=B;function Nm(t,e,r,i){if(typeof t!=\"function\")throw new TypeError('\"callback\" argument must be a function');var n=arguments.length,o,s;switch(n){case 0:case 1:return B.nextTick(t);case 2:return B.nextTick(function(){t.call(null,e)});case 3:return B.nextTick(function(){t.call(null,e,r)});case 4:return B.nextTick(function(){t.call(null,e,r,i)});default:for(o=new Array(n-1),s=0;s{_();v();m();var j=Ho(),{Buffer:q}=(be(),X(me)),qm=q.allocUnsafe(0),Dm=q.from([0]),Ai=Ad(),jm=Id().nextTick,qe=ot()(\"mqtt-packet:writeToStream\"),Pn=Ai.cache,Fm=Ai.generateNumber,Wm=Ai.generateCache,Ko=Ai.genBufVariableByteInt,$m=Ai.generate4ByteBuffer,Te=Go,kn=!0;function kd(t,e,r){switch(qe(\"generate called\"),e.cork&&(e.cork(),jm(Hm,e)),kn&&(kn=!1,Wm()),qe(\"generate: packet.cmd: %s\",t.cmd),t.cmd){case\"connect\":return Vm(t,e,r);case\"connack\":return zm(t,e,r);case\"publish\":return Km(t,e,r);case\"puback\":case\"pubrec\":case\"pubrel\":case\"pubcomp\":return Gm(t,e,r);case\"subscribe\":return Qm(t,e,r);case\"suback\":return Ym(t,e,r);case\"unsubscribe\":return Jm(t,e,r);case\"unsuback\":return Xm(t,e,r);case\"pingreq\":case\"pingresp\":return Zm(t,e,r);case\"disconnect\":return e1(t,e,r);case\"auth\":return t1(t,e,r);default:return e.destroy(new Error(\"Unknown command\")),!1}}Object.defineProperty(kd,\"cacheNumbers\",{get(){return Te===Go},set(t){t?((!Pn||Object.keys(Pn).length===0)&&(kn=!0),Te=Go):(kn=!1,Te=r1)}});function Hm(t){t.uncork()}function Vm(t,e,r){let i=t||{},n=i.protocolId||\"MQTT\",o=i.protocolVersion||4,s=i.will,a=i.clean,l=i.keepalive||0,c=i.clientId||\"\",h=i.username,d=i.password,g=i.properties;a===void 0&&(a=!0);let y=0;if(!n||typeof n!=\"string\"&&!q.isBuffer(n))return e.destroy(new Error(\"Invalid protocolId\")),!1;if(y+=n.length+2,o!==3&&o!==4&&o!==5)return e.destroy(new Error(\"Invalid protocol version\")),!1;if(y+=1,(typeof c==\"string\"||q.isBuffer(c))&&(c||o>=4)&&(c||a))y+=q.byteLength(c)+2;else{if(o<4)return e.destroy(new Error(\"clientId must be supplied before 3.1.1\")),!1;if(a*1===0)return e.destroy(new Error(\"clientId must be given if cleanSession set to 0\")),!1}if(typeof l!=\"number\"||l<0||l>65535||l%1!==0)return e.destroy(new Error(\"Invalid keepalive\")),!1;y+=2,y+=1;let w,S;if(o===5){if(w=Wt(e,g),!w)return!1;y+=w.length}if(s){if(typeof s!=\"object\")return e.destroy(new Error(\"Invalid will\")),!1;if(!s.topic||typeof s.topic!=\"string\")return e.destroy(new Error(\"Invalid will topic\")),!1;if(y+=q.byteLength(s.topic)+2,y+=2,s.payload)if(s.payload.length>=0)typeof s.payload==\"string\"?y+=q.byteLength(s.payload):y+=s.payload.length;else return e.destroy(new Error(\"Invalid will payload\")),!1;if(S={},o===5){if(S=Wt(e,s.properties),!S)return!1;y+=S.length}}let E=!1;if(h!=null)if(Pd(h))E=!0,y+=q.byteLength(h)+2;else return e.destroy(new Error(\"Invalid username\")),!1;if(d!=null){if(!E)return e.destroy(new Error(\"Username is required to use password\")),!1;if(Pd(d))y+=Od(d)+2;else return e.destroy(new Error(\"Invalid password\")),!1}e.write(j.CONNECT_HEADER),De(e,y),Yr(e,n),i.bridgeMode&&(o+=128),e.write(o===131?j.VERSION131:o===132?j.VERSION132:o===4?j.VERSION4:o===5?j.VERSION5:j.VERSION3);let I=0;return I|=h!=null?j.USERNAME_MASK:0,I|=d!=null?j.PASSWORD_MASK:0,I|=s&&s.retain?j.WILL_RETAIN_MASK:0,I|=s&&s.qos?s.qos<0&&Te(e,c),g?.write(),qe(\"publish: payload: %o\",l),e.write(l)}function Gm(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.cmd||\"puback\",s=n.messageId,a=n.dup&&o===\"pubrel\"?j.DUP_MASK:0,l=0,c=n.reasonCode,h=n.properties,d=i===5?3:2;if(o===\"pubrel\"&&(l=1),typeof s!=\"number\")return e.destroy(new Error(\"Invalid messageId\")),!1;let g=null;if(i===5&&typeof h==\"object\"){if(g=Ii(e,h,r,d),!g)return!1;d+=g.length}return e.write(j.ACKS[o][l][a][0]),d===3&&(d+=c!==0?1:-1),De(e,d),Te(e,s),i===5&&d!==2&&e.write(q.from([c])),g!==null?g.write():d===4&&e.write(q.from([0])),!0}function Qm(t,e,r){qe(\"subscribe: packet: \");let i=r?r.protocolVersion:4,n=t||{},o=n.dup?j.DUP_MASK:0,s=n.messageId,a=n.subscriptions,l=n.properties,c=0;if(typeof s!=\"number\")return e.destroy(new Error(\"Invalid messageId\")),!1;c+=2;let h=null;if(i===5){if(h=Wt(e,l),!h)return!1;c+=h.length}if(typeof a==\"object\"&&a.length)for(let g=0;g2)return e.destroy(new Error(\"Invalid subscriptions - invalid Retain Handling\")),!1}c+=q.byteLength(y)+2+1}else return e.destroy(new Error(\"Invalid subscriptions\")),!1;qe(\"subscribe: writing to stream: %o\",j.SUBSCRIBE_HEADER),e.write(j.SUBSCRIBE_HEADER[1][o?1:0][0]),De(e,c),Te(e,s),h!==null&&h.write();let d=!0;for(let g of a){let y=g.topic,w=g.qos,S=+g.nl,E=+g.rap,I=g.rh,C;wr(e,y),C=j.SUBSCRIBE_OPTIONS_QOS[w],i===5&&(C|=S?j.SUBSCRIBE_OPTIONS_NL:0,C|=E?j.SUBSCRIBE_OPTIONS_RAP:0,C|=I?j.SUBSCRIBE_OPTIONS_RH[I]:0),d=e.write(q.from([C]))}return d}function Ym(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.messageId,s=n.granted,a=n.properties,l=0;if(typeof o!=\"number\")return e.destroy(new Error(\"Invalid messageId\")),!1;if(l+=2,typeof s==\"object\"&&s.length)for(let h=0;hj.VARBYTEINT_MAX)return t.destroy(new Error(`Invalid variable byte integer: ${e}`)),!1;let r=Td[e];return r||(r=Ko(e),e<16384&&(Td[e]=r)),qe(\"writeVarByteInt: writing to stream: %o\",r),t.write(r)}function wr(t,e){let r=q.byteLength(e);return Te(t,r),qe(\"writeString: %s\",e),t.write(e,\"utf8\")}function Rd(t,e,r){wr(t,e),wr(t,r)}function Go(t,e){return qe(\"writeNumberCached: number: %d\",e),qe(\"writeNumberCached: %o\",Pn[e]),t.write(Pn[e])}function r1(t,e){let r=Fm(e);return qe(\"writeNumberGenerated: %o\",r),t.write(r)}function i1(t,e){let r=$m(e);return qe(\"write4ByteNumber: %o\",r),t.write(r)}function Yr(t,e){typeof e==\"string\"?wr(t,e):e?(Te(t,e.length),t.write(e)):Te(t,0)}function Wt(t,e){if(typeof e!=\"object\"||e.length!=null)return{length:1,write(){Bd(t,{},0)}};let r=0;function i(o,s){let a=j.propertiesTypes[o],l=0;switch(a){case\"byte\":{if(typeof s!=\"boolean\")return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+1;break}case\"int8\":{if(typeof s!=\"number\"||s<0||s>255)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+1;break}case\"binary\":{if(s&&s===null)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+q.byteLength(s)+2;break}case\"int16\":{if(typeof s!=\"number\"||s<0||s>65535)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+2;break}case\"int32\":{if(typeof s!=\"number\"||s<0||s>4294967295)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+4;break}case\"var\":{if(typeof s!=\"number\"||s<0||s>268435455)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+q.byteLength(Ko(s));break}case\"string\":{if(typeof s!=\"string\")return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+2+q.byteLength(s.toString());break}case\"pair\":{if(typeof s!=\"object\")return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=Object.getOwnPropertyNames(s).reduce((c,h)=>{let d=s[h];return Array.isArray(d)?c+=d.reduce((g,y)=>(g+=1+2+q.byteLength(h.toString())+2+q.byteLength(y.toString()),g),0):c+=1+2+q.byteLength(h.toString())+2+q.byteLength(s[h].toString()),c},0);break}default:return t.destroy(new Error(`Invalid property ${o}: ${s}`)),!1}return l}if(e)for(let o in e){let s=0,a=0,l=e[o];if(Array.isArray(l))for(let c=0;co;){let a=n.shift();if(a&&e[a])delete e[a],s=Wt(t,e);else return!1}return s}function Cd(t,e,r){switch(j.propertiesTypes[e]){case\"byte\":{t.write(q.from([j.properties[e]])),t.write(q.from([+r]));break}case\"int8\":{t.write(q.from([j.properties[e]])),t.write(q.from([r]));break}case\"binary\":{t.write(q.from([j.properties[e]])),Yr(t,r);break}case\"int16\":{t.write(q.from([j.properties[e]])),Te(t,r);break}case\"int32\":{t.write(q.from([j.properties[e]])),i1(t,r);break}case\"var\":{t.write(q.from([j.properties[e]])),De(t,r);break}case\"string\":{t.write(q.from([j.properties[e]])),wr(t,r);break}case\"pair\":{Object.getOwnPropertyNames(r).forEach(n=>{let o=r[n];Array.isArray(o)?o.forEach(s=>{t.write(q.from([j.properties[e]])),Rd(t,n.toString(),s.toString())}):(t.write(q.from([j.properties[e]])),Rd(t,n.toString(),o.toString()))});break}default:return t.destroy(new Error(`Invalid property ${e} value: ${r}`)),!1}}function Bd(t,e,r){De(t,r);for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!==null){let n=e[i];if(Array.isArray(n))for(let o=0;o{_();v();m();var n1=Qo(),{EventEmitter:s1}=(sr(),X(nr)),{Buffer:Md}=(be(),X(me));function o1(t,e){let r=new Yo;return n1(t,r,e),r.concat()}var Yo=class extends s1{constructor(){super(),this._array=new Array(20),this._i=0}write(e){return this._array[this._i++]=e,!0}concat(){let e=0,r=new Array(this._array.length),i=this._array,n=0,o;for(o=0;o{_();v();m();On.parser=md().parser;On.generate=Ud();On.writeToStream=Qo()});var Zo=M(Xo=>{\"use strict\";_();v();m();Object.defineProperty(Xo,\"__esModule\",{value:!0});var Jo=class{constructor(){this.nextId=Math.max(1,Math.floor(Math.random()*65535))}allocate(){let e=this.nextId++;return this.nextId===65536&&(this.nextId=1),e}getLastAllocated(){return this.nextId===1?65535:this.nextId-1}register(e){return!0}deallocate(e){}clear(){}};Xo.default=Jo});var Dd=M((bB,qd)=>{\"use strict\";_();v();m();qd.exports=a1;function Jr(t){return t instanceof x?x.from(t):new t.constructor(t.buffer.slice(),t.byteOffset,t.length)}function a1(t){if(t=t||{},t.circles)return l1(t);return t.proto?i:r;function e(n,o){for(var s=Object.keys(n),a=new Array(s.length),l=0;l{\"use strict\";_();v();m();jd.exports=Dd()()});var $d=M(Xr=>{\"use strict\";_();v();m();Object.defineProperty(Xr,\"__esModule\",{value:!0});Xr.validateTopics=Xr.validateTopic=void 0;function Wd(t){let e=t.split(\"/\");for(let r=0;r{\"use strict\";_();v();m();Object.defineProperty(ta,\"__esModule\",{value:!0});var f1=jt(),c1={objectMode:!0},h1={clean:!0},ea=class{constructor(e){this.options=e||{},this.options=Object.assign(Object.assign({},h1),e),this._inflights=new Map}put(e,r){return this._inflights.set(e.messageId,e),r&&r(),this}createStream(){let e=new f1.Readable(c1),r=[],i=!1,n=0;return this._inflights.forEach((o,s)=>{r.push(o)}),e._read=()=>{!i&&n{if(!i)return i=!0,setTimeout(()=>{e.emit(\"close\")},0),e},e}del(e,r){let i=this._inflights.get(e.messageId);return i?(this._inflights.delete(e.messageId),r(null,i)):r&&r(new Error(\"missing packet\")),this}get(e,r){let i=this._inflights.get(e.messageId);return i?r(null,i):r&&r(new Error(\"missing packet\")),this}close(e){this.options.clean&&(this._inflights=null),e&&e()}};ta.default=ea});var Vd=M(ia=>{\"use strict\";_();v();m();Object.defineProperty(ia,\"__esModule\",{value:!0});var Hd=[0,16,128,131,135,144,145,151,153],d1=(t,e,r)=>{t.log(\"handlePublish: packet %o\",e),r=typeof r<\"u\"?r:t.noop;let i=e.topic.toString(),n=e.payload,{qos:o}=e,{messageId:s}=e,{options:a}=t;if(t.options.protocolVersion===5){let l;if(e.properties&&(l=e.properties.topicAlias),typeof l<\"u\")if(i.length===0)if(l>0&&l<=65535){let c=t.topicAliasRecv.getTopicByAlias(l);if(c)i=c,t.log(\"handlePublish :: topic complemented by alias. topic: %s - alias: %d\",i,l);else{t.log(\"handlePublish :: unregistered topic alias. alias: %d\",l),t.emit(\"error\",new Error(\"Received unregistered Topic Alias\"));return}}else{t.log(\"handlePublish :: topic alias out of range. alias: %d\",l),t.emit(\"error\",new Error(\"Received Topic Alias is out of range\"));return}else if(t.topicAliasRecv.put(i,l))t.log(\"handlePublish :: registered topic: %s - alias: %d\",i,l);else{t.log(\"handlePublish :: topic alias out of range. alias: %d\",l),t.emit(\"error\",new Error(\"Received Topic Alias is out of range\"));return}}switch(t.log(\"handlePublish: qos %d\",o),o){case 2:{a.customHandleAcks(i,n,e,(l,c)=>{if(typeof l==\"number\"&&(c=l,l=null),l)return t.emit(\"error\",l);if(Hd.indexOf(c)===-1)return t.emit(\"error\",new Error(\"Wrong reason code for pubrec\"));c?t._sendPacket({cmd:\"pubrec\",messageId:s,reasonCode:c},r):t.incomingStore.put(e,()=>{t._sendPacket({cmd:\"pubrec\",messageId:s},r)})});break}case 1:{a.customHandleAcks(i,n,e,(l,c)=>{if(typeof l==\"number\"&&(c=l,l=null),l)return t.emit(\"error\",l);if(Hd.indexOf(c)===-1)return t.emit(\"error\",new Error(\"Wrong reason code for puback\"));c||t.emit(\"message\",i,n,e),t.handleMessage(e,h=>{if(h)return r&&r(h);t._sendPacket({cmd:\"puback\",messageId:s,reasonCode:c},r)})});break}case 0:t.emit(\"message\",i,n,e),t.handleMessage(e,r);break;default:t.log(\"handlePublish: unknown QoS. Doing nothing.\");break}};ia.default=d1});var zd=M((XB,p1)=>{p1.exports={version:\"5.10.3\"}});var _r=M(at=>{\"use strict\";_();v();m();Object.defineProperty(at,\"__esModule\",{value:!0});at.MQTTJS_VERSION=at.nextTick=at.applyMixin=at.ErrorWithReasonCode=void 0;var na=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype),Object.getPrototypeOf(this).name=\"ErrorWithReasonCode\"}};at.ErrorWithReasonCode=na;function g1(t,e,r=!1){var i;let n=[e];for(;;){let o=n[0],s=Object.getPrototypeOf(o);if(s?.prototype)n.unshift(s);else break}for(let o of n)for(let s of Object.getOwnPropertyNames(o.prototype))(r||s!==\"constructor\")&&Object.defineProperty(t.prototype,s,(i=Object.getOwnPropertyDescriptor(o.prototype,s))!==null&&i!==void 0?i:Object.create(null))}at.applyMixin=g1;at.nextTick=typeof(B===null||B===void 0?void 0:B.nextTick)==\"function\"?B.nextTick:t=>{setTimeout(t,0)};at.MQTTJS_VERSION=zd().version});var Ti=M($t=>{\"use strict\";_();v();m();Object.defineProperty($t,\"__esModule\",{value:!0});$t.ReasonCodes=void 0;var Kd=_r();$t.ReasonCodes={0:\"\",1:\"Unacceptable protocol version\",2:\"Identifier rejected\",3:\"Server unavailable\",4:\"Bad username or password\",5:\"Not authorized\",16:\"No matching subscribers\",17:\"No subscription existed\",128:\"Unspecified error\",129:\"Malformed Packet\",130:\"Protocol Error\",131:\"Implementation specific error\",132:\"Unsupported Protocol Version\",133:\"Client Identifier not valid\",134:\"Bad User Name or Password\",135:\"Not authorized\",136:\"Server unavailable\",137:\"Server busy\",138:\"Banned\",139:\"Server shutting down\",140:\"Bad authentication method\",141:\"Keep Alive timeout\",142:\"Session taken over\",143:\"Topic Filter invalid\",144:\"Topic Name invalid\",145:\"Packet identifier in use\",146:\"Packet Identifier not found\",147:\"Receive Maximum exceeded\",148:\"Topic Alias invalid\",149:\"Packet too large\",150:\"Message rate too high\",151:\"Quota exceeded\",152:\"Administrative action\",153:\"Payload format invalid\",154:\"Retain not supported\",155:\"QoS not supported\",156:\"Use another server\",157:\"Server moved\",158:\"Shared Subscriptions not supported\",159:\"Connection rate exceeded\",160:\"Maximum connect time\",161:\"Subscription Identifiers not supported\",162:\"Wildcard Subscriptions not supported\"};var y1=(t,e)=>{let{messageId:r}=e,i=e.cmd,n=null,o=t.outgoing[r]?t.outgoing[r].cb:null,s=null;if(!o){t.log(\"_handleAck :: Server sent an ack in error. Ignoring.\");return}switch(t.log(\"_handleAck :: packet type\",i),i){case\"pubcomp\":case\"puback\":{let a=e.reasonCode;a&&a>0&&a!==16?(s=new Kd.ErrorWithReasonCode(`Publish error: ${$t.ReasonCodes[a]}`,a),t._removeOutgoingAndStoreMessage(r,()=>{o(s,e)})):t._removeOutgoingAndStoreMessage(r,o);break}case\"pubrec\":{n={cmd:\"pubrel\",qos:2,messageId:r};let a=e.reasonCode;a&&a>0&&a!==16?(s=new Kd.ErrorWithReasonCode(`Publish error: ${$t.ReasonCodes[a]}`,a),t._removeOutgoingAndStoreMessage(r,()=>{o(s,e)})):t._sendPacket(n);break}case\"suback\":{delete t.outgoing[r],t.messageIdProvider.deallocate(r);let a=e.granted;for(let l=0;l{delete t._resubscribeTopics[d]})}}delete t.messageIdToTopic[r],t._invokeStoreProcessingQueue(),o(s,e);break}case\"unsuback\":{delete t.outgoing[r],t.messageIdProvider.deallocate(r),t._invokeStoreProcessingQueue(),o(null,e);break}default:t.emit(\"error\",new Error(\"unrecognized packet type\"))}t.disconnecting&&Object.keys(t.outgoing).length===0&&t.emit(\"outgoingEmpty\")};$t.default=y1});var Qd=M(sa=>{\"use strict\";_();v();m();Object.defineProperty(sa,\"__esModule\",{value:!0});var Gd=_r(),b1=Ti(),w1=(t,e)=>{let{options:r}=t,i=r.protocolVersion,n=i===5?e.reasonCode:e.returnCode;if(i!==5){let o=new Gd.ErrorWithReasonCode(`Protocol error: Auth packets are only supported in MQTT 5. Your version:${i}`,n);t.emit(\"error\",o);return}t.handleAuth(e,(o,s)=>{if(o){t.emit(\"error\",o);return}if(n===24)t.reconnecting=!1,t._sendPacket(s);else{let a=new Gd.ErrorWithReasonCode(`Connection refused: ${b1.ReasonCodes[n]}`,n);t.emit(\"error\",a)}})};sa.default=w1});var ep=M(Mn=>{\"use strict\";_();v();m();Object.defineProperty(Mn,\"__esModule\",{value:!0});Mn.LRUCache=void 0;var Ri=typeof performance==\"object\"&&performance&&typeof performance.now==\"function\"?performance:Date,Jd=new Set,oa=typeof B==\"object\"&&B?B:{},Xd=(t,e,r,i)=>{typeof oa.emitWarning==\"function\"?oa.emitWarning(t,e,r,i):console.error(`[${r}] ${e}: ${t}`)},xn=globalThis.AbortController,Yd=globalThis.AbortSignal;if(typeof xn>\"u\"){Yd=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(i,n){this._onabort.push(n)}},xn=class{constructor(){e()}signal=new Yd;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=!0;for(let n of this.signal._onabort)n(i);this.signal.onabort?.(i)}}};let t=oa.env?.LRU_CACHE_IGNORE_AC_WARNING!==\"1\",e=()=>{t&&(t=!1,Xd(\"AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.\",\"NO_ABORT_CONTROLLER\",\"ENOTSUP\",e))}}var _1=t=>!Jd.has(t),EP=Symbol(\"type\"),Ht=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Zd=t=>Ht(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?Zr:null:null,Zr=class extends Array{constructor(e){super(e),this.fill(0)}},aa=class t{heap;length;static#l=!1;static create(e){let r=Zd(e);if(!r)return[];t.#l=!0;let i=new t(e,r);return t.#l=!1,i}constructor(e,r){if(!t.#l)throw new TypeError(\"instantiate Stack using Stack.create(n)\");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},la=class t{#l;#c;#p;#g;#B;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#y;#n;#r;#e;#u;#h;#a;#s;#b;#o;#E;#S;#w;#_;#I;#f;static unsafeExposeInternals(e){return{starts:e.#S,ttls:e.#w,sizes:e.#E,keyMap:e.#n,keyList:e.#r,valList:e.#e,next:e.#u,prev:e.#h,get head(){return e.#a},get tail(){return e.#s},free:e.#b,isBackgroundFetch:r=>e.#t(r),backgroundFetch:(r,i,n,o)=>e.#O(r,i,n,o),moveToTail:r=>e.#C(r),indexes:r=>e.#m(r),rindexes:r=>e.#v(r),isStale:r=>e.#d(r)}}get max(){return this.#l}get maxSize(){return this.#c}get calculatedSize(){return this.#y}get size(){return this.#i}get fetchMethod(){return this.#B}get dispose(){return this.#p}get disposeAfter(){return this.#g}constructor(e){let{max:r=0,ttl:i,ttlResolution:n=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:a,allowStale:l,dispose:c,disposeAfter:h,noDisposeOnSet:d,noUpdateTTL:g,maxSize:y=0,maxEntrySize:w=0,sizeCalculation:S,fetchMethod:E,noDeleteOnFetchRejection:I,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:R,allowStaleOnFetchAbort:U,ignoreFetchAbort:N}=e;if(r!==0&&!Ht(r))throw new TypeError(\"max option must be a nonnegative integer\");let W=r?Zd(r):Array;if(!W)throw new Error(\"invalid max value: \"+r);if(this.#l=r,this.#c=y,this.maxEntrySize=w||this.#c,this.sizeCalculation=S,this.sizeCalculation){if(!this.#c&&!this.maxEntrySize)throw new TypeError(\"cannot set sizeCalculation without setting maxSize or maxEntrySize\");if(typeof this.sizeCalculation!=\"function\")throw new TypeError(\"sizeCalculation set to non-function\")}if(E!==void 0&&typeof E!=\"function\")throw new TypeError(\"fetchMethod must be a function if specified\");if(this.#B=E,this.#I=!!E,this.#n=new Map,this.#r=new Array(r).fill(void 0),this.#e=new Array(r).fill(void 0),this.#u=new W(r),this.#h=new W(r),this.#a=0,this.#s=0,this.#b=aa.create(r),this.#i=0,this.#y=0,typeof c==\"function\"&&(this.#p=c),typeof h==\"function\"?(this.#g=h,this.#o=[]):(this.#g=void 0,this.#o=void 0),this.#_=!!this.#p,this.#f=!!this.#g,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!g,this.noDeleteOnFetchRejection=!!I,this.allowStaleOnFetchRejection=!!R,this.allowStaleOnFetchAbort=!!U,this.ignoreFetchAbort=!!N,this.maxEntrySize!==0){if(this.#c!==0&&!Ht(this.#c))throw new TypeError(\"maxSize must be a positive integer if specified\");if(!Ht(this.maxEntrySize))throw new TypeError(\"maxEntrySize must be a positive integer if specified\");this.#q()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!a,this.ttlResolution=Ht(n)||n===0?n:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!Ht(this.ttl))throw new TypeError(\"ttl must be a positive integer if specified\");this.#x()}if(this.#l===0&&this.ttl===0&&this.#c===0)throw new TypeError(\"At least one of max, maxSize, or ttl is required\");if(!this.ttlAutopurge&&!this.#l&&!this.#c){let K=\"LRU_CACHE_UNBOUNDED\";_1(K)&&(Jd.add(K),Xd(\"TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.\",\"UnboundedCacheWarning\",K,t))}}getRemainingTTL(e){return this.#n.has(e)?1/0:0}#x(){let e=new Zr(this.#l),r=new Zr(this.#l);this.#w=e,this.#S=r,this.#M=(o,s,a=Ri.now())=>{if(r[o]=s!==0?a:0,e[o]=s,s!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#d(o)&&this.delete(this.#r[o])},s+1);l.unref&&l.unref()}},this.#T=o=>{r[o]=e[o]!==0?Ri.now():0},this.#A=(o,s)=>{if(e[s]){let a=e[s],l=r[s];o.ttl=a,o.start=l,o.now=i||n();let c=o.now-l;o.remainingTTL=a-c}};let i=0,n=()=>{let o=Ri.now();if(this.ttlResolution>0){i=o;let s=setTimeout(()=>i=0,this.ttlResolution);s.unref&&s.unref()}return o};this.getRemainingTTL=o=>{let s=this.#n.get(o);if(s===void 0)return 0;let a=e[s],l=r[s];if(a===0||l===0)return 1/0;let c=(i||n())-l;return a-c},this.#d=o=>e[o]!==0&&r[o]!==0&&(i||n())-r[o]>e[o]}#T=()=>{};#A=()=>{};#M=()=>{};#d=()=>!1;#q(){let e=new Zr(this.#l);this.#y=0,this.#E=e,this.#R=r=>{this.#y-=e[r],e[r]=0},this.#L=(r,i,n,o)=>{if(this.#t(i))return 0;if(!Ht(n))if(o){if(typeof o!=\"function\")throw new TypeError(\"sizeCalculation must be a function\");if(n=o(i,r),!Ht(n))throw new TypeError(\"sizeCalculation return invalid (expect positive integer)\")}else throw new TypeError(\"invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.\");return n},this.#P=(r,i,n)=>{if(e[r]=i,this.#c){let o=this.#c-e[r];for(;this.#y>o;)this.#k(!0)}this.#y+=e[r],n&&(n.entrySize=i,n.totalCalculatedSize=this.#y)}}#R=e=>{};#P=(e,r,i)=>{};#L=(e,r,i,n)=>{if(i||n)throw new TypeError(\"cannot set size without setting maxSize or maxEntrySize on cache\");return 0};*#m({allowStale:e=this.allowStale}={}){if(this.#i)for(let r=this.#s;!(!this.#U(r)||((e||!this.#d(r))&&(yield r),r===this.#a));)r=this.#h[r]}*#v({allowStale:e=this.allowStale}={}){if(this.#i)for(let r=this.#a;!(!this.#U(r)||((e||!this.#d(r))&&(yield r),r===this.#s));)r=this.#u[r]}#U(e){return e!==void 0&&this.#n.get(this.#r[e])===e}*entries(){for(let e of this.#m())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*rentries(){for(let e of this.#v())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*keys(){for(let e of this.#m()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r)}}*rkeys(){for(let e of this.#v()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r)}}*values(){for(let e of this.#m())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}*rvalues(){for(let e of this.#v())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}[Symbol.iterator](){return this.entries()}find(e,r={}){for(let i of this.#m()){let n=this.#e[i],o=this.#t(n)?n.__staleWhileFetching:n;if(o!==void 0&&e(o,this.#r[i],this))return this.get(this.#r[i],r)}}forEach(e,r=this){for(let i of this.#m()){let n=this.#e[i],o=this.#t(n)?n.__staleWhileFetching:n;o!==void 0&&e.call(r,o,this.#r[i],this)}}rforEach(e,r=this){for(let i of this.#v()){let n=this.#e[i],o=this.#t(n)?n.__staleWhileFetching:n;o!==void 0&&e.call(r,o,this.#r[i],this)}}purgeStale(){let e=!1;for(let r of this.#v({allowStale:!0}))this.#d(r)&&(this.delete(this.#r[r]),e=!0);return e}dump(){let e=[];for(let r of this.#m({allowStale:!0})){let i=this.#r[r],n=this.#e[r],o=this.#t(n)?n.__staleWhileFetching:n;if(o===void 0||i===void 0)continue;let s={value:o};if(this.#w&&this.#S){s.ttl=this.#w[r];let a=Ri.now()-this.#S[r];s.start=Math.floor(Date.now()-a)}this.#E&&(s.size=this.#E[r]),e.unshift([i,s])}return e}load(e){this.clear();for(let[r,i]of e){if(i.start){let n=Date.now()-i.start;i.start=Ri.now()-n}this.set(r,i.value,i)}}set(e,r,i={}){if(r===void 0)return this.delete(e),this;let{ttl:n=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=i,{noUpdateTTL:c=this.noUpdateTTL}=i,h=this.#L(e,r,i.size||0,a);if(this.maxEntrySize&&h>this.maxEntrySize)return l&&(l.set=\"miss\",l.maxEntrySizeExceeded=!0),this.delete(e),this;let d=this.#i===0?void 0:this.#n.get(e);if(d===void 0)d=this.#i===0?this.#s:this.#b.length!==0?this.#b.pop():this.#i===this.#l?this.#k(!1):this.#i,this.#r[d]=e,this.#e[d]=r,this.#n.set(e,d),this.#u[this.#s]=d,this.#h[d]=this.#s,this.#s=d,this.#i++,this.#P(d,h,l),l&&(l.set=\"add\"),c=!1;else{this.#C(d);let g=this.#e[d];if(r!==g){if(this.#I&&this.#t(g)){g.__abortController.abort(new Error(\"replaced\"));let{__staleWhileFetching:y}=g;y!==void 0&&!s&&(this.#_&&this.#p?.(y,e,\"set\"),this.#f&&this.#o?.push([y,e,\"set\"]))}else s||(this.#_&&this.#p?.(g,e,\"set\"),this.#f&&this.#o?.push([g,e,\"set\"]));if(this.#R(d),this.#P(d,h,l),this.#e[d]=r,l){l.set=\"replace\";let y=g&&this.#t(g)?g.__staleWhileFetching:g;y!==void 0&&(l.oldValue=y)}}else l&&(l.set=\"update\")}if(n!==0&&!this.#w&&this.#x(),this.#w&&(c||this.#M(d,n,o),l&&this.#A(l,d)),!s&&this.#f&&this.#o){let g=this.#o,y;for(;y=g?.shift();)this.#g?.(...y)}return this}pop(){try{for(;this.#i;){let e=this.#e[this.#a];if(this.#k(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#o){let e=this.#o,r;for(;r=e?.shift();)this.#g?.(...r)}}}#k(e){let r=this.#a,i=this.#r[r],n=this.#e[r];return this.#I&&this.#t(n)?n.__abortController.abort(new Error(\"evicted\")):(this.#_||this.#f)&&(this.#_&&this.#p?.(n,i,\"evict\"),this.#f&&this.#o?.push([n,i,\"evict\"])),this.#R(r),e&&(this.#r[r]=void 0,this.#e[r]=void 0,this.#b.push(r)),this.#i===1?(this.#a=this.#s=0,this.#b.length=0):this.#a=this.#u[r],this.#n.delete(i),this.#i--,r}has(e,r={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:n}=r,o=this.#n.get(e);if(o!==void 0){let s=this.#e[o];if(this.#t(s)&&s.__staleWhileFetching===void 0)return!1;if(this.#d(o))n&&(n.has=\"stale\",this.#A(n,o));else return i&&this.#T(o),n&&(n.has=\"hit\",this.#A(n,o)),!0}else n&&(n.has=\"miss\");return!1}peek(e,r={}){let{allowStale:i=this.allowStale}=r,n=this.#n.get(e);if(n!==void 0&&(i||!this.#d(n))){let o=this.#e[n];return this.#t(o)?o.__staleWhileFetching:o}}#O(e,r,i,n){let o=r===void 0?void 0:this.#e[r];if(this.#t(o))return o;let s=new xn,{signal:a}=i;a?.addEventListener(\"abort\",()=>s.abort(a.reason),{signal:s.signal});let l={signal:s.signal,options:i,context:n},c=(S,E=!1)=>{let{aborted:I}=s.signal,C=i.ignoreFetchAbort&&S!==void 0;if(i.status&&(I&&!E?(i.status.fetchAborted=!0,i.status.fetchError=s.signal.reason,C&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),I&&!C&&!E)return d(s.signal.reason);let R=y;return this.#e[r]===y&&(S===void 0?R.__staleWhileFetching?this.#e[r]=R.__staleWhileFetching:this.delete(e):(i.status&&(i.status.fetchUpdated=!0),this.set(e,S,l.options))),S},h=S=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=S),d(S)),d=S=>{let{aborted:E}=s.signal,I=E&&i.allowStaleOnFetchAbort,C=I||i.allowStaleOnFetchRejection,R=C||i.noDeleteOnFetchRejection,U=y;if(this.#e[r]===y&&(!R||U.__staleWhileFetching===void 0?this.delete(e):I||(this.#e[r]=U.__staleWhileFetching)),C)return i.status&&U.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),U.__staleWhileFetching;if(U.__returned===U)throw S},g=(S,E)=>{let I=this.#B?.(e,o,l);I&&I instanceof Promise&&I.then(C=>S(C===void 0?void 0:C),E),s.signal.addEventListener(\"abort\",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(S(void 0),i.allowStaleOnFetchAbort&&(S=C=>c(C,!0)))})};i.status&&(i.status.fetchDispatched=!0);let y=new Promise(g).then(c,h),w=Object.assign(y,{__abortController:s,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(e,w,{...l.options,status:void 0}),r=this.#n.get(e)):this.#e[r]=w,w}#t(e){if(!this.#I)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty(\"__staleWhileFetching\")&&r.__abortController instanceof xn}async fetch(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:l=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:h=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:g=this.allowStaleOnFetchRejection,ignoreFetchAbort:y=this.ignoreFetchAbort,allowStaleOnFetchAbort:w=this.allowStaleOnFetchAbort,context:S,forceRefresh:E=!1,status:I,signal:C}=r;if(!this.#I)return I&&(I.fetch=\"get\"),this.get(e,{allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:o,status:I});let R={allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:a,size:l,sizeCalculation:c,noUpdateTTL:h,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:w,ignoreFetchAbort:y,status:I,signal:C},U=this.#n.get(e);if(U===void 0){I&&(I.fetch=\"miss\");let N=this.#O(e,U,R,S);return N.__returned=N}else{let N=this.#e[U];if(this.#t(N)){let pe=i&&N.__staleWhileFetching!==void 0;return I&&(I.fetch=\"inflight\",pe&&(I.returnedStale=!0)),pe?N.__staleWhileFetching:N.__returned=N}let W=this.#d(U);if(!E&&!W)return I&&(I.fetch=\"hit\"),this.#C(U),n&&this.#T(U),I&&this.#A(I,U),N;let K=this.#O(e,U,R,S),Q=K.__staleWhileFetching!==void 0&&i;return I&&(I.fetch=W?\"stale\":\"refresh\",Q&&W&&(I.returnedStale=!0)),Q?K.__staleWhileFetching:K.__returned=K}}get(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=r,a=this.#n.get(e);if(a!==void 0){let l=this.#e[a],c=this.#t(l);return s&&this.#A(s,a),this.#d(a)?(s&&(s.get=\"stale\"),c?(s&&i&&l.__staleWhileFetching!==void 0&&(s.returnedStale=!0),i?l.__staleWhileFetching:void 0):(o||this.delete(e),s&&i&&(s.returnedStale=!0),i?l:void 0)):(s&&(s.get=\"hit\"),c?l.__staleWhileFetching:(this.#C(a),n&&this.#T(a),l))}else s&&(s.get=\"miss\")}#N(e,r){this.#h[r]=e,this.#u[e]=r}#C(e){e!==this.#s&&(e===this.#a?this.#a=this.#u[e]:this.#N(this.#h[e],this.#u[e]),this.#N(this.#s,e),this.#s=e)}delete(e){let r=!1;if(this.#i!==0){let i=this.#n.get(e);if(i!==void 0)if(r=!0,this.#i===1)this.clear();else{this.#R(i);let n=this.#e[i];this.#t(n)?n.__abortController.abort(new Error(\"deleted\")):(this.#_||this.#f)&&(this.#_&&this.#p?.(n,e,\"delete\"),this.#f&&this.#o?.push([n,e,\"delete\"])),this.#n.delete(e),this.#r[i]=void 0,this.#e[i]=void 0,i===this.#s?this.#s=this.#h[i]:i===this.#a?this.#a=this.#u[i]:(this.#u[this.#h[i]]=this.#u[i],this.#h[this.#u[i]]=this.#h[i]),this.#i--,this.#b.push(i)}}if(this.#f&&this.#o?.length){let i=this.#o,n;for(;n=i?.shift();)this.#g?.(...n)}return r}clear(){for(let e of this.#v({allowStale:!0})){let r=this.#e[e];if(this.#t(r))r.__abortController.abort(new Error(\"deleted\"));else{let i=this.#r[e];this.#_&&this.#p?.(r,i,\"delete\"),this.#f&&this.#o?.push([r,i,\"delete\"])}}if(this.#n.clear(),this.#e.fill(void 0),this.#r.fill(void 0),this.#w&&this.#S&&(this.#w.fill(0),this.#S.fill(0)),this.#E&&this.#E.fill(0),this.#a=0,this.#s=0,this.#b.length=0,this.#y=0,this.#i=0,this.#f&&this.#o){let e=this.#o,r;for(;r=e?.shift();)this.#g?.(...r)}}};Mn.LRUCache=la});var lt=M(Vt=>{\"use strict\";_();v();m();Object.defineProperty(Vt,\"t\",{value:!0});Vt.ContainerIterator=Vt.Container=Vt.Base=void 0;var ua=class{constructor(e=0){this.iteratorType=e}equals(e){return this.o===e.o}};Vt.ContainerIterator=ua;var Ln=class{constructor(){this.i=0}get length(){return this.i}size(){return this.i}empty(){return this.i===0}};Vt.Base=Ln;var fa=class extends Ln{};Vt.Container=fa});var tp=M(Un=>{\"use strict\";_();v();m();Object.defineProperty(Un,\"t\",{value:!0});Un.default=void 0;var m1=lt(),ca=class extends m1.Base{constructor(e=[]){super(),this.S=[];let r=this;e.forEach(function(i){r.push(i)})}clear(){this.i=0,this.S=[]}push(e){return this.S.push(e),this.i+=1,this.i}pop(){if(this.i!==0)return this.i-=1,this.S.pop()}top(){return this.S[this.i-1]}},v1=ca;Un.default=v1});var rp=M(Nn=>{\"use strict\";_();v();m();Object.defineProperty(Nn,\"t\",{value:!0});Nn.default=void 0;var E1=lt(),ha=class extends E1.Base{constructor(e=[]){super(),this.j=0,this.q=[];let r=this;e.forEach(function(i){r.push(i)})}clear(){this.q=[],this.i=this.j=0}push(e){let r=this.q.length;if(this.j/r>.5&&this.j+this.i>=r&&r>4096){let i=this.i;for(let n=0;n{\"use strict\";_();v();m();Object.defineProperty(qn,\"t\",{value:!0});qn.default=void 0;var A1=lt(),da=class extends A1.Base{constructor(e=[],r=function(n,o){return n>o?-1:n>1;for(let o=this.i-1>>1;o>=0;--o)this.k(o,n)}m(e){let r=this.C[e];for(;e>0;){let i=e-1>>1,n=this.C[i];if(this.v(n,r)<=0)break;this.C[e]=n,e=i}this.C[e]=r}k(e,r){let i=this.C[e];for(;e0&&(n=o,s=this.C[o]),this.v(s,i)>=0)break;this.C[e]=s,e=n}this.C[e]=i}clear(){this.i=0,this.C.length=0}push(e){this.C.push(e),this.m(this.i),this.i+=1}pop(){if(this.i===0)return;let e=this.C[0],r=this.C.pop();return this.i-=1,this.i&&(this.C[0]=r,this.k(0,this.i>>1)),e}top(){return this.C[0]}find(e){return this.C.indexOf(e)>=0}remove(e){let r=this.C.indexOf(e);return r<0?!1:(r===0?this.pop():r===this.i-1?(this.C.pop(),this.i-=1):(this.C.splice(r,1,this.C.pop()),this.i-=1,this.m(r),this.k(r,this.i>>1)),!0)}updateItem(e){let r=this.C.indexOf(e);return r<0?!1:(this.m(r),this.k(r,this.i>>1),!0)}toArray(){return[...this.C]}},I1=da;qn.default=I1});var jn=M(Dn=>{\"use strict\";_();v();m();Object.defineProperty(Dn,\"t\",{value:!0});Dn.default=void 0;var T1=lt(),pa=class extends T1.Container{},R1=pa;Dn.default=R1});var ut=M(ga=>{\"use strict\";_();v();m();Object.defineProperty(ga,\"t\",{value:!0});ga.throwIteratorAccessError=C1;function C1(){throw new RangeError(\"Iterator access denied!\")}});var ba=M(Wn=>{\"use strict\";_();v();m();Object.defineProperty(Wn,\"t\",{value:!0});Wn.RandomIterator=void 0;var B1=lt(),Fn=ut(),ya=class extends B1.ContainerIterator{constructor(e,r){super(r),this.o=e,this.iteratorType===0?(this.pre=function(){return this.o===0&&(0,Fn.throwIteratorAccessError)(),this.o-=1,this},this.next=function(){return this.o===this.container.size()&&(0,Fn.throwIteratorAccessError)(),this.o+=1,this}):(this.pre=function(){return this.o===this.container.size()-1&&(0,Fn.throwIteratorAccessError)(),this.o+=1,this},this.next=function(){return this.o===-1&&(0,Fn.throwIteratorAccessError)(),this.o-=1,this})}get pointer(){return this.container.getElementByPos(this.o)}set pointer(e){this.container.setElementByPos(this.o,e)}};Wn.RandomIterator=ya});var np=M($n=>{\"use strict\";_();v();m();Object.defineProperty($n,\"t\",{value:!0});$n.default=void 0;var P1=O1(jn()),k1=ba();function O1(t){return t&&t.t?t:{default:t}}var mr=class t extends k1.RandomIterator{constructor(e,r,i){super(e,i),this.container=r}copy(){return new t(this.o,this.container,this.iteratorType)}},wa=class extends P1.default{constructor(e=[],r=!0){if(super(),Array.isArray(e))this.J=r?[...e]:e,this.i=e.length;else{this.J=[];let i=this;e.forEach(function(n){i.pushBack(n)})}}clear(){this.i=0,this.J.length=0}begin(){return new mr(0,this)}end(){return new mr(this.i,this)}rBegin(){return new mr(this.i-1,this,1)}rEnd(){return new mr(-1,this,1)}front(){return this.J[0]}back(){return this.J[this.i-1]}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;return this.J[e]}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;return this.J.splice(e,1),this.i-=1,this.i}eraseElementByValue(e){let r=0;for(let i=0;ithis.i-1)throw new RangeError;this.J[e]=r}insert(e,r,i=1){if(e<0||e>this.i)throw new RangeError;return this.J.splice(e,0,...new Array(i).fill(r)),this.i+=i,this.i}find(e){for(let r=0;r{\"use strict\";_();v();m();Object.defineProperty(Hn,\"t\",{value:!0});Hn.default=void 0;var M1=U1(jn()),L1=lt(),vr=ut();function U1(t){return t&&t.t?t:{default:t}}var Er=class t extends L1.ContainerIterator{constructor(e,r,i,n){super(n),this.o=e,this.h=r,this.container=i,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,vr.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,vr.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,vr.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,vr.throwIteratorAccessError)(),this.o=this.o.L,this})}get pointer(){return this.o===this.h&&(0,vr.throwIteratorAccessError)(),this.o.l}set pointer(e){this.o===this.h&&(0,vr.throwIteratorAccessError)(),this.o.l=e}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},_a=class extends M1.default{constructor(e=[]){super(),this.h={},this.p=this._=this.h.L=this.h.B=this.h;let r=this;e.forEach(function(i){r.pushBack(i)})}V(e){let{L:r,B:i}=e;r.B=i,i.L=r,e===this.p&&(this.p=i),e===this._&&(this._=r),this.i-=1}G(e,r){let i=r.B,n={l:e,L:r,B:i};r.B=n,i.L=n,r===this.h&&(this.p=n),i===this.h&&(this._=n),this.i+=1}clear(){this.i=0,this.p=this._=this.h.L=this.h.B=this.h}begin(){return new Er(this.p,this.h,this)}end(){return new Er(this.h,this.h,this)}rBegin(){return new Er(this._,this.h,this,1)}rEnd(){return new Er(this.h,this.h,this,1)}front(){return this.p.l}back(){return this._.l}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return r.l}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return this.V(r),this.i}eraseElementByValue(e){let r=this.p;for(;r!==this.h;)r.l===e&&this.V(r),r=r.B;return this.i}eraseElementByIterator(e){let r=e.o;return r===this.h&&(0,vr.throwIteratorAccessError)(),e=e.next(),this.V(r),e}pushBack(e){return this.G(e,this._),this.i}popBack(){if(this.i===0)return;let e=this._.l;return this.V(this._),e}pushFront(e){return this.G(e,this.h),this.i}popFront(){if(this.i===0)return;let e=this.p.l;return this.V(this.p),e}setElementByPos(e,r){if(e<0||e>this.i-1)throw new RangeError;let i=this.p;for(;e--;)i=i.B;i.l=r}insert(e,r,i=1){if(e<0||e>this.i)throw new RangeError;if(i<=0)return this.i;if(e===0)for(;i--;)this.pushFront(r);else if(e===this.i)for(;i--;)this.pushBack(r);else{let n=this.p;for(let s=1;s{\"use strict\";_();v();m();Object.defineProperty(Vn,\"t\",{value:!0});Vn.default=void 0;var q1=j1(jn()),D1=ba();function j1(t){return t&&t.t?t:{default:t}}var Sr=class t extends D1.RandomIterator{constructor(e,r,i){super(e,i),this.container=r}copy(){return new t(this.o,this.container,this.iteratorType)}},ma=class extends q1.default{constructor(e=[],r=4096){super(),this.j=0,this.D=0,this.R=0,this.N=0,this.P=0,this.A=[];let i=(()=>{if(typeof e.length==\"number\")return e.length;if(typeof e.size==\"number\")return e.size;if(typeof e.size==\"function\")return e.size();throw new TypeError(\"Cannot get the length or size of the container\")})();this.F=r,this.P=Math.max(Math.ceil(i/this.F),1);for(let s=0;s>1)-(n>>1),this.D=this.N=this.F-i%this.F>>1;let o=this;e.forEach(function(s){o.pushBack(s)})}T(){let e=[],r=Math.max(this.P>>1,1);for(let i=0;i>1}begin(){return new Sr(0,this)}end(){return new Sr(this.i,this)}rBegin(){return new Sr(this.i-1,this,1)}rEnd(){return new Sr(-1,this,1)}front(){if(this.i!==0)return this.A[this.j][this.D]}back(){if(this.i!==0)return this.A[this.R][this.N]}pushBack(e){return this.i&&(this.N0?this.N-=1:this.R>0?(this.R-=1,this.N=this.F-1):(this.R=this.P-1,this.N=this.F-1)),this.i-=1,e}pushFront(e){return this.i&&(this.D>0?this.D-=1:this.j>0?(this.j-=1,this.D=this.F-1):(this.j=this.P-1,this.D=this.F-1),this.j===this.R&&this.D===this.N&&this.T()),this.i+=1,this.A[this.j][this.D]=e,this.i}popFront(){if(this.i===0)return;let e=this.A[this.j][this.D];return this.i!==1&&(this.Dthis.i-1)throw new RangeError;let{curNodeBucketIndex:r,curNodePointerIndex:i}=this.O(e);return this.A[r][i]}setElementByPos(e,r){if(e<0||e>this.i-1)throw new RangeError;let{curNodeBucketIndex:i,curNodePointerIndex:n}=this.O(e);this.A[i][n]=r}insert(e,r,i=1){if(e<0||e>this.i)throw new RangeError;if(e===0)for(;i--;)this.pushFront(r);else if(e===this.i)for(;i--;)this.pushBack(r);else{let n=[];for(let o=e;othis.i-1)throw new RangeError;if(e===0)this.popFront();else if(e===this.i-1)this.popBack();else{let r=[];for(let n=e+1;ne;)this.popBack();return this.i}sort(e){let r=[];for(let i=0;i{\"use strict\";_();v();m();Object.defineProperty(ei,\"t\",{value:!0});ei.TreeNodeEnableIndex=ei.TreeNode=void 0;var zn=class{constructor(e,r){this.ee=1,this.u=void 0,this.l=void 0,this.U=void 0,this.W=void 0,this.tt=void 0,this.u=e,this.l=r}L(){let e=this;if(e.ee===1&&e.tt.tt===e)e=e.W;else if(e.U)for(e=e.U;e.W;)e=e.W;else{let r=e.tt;for(;r.U===e;)e=r,r=e.tt;e=r}return e}B(){let e=this;if(e.W){for(e=e.W;e.U;)e=e.U;return e}else{let r=e.tt;for(;r.W===e;)e=r,r=e.tt;return e.W!==r?r:e}}te(){let e=this.tt,r=this.W,i=r.U;return e.tt===this?e.tt=r:e.U===this?e.U=r:e.W=r,r.tt=e,r.U=this,this.tt=r,this.W=i,i&&(i.tt=this),r}se(){let e=this.tt,r=this.U,i=r.W;return e.tt===this?e.tt=r:e.U===this?e.U=r:e.W=r,r.tt=e,r.W=this,this.tt=r,this.U=i,i&&(i.tt=this),r}};ei.TreeNode=zn;var va=class extends zn{constructor(){super(...arguments),this.rt=1}te(){let e=super.te();return this.ie(),e.ie(),e}se(){let e=super.se();return this.ie(),e.ie(),e}ie(){this.rt=1,this.U&&(this.rt+=this.U.rt),this.W&&(this.rt+=this.W.rt)}};ei.TreeNodeEnableIndex=va});var Sa=M(Kn=>{\"use strict\";_();v();m();Object.defineProperty(Kn,\"t\",{value:!0});Kn.default=void 0;var lp=ap(),W1=lt(),up=ut(),Ea=class extends W1.Container{constructor(e=function(i,n){return in?1:0},r=!1){super(),this.Y=void 0,this.v=e,r?(this.re=lp.TreeNodeEnableIndex,this.M=function(i,n,o){let s=this.ne(i,n,o);if(s){let a=s.tt;for(;a!==this.h;)a.rt+=1,a=a.tt;let l=this.he(s);if(l){let{parentNode:c,grandParent:h,curNode:d}=l;c.ie(),h.ie(),d.ie()}}return this.i},this.V=function(i){let n=this.fe(i);for(;n!==this.h;)n.rt-=1,n=n.tt}):(this.re=lp.TreeNode,this.M=function(i,n,o){let s=this.ne(i,n,o);return s&&this.he(s),this.i},this.V=this.fe),this.h=new this.re}X(e,r){let i=this.h;for(;e;){let n=this.v(e.u,r);if(n<0)e=e.W;else if(n>0)i=e,e=e.U;else return e}return i}Z(e,r){let i=this.h;for(;e;)this.v(e.u,r)<=0?e=e.W:(i=e,e=e.U);return i}$(e,r){let i=this.h;for(;e;){let n=this.v(e.u,r);if(n<0)i=e,e=e.W;else if(n>0)e=e.U;else return e}return i}rr(e,r){let i=this.h;for(;e;)this.v(e.u,r)<0?(i=e,e=e.W):e=e.U;return i}ue(e){for(;;){let r=e.tt;if(r===this.h)return;if(e.ee===1){e.ee=0;return}if(e===r.U){let i=r.W;if(i.ee===1)i.ee=0,r.ee=1,r===this.Y?this.Y=r.te():r.te();else if(i.W&&i.W.ee===1){i.ee=r.ee,r.ee=0,i.W.ee=0,r===this.Y?this.Y=r.te():r.te();return}else i.U&&i.U.ee===1?(i.ee=1,i.U.ee=0,i.se()):(i.ee=1,e=r)}else{let i=r.U;if(i.ee===1)i.ee=0,r.ee=1,r===this.Y?this.Y=r.se():r.se();else if(i.U&&i.U.ee===1){i.ee=r.ee,r.ee=0,i.U.ee=0,r===this.Y?this.Y=r.se():r.se();return}else i.W&&i.W.ee===1?(i.ee=1,i.W.ee=0,i.te()):(i.ee=1,e=r)}}}fe(e){if(this.i===1)return this.clear(),this.h;let r=e;for(;r.U||r.W;){if(r.W)for(r=r.W;r.U;)r=r.U;else r=r.U;[e.u,r.u]=[r.u,e.u],[e.l,r.l]=[r.l,e.l],e=r}this.h.U===r?this.h.U=r.tt:this.h.W===r&&(this.h.W=r.tt),this.ue(r);let i=r.tt;return r===i.U?i.U=void 0:i.W=void 0,this.i-=1,this.Y.ee=0,i}oe(e,r){return e===void 0?!1:this.oe(e.U,r)||r(e)?!0:this.oe(e.W,r)}he(e){for(;;){let r=e.tt;if(r.ee===0)return;let i=r.tt;if(r===i.U){let n=i.W;if(n&&n.ee===1){if(n.ee=r.ee=0,i===this.Y)return;i.ee=1,e=i;continue}else if(e===r.W){if(e.ee=0,e.U&&(e.U.tt=r),e.W&&(e.W.tt=i),r.W=e.U,i.U=e.W,e.U=r,e.W=i,i===this.Y)this.Y=e,this.h.tt=e;else{let o=i.tt;o.U===i?o.U=e:o.W=e}return e.tt=i.tt,r.tt=e,i.tt=e,i.ee=1,{parentNode:r,grandParent:i,curNode:e}}else r.ee=0,i===this.Y?this.Y=i.se():i.se(),i.ee=1}else{let n=i.U;if(n&&n.ee===1){if(n.ee=r.ee=0,i===this.Y)return;i.ee=1,e=i;continue}else if(e===r.U){if(e.ee=0,e.U&&(e.U.tt=i),e.W&&(e.W.tt=r),i.W=e.U,r.U=e.W,e.U=i,e.W=r,i===this.Y)this.Y=e,this.h.tt=e;else{let o=i.tt;o.U===i?o.U=e:o.W=e}return e.tt=i.tt,r.tt=e,i.tt=e,i.ee=1,{parentNode:r,grandParent:i,curNode:e}}else r.ee=0,i===this.Y?this.Y=i.te():i.te(),i.ee=1}return}}ne(e,r,i){if(this.Y===void 0){this.i+=1,this.Y=new this.re(e,r),this.Y.ee=0,this.Y.tt=this.h,this.h.tt=this.Y,this.h.U=this.Y,this.h.W=this.Y;return}let n,o=this.h.U,s=this.v(o.u,e);if(s===0){o.l=r;return}else if(s>0)o.U=new this.re(e,r),o.U.tt=o,n=o.U,this.h.U=n;else{let a=this.h.W,l=this.v(a.u,e);if(l===0){a.l=r;return}else if(l<0)a.W=new this.re(e,r),a.W.tt=a,n=a.W,this.h.W=n;else{if(i!==void 0){let c=i.o;if(c!==this.h){let h=this.v(c.u,e);if(h===0){c.l=r;return}else if(h>0){let d=c.L(),g=this.v(d.u,e);if(g===0){d.l=r;return}else g<0&&(n=new this.re(e,r),d.W===void 0?(d.W=n,n.tt=d):(c.U=n,n.tt=c))}}}if(n===void 0)for(n=this.Y;;){let c=this.v(n.u,e);if(c>0){if(n.U===void 0){n.U=new this.re(e,r),n.U.tt=n,n=n.U;break}n=n.U}else if(c<0){if(n.W===void 0){n.W=new this.re(e,r),n.W.tt=n,n=n.W;break}n=n.W}else{n.l=r;return}}}}return this.i+=1,n}I(e,r){for(;e;){let i=this.v(e.u,r);if(i<0)e=e.W;else if(i>0)e=e.U;else return e}return e||this.h}clear(){this.i=0,this.Y=void 0,this.h.tt=void 0,this.h.U=this.h.W=void 0}updateKeyByIterator(e,r){let i=e.o;if(i===this.h&&(0,up.throwIteratorAccessError)(),this.i===1)return i.u=r,!0;if(i===this.h.U)return this.v(i.B().u,r)>0?(i.u=r,!0):!1;if(i===this.h.W)return this.v(i.L().u,r)<0?(i.u=r,!0):!1;let n=i.L().u;if(this.v(n,r)>=0)return!1;let o=i.B().u;return this.v(o,r)<=0?!1:(i.u=r,!0)}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=0,i=this;return this.oe(this.Y,function(n){return e===r?(i.V(n),!0):(r+=1,!1)}),this.i}eraseElementByKey(e){if(this.i===0)return!1;let r=this.I(this.Y,e);return r===this.h?!1:(this.V(r),!0)}eraseElementByIterator(e){let r=e.o;r===this.h&&(0,up.throwIteratorAccessError)();let i=r.W===void 0;return e.iteratorType===0?i&&e.next():(!i||r.U===void 0)&&e.next(),this.V(r),e}forEach(e){let r=0;for(let i of this)e(i,r++,this)}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r,i=0;for(let n of this){if(i===e){r=n;break}i+=1}return r}getHeight(){if(this.i===0)return 0;let e=function(r){return r?Math.max(e(r.U),e(r.W))+1:0};return e(this.Y)}},$1=Ea;Kn.default=$1});var Ia=M(Qn=>{\"use strict\";_();v();m();Object.defineProperty(Qn,\"t\",{value:!0});Qn.default=void 0;var H1=lt(),Gn=ut(),Aa=class extends H1.ContainerIterator{constructor(e,r,i){super(i),this.o=e,this.h=r,this.iteratorType===0?(this.pre=function(){return this.o===this.h.U&&(0,Gn.throwIteratorAccessError)(),this.o=this.o.L(),this},this.next=function(){return this.o===this.h&&(0,Gn.throwIteratorAccessError)(),this.o=this.o.B(),this}):(this.pre=function(){return this.o===this.h.W&&(0,Gn.throwIteratorAccessError)(),this.o=this.o.B(),this},this.next=function(){return this.o===this.h&&(0,Gn.throwIteratorAccessError)(),this.o=this.o.L(),this})}get index(){let e=this.o,r=this.h.tt;if(e===this.h)return r?r.rt-1:0;let i=0;for(e.U&&(i+=e.U.rt);e!==r;){let n=e.tt;e===n.W&&(i+=1,n.U&&(i+=n.U.rt)),e=n}return i}},V1=Aa;Qn.default=V1});var cp=M(Yn=>{\"use strict\";_();v();m();Object.defineProperty(Yn,\"t\",{value:!0});Yn.default=void 0;var z1=fp(Sa()),K1=fp(Ia()),G1=ut();function fp(t){return t&&t.t?t:{default:t}}var Ke=class t extends K1.default{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){return this.o===this.h&&(0,G1.throwIteratorAccessError)(),this.o.u}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},Ta=class extends z1.default{constructor(e=[],r,i){super(r,i);let n=this;e.forEach(function(o){n.insert(o)})}*K(e){e!==void 0&&(yield*this.K(e.U),yield e.u,yield*this.K(e.W))}begin(){return new Ke(this.h.U||this.h,this.h,this)}end(){return new Ke(this.h,this.h,this)}rBegin(){return new Ke(this.h.W||this.h,this.h,this,1)}rEnd(){return new Ke(this.h,this.h,this,1)}front(){return this.h.U?this.h.U.u:void 0}back(){return this.h.W?this.h.W.u:void 0}insert(e,r){return this.M(e,void 0,r)}find(e){let r=this.I(this.Y,e);return new Ke(r,this.h,this)}lowerBound(e){let r=this.X(this.Y,e);return new Ke(r,this.h,this)}upperBound(e){let r=this.Z(this.Y,e);return new Ke(r,this.h,this)}reverseLowerBound(e){let r=this.$(this.Y,e);return new Ke(r,this.h,this)}reverseUpperBound(e){let r=this.rr(this.Y,e);return new Ke(r,this.h,this)}union(e){let r=this;return e.forEach(function(i){r.insert(i)}),this.i}[Symbol.iterator](){return this.K(this.Y)}},Q1=Ta;Yn.default=Q1});var dp=M(Jn=>{\"use strict\";_();v();m();Object.defineProperty(Jn,\"t\",{value:!0});Jn.default=void 0;var Y1=hp(Sa()),J1=hp(Ia()),X1=ut();function hp(t){return t&&t.t?t:{default:t}}var Ge=class t extends J1.default{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){this.o===this.h&&(0,X1.throwIteratorAccessError)();let e=this;return new Proxy([],{get(r,i){if(i===\"0\")return e.o.u;if(i===\"1\")return e.o.l},set(r,i,n){if(i!==\"1\")throw new TypeError(\"props must be 1\");return e.o.l=n,!0}})}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},Ra=class extends Y1.default{constructor(e=[],r,i){super(r,i);let n=this;e.forEach(function(o){n.setElement(o[0],o[1])})}*K(e){e!==void 0&&(yield*this.K(e.U),yield[e.u,e.l],yield*this.K(e.W))}begin(){return new Ge(this.h.U||this.h,this.h,this)}end(){return new Ge(this.h,this.h,this)}rBegin(){return new Ge(this.h.W||this.h,this.h,this,1)}rEnd(){return new Ge(this.h,this.h,this,1)}front(){if(this.i===0)return;let e=this.h.U;return[e.u,e.l]}back(){if(this.i===0)return;let e=this.h.W;return[e.u,e.l]}lowerBound(e){let r=this.X(this.Y,e);return new Ge(r,this.h,this)}upperBound(e){let r=this.Z(this.Y,e);return new Ge(r,this.h,this)}reverseLowerBound(e){let r=this.$(this.Y,e);return new Ge(r,this.h,this)}reverseUpperBound(e){let r=this.rr(this.Y,e);return new Ge(r,this.h,this)}setElement(e,r,i){return this.M(e,r,i)}find(e){let r=this.I(this.Y,e);return new Ge(r,this.h,this)}getElementByKey(e){return this.I(this.Y,e).l}union(e){let r=this;return e.forEach(function(i){r.setElement(i[0],i[1])}),this.i}[Symbol.iterator](){return this.K(this.Y)}},Z1=Ra;Jn.default=Z1});var Ba=M(Ca=>{\"use strict\";_();v();m();Object.defineProperty(Ca,\"t\",{value:!0});Ca.default=ev;function ev(t){let e=typeof t;return e===\"object\"&&t!==null||e===\"function\"}});var xa=M(ti=>{\"use strict\";_();v();m();Object.defineProperty(ti,\"t\",{value:!0});ti.HashContainerIterator=ti.HashContainer=void 0;var pp=lt(),Pa=tv(Ba()),Ci=ut();function tv(t){return t&&t.t?t:{default:t}}var ka=class extends pp.ContainerIterator{constructor(e,r,i){super(i),this.o=e,this.h=r,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,Ci.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,Ci.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,Ci.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,Ci.throwIteratorAccessError)(),this.o=this.o.L,this})}};ti.HashContainerIterator=ka;var Oa=class extends pp.Container{constructor(){super(),this.H=[],this.g={},this.HASH_TAG=Symbol(\"@@HASH_TAG\"),Object.setPrototypeOf(this.g,null),this.h={},this.h.L=this.h.B=this.p=this._=this.h}V(e){let{L:r,B:i}=e;r.B=i,i.L=r,e===this.p&&(this.p=i),e===this._&&(this._=r),this.i-=1}M(e,r,i){i===void 0&&(i=(0,Pa.default)(e));let n;if(i){let o=e[this.HASH_TAG];if(o!==void 0)return this.H[o].l=r,this.i;Object.defineProperty(e,this.HASH_TAG,{value:this.H.length,configurable:!0}),n={u:e,l:r,L:this._,B:this.h},this.H.push(n)}else{let o=this.g[e];if(o)return o.l=r,this.i;n={u:e,l:r,L:this._,B:this.h},this.g[e]=n}return this.i===0?(this.p=n,this.h.B=n):this._.B=n,this._=n,this.h.L=n,++this.i}I(e,r){if(r===void 0&&(r=(0,Pa.default)(e)),r){let i=e[this.HASH_TAG];return i===void 0?this.h:this.H[i]}else return this.g[e]||this.h}clear(){let e=this.HASH_TAG;this.H.forEach(function(r){delete r.u[e]}),this.H=[],this.g={},Object.setPrototypeOf(this.g,null),this.i=0,this.p=this._=this.h.L=this.h.B=this.h}eraseElementByKey(e,r){let i;if(r===void 0&&(r=(0,Pa.default)(e)),r){let n=e[this.HASH_TAG];if(n===void 0)return!1;delete e[this.HASH_TAG],i=this.H[n],delete this.H[n]}else{if(i=this.g[e],i===void 0)return!1;delete this.g[e]}return this.V(i),!0}eraseElementByIterator(e){let r=e.o;return r===this.h&&(0,Ci.throwIteratorAccessError)(),this.V(r),e.next()}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return this.V(r),this.i}};ti.HashContainer=Oa});var yp=M(Xn=>{\"use strict\";_();v();m();Object.defineProperty(Xn,\"t\",{value:!0});Xn.default=void 0;var gp=xa(),rv=ut(),Ar=class t extends gp.HashContainerIterator{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){return this.o===this.h&&(0,rv.throwIteratorAccessError)(),this.o.u}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},Ma=class extends gp.HashContainer{constructor(e=[]){super();let r=this;e.forEach(function(i){r.insert(i)})}begin(){return new Ar(this.p,this.h,this)}end(){return new Ar(this.h,this.h,this)}rBegin(){return new Ar(this._,this.h,this,1)}rEnd(){return new Ar(this.h,this.h,this,1)}front(){return this.p.u}back(){return this._.u}insert(e,r){return this.M(e,void 0,r)}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return r.u}find(e,r){let i=this.I(e,r);return new Ar(i,this.h,this)}forEach(e){let r=0,i=this.p;for(;i!==this.h;)e(i.u,r++,this),i=i.B}[Symbol.iterator](){return function*(){let e=this.p;for(;e!==this.h;)yield e.u,e=e.B}.bind(this)()}},iv=Ma;Xn.default=iv});var wp=M(Zn=>{\"use strict\";_();v();m();Object.defineProperty(Zn,\"t\",{value:!0});Zn.default=void 0;var bp=xa(),nv=ov(Ba()),sv=ut();function ov(t){return t&&t.t?t:{default:t}}var Ir=class t extends bp.HashContainerIterator{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){this.o===this.h&&(0,sv.throwIteratorAccessError)();let e=this;return new Proxy([],{get(r,i){if(i===\"0\")return e.o.u;if(i===\"1\")return e.o.l},set(r,i,n){if(i!==\"1\")throw new TypeError(\"props must be 1\");return e.o.l=n,!0}})}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},La=class extends bp.HashContainer{constructor(e=[]){super();let r=this;e.forEach(function(i){r.setElement(i[0],i[1])})}begin(){return new Ir(this.p,this.h,this)}end(){return new Ir(this.h,this.h,this)}rBegin(){return new Ir(this._,this.h,this,1)}rEnd(){return new Ir(this.h,this.h,this,1)}front(){if(this.i!==0)return[this.p.u,this.p.l]}back(){if(this.i!==0)return[this._.u,this._.l]}setElement(e,r,i){return this.M(e,r,i)}getElementByKey(e,r){if(r===void 0&&(r=(0,nv.default)(e)),r){let n=e[this.HASH_TAG];return n!==void 0?this.H[n].l:void 0}let i=this.g[e];return i?i.l:void 0}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return[r.u,r.l]}find(e,r){let i=this.I(e,r);return new Ir(i,this.h,this)}forEach(e){let r=0,i=this.p;for(;i!==this.h;)e([i.u,i.l],r++,this),i=i.B}[Symbol.iterator](){return function*(){let e=this.p;for(;e!==this.h;)yield[e.u,e.l],e=e.B}.bind(this)()}},av=La;Zn.default=av});var _p=M(je=>{\"use strict\";_();v();m();Object.defineProperty(je,\"t\",{value:!0});Object.defineProperty(je,\"Deque\",{enumerable:!0,get:function(){return dv.default}});Object.defineProperty(je,\"HashMap\",{enumerable:!0,get:function(){return bv.default}});Object.defineProperty(je,\"HashSet\",{enumerable:!0,get:function(){return yv.default}});Object.defineProperty(je,\"LinkList\",{enumerable:!0,get:function(){return hv.default}});Object.defineProperty(je,\"OrderedMap\",{enumerable:!0,get:function(){return gv.default}});Object.defineProperty(je,\"OrderedSet\",{enumerable:!0,get:function(){return pv.default}});Object.defineProperty(je,\"PriorityQueue\",{enumerable:!0,get:function(){return fv.default}});Object.defineProperty(je,\"Queue\",{enumerable:!0,get:function(){return uv.default}});Object.defineProperty(je,\"Stack\",{enumerable:!0,get:function(){return lv.default}});Object.defineProperty(je,\"Vector\",{enumerable:!0,get:function(){return cv.default}});var lv=ft(tp()),uv=ft(rp()),fv=ft(ip()),cv=ft(np()),hv=ft(sp()),dv=ft(op()),pv=ft(cp()),gv=ft(dp()),yv=ft(yp()),bv=ft(wp());function ft(t){return t&&t.t?t:{default:t}}});var vp=M((lx,mp)=>{\"use strict\";_();v();m();var wv=_p().OrderedSet,ct=ot()(\"number-allocator:trace\"),_v=ot()(\"number-allocator:error\");function Re(t,e){this.low=t,this.high=e}Re.prototype.equals=function(t){return this.low===t.low&&this.high===t.high};Re.prototype.compare=function(t){return this.lowr.compare(i)),ct(\"Create\"),this.clear()}ht.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low};ht.prototype.alloc=function(){if(this.ss.size()===0)return ct(\"alloc():empty\"),null;let t=this.ss.begin(),e=t.pointer.low,r=t.pointer.high,i=e;return i+1<=r?this.ss.updateKeyByIterator(t,new Re(e+1,r)):this.ss.eraseElementByPos(0),ct(\"alloc():\"+i),i};ht.prototype.use=function(t){let e=new Re(t,t),r=this.ss.lowerBound(e);if(!r.equals(this.ss.end())){let i=r.pointer.low,n=r.pointer.high;return r.pointer.equals(e)?(this.ss.eraseElementByIterator(r),ct(\"use():\"+t),!0):i>t?!1:i===t?(this.ss.updateKeyByIterator(r,new Re(i+1,n)),ct(\"use():\"+t),!0):n===t?(this.ss.updateKeyByIterator(r,new Re(i,n-1)),ct(\"use():\"+t),!0):(this.ss.updateKeyByIterator(r,new Re(t+1,n)),this.ss.insert(new Re(i,t-1)),ct(\"use():\"+t),!0)}return ct(\"use():failed\"),!1};ht.prototype.free=function(t){if(tthis.max){_v(\"free():\"+t+\" is out of range\");return}let e=new Re(t,t),r=this.ss.upperBound(e);if(r.equals(this.ss.end())){if(r.equals(this.ss.begin())){this.ss.insert(e);return}r.pre();let i=r.pointer.high;r.pointer.high+1===t?this.ss.updateKeyByIterator(r,new Re(i,t)):this.ss.insert(e)}else if(r.equals(this.ss.begin()))if(t+1===r.pointer.low){let i=r.pointer.high;this.ss.updateKeyByIterator(r,new Re(t,i))}else this.ss.insert(e);else{let i=r.pointer.low,n=r.pointer.high;r.pre();let o=r.pointer.low;r.pointer.high+1===t?t+1===i?(this.ss.eraseElementByIterator(r),this.ss.updateKeyByIterator(r,new Re(o,n))):this.ss.updateKeyByIterator(r,new Re(o,t)):t+1===i?(this.ss.eraseElementByIterator(r.next()),this.ss.insert(new Re(t,n))):this.ss.insert(e)}ct(\"free():\"+t)};ht.prototype.clear=function(){ct(\"clear()\"),this.ss.clear(),this.ss.insert(new Re(this.min,this.max))};ht.prototype.intervalCount=function(){return this.ss.size()};ht.prototype.dump=function(){console.log(\"length:\"+this.ss.size());for(let t of this.ss)console.log(t)};mp.exports=ht});var Ua=M((gx,Ep)=>{_();v();m();var mv=vp();Ep.exports.NumberAllocator=mv});var Sp=M(qa=>{\"use strict\";_();v();m();Object.defineProperty(qa,\"__esModule\",{value:!0});var vv=ep(),Ev=Ua(),Na=class{constructor(e){e>0&&(this.aliasToTopic=new vv.LRUCache({max:e}),this.topicToAlias={},this.numberAllocator=new Ev.NumberAllocator(1,e),this.max=e,this.length=0)}put(e,r){if(r===0||r>this.max)return!1;let i=this.aliasToTopic.get(r);return i&&delete this.topicToAlias[i],this.aliasToTopic.set(r,e),this.topicToAlias[e]=r,this.numberAllocator.use(r),this.length=this.aliasToTopic.size,!0}getTopicByAlias(e){return this.aliasToTopic.get(e)}getAliasByTopic(e){let r=this.topicToAlias[e];return typeof r<\"u\"&&this.aliasToTopic.get(r),r}clear(){this.aliasToTopic.clear(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0}getLruAlias(){let e=this.numberAllocator.firstVacant();return e||[...this.aliasToTopic.keys()][this.aliasToTopic.size-1]}};qa.default=Na});var Ap=M(Bi=>{\"use strict\";_();v();m();var Sv=Bi&&Bi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Bi,\"__esModule\",{value:!0});var Av=Ti(),Iv=Sv(Sp()),Tv=_r(),Rv=(t,e)=>{t.log(\"_handleConnack\");let{options:r}=t,n=r.protocolVersion===5?e.reasonCode:e.returnCode;if(clearTimeout(t.connackTimer),delete t.topicAliasSend,e.properties){if(e.properties.topicAliasMaximum){if(e.properties.topicAliasMaximum>65535){t.emit(\"error\",new Error(\"topicAliasMaximum from broker is out of range\"));return}e.properties.topicAliasMaximum>0&&(t.topicAliasSend=new Iv.default(e.properties.topicAliasMaximum))}e.properties.serverKeepAlive&&r.keepalive&&(r.keepalive=e.properties.serverKeepAlive),e.properties.maximumPacketSize&&(r.properties||(r.properties={}),r.properties.maximumPacketSize=e.properties.maximumPacketSize)}if(n===0)t.reconnecting=!1,t._onConnect(e);else if(n>0){let o=new Tv.ErrorWithReasonCode(`Connection refused: ${Av.ReasonCodes[n]}`,n);t.emit(\"error\",o),t.options.reconnectOnConnackError&&t._cleanUp(!0)}};Bi.default=Rv});var Ip=M(Da=>{\"use strict\";_();v();m();Object.defineProperty(Da,\"__esModule\",{value:!0});var Cv=(t,e,r)=>{t.log(\"handling pubrel packet\");let i=typeof r<\"u\"?r:t.noop,{messageId:n}=e,o={cmd:\"pubcomp\",messageId:n};t.incomingStore.get(e,(s,a)=>{s?t._sendPacket(o,i):(t.emit(\"message\",a.topic,a.payload,a),t.handleMessage(a,l=>{if(l)return i(l);t.incomingStore.del(a,t.noop),t._sendPacket(o,i)}))})};Da.default=Cv});var Tp=M(Pi=>{\"use strict\";_();v();m();var ki=Pi&&Pi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Pi,\"__esModule\",{value:!0});var Bv=ki(Vd()),Pv=ki(Qd()),kv=ki(Ap()),Ov=ki(Ti()),xv=ki(Ip()),Mv=(t,e,r)=>{let{options:i}=t;if(i.protocolVersion===5&&i.properties&&i.properties.maximumPacketSize&&i.properties.maximumPacketSize{\"use strict\";_();v();m();var Lv=ri&&ri.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ri,\"__esModule\",{value:!0});ri.TypedEventEmitter=void 0;var Uv=Lv((sr(),X(nr))),Nv=_r(),es=class{};ri.TypedEventEmitter=es;(0,Nv.applyMixin)(es,Uv.default)});var Oi=M(Tr=>{\"use strict\";_();v();m();Object.defineProperty(Tr,\"__esModule\",{value:!0});Tr.isReactNativeBrowser=Tr.isWebWorker=void 0;var qv=()=>{var t;return typeof window<\"u\"?typeof navigator<\"u\"&&((t=navigator.userAgent)===null||t===void 0?void 0:t.toLowerCase().indexOf(\" electron/\"))>-1&&(!(B===null||B===void 0)&&B.versions)?!Object.prototype.hasOwnProperty.call(B.versions,\"electron\"):typeof window.document<\"u\":!1},Cp=()=>{var t,e;return!!(typeof self==\"object\"&&(!((e=(t=self?.constructor)===null||t===void 0?void 0:t.name)===null||e===void 0)&&e.includes(\"WorkerGlobalScope\")))},Bp=()=>typeof navigator<\"u\"&&navigator.product===\"ReactNative\",Dv=qv()||Cp()||Bp();Tr.isWebWorker=Cp();Tr.isReactNativeBrowser=Bp();Tr.default=Dv});var kp=M((ts,Pp)=>{_();v();m();(function(t,e){typeof ts==\"object\"&&typeof Pp<\"u\"?e(ts):typeof define==\"function\"&&define.amd?define([\"exports\"],e):(t=typeof globalThis<\"u\"?globalThis:t||self,e(t.fastUniqueNumbers={}))})(ts,function(t){\"use strict\";var e=function(g){return function(y){var w=g(y);return y.add(w),w}},r=function(g){return function(y,w){return g.set(y,w),w}},i=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,n=536870912,o=n*2,s=function(g,y){return function(w){var S=y.get(w),E=S===void 0?w.size:Si)throw new Error(\"Congratulations, you created a collection of unique numbers which uses all available integers!\");for(;w.has(E);)E=Math.floor(Math.random()*i);return g(w,E)}},a=new WeakMap,l=r(a),c=s(l,a),h=e(c);t.addUniqueNumber=h,t.generateUniqueNumber=c})});var xp=M((rs,Op)=>{_();v();m();(function(t,e){typeof rs==\"object\"&&typeof Op<\"u\"?e(rs,kp()):typeof define==\"function\"&&define.amd?define([\"exports\",\"fast-unique-numbers\"],e):(t=typeof globalThis<\"u\"?globalThis:t||self,e(t.workerTimersBroker={},t.fastUniqueNumbers))})(rs,function(t,e){\"use strict\";var r=function(s){return s.method!==void 0&&s.method===\"call\"},i=function(s){return s.error===null&&typeof s.id==\"number\"},n=function(s){var a=new Map([[0,function(){}]]),l=new Map([[0,function(){}]]),c=new Map,h=new Worker(s);h.addEventListener(\"message\",function(S){var E=S.data;if(r(E)){var I=E.params,C=I.timerId,R=I.timerType;if(R===\"interval\"){var U=a.get(C);if(typeof U==\"number\"){var N=c.get(U);if(N===void 0||N.timerId!==C||N.timerType!==R)throw new Error(\"The timer is in an undefined state.\")}else if(typeof U<\"u\")U();else throw new Error(\"The timer is in an undefined state.\")}else if(R===\"timeout\"){var W=l.get(C);if(typeof W==\"number\"){var K=c.get(W);if(K===void 0||K.timerId!==C||K.timerType!==R)throw new Error(\"The timer is in an undefined state.\")}else if(typeof W<\"u\")W(),l.delete(C);else throw new Error(\"The timer is in an undefined state.\")}}else if(i(E)){var z=E.id,Q=c.get(z);if(Q===void 0)throw new Error(\"The timer is in an undefined state.\");var pe=Q.timerId,Yt=Q.timerType;c.delete(z),Yt===\"interval\"?a.delete(pe):l.delete(pe)}else{var ge=E.error.message;throw new Error(ge)}});var d=function(E){var I=e.generateUniqueNumber(c);c.set(I,{timerId:E,timerType:\"interval\"}),a.set(E,I),h.postMessage({id:I,method:\"clear\",params:{timerId:E,timerType:\"interval\"}})},g=function(E){var I=e.generateUniqueNumber(c);c.set(I,{timerId:E,timerType:\"timeout\"}),l.set(E,I),h.postMessage({id:I,method:\"clear\",params:{timerId:E,timerType:\"timeout\"}})},y=function(E){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,C=e.generateUniqueNumber(a);return a.set(C,function(){E(),typeof a.get(C)==\"function\"&&h.postMessage({id:null,method:\"set\",params:{delay:I,now:performance.now(),timerId:C,timerType:\"interval\"}})}),h.postMessage({id:null,method:\"set\",params:{delay:I,now:performance.now(),timerId:C,timerType:\"interval\"}}),C},w=function(E){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,C=e.generateUniqueNumber(l);return l.set(C,E),h.postMessage({id:null,method:\"set\",params:{delay:I,now:performance.now(),timerId:C,timerType:\"timeout\"}}),C};return{clearInterval:d,clearTimeout:g,setInterval:y,setTimeout:w}};t.load=n})});var Lp=M((is,Mp)=>{_();v();m();(function(t,e){typeof is==\"object\"&&typeof Mp<\"u\"?e(is,xp()):typeof define==\"function\"&&define.amd?define([\"exports\",\"worker-timers-broker\"],e):(t=typeof globalThis<\"u\"?globalThis:t||self,e(t.workerTimers={},t.workerTimersBroker))})(is,function(t,e){\"use strict\";var r=function(h,d){var g=null;return function(){if(g!==null)return g;var y=new Blob([d],{type:\"application/javascript; charset=utf-8\"}),w=URL.createObjectURL(y);return g=h(w),setTimeout(function(){return URL.revokeObjectURL(w)}),g}},i=`(()=>{var e={472:(e,t,r)=>{var o,i;void 0===(i=\"function\"==typeof(o=function(){\"use strict\";var e=new Map,t=new Map,r=function(t){var r=e.get(t);if(void 0===r)throw new Error('There is no interval scheduled with the given id \"'.concat(t,'\".'));clearTimeout(r),e.delete(t)},o=function(e){var r=t.get(e);if(void 0===r)throw new Error('There is no timeout scheduled with the given id \"'.concat(e,'\".'));clearTimeout(r),t.delete(e)},i=function(e,t){var r,o=performance.now();return{expected:o+(r=e-Math.max(0,o-t)),remainingDelay:r}},n=function e(t,r,o,i){var n=performance.now();n>o?postMessage({id:null,method:\"call\",params:{timerId:r,timerType:i}}):t.set(r,setTimeout(e,o-n,t,r,o,i))},a=function(t,r,o){var a=i(t,o),s=a.expected,d=a.remainingDelay;e.set(r,setTimeout(n,d,e,r,s,\"interval\"))},s=function(e,r,o){var a=i(e,o),s=a.expected,d=a.remainingDelay;t.set(r,setTimeout(n,d,t,r,s,\"timeout\"))};addEventListener(\"message\",(function(e){var t=e.data;try{if(\"clear\"===t.method){var i=t.id,n=t.params,d=n.timerId,c=n.timerType;if(\"interval\"===c)r(d),postMessage({error:null,id:i});else{if(\"timeout\"!==c)throw new Error('The given type \"'.concat(c,'\" is not supported'));o(d),postMessage({error:null,id:i})}}else{if(\"set\"!==t.method)throw new Error('The given method \"'.concat(t.method,'\" is not supported'));var u=t.params,l=u.delay,p=u.now,m=u.timerId,v=u.timerType;if(\"interval\"===v)a(l,m,p);else{if(\"timeout\"!==v)throw new Error('The given type \"'.concat(v,'\" is not supported'));s(l,m,p)}}}catch(e){postMessage({error:{message:e.message},id:t.id,result:null})}}))})?o.call(t,r,t,e):o)||(e.exports=i)}},t={};function r(o){var i=t[o];if(void 0!==i)return i.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{\"use strict\";r(472)})()})();`,n=r(e.load,i),o=function(h){return n().clearInterval(h)},s=function(h){return n().clearTimeout(h)},a=function(){var h;return(h=n()).setInterval.apply(h,arguments)},l=function(){var h;return(h=n()).setTimeout.apply(h,arguments)};t.clearInterval=o,t.clearTimeout=s,t.setInterval=a,t.setTimeout=l})});var Dp=M(Ct=>{\"use strict\";_();v();m();var jv=Ct&&Ct.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||(\"get\"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),Fv=Ct&&Ct.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,\"default\",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wv=Ct&&Ct.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!==\"default\"&&Object.prototype.hasOwnProperty.call(t,r)&&jv(e,t,r);return Fv(e,t),e};Object.defineProperty(Ct,\"__esModule\",{value:!0});var ja=Wv(Oi()),Up=Lp(),Np={set:Up.setInterval,clear:Up.clearInterval},qp={set:(t,e)=>setInterval(t,e),clear:t=>clearInterval(t)},$v=t=>{switch(t){case\"native\":return qp;case\"worker\":return Np;case\"auto\":default:return ja.default&&!ja.isWebWorker&&!ja.isReactNativeBrowser?Np:qp}};Ct.default=$v});var Wa=M(xi=>{\"use strict\";_();v();m();var Hv=xi&&xi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xi,\"__esModule\",{value:!0});var Vv=Hv(Dp()),Fa=class{get keepaliveTimeoutTimestamp(){return this._keepaliveTimeoutTimestamp}get intervalEvery(){return this._intervalEvery}get keepalive(){return this._keepalive}constructor(e,r){this.destroyed=!1,this.client=e,this.timer=typeof r==\"object\"&&\"set\"in r&&\"clear\"in r?r:(0,Vv.default)(r),this.setKeepalive(e.options.keepalive)}clear(){this.timerId&&(this.timer.clear(this.timerId),this.timerId=null)}setKeepalive(e){if(e*=1e3,isNaN(e)||e<=0||e>2147483647)throw new Error(`Keepalive value must be an integer between 0 and 2147483647. Provided value is ${e}`);this._keepalive=e,this.reschedule(),this.client.log(`KeepaliveManager: set keepalive to ${e}ms`)}destroy(){this.clear(),this.destroyed=!0}reschedule(){if(this.destroyed)return;this.clear(),this.counter=0;let e=Math.ceil(this._keepalive*1.5);this._keepaliveTimeoutTimestamp=Date.now()+e,this._intervalEvery=Math.ceil(this._keepalive/2),this.timerId=this.timer.set(()=>{this.destroyed||(this.counter+=1,this.counter===2?this.client.sendPing():this.counter>2&&this.client.onKeepaliveTimeout())},this._intervalEvery)}};xi.default=Fa});var os=M(Qe=>{\"use strict\";_();v();m();var zv=Qe&&Qe.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||(\"get\"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),Kv=Qe&&Qe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,\"default\",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hp=Qe&&Qe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!==\"default\"&&Object.prototype.hasOwnProperty.call(t,r)&&zv(e,t,r);return Kv(e,t),e},zt=Qe&&Qe.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qe,\"__esModule\",{value:!0});var Gv=zt(Gu()),$a=zt(Nd()),Qv=zt(Zo()),Yv=jt(),jp=zt(Fd()),Fp=Hp($d()),Jv=zt(ot()),ii=zt(ra()),Xv=zt(Tp()),ns=_r(),Zv=Rp(),eE=zt(Wa()),Wp=Hp(Oi()),Ha=globalThis.setImmediate||((...t)=>{let e=t.shift();(0,ns.nextTick)(()=>{e(...t)})}),$p={keepalive:60,reschedulePings:!0,protocolId:\"MQTT\",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0,writeCache:!0,timerVariant:\"auto\"},ss=class t extends Zv.TypedEventEmitter{static defaultId(){return`mqttjs_${Math.random().toString(16).substr(2,8)}`}constructor(e,r){super(),this.options=r||{};for(let i in $p)typeof this.options[i]>\"u\"?this.options[i]=$p[i]:this.options[i]=r[i];this.log=this.options.log||(0,Jv.default)(\"mqttjs:client\"),this.noop=this._noop.bind(this),this.log(\"MqttClient :: version:\",t.VERSION),Wp.isWebWorker?this.log(\"MqttClient :: environment\",\"webworker\"):this.log(\"MqttClient :: environment\",Wp.default?\"browser\":\"node\"),this.log(\"MqttClient :: options.protocol\",r.protocol),this.log(\"MqttClient :: options.protocolVersion\",r.protocolVersion),this.log(\"MqttClient :: options.username\",r.username),this.log(\"MqttClient :: options.keepalive\",r.keepalive),this.log(\"MqttClient :: options.reconnectPeriod\",r.reconnectPeriod),this.log(\"MqttClient :: options.rejectUnauthorized\",r.rejectUnauthorized),this.log(\"MqttClient :: options.properties.topicAliasMaximum\",r.properties?r.properties.topicAliasMaximum:void 0),this.options.clientId=typeof r.clientId==\"string\"?r.clientId:t.defaultId(),this.log(\"MqttClient :: clientId\",this.options.clientId),this.options.customHandleAcks=r.protocolVersion===5&&r.customHandleAcks?r.customHandleAcks:(...i)=>{i[3](null,0)},this.options.writeCache||($a.default.writeToStream.cacheNumbers=!1),this.streamBuilder=e,this.messageIdProvider=typeof this.options.messageIdProvider>\"u\"?new Qv.default:this.options.messageIdProvider,this.outgoingStore=r.outgoingStore||new ii.default,this.incomingStore=r.incomingStore||new ii.default,this.queueQoSZero=r.queueQoSZero===void 0?!0:r.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.keepaliveManager=null,this.connected=!1,this.disconnecting=!1,this.reconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,r.properties&&r.properties.topicAliasMaximum>0&&(r.properties.topicAliasMaximum>65535?this.log(\"MqttClient :: options.properties.topicAliasMaximum is out of range\"):this.topicAliasRecv=new Gv.default(r.properties.topicAliasMaximum)),this.on(\"connect\",()=>{let{queue:i}=this,n=()=>{let o=i.shift();this.log(\"deliver :: entry %o\",o);let s=null;if(!o){this._resubscribe();return}s=o.packet,this.log(\"deliver :: call _sendPacket for %o\",s);let a=!0;s.messageId&&s.messageId!==0&&(this.messageIdProvider.register(s.messageId)||(a=!1)),a?this._sendPacket(s,l=>{o.cb&&o.cb(l),n()}):(this.log(\"messageId: %d has already used. The message is skipped and removed.\",s.messageId),n())};this.log(\"connect :: sending queued packets\"),n()}),this.on(\"close\",()=>{this.log(\"close :: connected set to `false`\"),this.connected=!1,this.log(\"close :: clearing connackTimer\"),clearTimeout(this.connackTimer),this._destroyKeepaliveManager(),this.topicAliasRecv&&this.topicAliasRecv.clear(),this.log(\"close :: calling _setupReconnect\"),this._setupReconnect()}),this.options.manualConnect||(this.log(\"MqttClient :: setting up stream\"),this.connect())}handleAuth(e,r){r()}handleMessage(e,r){r()}_nextId(){return this.messageIdProvider.allocate()}getLastMessageId(){return this.messageIdProvider.getLastAllocated()}connect(){var e;let r=new Yv.Writable,i=$a.default.parser(this.options),n=null,o=[];this.log(\"connect :: calling method to clear reconnect\"),this._clearReconnect(),this.disconnected&&!this.reconnecting&&(this.incomingStore=this.options.incomingStore||new ii.default,this.outgoingStore=this.options.outgoingStore||new ii.default,this.disconnecting=!1,this.disconnected=!1),this.log(\"connect :: using streamBuilder provided to client to create stream\"),this.stream=this.streamBuilder(this),i.on(\"packet\",h=>{this.log(\"parser :: on packet push to packets array.\"),o.push(h)});let s=()=>{this.log(\"work :: getting next packet in queue\");let h=o.shift();if(h)this.log(\"work :: packet pulled from queue\"),(0,Xv.default)(this,h,a);else{this.log(\"work :: no packets in queue\");let d=n;n=null,this.log(\"work :: done flag is %s\",!!d),d&&d()}},a=()=>{if(o.length)(0,ns.nextTick)(s);else{let h=n;n=null,h()}};r._write=(h,d,g)=>{n=g,this.log(\"writable stream :: parsing buffer\"),i.parse(h),s()};let l=h=>{this.log(\"streamErrorHandler :: error\",h.message),h.code?(this.log(\"streamErrorHandler :: emitting error\"),this.emit(\"error\",h)):this.noop(h)};this.log(\"connect :: pipe stream to writable stream\"),this.stream.pipe(r),this.stream.on(\"error\",l),this.stream.on(\"close\",()=>{this.log(\"(%s)stream :: on close\",this.options.clientId),this._flushVolatile(),this.log(\"stream: emit close to MqttClient\"),this.emit(\"close\")}),this.log(\"connect: sending packet `connect`\");let c={cmd:\"connect\",protocolId:this.options.protocolId,protocolVersion:this.options.protocolVersion,clean:this.options.clean,clientId:this.options.clientId,keepalive:this.options.keepalive,username:this.options.username,password:this.options.password,properties:this.options.properties};if(this.options.will&&(c.will=Object.assign(Object.assign({},this.options.will),{payload:(e=this.options.will)===null||e===void 0?void 0:e.payload})),this.topicAliasRecv&&(c.properties||(c.properties={}),this.topicAliasRecv&&(c.properties.topicAliasMaximum=this.topicAliasRecv.max)),this._writePacket(c),i.on(\"error\",this.emit.bind(this,\"error\")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return this.end(()=>this.emit(\"error\",new Error(\"Packet has no Authentication Method\"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket==\"object\"){let h=Object.assign({cmd:\"auth\",reasonCode:0},this.options.authPacket);this._writePacket(h)}}return this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(()=>{this.log(\"!!connectTimeout hit!! Calling _cleanUp with force `true`\"),this.emit(\"error\",new Error(\"connack timeout\")),this._cleanUp(!0)},this.options.connectTimeout),this}publish(e,r,i,n){this.log(\"publish :: message `%s` to topic `%s`\",r,e);let{options:o}=this;typeof i==\"function\"&&(n=i,i=null),i=i||{},i=Object.assign(Object.assign({},{qos:0,retain:!1,dup:!1}),i);let{qos:a,retain:l,dup:c,properties:h,cbStorePut:d}=i;if(this._checkDisconnecting(n))return this;let g=()=>{let y=0;if((a===1||a===2)&&(y=this._nextId(),y===null))return this.log(\"No messageId left\"),!1;let w={cmd:\"publish\",topic:e,payload:r,qos:a,retain:l,messageId:y,dup:c};switch(o.protocolVersion===5&&(w.properties=h),this.log(\"publish :: qos\",a),a){case 1:case 2:this.outgoing[w.messageId]={volatile:!1,cb:n||this.noop},this.log(\"MqttClient:publish: packet cmd: %s\",w.cmd),this._sendPacket(w,void 0,d);break;default:this.log(\"MqttClient:publish: packet cmd: %s\",w.cmd),this._sendPacket(w,n,d);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!g())&&this._storeProcessingQueue.push({invoke:g,cbStorePut:i.cbStorePut,callback:n}),this}publishAsync(e,r,i){return new Promise((n,o)=>{this.publish(e,r,i,(s,a)=>{s?o(s):n(a)})})}subscribe(e,r,i){let n=this.options.protocolVersion;typeof r==\"function\"&&(i=r),i=i||this.noop;let o=!1,s=[];typeof e==\"string\"?(e=[e],s=e):Array.isArray(e)?s=e:typeof e==\"object\"&&(o=e.resubscribe,delete e.resubscribe,s=Object.keys(e));let a=Fp.validateTopics(s);if(a!==null)return Ha(i,new Error(`Invalid topic ${a}`)),this;if(this._checkDisconnecting(i))return this.log(\"subscribe: discconecting true\"),this;let l={qos:0};n===5&&(l.nl=!1,l.rap=!1,l.rh=0),r=Object.assign(Object.assign({},l),r);let c=r.properties,h=[],d=(y,w)=>{if(w=w||r,!Object.prototype.hasOwnProperty.call(this._resubscribeTopics,y)||this._resubscribeTopics[y].qos{this.log(\"subscribe: array topic %s\",y),d(y)}):Object.keys(e).forEach(y=>{this.log(\"subscribe: object topic %s, %o\",y,e[y]),d(y,e[y])}),!h.length)return i(null,[]),this;let g=()=>{let y=this._nextId();if(y===null)return this.log(\"No messageId left\"),!1;let w={cmd:\"subscribe\",subscriptions:h,messageId:y};if(c&&(w.properties=c),this.options.resubscribe){this.log(\"subscribe :: resubscribe true\");let S=[];h.forEach(E=>{if(this.options.reconnectPeriod>0){let I={qos:E.qos};n===5&&(I.nl=E.nl||!1,I.rap=E.rap||!1,I.rh=E.rh||0,I.properties=E.properties),this._resubscribeTopics[E.topic]=I,S.push(E.topic)}}),this.messageIdToTopic[w.messageId]=S}return this.outgoing[w.messageId]={volatile:!0,cb(S,E){if(!S){let{granted:I}=E;for(let C=0;C0||!g())&&this._storeProcessingQueue.push({invoke:g,callback:i}),this}subscribeAsync(e,r){return new Promise((i,n)=>{this.subscribe(e,r,(o,s)=>{o?n(o):i(s)})})}unsubscribe(e,r,i){typeof e==\"string\"&&(e=[e]),typeof r==\"function\"&&(i=r),i=i||this.noop;let n=Fp.validateTopics(e);if(n!==null)return Ha(i,new Error(`Invalid topic ${n}`)),this;if(this._checkDisconnecting(i))return this;let o=()=>{let s=this._nextId();if(s===null)return this.log(\"No messageId left\"),!1;let a={cmd:\"unsubscribe\",messageId:s,unsubscriptions:[]};return typeof e==\"string\"?a.unsubscriptions=[e]:Array.isArray(e)&&(a.unsubscriptions=e),this.options.resubscribe&&a.unsubscriptions.forEach(l=>{delete this._resubscribeTopics[l]}),typeof r==\"object\"&&r.properties&&(a.properties=r.properties),this.outgoing[a.messageId]={volatile:!0,cb:i},this.log(\"unsubscribe: call _sendPacket\"),this._sendPacket(a),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!o())&&this._storeProcessingQueue.push({invoke:o,callback:i}),this}unsubscribeAsync(e,r){return new Promise((i,n)=>{this.unsubscribe(e,r,(o,s)=>{o?n(o):i(s)})})}end(e,r,i){this.log(\"end :: (%s)\",this.options.clientId),(e==null||typeof e!=\"boolean\")&&(i=i||r,r=e,e=!1),typeof r!=\"object\"&&(i=i||r,r=null),this.log(\"end :: cb? %s\",!!i),(!i||typeof i!=\"function\")&&(i=this.noop);let n=()=>{this.log(\"end :: closeStores: closing incoming and outgoing stores\"),this.disconnected=!0,this.incomingStore.close(s=>{this.outgoingStore.close(a=>{if(this.log(\"end :: closeStores: emitting end\"),this.emit(\"end\"),i){let l=s||a;this.log(\"end :: closeStores: invoking callback with args\"),i(l)}})}),this._deferredReconnect?this._deferredReconnect():(this.options.reconnectPeriod===0||this.options.manualConnect)&&(this.disconnecting=!1)},o=()=>{this.log(\"end :: (%s) :: finish :: calling _cleanUp with force %s\",this.options.clientId,e),this._cleanUp(e,()=>{this.log(\"end :: finish :: calling process.nextTick on closeStores\"),(0,ns.nextTick)(n)},r)};return this.disconnecting?(i(),this):(this._clearReconnect(),this.disconnecting=!0,!e&&Object.keys(this.outgoing).length>0?(this.log(\"end :: (%s) :: calling finish in 10ms once outgoing is empty\",this.options.clientId),this.once(\"outgoingEmpty\",setTimeout.bind(null,o,10))):(this.log(\"end :: (%s) :: immediately calling finish\",this.options.clientId),o()),this)}endAsync(e,r){return new Promise((i,n)=>{this.end(e,r,o=>{o?n(o):i()})})}removeOutgoingMessage(e){if(this.outgoing[e]){let{cb:r}=this.outgoing[e];this._removeOutgoingAndStoreMessage(e,()=>{r(new Error(\"Message removed\"))})}return this}reconnect(e){this.log(\"client reconnect\");let r=()=>{e?(this.options.incomingStore=e.incomingStore,this.options.outgoingStore=e.outgoingStore):(this.options.incomingStore=null,this.options.outgoingStore=null),this.incomingStore=this.options.incomingStore||new ii.default,this.outgoingStore=this.options.outgoingStore||new ii.default,this.disconnecting=!1,this.disconnected=!1,this._deferredReconnect=null,this._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),this}_flushVolatile(){this.outgoing&&(this.log(\"_flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function\"),Object.keys(this.outgoing).forEach(e=>{this.outgoing[e].volatile&&typeof this.outgoing[e].cb==\"function\"&&(this.outgoing[e].cb(new Error(\"Connection closed\")),delete this.outgoing[e])}))}_flush(){this.outgoing&&(this.log(\"_flush: queue exists? %b\",!!this.outgoing),Object.keys(this.outgoing).forEach(e=>{typeof this.outgoing[e].cb==\"function\"&&(this.outgoing[e].cb(new Error(\"Connection closed\")),delete this.outgoing[e])}))}_removeTopicAliasAndRecoverTopicName(e){let r;e.properties&&(r=e.properties.topicAlias);let i=e.topic.toString();if(this.log(\"_removeTopicAliasAndRecoverTopicName :: alias %d, topic %o\",r,i),i.length===0){if(typeof r>\"u\")return new Error(\"Unregistered Topic Alias\");if(i=this.topicAliasSend.getTopicByAlias(r),typeof i>\"u\")return new Error(\"Unregistered Topic Alias\");e.topic=i}r&&delete e.properties.topicAlias}_checkDisconnecting(e){return this.disconnecting&&(e&&e!==this.noop?e(new Error(\"client disconnecting\")):this.emit(\"error\",new Error(\"client disconnecting\"))),this.disconnecting}_reconnect(){this.log(\"_reconnect: emitting reconnect to client\"),this.emit(\"reconnect\"),this.connected?(this.end(()=>{this.connect()}),this.log(\"client already connected. disconnecting first.\")):(this.log(\"_reconnect: calling connect\"),this.connect())}_setupReconnect(){!this.disconnecting&&!this.reconnectTimer&&this.options.reconnectPeriod>0?(this.reconnecting||(this.log(\"_setupReconnect :: emit `offline` state\"),this.emit(\"offline\"),this.log(\"_setupReconnect :: set `reconnecting` to `true`\"),this.reconnecting=!0),this.log(\"_setupReconnect :: setting reconnectTimer for %d ms\",this.options.reconnectPeriod),this.reconnectTimer=setInterval(()=>{this.log(\"reconnectTimer :: reconnect triggered!\"),this._reconnect()},this.options.reconnectPeriod)):this.log(\"_setupReconnect :: doing nothing...\")}_clearReconnect(){this.log(\"_clearReconnect : clearing reconnect timer\"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)}_cleanUp(e,r,i={}){if(r&&(this.log(\"_cleanUp :: done callback provided for on stream close\"),this.stream.on(\"close\",r)),this.log(\"_cleanUp :: forced? %s\",e),e)this.options.reconnectPeriod===0&&this.options.clean&&this._flush(),this.log(\"_cleanUp :: (%s) :: destroying stream\",this.options.clientId),this.stream.destroy();else{let n=Object.assign({cmd:\"disconnect\"},i);this.log(\"_cleanUp :: (%s) :: call _sendPacket with disconnect packet\",this.options.clientId),this._sendPacket(n,()=>{this.log(\"_cleanUp :: (%s) :: destroying stream\",this.options.clientId),Ha(()=>{this.stream.end(()=>{this.log(\"_cleanUp :: (%s) :: stream destroyed\",this.options.clientId)})})})}!this.disconnecting&&!this.reconnecting&&(this.log(\"_cleanUp :: client not disconnecting/reconnecting. Clearing and resetting reconnect.\"),this._clearReconnect(),this._setupReconnect()),this._destroyKeepaliveManager(),r&&!this.connected&&(this.log(\"_cleanUp :: (%s) :: removing stream `done` callback `close` listener\",this.options.clientId),this.stream.removeListener(\"close\",r),r())}_storeAndSend(e,r,i){this.log(\"storeAndSend :: store packet with cmd %s to outgoingStore\",e.cmd);let n=e,o;if(n.cmd===\"publish\"&&(n=(0,jp.default)(e),o=this._removeTopicAliasAndRecoverTopicName(n),o))return r&&r(o);this.outgoingStore.put(n,s=>{if(s)return r&&r(s);i(),this._writePacket(e,r)})}_applyTopicAlias(e){if(this.options.protocolVersion===5&&e.cmd===\"publish\"){let r;e.properties&&(r=e.properties.topicAlias);let i=e.topic.toString();if(this.topicAliasSend)if(r){if(i.length!==0&&(this.log(\"applyTopicAlias :: register topic: %s - alias: %d\",i,r),!this.topicAliasSend.put(i,r)))return this.log(\"applyTopicAlias :: error out of range. topic: %s - alias: %d\",i,r),new Error(\"Sending Topic Alias out of range\")}else i.length!==0&&(this.options.autoAssignTopicAlias?(r=this.topicAliasSend.getAliasByTopic(i),r?(e.topic=\"\",e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log(\"applyTopicAlias :: auto assign(use) topic: %s - alias: %d\",i,r)):(r=this.topicAliasSend.getLruAlias(),this.topicAliasSend.put(i,r),e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log(\"applyTopicAlias :: auto assign topic: %s - alias: %d\",i,r))):this.options.autoUseTopicAlias&&(r=this.topicAliasSend.getAliasByTopic(i),r&&(e.topic=\"\",e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log(\"applyTopicAlias :: auto use topic: %s - alias: %d\",i,r))));else if(r)return this.log(\"applyTopicAlias :: error out of range. topic: %s - alias: %d\",i,r),new Error(\"Sending Topic Alias out of range\")}}_noop(e){this.log(\"noop ::\",e)}_writePacket(e,r){this.log(\"_writePacket :: packet: %O\",e),this.log(\"_writePacket :: emitting `packetsend`\"),this.emit(\"packetsend\",e),this.log(\"_writePacket :: writing to stream\");let i=$a.default.writeToStream(e,this.stream,this.options);this.log(\"_writePacket :: writeToStream result %s\",i),!i&&r&&r!==this.noop?(this.log(\"_writePacket :: handle events on `drain` once through callback.\"),this.stream.once(\"drain\",r)):r&&(this.log(\"_writePacket :: invoking cb\"),r())}_sendPacket(e,r,i,n){this.log(\"_sendPacket :: (%s) :: start\",this.options.clientId),i=i||this.noop,r=r||this.noop;let o=this._applyTopicAlias(e);if(o){r(o);return}if(!this.connected){if(e.cmd===\"auth\"){this._writePacket(e,r);return}this.log(\"_sendPacket :: client not connected. Storing packet offline.\"),this._storePacket(e,r,i);return}if(n){this._writePacket(e,r);return}switch(e.cmd){case\"publish\":break;case\"pubrel\":this._storeAndSend(e,r,i);return;default:this._writePacket(e,r);return}switch(e.qos){case 2:case 1:this._storeAndSend(e,r,i);break;case 0:default:this._writePacket(e,r);break}this.log(\"_sendPacket :: (%s) :: end\",this.options.clientId)}_storePacket(e,r,i){this.log(\"_storePacket :: packet: %o\",e),this.log(\"_storePacket :: cb? %s\",!!r),i=i||this.noop;let n=e;if(n.cmd===\"publish\"){n=(0,jp.default)(e);let s=this._removeTopicAliasAndRecoverTopicName(n);if(s)return r&&r(s)}let o=n.qos||0;o===0&&this.queueQoSZero||n.cmd!==\"publish\"?this.queue.push({packet:n,cb:r}):o>0?(r=this.outgoing[n.messageId]?this.outgoing[n.messageId].cb:null,this.outgoingStore.put(n,s=>{if(s)return r&&r(s);i()})):r&&r(new Error(\"No connection to broker\"))}_setupKeepaliveManager(){this.log(\"_setupKeepaliveManager :: keepalive %d (seconds)\",this.options.keepalive),!this.keepaliveManager&&this.options.keepalive&&(this.keepaliveManager=new eE.default(this,this.options.timerVariant))}_destroyKeepaliveManager(){this.keepaliveManager&&(this.log(\"_destroyKeepaliveManager :: destroying keepalive manager\"),this.keepaliveManager.destroy(),this.keepaliveManager=null)}reschedulePing(e=!1){this.keepaliveManager&&this.options.keepalive&&(e||this.options.reschedulePings)&&this._reschedulePing()}_reschedulePing(){this.log(\"_reschedulePing :: rescheduling ping\"),this.keepaliveManager.reschedule()}sendPing(){this.log(\"_sendPing :: sending pingreq\"),this._sendPacket({cmd:\"pingreq\"})}onKeepaliveTimeout(){this.emit(\"error\",new Error(\"Keepalive timeout\")),this.log(\"onKeepaliveTimeout :: calling _cleanUp with force true\"),this._cleanUp(!0)}_resubscribe(){this.log(\"_resubscribe\");let e=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion>=4&&!this.connackPacket.sessionPresent)&&e.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){this.log(\"_resubscribe: protocolVersion 5\");for(let r=0;r{let i=this.outgoingStore.createStream(),n=()=>{i.destroy(),i=null,this._flushStoreProcessingQueue(),o()},o=()=>{this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={}};this.once(\"close\",n),i.on(\"error\",a=>{o(),this._flushStoreProcessingQueue(),this.removeListener(\"close\",n),this.emit(\"error\",a)});let s=()=>{if(!i)return;let a=i.read(1),l;if(!a){i.once(\"readable\",s);return}if(this._storeProcessing=!0,this._packetIdsDuringStoreProcessing[a.messageId]){s();return}!this.disconnecting&&!this.reconnectTimer?(l=this.outgoing[a.messageId]?this.outgoing[a.messageId].cb:null,this.outgoing[a.messageId]={volatile:!1,cb(c,h){l&&l(c,h),s()}},this._packetIdsDuringStoreProcessing[a.messageId]=!0,this.messageIdProvider.register(a.messageId)?this._sendPacket(a,void 0,void 0,!0):this.log(\"messageId: %d has already used.\",a.messageId)):i.destroy&&i.destroy()};i.on(\"end\",()=>{let a=!0;for(let l in this._packetIdsDuringStoreProcessing)if(!this._packetIdsDuringStoreProcessing[l]){a=!1;break}this.removeListener(\"close\",n),a?(o(),this._invokeAllStoreProcessingQueue(),this.emit(\"connect\",e)):r()}),s()};r()}_invokeStoreProcessingQueue(){if(!this._storeProcessing&&this._storeProcessingQueue.length>0){let e=this._storeProcessingQueue[0];if(e&&e.invoke())return this._storeProcessingQueue.shift(),!0}return!1}_invokeAllStoreProcessingQueue(){for(;this._invokeStoreProcessingQueue(););}_flushStoreProcessingQueue(){for(let e of this._storeProcessingQueue)e.cbStorePut&&e.cbStorePut(new Error(\"Connection closed\")),e.callback&&e.callback(new Error(\"Connection closed\"));this._storeProcessingQueue.splice(0)}_removeOutgoingAndStoreMessage(e,r){delete this.outgoing[e],this.outgoingStore.del({messageId:e},(i,n)=>{r(i,n),this.messageIdProvider.deallocate(e),this._invokeStoreProcessingQueue()})}};ss.VERSION=ns.MQTTJS_VERSION;Qe.default=ss});var Vp=M(za=>{\"use strict\";_();v();m();Object.defineProperty(za,\"__esModule\",{value:!0});var tE=Ua(),Va=class{constructor(){this.numberAllocator=new tE.NumberAllocator(1,65535)}allocate(){return this.lastId=this.numberAllocator.alloc(),this.lastId}getLastAllocated(){return this.lastId}register(e){return this.numberAllocator.use(e)}deallocate(e){this.numberAllocator.free(e)}clear(){this.numberAllocator.clear()}};za.default=Va});function Rr(t){throw new RangeError(sE[t])}function zp(t,e){let r=t.split(\"@\"),i=\"\";r.length>1&&(i=r[0]+\"@\",t=r[1]);let n=function(o,s){let a=[],l=o.length;for(;l--;)a[l]=s(o[l]);return a}((t=t.replace(nE,\".\")).split(\".\"),e).join(\".\");return i+n}function Yp(t){let e=[],r=0,i=t.length;for(;r=55296&&n<=56319&&r{_();v();m();rE=/^xn--/,iE=/[^\\0-\\x7E]/,nE=/[\\x2E\\u3002\\uFF0E\\uFF61]/g,sE={overflow:\"Overflow: input needs wider integers to process\",\"not-basic\":\"Illegal input >= 0x80 (not a basic code point)\",\"invalid-input\":\"Invalid input\"},dt=Math.floor,Ka=String.fromCharCode;Kp=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Jp=function(t,e,r){let i=0;for(t=r?dt(t/700):t>>1,t+=dt(t/e);t>455;i+=36)t=dt(t/35);return dt(i+36*t/(t+38))},Gp=function(t){let e=[],r=t.length,i=0,n=128,o=72,s=t.lastIndexOf(\"-\");s<0&&(s=0);for(let l=0;l=128&&Rr(\"not-basic\"),e.push(t.charCodeAt(l));for(let l=s>0?s+1:0;l=r&&Rr(\"invalid-input\");let y=(a=t.charCodeAt(l++))-48<10?a-22:a-65<26?a-65:a-97<26?a-97:36;(y>=36||y>dt((2147483647-i)/d))&&Rr(\"overflow\"),i+=y*d;let w=g<=o?1:g>=o+26?26:g-o;if(ydt(2147483647/S)&&Rr(\"overflow\"),d*=S}let h=e.length+1;o=Jp(i-c,h,c==0),dt(i/h)>2147483647-n&&Rr(\"overflow\"),n+=dt(i/h),i%=h,e.splice(i++,0,n)}var a;return String.fromCodePoint(...e)},Qp=function(t){let e=[],r=(t=Yp(t)).length,i=128,n=0,o=72;for(let l of t)l<128&&e.push(Ka(l));let s=e.length,a=s;for(s&&e.push(\"-\");a=i&&hdt((2147483647-n)/c)&&Rr(\"overflow\"),n+=(l-i)*c,i=l;for(let h of t)if(h2147483647&&Rr(\"overflow\"),h==i){let d=n;for(let g=36;;g+=36){let y=g<=o?1:g>=o+26?26:g-o;if(dString.fromCodePoint(...t)},decode:Gp,encode:Qp,toASCII:function(t){return zp(t,function(e){return iE.test(e)?\"xn--\"+Qp(e):e})},toUnicode:function(t){return zp(t,function(e){return rE.test(e)?Gp(e.slice(4).toLowerCase()):e})}};Kt.decode;Kt.encode;Kt.toASCII;Kt.toUnicode;Kt.ucs2;Kt.version});function oE(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var aE,Mi,lE,pt,Zp=_e(()=>{_();v();m();aE=function(t,e,r,i){e=e||\"&\",r=r||\"=\";var n={};if(typeof t!=\"string\"||t.length===0)return n;var o=/\\+/g;t=t.split(e);var s=1e3;i&&typeof i.maxKeys==\"number\"&&(s=i.maxKeys);var a=t.length;s>0&&a>s&&(a=s);for(var l=0;l=0?(c=y.substr(0,w),h=y.substr(w+1)):(c=y,h=\"\"),d=decodeURIComponent(c),g=decodeURIComponent(h),oE(n,d)?Array.isArray(n[d])?n[d].push(g):n[d]=[n[d],g]:n[d]=g}return n},Mi=function(t){switch(typeof t){case\"string\":return t;case\"boolean\":return t?\"true\":\"false\";case\"number\":return isFinite(t)?t:\"\";default:return\"\"}},lE=function(t,e,r,i){return e=e||\"&\",r=r||\"=\",t===null&&(t=void 0),typeof t==\"object\"?Object.keys(t).map(function(n){var o=encodeURIComponent(Mi(n))+r;return Array.isArray(t[n])?t[n].map(function(s){return o+encodeURIComponent(Mi(s))}).join(e):o+encodeURIComponent(Mi(t[n]))}).join(e):i?encodeURIComponent(Mi(i))+r+encodeURIComponent(Mi(t)):\"\"},pt={};pt.decode=pt.parse=aE,pt.encode=pt.stringify=lE;pt.decode;pt.encode;pt.parse;pt.stringify});function Ga(){throw new Error(\"setTimeout has not been defined\")}function Qa(){throw new Error(\"clearTimeout has not been defined\")}function rg(t){if(Pt===setTimeout)return setTimeout(t,0);if((Pt===Ga||!Pt)&&setTimeout)return Pt=setTimeout,setTimeout(t,0);try{return Pt(t,0)}catch{try{return Pt.call(null,t,0)}catch{return Pt.call(this||si,t,0)}}}function uE(){ni&&Cr&&(ni=!1,Cr.length?Ot=Cr.concat(Ot):as=-1,Ot.length&&ig())}function ig(){if(!ni){var t=rg(uE);ni=!0;for(var e=Ot.length;e;){for(Cr=Ot,Ot=[];++as{_();v();m();si=typeof globalThis<\"u\"?globalThis:typeof self<\"u\"?self:global,fe=tg={};(function(){try{Pt=typeof setTimeout==\"function\"?setTimeout:Ga}catch{Pt=Ga}try{kt=typeof clearTimeout==\"function\"?clearTimeout:Qa}catch{kt=Qa}})();Ot=[],ni=!1,as=-1;fe.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r1)for(var I=1;I{_();v();m();Ya={},sg=!1,oi=typeof globalThis<\"u\"?globalThis:typeof self<\"u\"?self:global;re=fE();re.platform=\"browser\";re.addListener;re.argv;re.binding;re.browser;re.chdir;re.cwd;re.emit;re.env;re.listeners;re.nextTick;re.off;re.on;re.once;re.prependListener;re.prependOnceListener;re.removeAllListeners;re.removeListener;re.title;re.umask;re.version;re.versions});function cE(){if(og)return Xa;og=!0;var t=re;function e(o){if(typeof o!=\"string\")throw new TypeError(\"Path must be a string. Received \"+JSON.stringify(o))}function r(o,s){for(var a=\"\",l=0,c=-1,h=0,d,g=0;g<=o.length;++g){if(g2){var y=a.lastIndexOf(\"/\");if(y!==a.length-1){y===-1?(a=\"\",l=0):(a=a.slice(0,y),l=a.length-1-a.lastIndexOf(\"/\")),c=g,h=0;continue}}else if(a.length===2||a.length===1){a=\"\",l=0,c=g,h=0;continue}}s&&(a.length>0?a+=\"/..\":a=\"..\",l=2)}else a.length>0?a+=\"/\"+o.slice(c+1,g):a=o.slice(c+1,g),l=g-c-1;c=g,h=0}else d===46&&h!==-1?++h:h=-1}return a}function i(o,s){var a=s.dir||s.root,l=s.base||(s.name||\"\")+(s.ext||\"\");return a?a===s.root?a+l:a+o+l:l}var n={resolve:function(){for(var s=\"\",a=!1,l,c=arguments.length-1;c>=-1&&!a;c--){var h;c>=0?h=arguments[c]:(l===void 0&&(l=t.cwd()),h=l),e(h),h.length!==0&&(s=h+\"/\"+s,a=h.charCodeAt(0)===47)}return s=r(s,!a),a?s.length>0?\"/\"+s:\"/\":s.length>0?s:\".\"},normalize:function(s){if(e(s),s.length===0)return\".\";var a=s.charCodeAt(0)===47,l=s.charCodeAt(s.length-1)===47;return s=r(s,!a),s.length===0&&!a&&(s=\".\"),s.length>0&&l&&(s+=\"/\"),a?\"/\"+s:s},isAbsolute:function(s){return e(s),s.length>0&&s.charCodeAt(0)===47},join:function(){if(arguments.length===0)return\".\";for(var s,a=0;a0&&(s===void 0?s=l:s+=\"/\"+l)}return s===void 0?\".\":n.normalize(s)},relative:function(s,a){if(e(s),e(a),s===a||(s=n.resolve(s),a=n.resolve(a),s===a))return\"\";for(var l=1;lw){if(a.charCodeAt(d+E)===47)return a.slice(d+E+1);if(E===0)return a.slice(d+E)}else h>w&&(s.charCodeAt(l+E)===47?S=E:E===0&&(S=0));break}var I=s.charCodeAt(l+E),C=a.charCodeAt(d+E);if(I!==C)break;I===47&&(S=E)}var R=\"\";for(E=l+S+1;E<=c;++E)(E===c||s.charCodeAt(E)===47)&&(R.length===0?R+=\"..\":R+=\"/..\");return R.length>0?R+a.slice(d+S):(d+=S,a.charCodeAt(d)===47&&++d,a.slice(d))},_makeLong:function(s){return s},dirname:function(s){if(e(s),s.length===0)return\".\";for(var a=s.charCodeAt(0),l=a===47,c=-1,h=!0,d=s.length-1;d>=1;--d)if(a=s.charCodeAt(d),a===47){if(!h){c=d;break}}else h=!1;return c===-1?l?\"/\":\".\":l&&c===1?\"//\":s.slice(0,c)},basename:function(s,a){if(a!==void 0&&typeof a!=\"string\")throw new TypeError('\"ext\" argument must be a string');e(s);var l=0,c=-1,h=!0,d;if(a!==void 0&&a.length>0&&a.length<=s.length){if(a.length===s.length&&a===s)return\"\";var g=a.length-1,y=-1;for(d=s.length-1;d>=0;--d){var w=s.charCodeAt(d);if(w===47){if(!h){l=d+1;break}}else y===-1&&(h=!1,y=d+1),g>=0&&(w===a.charCodeAt(g)?--g===-1&&(c=d):(g=-1,c=y))}return l===c?c=y:c===-1&&(c=s.length),s.slice(l,c)}else{for(d=s.length-1;d>=0;--d)if(s.charCodeAt(d)===47){if(!h){l=d+1;break}}else c===-1&&(h=!1,c=d+1);return c===-1?\"\":s.slice(l,c)}},extname:function(s){e(s);for(var a=-1,l=0,c=-1,h=!0,d=0,g=s.length-1;g>=0;--g){var y=s.charCodeAt(g);if(y===47){if(!h){l=g+1;break}continue}c===-1&&(h=!1,c=g+1),y===46?a===-1?a=g:d!==1&&(d=1):a!==-1&&(d=-1)}return a===-1||c===-1||d===0||d===1&&a===c-1&&a===l+1?\"\":s.slice(a,c)},format:function(s){if(s===null||typeof s!=\"object\")throw new TypeError('The \"pathObject\" argument must be of type Object. Received type '+typeof s);return i(\"/\",s)},parse:function(s){e(s);var a={root:\"\",dir:\"\",base:\"\",ext:\"\",name:\"\"};if(s.length===0)return a;var l=s.charCodeAt(0),c=l===47,h;c?(a.root=\"/\",h=1):h=0;for(var d=-1,g=0,y=-1,w=!0,S=s.length-1,E=0;S>=h;--S){if(l=s.charCodeAt(S),l===47){if(!w){g=S+1;break}continue}y===-1&&(w=!1,y=S+1),l===46?d===-1?d=S:E!==1&&(E=1):d!==-1&&(E=-1)}return d===-1||y===-1||E===0||E===1&&d===y-1&&d===g+1?y!==-1&&(g===0&&c?a.base=a.name=s.slice(1,y):a.base=a.name=s.slice(g,y)):(g===0&&c?(a.name=s.slice(1,d),a.base=s.slice(1,y)):(a.name=s.slice(g,d),a.base=s.slice(g,y)),a.ext=s.slice(d,y)),g>0?a.dir=s.slice(0,g-1):c&&(a.dir=\"/\"),a},sep:\"/\",delimiter:\":\",win32:null,posix:null};return n.posix=n,Xa=n,Xa}var Xa,og,Za,ag=_e(()=>{_();v();m();Ja();Xa={},og=!1;Za=cE()});var gg={};Jt(gg,{URL:()=>FE,Url:()=>UE,default:()=>Z,fileURLToPath:()=>dg,format:()=>NE,parse:()=>jE,pathToFileURL:()=>pg,resolve:()=>qE,resolveObject:()=>DE});function Fe(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function Li(t,e,r){if(t&>.isObject(t)&&t instanceof Fe)return t;var i=new Fe;return i.parse(t,e,r),i}function _E(){if(cg)return rl;cg=!0;var t=ne;function e(o){if(typeof o!=\"string\")throw new TypeError(\"Path must be a string. Received \"+JSON.stringify(o))}function r(o,s){for(var a=\"\",l=0,c=-1,h=0,d,g=0;g<=o.length;++g){if(g2){var y=a.lastIndexOf(\"/\");if(y!==a.length-1){y===-1?(a=\"\",l=0):(a=a.slice(0,y),l=a.length-1-a.lastIndexOf(\"/\")),c=g,h=0;continue}}else if(a.length===2||a.length===1){a=\"\",l=0,c=g,h=0;continue}}s&&(a.length>0?a+=\"/..\":a=\"..\",l=2)}else a.length>0?a+=\"/\"+o.slice(c+1,g):a=o.slice(c+1,g),l=g-c-1;c=g,h=0}else d===46&&h!==-1?++h:h=-1}return a}function i(o,s){var a=s.dir||s.root,l=s.base||(s.name||\"\")+(s.ext||\"\");return a?a===s.root?a+l:a+o+l:l}var n={resolve:function(){for(var s=\"\",a=!1,l,c=arguments.length-1;c>=-1&&!a;c--){var h;c>=0?h=arguments[c]:(l===void 0&&(l=t.cwd()),h=l),e(h),h.length!==0&&(s=h+\"/\"+s,a=h.charCodeAt(0)===47)}return s=r(s,!a),a?s.length>0?\"/\"+s:\"/\":s.length>0?s:\".\"},normalize:function(s){if(e(s),s.length===0)return\".\";var a=s.charCodeAt(0)===47,l=s.charCodeAt(s.length-1)===47;return s=r(s,!a),s.length===0&&!a&&(s=\".\"),s.length>0&&l&&(s+=\"/\"),a?\"/\"+s:s},isAbsolute:function(s){return e(s),s.length>0&&s.charCodeAt(0)===47},join:function(){if(arguments.length===0)return\".\";for(var s,a=0;a0&&(s===void 0?s=l:s+=\"/\"+l)}return s===void 0?\".\":n.normalize(s)},relative:function(s,a){if(e(s),e(a),s===a||(s=n.resolve(s),a=n.resolve(a),s===a))return\"\";for(var l=1;lw){if(a.charCodeAt(d+E)===47)return a.slice(d+E+1);if(E===0)return a.slice(d+E)}else h>w&&(s.charCodeAt(l+E)===47?S=E:E===0&&(S=0));break}var I=s.charCodeAt(l+E),C=a.charCodeAt(d+E);if(I!==C)break;I===47&&(S=E)}var R=\"\";for(E=l+S+1;E<=c;++E)(E===c||s.charCodeAt(E)===47)&&(R.length===0?R+=\"..\":R+=\"/..\");return R.length>0?R+a.slice(d+S):(d+=S,a.charCodeAt(d)===47&&++d,a.slice(d))},_makeLong:function(s){return s},dirname:function(s){if(e(s),s.length===0)return\".\";for(var a=s.charCodeAt(0),l=a===47,c=-1,h=!0,d=s.length-1;d>=1;--d)if(a=s.charCodeAt(d),a===47){if(!h){c=d;break}}else h=!1;return c===-1?l?\"/\":\".\":l&&c===1?\"//\":s.slice(0,c)},basename:function(s,a){if(a!==void 0&&typeof a!=\"string\")throw new TypeError('\"ext\" argument must be a string');e(s);var l=0,c=-1,h=!0,d;if(a!==void 0&&a.length>0&&a.length<=s.length){if(a.length===s.length&&a===s)return\"\";var g=a.length-1,y=-1;for(d=s.length-1;d>=0;--d){var w=s.charCodeAt(d);if(w===47){if(!h){l=d+1;break}}else y===-1&&(h=!1,y=d+1),g>=0&&(w===a.charCodeAt(g)?--g===-1&&(c=d):(g=-1,c=y))}return l===c?c=y:c===-1&&(c=s.length),s.slice(l,c)}else{for(d=s.length-1;d>=0;--d)if(s.charCodeAt(d)===47){if(!h){l=d+1;break}}else c===-1&&(h=!1,c=d+1);return c===-1?\"\":s.slice(l,c)}},extname:function(s){e(s);for(var a=-1,l=0,c=-1,h=!0,d=0,g=s.length-1;g>=0;--g){var y=s.charCodeAt(g);if(y===47){if(!h){l=g+1;break}continue}c===-1&&(h=!1,c=g+1),y===46?a===-1?a=g:d!==1&&(d=1):a!==-1&&(d=-1)}return a===-1||c===-1||d===0||d===1&&a===c-1&&a===l+1?\"\":s.slice(a,c)},format:function(s){if(s===null||typeof s!=\"object\")throw new TypeError('The \"pathObject\" argument must be of type Object. Received type '+typeof s);return i(\"/\",s)},parse:function(s){e(s);var a={root:\"\",dir:\"\",base:\"\",ext:\"\",name:\"\"};if(s.length===0)return a;var l=s.charCodeAt(0),c=l===47,h;c?(a.root=\"/\",h=1):h=0;for(var d=-1,g=0,y=-1,w=!0,S=s.length-1,E=0;S>=h;--S){if(l=s.charCodeAt(S),l===47){if(!w){g=S+1;break}continue}y===-1&&(w=!1,y=S+1),l===46?d===-1?d=S:E!==1&&(E=1):d!==-1&&(E=-1)}return d===-1||y===-1||E===0||E===1&&d===y-1&&d===g+1?y!==-1&&(g===0&&c?a.base=a.name=s.slice(1,y):a.base=a.name=s.slice(g,y)):(g===0&&c?(a.name=s.slice(1,d),a.base=s.slice(1,y)):(a.name=s.slice(g,d),a.base=s.slice(g,y)),a.ext=s.slice(d,y)),g>0?a.dir=s.slice(0,g-1):c&&(a.dir=\"/\"),a},sep:\"/\",delimiter:\":\",win32:null,posix:null};return n.posix=n,rl=n,rl}function kE(t){if(typeof t==\"string\")t=new URL(t);else if(!(t instanceof URL))throw new Deno.errors.InvalidData(\"invalid argument path , must be a string or URL\");if(t.protocol!==\"file:\")throw new Deno.errors.InvalidData(\"invalid url scheme\");return nl?OE(t):xE(t)}function OE(t){let e=t.hostname,r=t.pathname;for(let i=0;iAE||n!==\":\")throw new Deno.errors.InvalidData(\"file url path must be absolute\");return r.slice(1)}}function xE(t){if(t.hostname!==\"\")throw new Deno.errors.InvalidData(\"invalid file url hostname\");let e=t.pathname;for(let r=0;rVE||n!==\":\")throw new Deno.errors.InvalidData(\"file url path must be absolute\");return r.slice(1)}}function ZE(t){if(t.hostname!==\"\")throw new Deno.errors.InvalidData(\"invalid file url hostname\");let e=t.pathname;for(let r=0;r{_();v();m();Xp();Zp();ng();ag();Ja();Z={},hE=Kt,gt={isString:function(t){return typeof t==\"string\"},isObject:function(t){return typeof t==\"object\"&&t!==null},isNull:function(t){return t===null},isNullOrUndefined:function(t){return t==null}};Z.parse=Li,Z.resolve=function(t,e){return Li(t,!1,!0).resolve(e)},Z.resolveObject=function(t,e){return t?Li(t,!1,!0).resolveObject(e):e},Z.format=function(t){return gt.isString(t)&&(t=Li(t)),t instanceof Fe?t.format():Fe.prototype.format.call(t)},Z.Url=Fe;dE=/^([a-z0-9.+-]+:)/i,pE=/:[0-9]*$/,gE=/^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,yE=[\"{\",\"}\",\"|\",\"\\\\\",\"^\",\"`\"].concat([\"<\",\">\",'\"',\"`\",\" \",\"\\r\",`", + "`,\"\t\"]),il=[\"'\"].concat(yE),lg=[\"%\",\"/\",\"?\",\";\",\"#\"].concat(il),ug=[\"/\",\"?\",\"#\"],fg=/^[+a-z0-9A-Z_-]{0,63}$/,bE=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,wE={javascript:!0,\"javascript:\":!0},el={javascript:!0,\"javascript:\":!0},ai={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,\"http:\":!0,\"https:\":!0,\"ftp:\":!0,\"gopher:\":!0,\"file:\":!0},tl=pt;Fe.prototype.parse=function(t,e,r){if(!gt.isString(t))throw new TypeError(\"Parameter 'url' must be a string, not \"+typeof t);var i=t.indexOf(\"?\"),n=i!==-1&&i127?U+=\"x\":U+=R[N];if(!U.match(fg)){var K=I.slice(0,w),z=I.slice(w+1),Q=R.match(bE);Q&&(K.push(Q[1]),z.unshift(Q[2])),z.length&&(s=\"/\"+z.join(\".\")+s),this.hostname=K.join(\".\");break}}}this.hostname.length>255?this.hostname=\"\":this.hostname=this.hostname.toLowerCase(),E||(this.hostname=hE.toASCII(this.hostname));var pe=this.port?\":\"+this.port:\"\",Yt=this.hostname||\"\";this.host=Yt+pe,this.href+=this.host,E&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),s[0]!==\"/\"&&(s=\"/\"+s))}if(!wE[c])for(w=0,C=il.length;w0)&&r.host.split(\"@\"))&&(r.auth=Q.shift(),r.host=r.hostname=Q.shift())),r.search=t.search,r.query=t.query,gt.isNull(r.pathname)&>.isNull(r.search)||(r.path=(r.pathname?r.pathname:\"\")+(r.search?r.search:\"\")),r.href=r.format(),r;if(!R.length)return r.pathname=null,r.search?r.path=\"/\"+r.search:r.path=null,r.href=r.format(),r;for(var N=R.slice(-1)[0],W=(r.host||t.host||R.length>1)&&(N===\".\"||N===\"..\")||N===\"\",K=0,z=R.length;z>=0;z--)(N=R[z])===\".\"?R.splice(z,1):N===\"..\"?(R.splice(z,1),K++):K&&(R.splice(z,1),K--);if(!I&&!C)for(;K--;K)R.unshift(\"..\");!I||R[0]===\"\"||R[0]&&R[0].charAt(0)===\"/\"||R.unshift(\"\"),W&&R.join(\"/\").substr(-1)!==\"/\"&&R.push(\"\");var Q,pe=R[0]===\"\"||R[0]&&R[0].charAt(0)===\"/\";return U&&(r.hostname=r.host=pe?\"\":R.length?R.shift():\"\",(Q=!!(r.host&&r.host.indexOf(\"@\")>0)&&r.host.split(\"@\"))&&(r.auth=Q.shift(),r.host=r.hostname=Q.shift())),(I=I||r.host&&R.length)&&!pe&&R.unshift(\"\"),R.length?r.pathname=R.join(\"/\"):(r.pathname=null,r.path=null),gt.isNull(r.pathname)&>.isNull(r.search)||(r.path=(r.pathname?r.pathname:\"\")+(r.search?r.search:\"\")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},Fe.prototype.parseHost=function(){var t=this.host,e=pE.exec(t);e&&((e=e[0])!==\":\"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};Z.Url;Z.format;Z.resolve;Z.resolveObject;rl={},cg=!1;hg=_E(),mE=typeof Deno<\"u\"?Deno.build.os===\"windows\"?\"win32\":Deno.build.os:void 0;Z.URL=typeof URL<\"u\"?URL:null;Z.pathToFileURL=ME;Z.fileURLToPath=kE;Z.Url;Z.format;Z.resolve;Z.resolveObject;Z.URL;vE=92,EE=47,SE=97,AE=122,nl=mE===\"win32\",IE=/\\//g,TE=/%/g,RE=/\\\\/g,CE=/\\n/g,BE=/\\r/g,PE=/\\t/g;LE=typeof Deno<\"u\"?Deno.build.os===\"windows\"?\"win32\":Deno.build.os:void 0;Z.URL=typeof URL<\"u\"?URL:null;Z.pathToFileURL=pg;Z.fileURLToPath=dg;UE=Z.Url,NE=Z.format,qE=Z.resolve,DE=Z.resolveObject,jE=Z.parse,FE=Z.URL,WE=92,$E=47,HE=97,VE=122,sl=LE===\"win32\",zE=/\\//g,KE=/%/g,GE=/\\\\/g,QE=/\\n/g,YE=/\\r/g,JE=/\\t/g});var wg=M((YL,bg)=>{\"use strict\";_();v();m();bg.exports=function(){throw new Error(\"ws does not work in the browser. Browser clients must use the native WebSocket object\")}});var ls=M(li=>{\"use strict\";_();v();m();Object.defineProperty(li,\"__esModule\",{value:!0});li.BufferedDuplex=li.writev=void 0;var eS=jt(),_g=(be(),X(me));function mg(t,e){let r=new Array(t.length);for(let i=0;i{this.destroyed||this.push(n)})}_read(e){this.proxy.read(e)}_write(e,r,i){this.isSocketOpen?this.writeToProxy(e,r,i):this.writeQueue.push({chunk:e,encoding:r,cb:i})}_final(e){this.writeQueue=[],this.proxy.end(e)}_destroy(e,r){this.writeQueue=[],this.proxy.destroy(),r(e)}socketReady(){this.emit(\"connect\"),this.isSocketOpen=!0,this.processWriteQueue()}writeToProxy(e,r,i){this.proxy.write(e,r)===!1?this.proxy.once(\"drain\",i):i()}processWriteQueue(){for(;this.writeQueue.length>0;){let{chunk:e,encoding:r,cb:i}=this.writeQueue.shift();this.writeToProxy(e,r,i)}}};li.BufferedDuplex=ol});var Ui=M(Qt=>{\"use strict\";_();v();m();var ll=Qt&&Qt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qt,\"__esModule\",{value:!0});Qt.streamBuilder=Qt.browserStreamBuilder=void 0;var us=(be(),X(me)),vg=ll(wg()),tS=ll(ot()),rS=jt(),iS=ll(Oi()),al=ls(),Gt=(0,tS.default)(\"mqttjs:ws\"),nS=[\"rejectUnauthorized\",\"ca\",\"cert\",\"key\",\"pfx\",\"passphrase\"];function Eg(t,e){let r=`${t.protocol}://${t.hostname}:${t.port}${t.path}`;return typeof t.transformWsUrl==\"function\"&&(r=t.transformWsUrl(r,t,e)),r}function Sg(t){let e=t;return t.port||(t.protocol===\"wss\"?e.port=443:e.port=80),t.path||(e.path=\"/\"),t.wsOptions||(e.wsOptions={}),!iS.default&&!t.forceNativeWebSocket&&t.protocol===\"wss\"&&nS.forEach(r=>{Object.prototype.hasOwnProperty.call(t,r)&&!Object.prototype.hasOwnProperty.call(t.wsOptions,r)&&(e.wsOptions[r]=t[r])}),e}function sS(t){let e=Sg(t);if(e.hostname||(e.hostname=e.host),!e.hostname){if(typeof document>\"u\")throw new Error(\"Could not determine host. Specify host manually.\");let r=new URL(document.URL);e.hostname=r.hostname,e.port||(e.port=Number(r.port))}return e.objectMode===void 0&&(e.objectMode=!(e.binary===!0||e.binary===void 0)),e}function oS(t,e,r){Gt(\"createWebSocket\"),Gt(`protocol: ${r.protocolId} ${r.protocolVersion}`);let i=r.protocolId===\"MQIsdp\"&&r.protocolVersion===3?\"mqttv3.1\":\"mqtt\";Gt(`creating new Websocket for url: ${e} and protocol: ${i}`);let n;return r.createWebsocket?n=r.createWebsocket(e,[i],r):n=new vg.default(e,[i],r.wsOptions),n}function aS(t,e){let r=e.protocolId===\"MQIsdp\"&&e.protocolVersion===3?\"mqttv3.1\":\"mqtt\",i=Eg(e,t),n;return e.createWebsocket?n=e.createWebsocket(i,[r],e):n=new WebSocket(i,[r]),n.binaryType=\"arraybuffer\",n}var lS=(t,e)=>{Gt(\"streamBuilder\");let r=Sg(e);r.hostname=r.hostname||r.host||\"localhost\";let i=Eg(r,t),n=oS(t,i,r),o=vg.default.createWebSocketStream(n,r.wsOptions);return o.url=i,n.on(\"close\",()=>{o.destroy()}),o};Qt.streamBuilder=lS;var uS=(t,e)=>{Gt(\"browserStreamBuilder\");let r,n=sS(e).browserBufferSize||1024*512,o=e.browserBufferTimeout||1e3,s=!e.objectMode,a=aS(t,e),l=h(e,S,E);e.objectMode||(l._writev=al.writev.bind(l)),l.on(\"close\",()=>{a.close()});let c=typeof a.addEventListener<\"u\";a.readyState===a.OPEN?(r=l,r.socket=a):(r=new al.BufferedDuplex(e,l,a),c?a.addEventListener(\"open\",d):a.onopen=d),c?(a.addEventListener(\"close\",g),a.addEventListener(\"error\",y),a.addEventListener(\"message\",w)):(a.onclose=g,a.onerror=y,a.onmessage=w);function h(I,C,R){let U=new rS.Transform({objectMode:I.objectMode});return U._write=C,U._flush=R,U}function d(){Gt(\"WebSocket onOpen\"),r instanceof al.BufferedDuplex&&r.socketReady()}function g(I){Gt(\"WebSocket onClose\",I),r.end(),r.destroy()}function y(I){Gt(\"WebSocket onError\",I);let C=new Error(\"WebSocket error\");C.event=I,r.destroy(C)}async function w(I){let{data:C}=I;C instanceof ArrayBuffer?C=us.Buffer.from(C):C instanceof Blob?C=us.Buffer.from(await new Response(C).arrayBuffer()):C=us.Buffer.from(C,\"utf8\"),l&&!l.destroyed&&l.push(C)}function S(I,C,R){if(a.bufferedAmount>n){setTimeout(S,o,I,C,R);return}s&&typeof I==\"string\"&&(I=us.Buffer.from(I,\"utf8\"));try{a.send(I)}catch(U){return R(U)}R()}function E(I){a.close(),I()}return r};Qt.browserStreamBuilder=uS});var ul={};Jt(ul,{Server:()=>Me,Socket:()=>Me,Stream:()=>Me,_createServerHandle:()=>Me,_normalizeArgs:()=>Me,_setSimultaneousAccepts:()=>Me,connect:()=>Me,createConnection:()=>Me,createServer:()=>Me,default:()=>fS,isIP:()=>Me,isIPv4:()=>Me,isIPv6:()=>Me});function Me(){throw new Error(\"Node.js net module is not supported by JSPM core outside of Node.js\")}var fS,fl=_e(()=>{_();v();m();fS={_createServerHandle:Me,_normalizeArgs:Me,_setSimultaneousAccepts:Me,connect:Me,createConnection:Me,createServer:Me,isIP:Me,isIPv4:Me,isIPv6:Me,Server:Me,Socket:Me,Stream:Me}});var cl=M(Ni=>{\"use strict\";_();v();m();var Ag=Ni&&Ni.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ni,\"__esModule\",{value:!0});var cS=Ag((fl(),X(ul))),hS=Ag(ot()),dS=(0,hS.default)(\"mqttjs:tcp\"),pS=(t,e)=>{e.port=e.port||1883,e.hostname=e.hostname||e.host||\"localhost\";let{port:r,path:i}=e,n=e.hostname;return dS(\"port %d and host %s\",r,n),cS.default.createConnection({port:r,host:n,path:i})};Ni.default=pS});var Ig={};Jt(Ig,{default:()=>gS});var gS,Tg=_e(()=>{_();v();m();gS={}});var dl=M(qi=>{\"use strict\";_();v();m();var hl=qi&&qi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qi,\"__esModule\",{value:!0});var yS=hl((Tg(),X(Ig))),bS=hl((fl(),X(ul))),wS=hl(ot()),_S=(0,wS.default)(\"mqttjs:tls\"),mS=(t,e)=>{e.port=e.port||8883,e.host=e.hostname||e.host||\"localhost\",bS.default.isIP(e.host)===0&&(e.servername=e.host),e.rejectUnauthorized=e.rejectUnauthorized!==!1,delete e.path,_S(\"port %d host %s rejectUnauthorized %b\",e.port,e.host,e.rejectUnauthorized);let r=yS.default.connect(e);r.on(\"secureConnect\",()=>{e.rejectUnauthorized&&!r.authorized?r.emit(\"error\",new Error(\"TLS not authorized\")):r.removeListener(\"error\",i)});function i(n){e.rejectUnauthorized&&t.emit(\"error\",n),r.end()}return r.on(\"error\",i),r};qi.default=mS});var yl=M(gl=>{\"use strict\";_();v();m();Object.defineProperty(gl,\"__esModule\",{value:!0});var Rg=(be(),X(me)),vS=jt(),ES=ls(),yt,pl,Le;function SS(){let t=new vS.Transform;return t._write=(e,r,i)=>{yt.send({data:e.buffer,success(){i()},fail(n){i(new Error(n))}})},t._flush=e=>{yt.close({success(){e()}})},t}function AS(t){t.hostname||(t.hostname=\"localhost\"),t.path||(t.path=\"/\"),t.wsOptions||(t.wsOptions={})}function IS(t,e){let r=t.protocol===\"wxs\"?\"wss\":\"ws\",i=`${r}://${t.hostname}${t.path}`;return t.port&&t.port!==80&&t.port!==443&&(i=`${r}://${t.hostname}:${t.port}${t.path}`),typeof t.transformWsUrl==\"function\"&&(i=t.transformWsUrl(i,t,e)),i}function TS(){yt.onOpen(()=>{Le.socketReady()}),yt.onMessage(t=>{let{data:e}=t;e instanceof ArrayBuffer?e=Rg.Buffer.from(e):e=Rg.Buffer.from(e,\"utf8\"),pl.push(e)}),yt.onClose(()=>{Le.emit(\"close\"),Le.end(),Le.destroy()}),yt.onError(t=>{let e=new Error(t.errMsg);Le.destroy(e)})}var RS=(t,e)=>{if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error(\"Could not determine host. Specify host manually.\");let r=e.protocolId===\"MQIsdp\"&&e.protocolVersion===3?\"mqttv3.1\":\"mqtt\";AS(e);let i=IS(e,t);yt=wx.connectSocket({url:i,protocols:[r]}),pl=SS(),Le=new ES.BufferedDuplex(e,pl,yt),Le._destroy=(o,s)=>{yt.close({success(){s&&s(o)}})};let n=Le.destroy;return Le.destroy=(o,s)=>(Le.destroy=n,setTimeout(()=>{yt.close({fail(){Le._destroy(o,s)}})},0),Le),TS(),Le};gl.default=RS});var _l=M(wl=>{\"use strict\";_();v();m();Object.defineProperty(wl,\"__esModule\",{value:!0});var bl=(be(),X(me)),CS=jt(),BS=ls(),xt,fs,ui,Cg=!1;function PS(){let t=new CS.Transform;return t._write=(e,r,i)=>{xt.sendSocketMessage({data:e.buffer,success(){i()},fail(){i(new Error)}})},t._flush=e=>{xt.closeSocket({success(){e()}})},t}function kS(t){t.hostname||(t.hostname=\"localhost\"),t.path||(t.path=\"/\"),t.wsOptions||(t.wsOptions={})}function OS(t,e){let r=t.protocol===\"alis\"?\"wss\":\"ws\",i=`${r}://${t.hostname}${t.path}`;return t.port&&t.port!==80&&t.port!==443&&(i=`${r}://${t.hostname}:${t.port}${t.path}`),typeof t.transformWsUrl==\"function\"&&(i=t.transformWsUrl(i,t,e)),i}function xS(){Cg||(Cg=!0,xt.onSocketOpen(()=>{ui.socketReady()}),xt.onSocketMessage(t=>{if(typeof t.data==\"string\"){let e=bl.Buffer.from(t.data,\"base64\");fs.push(e)}else{let e=new FileReader;e.addEventListener(\"load\",()=>{let r=e.result;r instanceof ArrayBuffer?r=bl.Buffer.from(r):r=bl.Buffer.from(r,\"utf8\"),fs.push(r)}),e.readAsArrayBuffer(t.data)}}),xt.onSocketClose(()=>{ui.end(),ui.destroy()}),xt.onSocketError(t=>{ui.destroy(t)}))}var MS=(t,e)=>{if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error(\"Could not determine host. Specify host manually.\");let r=e.protocolId===\"MQIsdp\"&&e.protocolVersion===3?\"mqttv3.1\":\"mqtt\";kS(e);let i=OS(e,t);return xt=e.my,xt.connectSocket({url:i,protocols:r}),fs=PS(),ui=new BS.BufferedDuplex(e,fs,xt),xS(),ui};wl.default=MS});var kg=M(Br=>{\"use strict\";_();v();m();var cs=Br&&Br.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Br,\"__esModule\",{value:!0});Br.connectAsync=void 0;var LS=cs(ot()),US=cs((yg(),X(gg))),NS=cs(os()),qS=cs(Oi());typeof(B===null||B===void 0?void 0:B.nextTick)!=\"function\"&&(B.nextTick=setImmediate);var Bg=(0,LS.default)(\"mqttjs\"),de=null;function DS(t){let e;t.auth&&(e=t.auth.match(/^(.+):(.+)$/),e?(t.username=e[1],t.password=e[2]):t.username=t.auth)}function Pg(t,e){var r,i,n,o;if(Bg(\"connecting to an MQTT broker...\"),typeof t==\"object\"&&!e&&(e=t,t=\"\"),e=e||{},t&&typeof t==\"string\"){let l=US.default.parse(t,!0),c={};if(l.port!=null&&(c.port=Number(l.port)),c.host=l.hostname,c.query=l.query,c.auth=l.auth,c.protocol=l.protocol,c.path=l.path,c.protocol=(r=c.protocol)===null||r===void 0?void 0:r.replace(/:$/,\"\"),e=Object.assign(Object.assign({},c),e),!e.protocol)throw new Error(\"Missing protocol\")}if(e.unixSocket=e.unixSocket||((i=e.protocol)===null||i===void 0?void 0:i.includes(\"+unix\")),e.unixSocket?e.protocol=e.protocol.replace(\"+unix\",\"\"):!(!((n=e.protocol)===null||n===void 0)&&n.startsWith(\"ws\"))&&!(!((o=e.protocol)===null||o===void 0)&&o.startsWith(\"wx\"))&&delete e.path,DS(e),e.query&&typeof e.query.clientId==\"string\"&&(e.clientId=e.query.clientId),e.cert&&e.key)if(e.protocol){if([\"mqtts\",\"wss\",\"wxs\",\"alis\"].indexOf(e.protocol)===-1)switch(e.protocol){case\"mqtt\":e.protocol=\"mqtts\";break;case\"ws\":e.protocol=\"wss\";break;case\"wx\":e.protocol=\"wxs\";break;case\"ali\":e.protocol=\"alis\";break;default:throw new Error(`Unknown protocol for secure connection: \"${e.protocol}\"!`)}}else throw new Error(\"Missing secure protocol key\");if(de||(de={},!qS.default&&!e.forceNativeWebSocket?(de.ws=Ui().streamBuilder,de.wss=Ui().streamBuilder,de.mqtt=cl().default,de.tcp=cl().default,de.ssl=dl().default,de.tls=de.ssl,de.mqtts=dl().default):(de.ws=Ui().browserStreamBuilder,de.wss=Ui().browserStreamBuilder,de.wx=yl().default,de.wxs=yl().default,de.ali=_l().default,de.alis=_l().default)),!de[e.protocol]){let l=[\"mqtts\",\"wss\"].indexOf(e.protocol)!==-1;e.protocol=[\"mqtt\",\"mqtts\",\"ws\",\"wss\",\"wx\",\"wxs\",\"ali\",\"alis\"].filter((c,h)=>l&&h%2===0?!1:typeof de[c]==\"function\")[0]}if(e.clean===!1&&!e.clientId)throw new Error(\"Missing clientId for unclean clients\");e.protocol&&(e.defaultProtocol=e.protocol);function s(l){return e.servers&&((!l._reconnectCount||l._reconnectCount===e.servers.length)&&(l._reconnectCount=0),e.host=e.servers[l._reconnectCount].host,e.port=e.servers[l._reconnectCount].port,e.protocol=e.servers[l._reconnectCount].protocol?e.servers[l._reconnectCount].protocol:e.defaultProtocol,e.hostname=e.host,l._reconnectCount++),Bg(\"calling streambuilder for\",e.protocol),de[e.protocol](l,e)}let a=new NS.default(s,e);return a.on(\"error\",()=>{}),a}function jS(t,e,r=!0){return new Promise((i,n)=>{let o=Pg(t,e),s={connect:l=>{a(),i(o)},end:()=>{a(),i(o)},error:l=>{a(),o.end(),n(l)}};r===!1&&(s.close=()=>{s.error(new Error(\"Couldn't connect to server\"))});function a(){Object.keys(s).forEach(l=>{o.off(l,s[l])})}Object.keys(s).forEach(l=>{o.on(l,s[l])})})}Br.connectAsync=jS;Br.default=Pg});var ml=M(G=>{\"use strict\";_();v();m();var Og=G&&G.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||(\"get\"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),FS=G&&G.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,\"default\",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WS=G&&G.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!==\"default\"&&Object.prototype.hasOwnProperty.call(t,r)&&Og(e,t,r);return FS(e,t),e},xg=G&&G.__exportStar||function(t,e){for(var r in t)r!==\"default\"&&!Object.prototype.hasOwnProperty.call(e,r)&&Og(e,t,r)},Di=G&&G.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(G,\"__esModule\",{value:!0});G.ReasonCodes=G.KeepaliveManager=G.UniqueMessageIdProvider=G.DefaultMessageIdProvider=G.Store=G.MqttClient=G.connectAsync=G.connect=G.Client=void 0;var Mg=Di(os());G.MqttClient=Mg.default;var $S=Di(Zo());G.DefaultMessageIdProvider=$S.default;var HS=Di(Vp());G.UniqueMessageIdProvider=HS.default;var VS=Di(ra());G.Store=VS.default;var Lg=WS(kg());G.connect=Lg.default;Object.defineProperty(G,\"connectAsync\",{enumerable:!0,get:function(){return Lg.connectAsync}});var zS=Di(Wa());G.KeepaliveManager=zS.default;G.Client=Mg.default;xg(os(),G);xg(_r(),G);var KS=Ti();Object.defineProperty(G,\"ReasonCodes\",{enumerable:!0,get:function(){return KS.ReasonCodes}})});var XS=M(We=>{_();v();m();var Ug=We&&We.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||(\"get\"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),GS=We&&We.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,\"default\",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QS=We&&We.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!==\"default\"&&Object.prototype.hasOwnProperty.call(t,r)&&Ug(e,t,r);return GS(e,t),e},YS=We&&We.__exportStar||function(t,e){for(var r in t)r!==\"default\"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ug(e,t,r)};Object.defineProperty(We,\"__esModule\",{value:!0});var JS=QS(ml());We.default=JS;YS(ml(),We)});return XS();})();", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onScenePostEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "// Remove the messages of the last frame for no dataloss mode", + "Object", + " .values(gdjs.evtTools.mqtt.events)", + " .forEach((event, index) => {", + " if (Array.isArray(event.data))", + " event.data.shift();", + " else event.data = gdjs.evtTools.mqtt.empty;", + " });", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "description": "Triggers if the client is connected to an MQTT broker server.", + "fullName": "Is connected to a broker?", + "functionType": "Condition", + "name": "isConnected", + "sentence": "Client connected to a broker", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "eventsFunctionContext.returnValue =", + " gdjs.evtTools.mqtt.connection && gdjs.evtTools.mqtt.connection.connected;", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "description": "Connects to an MQTT broker. ", + "fullName": "Connect to a broker", + "functionType": "Action", + "name": "connect", + "sentence": "Connect to MQTT broker _PARAM1_ with parameters _PARAM2_ (secure connection: _PARAM3_)", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "// Parse settings", + "const settings = eventsFunctionContext.getArgument(\"settings\");", + "let settingsParsed;", + "if (settings.length > 2)", + " try {", + " settingsParsed = JSON.parse(settings);", + " } catch (e) {", + " settingsParsed = {}", + " console.error(\"Invalid settings: \", settings, \", Error:\", e);", + " };", + "", + "// Connect to broker", + "gdjs.evtTools.mqtt.connection = mqtt.connect(", + " (eventsFunctionContext.getArgument(\"secure\")", + " ? \"wss://\"", + " : \"ws://\")", + " + eventsFunctionContext.getArgument(\"host\"),", + " settingsParsed", + ");", + "", + "// Set up listeners", + "gdjs.evtTools.mqtt.connection.on(\"message\", (channel, message) => {", + " if (typeof gdjs.evtTools.mqtt.events[channel] === undefined) {", + " gdjs.evtTools.mqtt.events[channel] = {", + " loss: false,", + " data: [message],", + " };", + " return;", + " }", + "", + " const mqttEvent = gdjs.evtTools.mqtt.events[channel];", + " if (mqttEvent.loss) {", + " mqttEvent.data = message;", + " } else {", + " if (!Array.isArray(mqttEvent.data)) mqttEvent.data = [];", + " mqttEvent.data.push(message);", + " }", + "});", + "", + "gdjs.evtTools.mqtt.connection.on(\"error\", function (e) {", + " gdjs.evtTools.mqtt.lastError = e;", + "});", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Host port", + "name": "host", + "type": "string" + }, + { + "description": "Settings as JSON", + "longDescription": "You can find the list of settings at [the MQTT.js docs](https://github.com/mqttjs/MQTT.js/#client). \nAn example of valid configuration would be `\"{\\\"clientId\\\": \\\"myUserName\\\"}\"`.", + "name": "settings", + "type": "string" + }, + { + "description": "Use secure WebSockets?", + "name": "secure", + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Disconnects from the current MQTT broker.", + "fullName": "Disconnect from broker", + "functionType": "Action", + "name": "disconnect", + "sentence": "Disconnect from MQTT broker (force: _PARAM1_)", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "if (gdjs.evtTools.mqtt.connection === null) return;", + "gdjs.evtTools.mqtt.connection.end(eventsFunctionContext.getArgument(\"force\"));", + "gdjs.evtTools.mqtt.connection = null;", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Force end the connection?", + "longDescription": "By default, MQTT waits for pending messages or messages in the process of being sent to finish being sent before ending the connection. Use this to cancel any request and immediately shutdown the connection.", + "name": "force", + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Publishes a message on a topic.", + "fullName": "Publish message", + "functionType": "Action", + "name": "publish", + "sentence": "Publish variable _PARAM1_ on topic _PARAM2_ (QoS: _PARAM3_)", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "if (gdjs.evtTools.mqtt.connection === null) return;", + "gdjs.evtTools.mqtt.connection.publish(", + " eventsFunctionContext.getArgument(\"topic\"),", + " eventsFunctionContext.getArgument(\"content\"),", + " { qos: eventsFunctionContext.getArgument(\"QoS\"), retain: eventsFunctionContext.getArgument(\"retain\") }", + ");", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Text to publish", + "name": "content", + "type": "string" + }, + { + "description": "Topic to publish to", + "name": "topic", + "type": "string" + }, + { + "description": "The QoS", + "longDescription": "See [this](https://github.com/mqttjs/MQTT.js#qos) for more details.", + "name": "QoS", + "type": "expression" + }, + { + "description": "Should the message be retained?", + "longDescription": "When a message is retained, it will be sent to every client that subscribe to the topic. Only one message can be retained per topic, if another retained message is sent it will overwrite the previous one. \nRead more [here](https://www.hivemq.com/blog/mqtt-essentials-part-8-retained-messages/#retained-messages).", + "name": "retain", + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Subcribe to a topic. All messages published on that topic will be received.", + "fullName": "Subscribe to a topic", + "functionType": "Action", + "name": "subscribe", + "sentence": "Subscribe to topic _PARAM1_ with QoS at _PARAM2_ and dataloss _PARAM3_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "if (gdjs.evtTools.mqtt.connection === null) return;", + "", + "const topic = eventsFunctionContext.getArgument(\"topic\");", + "if (typeof gdjs.evtTools.mqtt.events[topic] === \"undefined\") gdjs.evtTools.mqtt.events[topic] = { data: eventsFunctionContext.getArgument(\"dataloss\") ? \"\" : [] };", + "gdjs.evtTools.mqtt.events[topic].loss = eventsFunctionContext.getArgument(\"dataloss\");", + "", + "gdjs.evtTools.mqtt.connection.subscribe(", + " topic,", + " { qos: eventsFunctionContext.getArgument(\"QoS\") }", + ");", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "The topic to subscribe to", + "name": "topic", + "type": "string" + }, + { + "description": "The QoS", + "longDescription": "See https://github.com/mqttjs/MQTT.js#qos for more details", + "name": "QoS", + "type": "expression" + }, + { + "description": "Is dataloss allowed?", + "longDescription": "See https://wiki.gdevelop.io/gdevelop5/all-features/p2p#choosing_if_you_want_to_activate_data_loss_mode for more details", + "name": "dataloss", + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Unsubcribe from a topic. No more messages from this topic will be received.", + "fullName": "Unsubscribe from a topic", + "functionType": "Action", + "name": "unsubscribe", + "sentence": "Unsubscribe from topic _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "if (gdjs.evtTools.mqtt.connection !== null)", + " gdjs.evtTools.mqtt.connection.unsubscribe(", + " eventsFunctionContext.getArgument(\"topic\")", + " );", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "The topic to subscribe to", + "name": "topic", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Triggers whenever a message was received. Note that you first need to subcribe to a topic in order to get messages from it.", + "fullName": "On message", + "functionType": "Condition", + "name": "onMessage", + "sentence": "Message received from topic _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const mqttEvent = gdjs.evtTools.mqtt.events[eventsFunctionContext.getArgument(\"topic\")];\r", + "if (typeof mqttEvent === \"undefined\" || typeof mqttEvent.data === \"undefined\") return;\r", + "eventsFunctionContext.returnValue =\r", + " Array.isArray(mqttEvent.data)\r", + " ? mqttEvent.data.length !== 0\r", + " : mqttEvent.data !== gdjs.evtTools.mqtt.empty;\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "The topic to listen to", + "name": "topic", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Get the last received message of a topic.", + "fullName": "Get last message", + "functionType": "StringExpression", + "name": "GetLastMessage", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const mqttEvent = gdjs.evtTools.mqtt.events[eventsFunctionContext.getArgument(\"topic\")];", + "if (typeof mqttEvent === \"undefined\") return;", + "eventsFunctionContext.returnValue = Array.isArray(mqttEvent.data)", + " ? mqttEvent.data[0]", + " : mqttEvent.data;", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "The topic to get the message from", + "name": "topic", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "description": "Gets the last error. Returns an empty string if there was no errors.", + "fullName": "Get the last error", + "functionType": "StringExpression", + "name": "getCurrentError", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": "eventsFunctionContext.returnValue = gdjs.evtTools.mqtt.lastError", + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [], + "objectGroups": [] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "onFirstSceneLoaded" + }, + { + "functionName": "onScenePostEvents" + }, + { + "functionName": "isConnected" + }, + { + "functionName": "connect" + }, + { + "functionName": "disconnect" + }, + { + "functionName": "publish" + }, + { + "functionName": "subscribe" + }, + { + "functionName": "unsubscribe" + }, + { + "functionName": "onMessage" + }, + { + "functionName": "GetLastMessage" + }, + { + "functionName": "getCurrentError" + } + ] + }, + "eventsBasedBehaviors": [], + "eventsBasedObjects": [] + }, + { + "author": "", + "category": "Network", + "dimension": "", + "extensionNamespace": "", + "fullName": "Advanced HTTP", + "gdevelopVersion": ">=5.5.222", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQoJLnN0MXtmaWxsOm5vbmU7c3Ryb2tlOiMwMDAwMDA7c3Ryb2tlLXdpZHRoOjI7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjEwO30NCjwvc3R5bGU+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSIxMSwxMiAyMSwxOCAzMSwxMiAiLz4NCjxsaW5lIGNsYXNzPSJzdDAiIHgxPSI0IiB5MT0iMTIiIHgyPSIxMSIgeTI9IjEyIi8+DQo8bGluZSBjbGFzcz0ic3QwIiB4MT0iMSIgeTE9IjE2IiB4Mj0iMTIiIHkyPSIxNiIvPg0KPGxpbmUgY2xhc3M9InN0MCIgeDE9IjQiIHkxPSIyMCIgeDI9IjExIiB5Mj0iMjAiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMSwxMnYtMWMwLTIuMiwxLjgtNCw0LTRoMTJjMi4yLDAsNCwxLjgsNCw0djEwYzAsMi4yLTEuOCw0LTQsNEgxNWMtMi4yLDAtNC0xLjgtNC00di0xIi8+DQo8L3N2Zz4NCg==", + "name": "AdvancedHTTP", + "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/Email/04e28ac117741933d15ac1cadb34e0d799c7a561352b1525a1b75c5bd1dbeabc_Email_email_envelope_letter_message_fast.svg", + "shortDescription": "HTTP requests with custom headers, methods, caching, CORS bypass, and JSON/FormData body.", + "version": "1.1.0", + "description": "An extension to create HTTP requests with more advanced settings than the built-in \"Network request\" action, like specifying headers or bypassing CORS.", + "origin": { + "identifier": "AdvancedHTTP", + "name": "gdevelop-extension-store" + }, + "tags": [ + "header", + "beacon", + "http", + "request", + "get", + "post", + "delete", + "patch", + "head", + "method", + "body", + "html", + "request", + "web", + "curl", + "url" + ], + "authorIds": [ + "ZgrsWuRTAkXgeuPV9bo0zuEcA2w1" + ], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [], + "eventsFunctions": [ + { + "description": "Creates a template for your request. All requests must be made from a request template.", + "fullName": "Create a new request template", + "functionType": "Action", + "group": "Request creation", + "name": "CreateRequest", + "sentence": "Create request template _PARAM1_ with URL _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "GlobalVariableClearChildren" + }, + "parameters": [ + "__AdvancedHTTP.Requests[Request]" + ] + }, + { + "type": { + "value": "ModVarGlobalTxt" + }, + "parameters": [ + "__AdvancedHTTP.Requests[Request].URL", + "=", + "URL" + ] + } + ] + } + ], + "parameters": [ + { + "description": "New request template name", + "name": "Request", + "supplementaryInformation": "sceneRequest", + "type": "identifier" + }, + { + "description": "URL the request will be sent to", + "name": "URL", + "supplementaryInformation": "sceneURL", + "type": "identifier" + } + ], + "objectGroups": [] + }, + { + "description": "Creates a new request template with all the attributes from an existing one.", + "fullName": "Copy a request template", + "functionType": "Action", + "group": "Request creation", + "name": "CopyRequest", + "sentence": "Create request _PARAM1_ from template _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "JSONToGlobalVariableStructure" + }, + "parameters": [ + "GlobalVarToJSON(__AdvancedHTTP.Requests[OriginRequest])", + "__AdvancedHTTP.Requests[Request]" + ] + } + ] + } + ], + "parameters": [ + { + "description": "New request template name", + "name": "Request", + "supplementaryInformation": "sceneRequest", + "type": "identifier" + }, + { + "description": "Request to copy", + "name": "OriginRequest", + "supplementaryInformation": "sceneRequest", + "type": "identifier" + } + ], + "objectGroups": [] + }, + { + "description": "The HTTP method of the request. GET is the default and what you should use if you are unsure which to pick. A request to a REST API endpoint may have a different effect depending on the method - refer to the documentation of the API you are calling to learn about the appropriate method to use.", + "fullName": "HTTP Method (Verb)", + "functionType": "Action", + "group": "Request settings", + "name": "SetRequestMethod", + "sentence": "Set HTTP method of request _PARAM1_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ModVarGlobalTxt" + }, + "parameters": [ + "__AdvancedHTTP.Requests[Request].Options.method", + "=", + "Method" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Request template name", + "name": "Request", + "supplementaryInformation": "sceneRequest", + "type": "identifier" + }, + { + "description": "HTTP Method", + "name": "Method", + "supplementaryInformation": "[\"GET\",\"POST\",\"PUT\",\"PATCH\",\"DELETE\",\"HEAD\",\"TRACE\",\"CONNECT\",\"OPTIONS\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "the HTTP method of the request. GET is the default and what you should use if you are unsure which to pick. A request to a REST API endpoint may have a different effect depending on the method - refer to the documentation of the API you are calling to learn about the appropriate method to use.", + "fullName": "HTTP Method (Verb)", + "functionType": "ExpressionAndCondition", + "group": "Request settings", + "name": "RequestMethod", + "sentence": "HTTP method of request _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GlobalVariableChildExists" + }, + "parameters": [ + "__AdvancedHTTP.Requests[Request].Options", + "\"method\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "GlobalVariableString(__AdvancedHTTP.Requests[Request].Options.method)" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GlobalVariableChildExists" + }, + "parameters": [ + "__AdvancedHTTP.Requests[Request].Options", + "\"method\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "\"GET\"" + ] + } + ] + } + ], + "expressionType": { + "supplementaryInformation": "[\"GET\",\"HEAD\",\"POST\",\"PUT\",\"OPTIONS\",\"CONNECT\",\"TRACE\"]", + "type": "stringWithSelector" + }, + "parameters": [ + { + "description": "Request template name", + "name": "Request", + "supplementaryInformation": "sceneRequest", + "type": "identifier" + } + ], + "objectGroups": [] + }, + { + "description": "Defines to what extent the results of the request is can/must be cached. When cached, instead of sending a request to the server, the browser will avoid making a real request to the server and will use a previous response given by the server for the same request.\n\nThe server also has a say in this via the Cache-Control header.", + "fullName": "HTTP Caching strategy", + "functionType": "Action", + "group": "Request settings", + "name": "SetRequestCache", + "sentence": "Set HTTP caching strategy of request _PARAM1_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ModVarGlobalTxt" + }, + "parameters": [ + "__AdvancedHTTP.Requests[Request].Options.cache", + "=", + "Cache" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Request template name", + "name": "Request", + "supplementaryInformation": "sceneRequest", + "type": "identifier" + }, + { + "description": "HTTP Caching strategy", + "longDescription": "Learn more about what each caching strategy does [on the MDN page for cache](https://developer.mozilla.org/en-US/docs/Web/API/Request/cache).", + "name": "Cache", + "supplementaryInformation": "[\"default\",\"no-store\",\"reload\",\"no-cache\",\"force-cache\",\"only-if-cached\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "the HTTP method of the request. GET is the default and what you should use if you are unsure which to pick. A request to a REST API endpoint may have a different effect depending on the method - refer to the documentation of the API you are calling to learn about the appropriate method to use.", + "fullName": "HTTP Caching", + "functionType": "ExpressionAndCondition", + "group": "Request settings", + "name": "RequestCache", + "sentence": "HTTP caching strategy of request _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GlobalVariableChildExists" + }, + "parameters": [ + "__AdvancedHTTP.Requests[Request].Options", + "\"cache\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "GlobalVariableString(__AdvancedHTTP.Requests[Request].Options.cache)" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GlobalVariableChildExists" + }, + "parameters": [ + "__AdvancedHTTP.Requests[Request].Options", + "\"cache\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "\"default\"" + ] + } + ] + } + ], + "expressionType": { + "supplementaryInformation": "[\"default\",\"reload\",\"no-cache\",\"force-cache\",\"only-if-cached\"]", + "type": "stringWithSelector" + }, + "parameters": [ + { + "description": "Request template name", + "name": "Request", + "supplementaryInformation": "sceneRequest", + "type": "identifier" + } + ], + "objectGroups": [] + }, + { + "description": "The HTTP method of the request. GET is the default and what you should use if you are unsure which to pick. A request to a REST API endpoint may have a different effect depending on the method - refer to the documentation of the API you are calling to learn about the appropriate method to use.", + "fullName": "HTTP Method (Verb)", + "functionType": "ActionWithOperator", + "getterName": "RequestBody", + "group": "Request settings", + "name": "SetRequestBody", + "sentence": "Set HTTP method of request _PARAM1_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ModVarGlobalTxt" + }, + "parameters": [ + "__AdvancedHTTP.Requests[Request].Options.body", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Request template name", + "name": "Request", + "supplementaryInformation": "sceneRequest", + "type": "identifier" + }, + { + "description": "HTTP Method", + "name": "Method", + "supplementaryInformation": "[\"GET\",\"POST\",\"PUT\",\"PATCH\",\"DELETE\",\"HEAD\",\"TRACE\",\"CONNECT\",\"OPTIONS\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "Sets the body of an HTTP request to a JSON representation of a structure variable.", + "fullName": "Body as JSON", + "functionType": "Action", + "getterName": "RequestBody", + "group": "Request settings", + "name": "SetJSONRequestBody", + "sentence": "Set body of request _PARAM1_ to contents of _PARAM2_ as JSON", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CopyArgumentToVariable" + }, + "parameters": [ + "\"Body\"", + "__AdvancedHTTP.Body" + ] + }, + { + "type": { + "value": "ModVarGlobalTxt" + }, + "parameters": [ + "__AdvancedHTTP.Requests[Request].Options.body", + "=", + "ToJSON(__AdvancedHTTP.Body)" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Request template name", + "name": "Request", + "supplementaryInformation": "sceneRequest", + "type": "identifier" + }, + { + "description": "Variable with body contents", + "name": "Body", + "supplementaryInformation": "[\"GET\",\"POST\",\"PUT\",\"PATCH\",\"DELETE\",\"HEAD\",\"TRACE\",\"CONNECT\",\"OPTIONS\"]", + "type": "scenevar" + } + ], + "objectGroups": [] + }, + { + "description": "Sets the body of an HTTP request to a form data representation of a structure variable.", + "fullName": "Body as form data", + "functionType": "Action", + "getterName": "RequestBody", + "group": "Request settings", + "name": "SetFormDataRequestBody", + "sentence": "Set body of request _PARAM1_ to contents of _PARAM2_ as form data", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Merge form data with the form data of the request" + }, + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "gdjs.Variable.copy(", + " eventsFunctionContext.getArgument(\"Body\"),", + " runtimeScene.getGame().getVariables().get(\"__AdvancedHTTP\")", + " .getChild(\"Requests\")", + " .getChild(eventsFunctionContext.getArgument(\"Request\"))", + " .getChild(\"FormData\"),", + " /* mergeVariables = */true", + ");", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Request template name", + "name": "Request", + "supplementaryInformation": "sceneRequest", + "type": "identifier" + }, + { + "description": "Variable with body contents", + "name": "Body", + "supplementaryInformation": "[\"GET\",\"POST\",\"PUT\",\"PATCH\",\"DELETE\",\"HEAD\",\"TRACE\",\"CONNECT\",\"OPTIONS\"]", + "type": "scenevar" + } + ], + "objectGroups": [] + }, + { + "description": "the body of the HTTP request. Contains data to send to the server, ususally in plain text, JSON or FormData format. This cannot be set for GET requests.", + "fullName": "Body", + "functionType": "ExpressionAndCondition", + "group": "Request settings", + "name": "RequestBody", + "sentence": "body of request _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GlobalVariableChildExists" + }, + "parameters": [ + "__AdvancedHTTP.Requests[Request].Options", + "\"body\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "GlobalVariableString(__AdvancedHTTP.Requests[Request].Options.body)" + ] + } + ] + } + ], + "expressionType": { + "supplementaryInformation": "[\"GET\",\"HEAD\",\"POST\",\"PUT\",\"OPTIONS\",\"CONNECT\",\"TRACE\"]", + "type": "string" + }, + "parameters": [ + { + "description": "Request template name", + "name": "Request", + "supplementaryInformation": "sceneRequest", + "type": "identifier" + } + ], + "objectGroups": [] + }, + { + "description": "The HTTP method of the request. GET is the default and what you should use if you are unsure which to pick. A request to a REST API endpoint may have a different effect depending on the method - refer to the documentation of the API you are calling to learn about the appropriate method to use.", + "fullName": "HTTP Method (Verb)", + "functionType": "ActionWithOperator", + "getterName": "RequestHeader", + "group": "Request settings", + "name": "SetRequestHeader", + "sentence": "Set HTTP method of request _PARAM1_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ModVarGlobalTxt" + }, + "parameters": [ + "__AdvancedHTTP.Requests[Request].Options.headers[Header]", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Request template name", + "name": "Request", + "supplementaryInformation": "sceneRequest", + "type": "identifier" + }, + { + "description": "HTTP Method", + "name": "Method", + "supplementaryInformation": "[\"GET\",\"POST\",\"PUT\",\"PATCH\",\"DELETE\",\"HEAD\",\"TRACE\",\"CONNECT\",\"OPTIONS\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "an HTTP header to be sent with the request.", + "fullName": "Header", + "functionType": "ExpressionAndCondition", + "group": "Request settings", + "name": "RequestHeader", + "sentence": "HTTP header _PARAM2_ of request _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GlobalVariableChildExists" + }, + "parameters": [ + "__AdvancedHTTP.Requests[Request].Options", + "\"headers\"" + ] + }, + { + "type": { + "value": "GlobalVariableChildExists" + }, + "parameters": [ + "__AdvancedHTTP.Requests[Request].Options.headers", + "Header" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "GlobalVariableString(__AdvancedHTTP.Requests[Request].Options.headers[Header])" + ] + } + ] + } + ], + "expressionType": { + "supplementaryInformation": "sceneHeader", + "type": "string" + }, + "parameters": [ + { + "description": "Request template name", + "name": "Request", + "supplementaryInformation": "sceneRequest", + "type": "identifier" + }, + { + "description": "HTTP header name", + "name": "Header", + "supplementaryInformation": "sceneHeader", + "type": "identifier" + } + ], + "objectGroups": [] + }, + { + "description": "The HTTP method of the request. GET is the default and what you should use if you are unsure which to pick. A request to a REST API endpoint may have a different effect depending on the method - refer to the documentation of the API you are calling to learn about the appropriate method to use.", + "fullName": "HTTP Method (Verb)", + "functionType": "ActionWithOperator", + "getterName": "RequestURL", + "group": "Request settings", + "name": "SetRequestURL", + "sentence": "Set HTTP method of request _PARAM1_ to _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "ModVarGlobalTxt" + }, + "parameters": [ + "__AdvancedHTTP.Requests[Request].URL", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Request template name", + "name": "Request", + "supplementaryInformation": "sceneRequest", + "type": "identifier" + } + ], + "objectGroups": [] + }, + { + "description": "the request template's target URL.", + "fullName": "URL", + "functionType": "ExpressionAndCondition", + "group": "Request settings", + "name": "RequestURL", + "sentence": "the URL of request template _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "GlobalVariableString(__AdvancedHTTP.Requests[Request].URL)" + ] + } + ] + } + ], + "expressionType": { + "supplementaryInformation": "sceneURL", + "type": "identifier" + }, + "parameters": [ + { + "description": "Request template name", + "name": "Request", + "supplementaryInformation": "sceneRequest", + "type": "identifier" + } + ], + "objectGroups": [] + }, + { + "description": "CORS prevents most external websites from being queried with the browser's HTTP client, since the browser may be authenticated on that website and as such another website would be able to impersonate the player on that other website.\n\nWhen the CORS Bypass is enabled, the request will be made from a server that is not authenticated anywhere and as such is not blocked by CORS, and it will share the response with your game. Note that as such, authentication cookies are ignored! If you own the REST API you are requesting, add CORS headers to your server instead of using this CORS Bypass.", + "fullName": "Enable CORS Bypass", + "functionType": "Action", + "group": "Request settings", + "name": "UseCORSBypass", + "sentence": "Enable CORS Bypass for request _PARAM1_: _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "UseBypass", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetGlobalVariableAsBoolean" + }, + "parameters": [ + "__AdvancedHTTP.Requests[Request].CORS", + "True" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "UseBypass", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetGlobalVariableAsBoolean" + }, + "parameters": [ + "__AdvancedHTTP.Requests[Request].CORS", + "False" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Request template name", + "name": "Request", + "supplementaryInformation": "sceneRequest", + "type": "identifier" + }, + { + "defaultValue": "yes", + "description": "Enable the CORS Bypass?", + "longDescription": "The CORS Bypass server is offered for free by [arthuro555](https://twitter.com/arthuro555). Consider making a [donation](https://ko-fi.com/arthuro555) to help keep the CORS Bypass server running.", + "name": "UseBypass", + "optional": true, + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Checks whether or not CORS Bypass has been enabled for the request template.", + "fullName": "CORS Bypass enabled", + "functionType": "Condition", + "group": "Request settings", + "name": "IsUsingCORSBypass", + "sentence": "CORS Bypass is enabled for request _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "GlobalVariableAsBoolean" + }, + "parameters": [ + "__AdvancedHTTP.Requests[Request].CORS", + "True" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Request template name", + "name": "Request", + "supplementaryInformation": "sceneRequest", + "type": "identifier" + } + ], + "objectGroups": [] + }, + { + "async": true, + "description": "Executes the request defined by a request template.", + "fullName": "Execute the request", + "functionType": "Action", + "group": "Request execution", + "name": "ExecuteRequest", + "sentence": "Execute request _PARAM1_ and store results in _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const logger = (this.logger || (this.logger = new gdjs.Logger(\"Advanced HTTP\")));", + "const advancedHTTP = (gdjs._advancedHTTP || (gdjs._advancedHTTP = { responses: new Map(), id: 1 }));", + "", + "/** @type {gdjs.Variable} */", + "const result = eventsFunctionContext.getArgument(\"Response\");", + "const requestName = eventsFunctionContext.getArgument(\"Request\");", + "const request = runtimeScene", + " .getGame()", + " .getVariables()", + " .get(\"__AdvancedHTTP\")", + " .getChild(\"Requests\")", + " .getChild(requestName)", + " .toJSObject();", + "if (!request.Options) request.Options = {}", + "if (request.Options.method === 'GET' || request.Options.method === 'HEAD') delete request.Options.body;", + "", + "if (typeof request.URL !== \"string\") {", + " eventsFunctionContext.task.resolve();", + " logger.error(`Couldn't execute request '${requestName}' - has it been properly initialized?`);", + " return;", + "}", + "", + "function isContentful(obj) {", + " for (var x in obj) { return true; }", + " return false;", + "}", + "const hasFormData = request.FormData && isContentful(request.FormData)", + "console.log(isContentful(request.FormData), request.FormData)", + "", + "if (hasFormData) {", + " if (request.Options.body && request.Options.body !== \"\") {", + " console.warn(`The request ${requestName} has both form data and a separate body - the body will be ignored and replaced by the form data.`);", + " }", + "", + " delete request.Options.body;", + "}", + "", + "if (request.CORS) {", + " // Cache makes sense only on the client. CF Workers does not support cache property on fetch anyways.", + " const cache = request.Options.cache;", + " delete request.Options.cache;", + " eventsFunctionContext.task = new gdjs.PromiseTask(", + " fetch(`https://cors.arthuro555.com?${JSON.stringify({", + " url: request.URL,", + " options: request.Options,", + " formData: isContentful(request.FormData) ? request.FormData : undefined", + " })}`, { keepalive: true, cache })", + " .then(async (response) => {", + " const { ok, status, headers, body } = await response.json();", + " result.fromJSObject({", + " ok,", + " status,", + " headers,", + " body,", + " });", + " })", + " .catch((e) => {", + " logger.error(`Couldn't execute request '${requestName}': ${e}`);", + " })", + " );", + "} else {", + " if (hasFormData && request.Options.method !== 'GET' && request.Options.method !== 'HEAD') {", + " const fd = request.Options.body = new FormData();", + " for (const key of Object.keys(request.FormData)) {", + " fd.append(key, request.FormData[key])", + " }", + " }", + "", + " eventsFunctionContext.task = new gdjs.PromiseTask(", + " fetch(request.URL, { keepalive: true, ...request.Options })", + " .then((response) => {", + " const id = advancedHTTP.id++;", + " const { ok, status, headers } = response;", + " result.fromJSObject({", + " id,", + " ok,", + " status,", + " headers: Object.fromEntries(headers.entries()),", + " });", + " result.getChild(\"id\").setNumber(id);", + " advancedHTTP.responses.set(id, response);", + " setTimeout(() => advancedHTTP.responses.delete(id), 10_000);", + " })", + " .catch((e) => {", + " logger.error(`Couldn't execute request '${requestName}': ${e}`);", + " })", + " );", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Request to execute", + "name": "Request", + "supplementaryInformation": "sceneRequest", + "type": "identifier" + }, + { + "description": "Variable where to store the response to the request", + "name": "Response", + "type": "scenevar" + } + ], + "objectGroups": [] + }, + { + "description": "Checks whether the server marked the response as a success (status code 1XX/2XX), not as a failure (status code 4XX/5XX).", + "fullName": "Success", + "functionType": "Condition", + "group": "Response", + "name": "ResponseSuccess", + "sentence": "Response _PARAM1_ indicates a success", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CopyArgumentToVariable" + }, + "parameters": [ + "\"Response\"", + "__AdvancedHTTP.Response" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "SceneVariableAsBoolean" + }, + "parameters": [ + "__AdvancedHTTP.Response.ok", + "True" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Variable containing the response", + "name": "Response", + "type": "scenevar" + } + ], + "objectGroups": [] + }, + { + "description": "the status code of the HTTP request (e.g. 200 if succeeded, 404 if not found, etc).", + "fullName": "Status code", + "functionType": "ExpressionAndCondition", + "group": "Response", + "name": "ResponseStatusCode", + "sentence": "Status code of response _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CopyArgumentToVariable" + }, + "parameters": [ + "\"Response\"", + "__AdvancedHTTP.Response" + ] + }, + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Variable(__AdvancedHTTP.Response.status)" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Variable containing the response", + "name": "Response", + "type": "scenevar" + } + ], + "objectGroups": [] + }, + { + "description": "Gets the status text for a response. For example, for a response with the status code 404, the status text will be \"Not Found\".", + "fullName": "Status text", + "functionType": "StringExpression", + "group": "Response", + "name": "ResponseStatusText", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "GlobalVariableChildExists" + }, + "parameters": [ + "__AdvancedHTTP", + "\"StatusTexts\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "JSONToGlobalVariableStructure" + }, + "parameters": [ + "\"{\\\"100\\\":\\\"Continue\\\",\\\"101\\\":\\\"Switching Protocols\\\",\\\"102\\\":\\\"Processing\\\",\\\"200\\\":\\\"OK\\\",\\\"201\\\":\\\"Created\\\",\\\"202\\\":\\\"Accepted\\\",\\\"203\\\":\\\"Non-Authoritative Information\\\",\\\"204\\\":\\\"No Content\\\",\\\"205\\\":\\\"Reset Content\\\",\\\"206\\\":\\\"Partial Content\\\",\\\"207\\\":\\\"Multi-Status\\\",\\\"226\\\":\\\"IM Used\\\",\\\"300\\\":\\\"Multiple Choices\\\",\\\"301\\\":\\\"Moved Permanently\\\",\\\"302\\\":\\\"Found\\\",\\\"303\\\":\\\"See Other\\\",\\\"304\\\":\\\"Not Modified\\\",\\\"305\\\":\\\"Use Proxy\\\",\\\"307\\\":\\\"Temporary Redirect\\\",\\\"308\\\":\\\"Permanent Redirect\\\",\\\"400\\\":\\\"Bad Request\\\",\\\"401\\\":\\\"Unauthorized\\\",\\\"402\\\":\\\"Payment Required\\\",\\\"403\\\":\\\"Forbidden\\\",\\\"404\\\":\\\"Not Found\\\",\\\"405\\\":\\\"Method Not Allowed\\\",\\\"406\\\":\\\"Not Acceptable\\\",\\\"407\\\":\\\"Proxy Authentication Required\\\",\\\"408\\\":\\\"Request Timeout\\\",\\\"409\\\":\\\"Conflict\\\",\\\"410\\\":\\\"Gone\\\",\\\"411\\\":\\\"Length Required\\\",\\\"412\\\":\\\"Precondition Failed\\\",\\\"413\\\":\\\"Payload Too Large\\\",\\\"414\\\":\\\"URI Too Long\\\",\\\"415\\\":\\\"Unsupported Media Type\\\",\\\"416\\\":\\\"Range Not Satisfiable\\\",\\\"417\\\":\\\"Expectation Failed\\\",\\\"418\\\":\\\"I'm a teapot\\\",\\\"422\\\":\\\"Unprocessable Entity\\\",\\\"423\\\":\\\"Locked\\\",\\\"424\\\":\\\"Failed Dependency\\\",\\\"426\\\":\\\"Upgrade Required\\\",\\\"428\\\":\\\"Precondition Required\\\",\\\"429\\\":\\\"Too Many Requests\\\",\\\"431\\\":\\\"Request Header Fields Too Large\\\",\\\"451\\\":\\\"Unavailable For Legal Reasons\\\",\\\"500\\\":\\\"Internal Server Error\\\",\\\"501\\\":\\\"Not Implemented\\\",\\\"502\\\":\\\"Bad Gateway\\\",\\\"503\\\":\\\"Service Unavailable\\\",\\\"504\\\":\\\"Gateway Time-out\\\",\\\"505\\\":\\\"HTTP Version Not Supported\\\",\\\"506\\\":\\\"Variant Also Negotiates\\\",\\\"507\\\":\\\"Insufficient Storage\\\",\\\"511\\\":\\\"Network Authentication Required\\\",\\\"1xx\\\":\\\"**Informational**\\\",\\\"2xx\\\":\\\"**Successful**\\\",\\\"3xx\\\":\\\"**Redirection**\\\",\\\"4xx\\\":\\\"**Client Error**\\\",\\\"5xx\\\":\\\"**Server Error**\\\",\\\"7xx\\\":\\\"**Developer Error**\\\"}\"", + "__AdvancedHTTP.StatusTexts" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CopyArgumentToVariable" + }, + "parameters": [ + "\"Response\"", + "__AdvancedHTTP.Response" + ] + }, + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "GlobalVariableString(__AdvancedHTTP.StatusTexts[Variable(__AdvancedHTTP.Response.status)])" + ] + } + ] + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Variable containing the response", + "name": "Response", + "type": "scenevar" + } + ], + "objectGroups": [] + }, + { + "description": "one of the HTTP headers included in the server's response.", + "fullName": "Header", + "functionType": "ExpressionAndCondition", + "group": "Response", + "name": "ResponseHeader", + "sentence": "Header _PARAM2_ of response _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CopyArgumentToVariable" + }, + "parameters": [ + "\"Response\"", + "__AdvancedHTTP.Response" + ] + }, + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "VariableString(__AdvancedHTTP.Response.headers[Header])" + ] + } + ] + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Variable containing the response", + "name": "Response", + "type": "scenevar" + }, + { + "description": "Header", + "name": "Header", + "supplementaryInformation": "sceneHeader", + "type": "identifier" + } + ], + "objectGroups": [] + }, + { + "async": true, + "description": "Reads the body sent by the server, and store it as a string in a variable.", + "fullName": "Get response body (text)", + "functionType": "Action", + "group": "Response", + "name": "ReadResponseText", + "sentence": "Read body of response _PARAM1_ into _PARAM2_ as text", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const logger = (this.logger || (this.logger = new gdjs.Logger(\"Advanced HTTP\")));\r", + "const advancedHTTP = (gdjs._advancedHTTP || (gdjs._advancedHTTP = { responses: new Map(), id: 1 }));\r", + "\r", + "/** @type {gdjs.Variable} */\r", + "const response = eventsFunctionContext.getArgument(\"Response\");\r", + "/** @type {gdjs.Variable} */\r", + "const body = eventsFunctionContext.getArgument(\"Body\");\r", + "\r", + "const id = response.getChild(\"id\").getAsNumber();\r", + "const responseBody = response.getChild(\"body\").getAsString();\r", + "\r", + "if (responseBody !== \"0\") {\r", + " body.setString(responseBody);\r", + " eventsFunctionContext.task.resolve();\r", + " return;\r", + "}\r", + "\r", + "if (!advancedHTTP.responses.has(id)) {\r", + " eventsFunctionContext.task.resolve();\r", + " logger.error(`Couldn't read the body of a request. Either an invalid request has passed, or the body has already been disposed of. The body must be read within 10 seconds of the request succeeding, as it will then be disposed of.`);\r", + " return;\r", + "}\r", + "\r", + "const fetchResponse = advancedHTTP.responses.get(id);\r", + "\r", + "eventsFunctionContext.task = new gdjs.PromiseTask(\r", + " fetchResponse\r", + " .text()\r", + " .then((text) => {\r", + " body.setString(text);\r", + " })\r", + " .catch((e) => {\r", + " logger.error(`An error occured while reading the body of a request: ${e}`)\r", + " })\r", + ")\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Variable containing the response", + "name": "Response", + "type": "scenevar" + }, + { + "description": "Variable where to write the body contents into", + "name": "Body", + "type": "scenevar" + } + ], + "objectGroups": [] + }, + { + "async": true, + "description": "Reads the body sent by the server, parses it as JSON and stores the resulting structure in a variable.", + "fullName": "Get response body (JSON)", + "functionType": "Action", + "group": "Response", + "name": "ReadResponseJSON", + "sentence": "Read body of response _PARAM1_ into _PARAM2_ as JSON", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const logger = (this.logger || (this.logger = new gdjs.Logger(\"Advanced HTTP\")));\r", + "const advancedHTTP = (gdjs._advancedHTTP || (gdjs._advancedHTTP = { responses: new Map(), id: 1 }));\r", + "\r", + "/** @type {gdjs.Variable} */\r", + "const response = eventsFunctionContext.getArgument(\"Response\");\r", + "/** @type {gdjs.Variable} */\r", + "const body = eventsFunctionContext.getArgument(\"Body\");\r", + "\r", + "const id = response.getChild(\"id\").getAsNumber();\r", + "const responseBody = response.getChild(\"body\").getAsString();\r", + "\r", + "if (responseBody !== \"0\") {\r", + " try {\r", + " const parsedBody = JSON.parse(responseBody)\r", + " body.fromJSObject(parsedBody);\r", + " } catch (e) {\r", + " logger.error(`An error occured while reading the body of a request: ${e}`)\r", + " }\r", + " eventsFunctionContext.task.resolve();\r", + " return;\r", + "}\r", + "\r", + "if (!advancedHTTP.responses.has(id)) {\r", + " eventsFunctionContext.task.resolve();\r", + " logger.error(`Couldn't read the body of a request. Either an invalid request has passed, or the body has already been disposed of. The body must be read within 10 seconds of the request succeeding, as it will then be disposed of.`);\r", + " return;\r", + "}\r", + "\r", + "const fetchResponse = advancedHTTP.responses.get(id);\r", + "\r", + "eventsFunctionContext.task = new gdjs.PromiseTask(\r", + " fetchResponse\r", + " .json()\r", + " .then((json) => {\r", + " body.fromJSObject(json);\r", + " })\r", + " .catch((e) => {\r", + " logger.error(`An error occured while reading the body of a request: ${e}`)\r", + " })\r", + ")\r", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "Variable containing the response", + "name": "Response", + "type": "scenevar" + }, + { + "description": "Variable where to write the body contents into", + "name": "Body", + "type": "scenevar" + } + ], + "objectGroups": [] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "folderName": "Request creation", + "children": [ + { + "functionName": "CreateRequest" + }, + { + "functionName": "CopyRequest" + } + ] + }, + { + "folderName": "Request settings", + "children": [ + { + "functionName": "SetRequestMethod" + }, + { + "functionName": "RequestMethod" + }, + { + "functionName": "SetRequestCache" + }, + { + "functionName": "RequestCache" + }, + { + "functionName": "SetRequestBody" + }, + { + "functionName": "SetJSONRequestBody" + }, + { + "functionName": "SetFormDataRequestBody" + }, + { + "functionName": "RequestBody" + }, + { + "functionName": "SetRequestHeader" + }, + { + "functionName": "RequestHeader" + }, + { + "functionName": "SetRequestURL" + }, + { + "functionName": "RequestURL" + }, + { + "functionName": "UseCORSBypass" + }, + { + "functionName": "IsUsingCORSBypass" + } + ] + }, + { + "folderName": "Request execution", + "children": [ + { + "functionName": "ExecuteRequest" + } + ] + }, + { + "folderName": "Response", + "children": [ + { + "functionName": "ResponseSuccess" + }, + { + "functionName": "ResponseStatusCode" + }, + { + "functionName": "ResponseStatusText" + }, + { + "functionName": "ResponseHeader" + }, + { + "functionName": "ReadResponseText" + }, + { + "functionName": "ReadResponseJSON" + } + ] + } + ] + }, + "eventsBasedBehaviors": [], + "eventsBasedObjects": [] + }, + { + "author": "", + "category": "Movement", + "dimension": "2D", + "extensionNamespace": "", + "fullName": "Pixel perfect movement", + "gdevelopVersion": ">=5.5.222", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQoJLnN0MXtmaWxsOm5vbmU7c3Ryb2tlOiMwMDAwMDA7c3Ryb2tlLXdpZHRoOjI7c3Ryb2tlLWxpbmVjYXA6cm91bmQ7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO30NCgkuc3Qye2ZpbGw6bm9uZTtzdHJva2U6IzAwMDAwMDtzdHJva2Utd2lkdGg6MjtzdHJva2UtbGluZWNhcDpyb3VuZDtzdHJva2UtbGluZWpvaW46cm91bmQ7c3Ryb2tlLWRhc2hhcnJheTo2LDY7fQ0KCS5zdDN7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtZGFzaGFycmF5OjQsNDt9DQoJLnN0NHtmaWxsOm5vbmU7c3Ryb2tlOiMwMDAwMDA7c3Ryb2tlLXdpZHRoOjI7c3Ryb2tlLWxpbmVjYXA6cm91bmQ7fQ0KCS5zdDV7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1kYXNoYXJyYXk6My4xMDgxLDMuMTA4MTt9DQoJDQoJCS5zdDZ7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDtzdHJva2UtZGFzaGFycmF5OjQsMzt9DQo8L3N0eWxlPg0KPHJlY3QgeD0iNCIgeT0iNCIgY2xhc3M9InN0MCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ii8+DQo8bGluZSBjbGFzcz0ic3QwIiB4MT0iMTIiIHkxPSIyOCIgeDI9IjEyIiB5Mj0iNCIvPg0KPGxpbmUgY2xhc3M9InN0MCIgeDE9IjIwIiB5MT0iMjgiIHgyPSIyMCIgeTI9IjQiLz4NCjxsaW5lIGNsYXNzPSJzdDAiIHgxPSIyOCIgeTE9IjIwIiB4Mj0iNCIgeTI9IjIwIi8+DQo8bGluZSBjbGFzcz0ic3QwIiB4MT0iMjgiIHkxPSIxMiIgeDI9IjQiIHkyPSIxMiIvPg0KPC9zdmc+DQo=", + "name": "PixelPerfectMovement", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Graphic Design/Graphic Design_grid.svg", + "shortDescription": "Grid-based pixel-perfect movement for platformer and top-down characters.", + "version": "0.3.2", + "description": [ + "Games with pixel art usually use pixels bigger than actual pixels of the screen. This can lead to big pixels partially overlapping each other which doesn't look good.", + "", + "This extension allows to seamlessly keep big pixels aligned when the object is stopped and still beneficiate from the high resolution of the screen to have smooth movements.", + "", + "It can be used for:", + "* Pixel-perfect platformers ([open the project online](https://editor.gdevelop.io/?project=example://platformer-with-tilemap))", + "* Align top-down characters on a grid ([open the project online](https://editor.gdevelop.io/?project=example://top-down-grid-movement))" + ], + "origin": { + "identifier": "PixelPerfectMovement", + "name": "gdevelop-extension-store" + }, + "tags": [ + "pixel perfect", + "platformer", + "platform", + "top-down", + "movement", + "grid" + ], + "authorIds": [ + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2", + "mkJFlZEo4aXeAZxt8CsXjEkW4Oq1", + "mMR36hCjO5dlcYmhNSuVtcREM473" + ], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [], + "eventsFunctions": [ + { + "description": "Return the speed necessary to cover a distance according to the deceleration.", + "fullName": "Speed to reach", + "functionType": "Expression", + "name": "SpeedToReach", + "private": true, + "sentence": "Braking distance from an initial speed: _PARAM2_ and a deceleration: _PARAM3_ is less than _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "Distance", + ">=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "sqrt(2 * Distance * Deceleration)" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "Distance", + "<", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "-sqrt(-2 * Distance * Deceleration)" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Distance", + "name": "Distance", + "type": "expression" + }, + { + "description": "Deceleration", + "name": "Deceleration", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Return the braking distance according to an initial speed and a deceleration.", + "fullName": "Braking distance", + "functionType": "Expression", + "name": "BrakingDistance", + "private": true, + "sentence": "Braking distance from an initial speed: _PARAM2_ and a deceleration: _PARAM3_ is less than _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Speed * Speed / (2 * Deceleration)" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Speed", + "name": "Speed", + "type": "expression" + }, + { + "description": "Deceleration", + "name": "Deceleration", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Define JavaScript classes for top-down.", + "fullName": "Define JavaScript classes for top-down", + "functionType": "Action", + "name": "DefineJavaScriptForTopDown", + "private": true, + "sentence": "Define JavaScript classes for top-down", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "if (gdjs.__pixelPerfectExtension) {", + " return;", + "}", + "", + "const epsilon = 1 / (1 << 20);", + "", + "class PixelPerfectTopDownMovement {", + "", + " /**", + " * @param {gdjs.RuntimeBehavior} pixelPerfectBehavior", + " * @param {gdjs.TopDownMovementRuntimeBehavior} topDownBehavior", + " */", + " constructor(pixelPerfectBehavior, topDownBehavior) {", + " /** @type {gdjs.RuntimeBehavior} */", + " this.pixelPerfectBehavior = pixelPerfectBehavior;", + " /** @type {gdjs.TopDownMovementRuntimeBehavior} */", + " this.topDownBehavior = topDownBehavior;", + "", + " topDownBehavior.registerHook(this);", + "", + " /** @type {number | null} */", + " this.targetX = null;", + " /** @type {number | null} */", + " this.targetY = null;", + " this.targetDirectionX = 0;", + " this.targetDirectionY = 0;", + " this.lastDirection = -1;", + " this.isVelocityAdjusted = false;", + " this.isVelocityAdjustedOnX = false;", + " this.isVelocityAdjustedOnY = false;", + " }", + "", + " /**", + " * Return the direction to use instead of the direction given in", + " * parameter.", + " * @param {gdjs.TopDownMovementRuntimeBehavior.TopDownMovementHookContext} context", + " * @return {number}", + " */", + " overrideDirection(context) {", + " let direction = context.getDirection();", + " if (!this.pixelPerfectBehavior.activated()) {", + " return direction;", + " }", + "", + " /** @type {number} */", + " const cellSize = this.pixelPerfectBehavior._getPixelSize();", + " const that = this.topDownBehavior;", + " const object = that.owner;", + "", + " if (cellSize <= 0 || that._allowDiagonals) {", + " return direction;", + " }", + "", + " // Forbid to turn before being aligned on the grid.", + "", + " const timeDelta = object.getElapsedTime() / 1000;", + " const deltaX = Math.abs(that._xVelocity * timeDelta);", + " const deltaY = Math.abs(that._yVelocity * timeDelta);", + "", + " const isTryingToMoveOnX = direction === 4 || direction === 0;", + " const isTryingToMoveOnY = direction === 6 || direction === 2;", + " if (isTryingToMoveOnX) {", + " if (that._yVelocity < 0) {", + " if (Math.abs(this.ceilToCellY(object.y) - object.y) > deltaY) {", + " direction = 6;", + " } else {", + " object.y = this.ceilToCellY(object.y);", + " }", + " }", + " if (that._yVelocity > 0) {", + " if (Math.abs(this.floorToCellY(object.y) - object.y) > deltaY) {", + " direction = 2;", + " } else {", + " object.y = this.floorToCellY(object.y);", + " }", + " }", + " } else if (isTryingToMoveOnY) {", + " if (that._xVelocity < 0) {", + " if (Math.abs(this.ceilToCellX(object.x) - object.x) > deltaX) {", + " direction = 4;", + " } else {", + " object.x = this.ceilToCellX(object.x);", + " }", + " }", + " if (that._xVelocity > 0) {", + " if (Math.abs(this.floorToCellX(object.x) - object.x) > deltaX) {", + " direction = 0;", + " } else {", + " object.x = this.floorToCellX(object.x);", + " }", + " }", + " }", + "", + " // Ensure sharp turn even with Verlet integrations.", + " const speed = Math.abs(that._xVelocity + that._yVelocity);", + " if (direction === 0) {", + " that._xVelocity = speed;", + " that._yVelocity = 0;", + " } else if (direction === 4) {", + " that._xVelocity = -speed;", + " that._yVelocity = 0;", + " } else if (direction === 2) {", + " that._yVelocity = speed;", + " that._xVelocity = 0;", + " } else if (direction === 6) {", + " that._yVelocity = -speed;", + " that._xVelocity = 0;", + " }", + "", + " this.lastDirection = direction;", + " return direction;", + " }", + "", + " /**", + " * Called before the acceleration and new direction is applied to the", + " * velocity.", + " * @param {gdjs.TopDownMovementRuntimeBehavior.TopDownMovementHookContext} context", + " */", + " beforeSpeedUpdate(context) {", + " if (!this.pixelPerfectBehavior.activated()) {", + " return;", + " }", + "", + " const direction = context.getDirection();", + " /** @type {number} */", + " const cellSize = this.pixelPerfectBehavior._getPixelSize();", + " const that = this.topDownBehavior;", + " const object = that.owner;", + "", + " if (cellSize <= 0) {", + " return;", + " }", + "", + " const isMovingOnX =", + " direction !== -1 && direction !== 2 && direction !== 6;", + " if (isMovingOnX) {", + " this.targetX = null;", + " } else if (this.targetX === null) {", + " // Find where the deceleration should stop the object.", + " if (that._xVelocity > 0) {", + " this.targetX = this.ceilToCellX(", + " object.x + this.getBreakingDistanceX()", + " );", + " this.targetDirectionX = 1;", + " }", + " if (that._xVelocity < 0) {", + " this.targetX = this.floorToCellX(", + " object.x - this.getBreakingDistanceX()", + " );", + " this.targetDirectionX = -1;", + " }", + " }", + "", + " const isMovingOnY =", + " direction !== -1 && direction !== 0 && direction !== 4;", + " if (isMovingOnY) {", + " this.targetY = null;", + " } else if (this.targetY === null) {", + " // Find where the deceleration should stop the object.", + " if (that._yVelocity > 0) {", + " this.targetY = this.ceilToCellY(", + " object.y + this.getBreakingDistanceY()", + " );", + " this.targetDirectionY = 1;", + " }", + " if (that._yVelocity < 0) {", + " this.targetY = this.floorToCellY(", + " object.y - this.getBreakingDistanceY()", + " );", + " this.targetDirectionY = -1;", + " }", + " }", + "", + " // Make as if the player had press button a bit longer to reach exactly", + " // the next cell.", + "", + " this.isVelocityAdjustedOnX = this.targetX !== null;", + " if (this.isVelocityAdjustedOnX) {", + " if (this.targetDirectionX > 0) {", + " if (this.targetX > object.getX()) {", + " that._xVelocity = Math.min(", + " that._xVelocity + that._acceleration,", + " that._maxSpeed,", + " this.getSpeedToReach(this.targetX - object.getX())", + " );", + " }", + " const nextFrameX = object.getX() + that._xVelocity * object.getElapsedTime() / 1000;", + " if (this.targetX <= nextFrameX) {", + " that._xVelocity = 0;", + " object.setX(this.roundToCellX(object.getX()));", + " this.targetX = null;", + " }", + " }", + " if (this.targetDirectionX < 0) {", + " if (this.targetX < object.getX()) {", + " that._xVelocity = Math.max(", + " that._xVelocity - that._acceleration,", + " -that._maxSpeed,", + " this.getSpeedToReach(this.targetX - object.getX())", + " );", + " }", + " const nextFrameX = object.getX() + that._xVelocity * object.getElapsedTime() / 1000;", + " if (this.targetX >= nextFrameX) {", + " that._xVelocity = 0;", + " object.setX(this.roundToCellX(object.getX()));", + " this.targetX = null;", + " }", + " }", + " // The velocity is exact. There no need for Verlet integration.", + " this.previousVelocityX = that._xVelocity;", + " }", + "", + " this.isVelocityAdjustedOnY = this.targetY !== null;", + " if (this.isVelocityAdjustedOnY) {", + " if (this.targetDirectionY > 0) {", + " if (this.targetY > object.getY()) {", + " that._yVelocity = Math.min(", + " that._yVelocity + that._acceleration,", + " that._maxSpeed,", + " this.getSpeedToReach(this.targetY - object.getY())", + " );", + " }", + " const nextFrameY = object.getY() + that._yVelocity * object.getElapsedTime() / 1000;", + " if (this.targetY <= nextFrameY) {", + " that._yVelocity = 0;", + " object.setY(this.roundToCellY(object.getY()));", + " this.targetY = null;", + " }", + " }", + " if (this.targetDirectionY < 0) {", + " if (this.targetY < object.getY()) {", + " that._yVelocity = Math.max(", + " that._yVelocity - that._acceleration,", + " -that._maxSpeed,", + " this.getSpeedToReach(this.targetY - object.getY())", + " );", + " }", + " const nextFrameY = object.getY() + that._yVelocity * object.getElapsedTime() / 1000;", + " if (this.targetY >= nextFrameY) {", + " that._yVelocity = 0;", + " object.setY(this.roundToCellY(object.getY()));", + " this.targetY = null;", + " }", + " }", + " // The velocity is exact. There no need for Verlet integration.", + " this.previousVelocityY = that._yVelocity;", + " }", + " }", + "", + " /**", + " * Called before the velocity is applied to the object position and", + " * angle.", + " */", + " beforePositionUpdate() {", + " if (!this.pixelPerfectBehavior.activated()) {", + " return;", + " }", + "", + " /** @type {number} */", + " const cellSize = this.pixelPerfectBehavior._getPixelSize();", + " if (cellSize <= 0) {", + " return;", + " }", + "", + " const that = this.topDownBehavior;", + "", + " if (this.isVelocityAdjustedOnX) {", + " // The velocity is exact. There no need for Verlet integration.", + " that._xVelocity = this.previousVelocityX;", + " }", + " if (this.isVelocityAdjustedOnY) {", + " // The velocity is exact. There no need for Verlet integration.", + " that._yVelocity = this.previousVelocityY;", + " }", + " }", + "", + " doStepPostEvents(instanceContainer) {", + " /** @type {number} */", + " const cellSize = this.pixelPerfectBehavior._getPixelSize();", + " if (cellSize <= 0) {", + " return;", + " }", + "", + " const that = this.topDownBehavior;", + " const object = that.owner;", + "", + " const isMovingOnX =", + " this.lastDirection !== -1 &&", + " this.lastDirection !== 2 &&", + " this.lastDirection !== 6;", + " const isMovingOnY =", + " this.lastDirection !== -1 &&", + " this.lastDirection !== 0 &&", + " this.lastDirection !== 4;", + "", + " // Avoid rounding errors after a call to \"separate\" to make characters", + " // move indefinitely in front of a wall because they can't reach the cell.", + " if (!isMovingOnX && that._xVelocity !== 0) {", + " const x = object.getX();", + " const roundedX = this.roundToCellX(x);", + " if (Math.abs(roundedX - x) < epsilon) {", + " object.setX(roundedX);", + " this.targetDirectionX = 0;", + " that._xVelocity = 0;", + " }", + " }", + " if (!isMovingOnY && that._yVelocity !== 0) {", + " const y = object.getY();", + " const roundedY = this.roundToCellY(y);", + " if (Math.abs(roundedY - y) < epsilon) {", + " object.setY(roundedY);", + " this.targetDirectionY = 0;", + " that._yVelocity = 0;", + " }", + " }", + " }", + "", + " /**", + " * @returns {number} the braking distance according to an initial speed and a deceleration.", + " */", + " getBreakingDistanceX() {", + " const that = this.topDownBehavior;", + " return (that._xVelocity * that._xVelocity) / (2 * that._deceleration);", + " }", + "", + " /**", + " * @returns {number} the braking distance according to an initial speed and a deceleration.", + " */", + " getBreakingDistanceY() {", + " const that = this.topDownBehavior;", + " return (that._yVelocity * that._yVelocity) / (2 * that._deceleration);", + " }", + "", + " /**", + " * @param {number} displacement", + " * @returns {number} the speed necessary to cover a distance according to the deceleration.", + " */", + " getSpeedToReach(displacement) {", + " const that = this.topDownBehavior;", + " return (", + " Math.sign(displacement) *", + " Math.sqrt(2 * Math.abs(displacement) * that._deceleration)", + " );", + " }", + "", + " /**", + " * @param {number} x", + " * @return {number}", + " */", + " ceilToCellX(x) {", + " /** @type {number} */", + " const cellSize = this.pixelPerfectBehavior._getPixelSize();", + " /** @type {number} */", + " const gridOffsetX = this.pixelPerfectBehavior._getOffsetX();", + "", + " return (", + " gridOffsetX +", + " cellSize * Math.ceil((x - gridOffsetX) / cellSize)", + " );", + " }", + "", + " /**", + " * @param {number} x", + " * @return {number}", + " */", + " roundToCellX(x) {", + " /** @type {number} */", + " const cellSize = this.pixelPerfectBehavior._getPixelSize();", + " /** @type {number} */", + " const gridOffsetX = this.pixelPerfectBehavior._getOffsetX();", + "", + " return (", + " gridOffsetX +", + " cellSize * Math.round((x - gridOffsetX) / cellSize)", + " );", + " }", + "", + " /**", + " * @param {number} x", + " * @return {number}", + " */", + " floorToCellX(x) {", + " /** @type {number} */", + " const cellSize = this.pixelPerfectBehavior._getPixelSize();", + " /** @type {number} */", + " const gridOffsetX = this.pixelPerfectBehavior._getOffsetX();", + "", + " return (", + " gridOffsetX +", + " cellSize * Math.floor((x - gridOffsetX) / cellSize)", + " );", + " }", + "", + " /**", + " * @param {number} y", + " * @return {number}", + " */", + " ceilToCellY(y) {", + " /** @type {number} */", + " const cellSize = this.pixelPerfectBehavior._getPixelSize();", + " /** @type {number} */", + " const gridOffsetY = this.pixelPerfectBehavior._getOffsetY();", + "", + " return (", + " gridOffsetY +", + " cellSize * Math.ceil((y - gridOffsetY) / cellSize)", + " );", + " }", + "", + " /**", + " * @param {number} y", + " * @return {number}", + " */", + " roundToCellY(y) {", + " /** @type {number} */", + " const cellSize = this.pixelPerfectBehavior._getPixelSize();", + " /** @type {number} */", + " const gridOffsetY = this.pixelPerfectBehavior._getOffsetY();", + "", + " return (", + " gridOffsetY +", + " cellSize * Math.round((y - gridOffsetY) / cellSize)", + " );", + " }", + "", + " /**", + " * @param {number} y", + " * @return {number}", + " */", + " floorToCellY(y) {", + " /** @type {number} */", + " const cellSize = this.pixelPerfectBehavior._getPixelSize();", + " /** @type {number} */", + " const gridOffsetY = this.pixelPerfectBehavior._getOffsetY();", + "", + " return (", + " gridOffsetY +", + " cellSize * Math.floor((y - gridOffsetY) / cellSize)", + " );", + " }", + "}", + "", + "gdjs.__pixelPerfectExtension = {", + " PixelPerfectTopDownMovement", + "}" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [], + "objectGroups": [] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "SpeedToReach" + }, + { + "functionName": "BrakingDistance" + }, + { + "functionName": "DefineJavaScriptForTopDown" + } + ] + }, + "eventsBasedBehaviors": [ + { + "description": "Seamlessly align big pixels using a top-down movement.", + "fullName": "Pixel perfect top-down movement", + "helpPath": "", + "iconUrl": "", + "name": "PixelPerfectTopDownMovement", + "objectType": "", + "previewIconUrl": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "PixelPerfectMovement::DefineJavaScriptForTopDown" + }, + "parameters": [ + "", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "\r", + "const object = objects[0];\r", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r", + "const behavior = object.getBehavior(behaviorName);\r", + "\r", + "/** @type {gdjs.TopDownMovementRuntimeBehavior} */\r", + "const topDownBehavior = object.getBehavior(behavior._getTopDownMovement());\r", + "\r", + "const pixelPerfect = new gdjs.__pixelPerfectExtension.PixelPerfectTopDownMovement(behavior, topDownBehavior);\r", + "topDownBehavior.__pixelPerfect = pixelPerfect;\r", + "behavior.__pixelPerfect = pixelPerfect;\r", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PixelPerfectMovement::PixelPerfectTopDownMovement", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPostEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const object = objects[0];", + "const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");", + "const behavior = object.getBehavior(behaviorName);", + "", + "behavior.__pixelPerfect.doStepPostEvents(runtimeScene);" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PixelPerfectMovement::PixelPerfectTopDownMovement", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "onCreated" + }, + { + "functionName": "doStepPostEvents" + } + ] + }, + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "Top-down movement behavior", + "extraInformation": [ + "TopDownMovementBehavior::TopDownMovementBehavior" + ], + "choices": [], + "name": "TopDownMovement" + }, + { + "value": "1", + "type": "Number", + "label": "Pixel size", + "name": "PixelSize" + }, + { + "value": "0", + "type": "Number", + "label": "Pixel grid offset X", + "name": "OffsetX" + }, + { + "value": "0", + "type": "Number", + "label": "Pixel grid offset Y", + "name": "OffsetY" + } + ], + "propertiesFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "propertyName": "TopDownMovement" + }, + { + "propertyName": "PixelSize" + }, + { + "propertyName": "OffsetX" + }, + { + "propertyName": "OffsetY" + } + ] + } + }, + { + "description": "Seamlessly align big pixels using a 2D platformer character movement.", + "fullName": "Pixel perfect platformer character", + "helpPath": "", + "iconUrl": "", + "name": "PixelPerfectPlatformerCharacter", + "objectType": "", + "previewIconUrl": "", + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPreEvents", + "sentence": "", + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "X axis", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "We don't know if the deceleration was already applied or not this step, but if the speed drifted from more than 1%, another extension is probably modifying the speed and it must not be overridden." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsDecelerating", + "True", + "" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(Object.PlatformerCharacter::CurrentSpeed() - PreviousSpeedX)", + "<", + "Object.PlatformerCharacter::CurrentSpeed() * 0.01 + Object.PlatformerCharacter::Deceleration() * TimeDelta()" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Find how far to go to reach a pixel." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PlatformBehavior::CurrentSpeed" + }, + "parameters": [ + "Object", + "PlatformerCharacter", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TargetX", + "=", + "OffsetX + PixelSize * ceil((Object.X() + PixelPerfectMovement::BrakingDistance(Object.PlatformerCharacter::CurrentSpeed(), Object.PlatformerCharacter::Deceleration()) - OffsetX) / PixelSize)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TargetDirectionX", + "=", + "1" + ] + } + ], + "events": [ + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "\"Target: \" + ToString(Object.X()) + \"-->\" + TargetX", + "", + "" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PlatformBehavior::CurrentSpeed" + }, + "parameters": [ + "Object", + "PlatformerCharacter", + "<", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TargetX", + "=", + "OffsetX + PixelSize * floor((Object.X() - PixelPerfectMovement::BrakingDistance(Object.PlatformerCharacter::CurrentSpeed(), Object.PlatformerCharacter::Deceleration()) - OffsetX) / PixelSize)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TargetDirectionX", + "=", + "-1" + ] + } + ], + "events": [ + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "\"Target: \" + ToString(Object.X()) + \"-->\" + TargetX", + "", + "" + ] + } + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Move to the target as the movement behavior would do." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosX" + }, + "parameters": [ + "Object", + "<", + "TargetX" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TargetDirectionX", + "=", + "1" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::PlatformerObjectBehavior::SetCurrentSpeed" + }, + "parameters": [ + "Object", + "PlatformerCharacter", + "=", + "min(Object.PlatformerCharacter::CurrentSpeed() + Object.PlatformerCharacter::Acceleration(), min(Object.PlatformerCharacter::MaxSpeed(), PixelPerfectMovement::SpeedToReach(TargetX - Object.X(), Object.PlatformerCharacter::Deceleration())))" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosX" + }, + "parameters": [ + "Object", + ">", + "TargetX" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TargetDirectionX", + "=", + "-1" + ] + } + ], + "actions": [ + { + "type": { + "value": "PlatformBehavior::PlatformerObjectBehavior::SetCurrentSpeed" + }, + "parameters": [ + "Object", + "PlatformerCharacter", + "=", + "max(Object.PlatformerCharacter::CurrentSpeed() - Object.PlatformerCharacter::Acceleration(), max(-Object.PlatformerCharacter::MaxSpeed(), PixelPerfectMovement::SpeedToReach(TargetX - Object.X(), Object.PlatformerCharacter::Deceleration())))" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "BuiltinCommonInstructions::And" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "PosX" + }, + "parameters": [ + "Object", + ">=", + "TargetX" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TargetDirectionX", + "=", + "1" + ] + } + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::And" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "PosX" + }, + "parameters": [ + "Object", + "<=", + "TargetX" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TargetDirectionX", + "=", + "-1" + ] + } + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetX" + }, + "parameters": [ + "Object", + "=", + "OffsetX + PixelSize * round((Object.X() - OffsetX) / PixelSize)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TargetDirectionX", + "=", + "0" + ] + }, + { + "type": { + "value": "PlatformBehavior::PlatformerObjectBehavior::SetCurrentSpeed" + }, + "parameters": [ + "Object", + "PlatformerCharacter", + "=", + "0" + ] + } + ], + "events": [ + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "\"X: \" + ToString(Object.X()) + \" Speed: \" + ToString(Object.PlatformerCharacter::CurrentSpeed())", + "", + "" + ] + } + ] + } + ] + } + ] + } + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Ladder", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PlatformBehavior::IsOnLadder" + }, + "parameters": [ + "Object", + "PlatformerCharacter" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Find how far to go to reach a pixel." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "PlatformBehavior::PlatformerObjectBehavior::IsUsingControl" + }, + "parameters": [ + "Object", + "PlatformerCharacter", + "\"Down\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "PlatformBehavior::PlatformerObjectBehavior::IsUsingControl" + }, + "parameters": [ + "Object", + "PlatformerCharacter", + "\"Up\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TargetY", + "=", + "OffsetY + PixelSize * ceil((Object.Y() - OffsetY) / PixelSize)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TargetDirectionY", + "=", + "1" + ] + } + ], + "events": [ + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "\"Target: \" + ToString(Object.Y()) + \"-->\" + TargetY", + "", + "" + ] + } + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "PlatformBehavior::PlatformerObjectBehavior::IsUsingControl" + }, + "parameters": [ + "Object", + "PlatformerCharacter", + "\"Up\"" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "PlatformBehavior::PlatformerObjectBehavior::IsUsingControl" + }, + "parameters": [ + "Object", + "PlatformerCharacter", + "\"Down\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TargetY", + "=", + "OffsetY + PixelSize * floor((Object.Y() - OffsetY) / PixelSize)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TargetDirectionY", + "=", + "-1" + ] + } + ], + "events": [ + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "\"Target: \" + ToString(Object.Y()) + \"-->\" + TargetY", + "", + "" + ] + } + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Move to the target as the movement behavior would do." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "PlatformBehavior::PlatformerObjectBehavior::IsUsingControl" + }, + "parameters": [ + "Object", + "PlatformerCharacter", + "\"Up\"" + ] + }, + { + "type": { + "inverted": true, + "value": "PlatformBehavior::PlatformerObjectBehavior::IsUsingControl" + }, + "parameters": [ + "Object", + "PlatformerCharacter", + "\"Down\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosY" + }, + "parameters": [ + "Object", + "<", + "TargetY" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TargetDirectionY", + "=", + "1" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetY" + }, + "parameters": [ + "Object", + "+", + "Object.PlatformerCharacter::MaxSpeed() * TimeDelta()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PosY" + }, + "parameters": [ + "Object", + ">", + "TargetY" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TargetDirectionY", + "=", + "-1" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetY" + }, + "parameters": [ + "Object", + "-", + "Object.PlatformerCharacter::MaxSpeed() * TimeDelta()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "BuiltinCommonInstructions::And" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "PosY" + }, + "parameters": [ + "Object", + ">=", + "TargetY" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TargetDirectionY", + "=", + "1" + ] + } + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::And" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "PosY" + }, + "parameters": [ + "Object", + "<=", + "TargetY" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TargetDirectionY", + "=", + "-1" + ] + } + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetY" + }, + "parameters": [ + "Object", + "=", + "OffsetY + PixelSize * round((Object.Y() - OffsetY) / PixelSize)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TargetDirectionY", + "=", + "0" + ] + } + ] + }, + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "\"X: \" + ToString(Object.X()) + \" Speed: \" + ToString(Object.PlatformerCharacter::CurrentSpeed())", + "", + "" + ] + } + ] + } + ] + } + ] + } + ], + "parameters": [] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PixelPerfectMovement::PixelPerfectPlatformerCharacter", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPostEvents", + "sentence": "", + "events": [ + { + "disabled": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(Object.PlatformerCharacter::CurrentSpeed())", + "!=", + "0" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(Object.PlatformerCharacter::CurrentSpeed())", + "!=", + "Object.PlatformerCharacter::MaxSpeed()" + ] + } + ], + "actions": [ + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "ToString(abs(PreviousSpeedX) - Object.PlatformerCharacter::Deceleration() * TimeDelta() - abs(Object.PlatformerCharacter::CurrentSpeed()))", + "", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Check if the character is decelerating.\nIt's done in doStepPostEvent because there is no way to know if the doStepPreEvents of this behavior is executed before or after the one of PlatformerCharcter.\nAs TimeDelta is used, we have to be sure the last PlatformerCharcter.doStepPreEvents call used the same TimeDelta. Which means this must be done after PlatformerCharcter.doStepPreEvents." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsDecelerating", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "PlatformBehavior::CurrentSpeed" + }, + "parameters": [ + "Object", + "PlatformerCharacter", + "=", + "0" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(Object.PlatformerCharacter::CurrentSpeed())", + "=", + "abs(PreviousSpeedX) - Object.PlatformerCharacter::Deceleration() * TimeDelta()" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsDecelerating", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Save the speed to detect speed changes from outside." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "PreviousSpeedX", + "=", + "Object.PlatformerCharacter::CurrentSpeed()" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PixelPerfectMovement::PixelPerfectPlatformerCharacter", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "doStepPreEvents" + }, + { + "functionName": "doStepPostEvents" + } + ] + }, + "propertyDescriptors": [ + { + "value": "", + "type": "Behavior", + "label": "Platformer character behavior", + "extraInformation": [ + "PlatformBehavior::PlatformerObjectBehavior" + ], + "choices": [], + "name": "PlatformerCharacter" + }, + { + "value": "1", + "type": "Number", + "label": "Pixel size", + "name": "PixelSize" + }, + { + "value": "0", + "type": "Number", + "label": "Pixel grid offset X", + "name": "OffsetX" + }, + { + "value": "0", + "type": "Number", + "label": "Pixel grid offset Y", + "name": "OffsetY" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TargetX" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TargetDirectionX" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TargetY" + }, + { + "value": "0", + "type": "Number", + "label": "", + "hidden": true, + "name": "TargetDirectionY" + }, + { + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "PreviousSpeedX" + }, + { + "value": "", + "type": "Boolean", + "label": "", + "hidden": true, + "name": "IsDecelerating" + } + ], + "propertiesFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "propertyName": "PlatformerCharacter" + }, + { + "propertyName": "PixelSize" + }, + { + "propertyName": "OffsetX" + }, + { + "propertyName": "OffsetY" + }, + { + "propertyName": "TargetX" + }, + { + "propertyName": "TargetDirectionX" + }, + { + "propertyName": "TargetY" + }, + { + "propertyName": "TargetDirectionY" + }, + { + "propertyName": "PreviousSpeedX" + }, + { + "propertyName": "IsDecelerating" + } + ] + } + } + ], + "eventsBasedObjects": [] + }, + { + "author": "Arthur Pacaud (arthuro555)", + "category": "Advanced", + "dimension": "", + "extensionNamespace": "", + "fullName": "Unique Identifiers", + "gdevelopVersion": ">=5.5.222", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWlkZW50aWZpZXIiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNiwxOFY4SDhWMThINk02LDQuNUg4VjYuNUg2VjQuNU0xNyw0SDE5VjE4SDE3VjE3Ljc1QzE3LDE3Ljc1IDE1LjY3LDE4IDE1LDE4QTUsNSAwIDAsMSAxMCwxM0E1LDUgMCAwLDEgMTUsOEMxNS42Nyw4IDE3LDguMjUgMTcsOC4yNVY0TTE3LDEwLjI1QzE3LDEwLjI1IDE1LjY3LDEwIDE1LDEwQTMsMyAwIDAsMCAxMiwxM0EzLDMgMCAwLDAgMTUsMTZDMTUuNjcsMTYgMTcsMTUuNzUgMTcsMTUuNzVWMTAuMjVaIiAvPjwvc3ZnPg==", + "name": "UUID", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/identifier.svg", + "shortDescription": "Generate unique identifiers: UUIDv4 random strings and incremented integer UIDs.", + "version": "1.0.0", + "description": [ + "Adds UUID (Universally Unique Identifiers) generation expressions via multiple patterns:", + "- UUIDv4: Creates a long random string of characters following the UUIDv4 standard. If available on the system/browser, will use a cryptographic random number generator, otherwise uses the same pseudorandom number generator as the `Random()` expression. Chances of collisions are extremely low, but not non-existent. As the return value is a string, it may not be the most performant pattern. It can not be predicted in most cases.", + "- Incremented integer: Returns use an integer that will be incremented after each call. Very performant and no risk of collisions. The UID will be predictable, so it may be vulnerable to some cryptographic attacks if used for private unique tokens, like password reset verification UID. Note that if you store IDs and then restart the game, there may be duplicates, since it'll reset the counter." + ], + "origin": { + "identifier": "UUID", + "name": "gdevelop-extension-store" + }, + "tags": [ + "random", + "generation", + "uid", + "uuid", + "guid", + "v4", + "unique", + "id", + "identifier" + ], + "authorIds": [ + "ZgrsWuRTAkXgeuPV9bo0zuEcA2w1" + ], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [], + "eventsFunctions": [ + { + "description": "Generates a unique identifier with the UUIDv4 pattern.", + "fullName": "Generate a UUIDv4", + "functionType": "StringExpression", + "name": "GenerateUUIDv4", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "// Use the engine implementation of UUIDv4.", + "eventsFunctionContext.returnValue = gdjs.makeUuid();", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [], + "objectGroups": [] + }, + { + "description": "Generates a unique identifier with the incremented integer pattern.", + "fullName": "Generate an incremented integer UID", + "functionType": "Expression", + "name": "GenerateIncrementedIntegerUID", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "GlobalVariable(__UUID_IncrementedInteger)" + ] + }, + { + "type": { + "value": "ModVarGlobal" + }, + "parameters": [ + "__UUID_IncrementedInteger", + "+", + "1" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [], + "objectGroups": [] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "GenerateUUIDv4" + }, + { + "functionName": "GenerateIncrementedIntegerUID" + } + ] + }, + "eventsBasedBehaviors": [], + "eventsBasedObjects": [] + }, + { + "author": "Silver-Streak, @Bouh, Tristan Rhodes", + "category": "Game mechanic", + "dimension": "2D", + "extensionNamespace": "", + "fullName": "Object \"Is On Screen\" Detection", + "gdevelopVersion": "", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLW1vbml0b3Itc2NyZWVuc2hvdCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik05LDZINVYxMEg3VjhIOU0xOSwxMEgxN1YxMkgxNVYxNEgxOU0yMSwxNkgzVjRIMjFNMjEsMkgzQzEuODksMiAxLDIuODkgMSw0VjE2QTIsMiAwIDAsMCAzLDE4SDEwVjIwSDhWMjJIMTZWMjBIMTRWMThIMjFBMiwyIDAgMCwwIDIzLDE2VjRDMjMsMi44OSAyMi4xLDIgMjEsMiIgLz48L3N2Zz4=", + "name": "IsOnScreen", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/monitor-screenshot.svg", + "shortDescription": "Condition to check if an object is visible in its layer's camera viewport.", + "version": "1.2.2", + "description": [ + "This extension adds conditions to check if an object is located within the visible portion of its layer's camera. The condition also allows for specifying padding to the virtual screen border.", + "", + "Note that this does not take into account any object visibility, such as being hidden or 0 opacity, but can be combined with those existing conditions." + ], + "origin": { + "identifier": "IsOnScreen", + "name": "gdevelop-extension-store" + }, + "tags": [ + "is on screen", + "condition", + "visible", + "hide", + "screen" + ], + "authorIds": [ + "2OwwM8ToR9dx9RJ2sAKTcrLmCB92", + "8Ih1aa8f5gWUp4UB2BdhQ2iXWxJ3", + "gqDaZjCfevOOxBYkK6zlhtZnXCg1" + ], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [], + "eventsFunctions": [], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT" + }, + "eventsBasedBehaviors": [ + { + "description": "This behavior provides a condition to check if the object is located within the visible portion of its layer's camera. The condition also allows for specifying padding to the virtual screen border.\nNote that object visibility, such as being hidden or 0 opacity, is not considered (but you can use those existing conditions in addition to this behavior).", + "fullName": "Is on screen", + "helpPath": "", + "iconUrl": "", + "name": "InOnScreen", + "objectType": "", + "previewIconUrl": "", + "quickCustomizationVisibility": "hidden", + "eventsFunctions": [ + { + "description": "Checks if an object position is within the viewport of its layer.", + "fullName": "Is on screen", + "functionType": "Condition", + "name": "IsOnScreen", + "sentence": "_PARAM0_ is on screen (padded by _PARAM2_ pixels)", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/*", + "Get the object layer, convert the position from this layer to the screen coordinates.", + "Get the point on each side on the object on screen, and compare with the screen area.", + "", + "This way even if the camera has a rotation or custom scale the object is always compared to the screen area.", + "*/", + "", + "", + "// Get the layer of the object.", + "const object = objects[0];", + "const layer = runtimeScene.getLayer(object.getLayer());", + "", + "// Get the aabb of the object on his layer.", + "const aabb = object.getVisibilityAABB();", + "", + "// Get the layer to convert the coordinates of the AABB to the screen coordinates", + "const topLeft = layer.convertInverseCoords(aabb.min[0], aabb.min[1]);", + "const topRight = layer.convertInverseCoords(aabb.max[0], aabb.min[1]);", + "const bottomRight = layer.convertInverseCoords(aabb.max[0], aabb.max[1]);", + "const bottomLeft = layer.convertInverseCoords(aabb.min[0], aabb.max[1]);", + "", + "// Get the points on each side of the object on screen.", + "const posLeftObjectOnScreen = Math.min(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]);", + "const posRightObjectOnScreen = Math.max(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]);", + "const posUpObjectOnScreen = Math.min(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]);", + "const posDownObjectOnScreen = Math.max(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]);", + "", + "const padding = eventsFunctionContext.getArgument(\"Padding\");", + "", + "if (", + " !(posLeftObjectOnScreen - padding > runtimeScene.getGame().getGameResolutionWidth() ||", + " posUpObjectOnScreen - padding > runtimeScene.getGame().getGameResolutionHeight() ||", + " posRightObjectOnScreen + padding < 0 ||", + " posDownObjectOnScreen + padding < 0", + " )", + ") {", + " eventsFunctionContext.returnValue = true;", + "}", + "" + ], + "parameterObjects": "Object", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "IsOnScreen::InOnScreen", + "type": "behavior" + }, + { + "description": "Padding (in pixels)", + "longDescription": "Number of pixels to pad the screen border. Zero by default. A negative value goes inside the screen, a positive value go outside.", + "name": "Padding", + "type": "expression" + } + ], + "objectGroups": [ + { + "name": "Group", + "objects": [] + } + ] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "IsOnScreen" + } + ] + }, + "propertyDescriptors": [], + "propertiesFolderStructure": { + "folderName": "__ROOT" + } + } + ], + "eventsBasedObjects": [] + }, + { + "author": "", + "category": "User interface", + "dimension": "2D", + "extensionNamespace": "", + "fullName": "Labeled button", + "gdevelopVersion": ">=5.5.230", + "helpPath": "/objects/button", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI5LDIzSDNjLTEuMSwwLTItMC45LTItMlYxMWMwLTEuMSwwLjktMiwyLTJoMjZjMS4xLDAsMiwwLjksMiwydjEwQzMxLDIyLjEsMzAuMSwyMywyOSwyM3oiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMywxOUwxMywxOWMtMS4xLDAtMi0wLjktMi0ydi0yYzAtMS4xLDAuOS0yLDItMmgwYzEuMSwwLDIsMC45LDIsMnYyQzE1LDE4LjEsMTQuMSwxOSwxMywxOXoiLz4NCjxsaW5lIGNsYXNzPSJzdDAiIHgxPSIxOCIgeTE9IjEzIiB4Mj0iMTgiIHkyPSIxOSIvPg0KPGxpbmUgY2xhc3M9InN0MCIgeDE9IjIxIiB5MT0iMTMiIHgyPSIxOCIgeTI9IjE3Ii8+DQo8bGluZSBjbGFzcz0ic3QwIiB4MT0iMjEiIHkxPSIxOSIgeDI9IjE5IiB5Mj0iMTYiLz4NCjwvc3ZnPg0K", + "name": "PanelSpriteButton", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Interface Elements/Interface Elements_interface_ui_button_ok_cta_clock_tap.svg", + "shortDescription": "Resizeable button with a label.", + "version": "2.2.1", + "description": [ + "A button that can be used for menus and most labelled buttons of a game. The button can be customized with a background for each state and a label. It handles user interactions and a simple condition can be used to check if it is clicked.", + "", + "There are ready-to-use buttons in the asset-store [menu buttons pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=menu-buttons-menu-buttons)." + ], + "origin": { + "identifier": "PanelSpriteButton", + "name": "gdevelop-extension-store" + }, + "tags": [ + "button", + "ui" + ], + "authorIds": [ + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" + ], + "changelog": [ + { + "version": "2.0.0", + "breaking": "- Buttons now use \"variants\", allowing easy swapping of their visual aspect. You will have to make some adjustments to existing buttons in your project. Follow this [migration documentation](https://wiki.gdevelop.io/gdevelop5/objects/custom-objects-prefab-template/migrate-to-variants/) to do these changes." + } + ], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [], + "eventsFunctions": [ + { + "description": "Check if the events are running for the editor.", + "fullName": "Editor is running", + "functionType": "Condition", + "name": "IsInGameEdition", + "private": true, + "sentence": "Events are running for the editor", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "const game = runtimeScene.getGame();\r", + "eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [], + "objectGroups": [] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "IsInGameEdition" + } + ] + }, + "eventsBasedBehaviors": [ + { + "description": "The finite state machine used internally by the button object.", + "fullName": "Button finite state machine", + "helpPath": "", + "iconUrl": "", + "name": "ButtonFSM", + "objectType": "", + "previewIconUrl": "", + "private": true, + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "doStepPostEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "PanelSpriteButton::IsInGameEdition" + }, + "parameters": [ + "", + "" + ] + } + ], + "actions": [], + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Finite state machine", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "The \"Validated\" state only last one frame." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Check position", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Make sure the cursor position is only checked once per frame." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldCheckHovering", + "True", + "" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "MouseOnlyCursorX(Object.Layer(), 0)", + "MouseOnlyCursorY(Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Touches are always pressed, so ShouldCheckHovering doesn't matter." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "False", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "TouchId", + "!=", + "0" + ] + }, + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(TouchId, Object.Layer(), 0)", + "TouchY(TouchId, Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + } + ] + } + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touch start", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasAnyTouchOrMouseStarted" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Index", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "StartedTouchOrMouseCount()", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "CollisionPoint" + }, + "parameters": [ + "Object", + "TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)", + "TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "StartedTouchOrMouseId(Index)" + ] + }, + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "PanelSpriteButton::ButtonFSM::PropertyState" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Hovered\"" + ] + }, + { + "type": { + "value": "PanelSpriteButton::ButtonFSM::PropertyState" + }, + "parameters": [ + "Object", + "Behavior", + "=", + "\"Idle\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Index", + "+", + "1" + ] + } + ] + } + ] + } + ] + } + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Apply position changes", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Hovered\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "MouseIsInside", + "True", + "" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Hovered\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedOutside\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "TouchIsInside", + "True", + "" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedOutside\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + } + ] + } + ], + "parameters": [] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Handle touch end", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "HasTouchEnded" + }, + "parameters": [ + "", + "TouchId" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + }, + { + "type": { + "inverted": true, + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } + ] + } + ] + } + ], + "parameters": [] + } + ], + "parameters": [] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PanelSpriteButton::ButtonFSM", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onDeActivate", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "PanelSpriteButton::ButtonFSM::ResetState" + }, + "parameters": [ + "Object", + "Behavior", + "" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PanelSpriteButton::ButtonFSM", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Reset the state of the button.", + "fullName": "Reset state", + "functionType": "Action", + "name": "ResetState", + "private": true, + "sentence": "Reset the button state of _PARAM0_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "TouchId", + "=", + "0" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PanelSpriteButton::ButtonFSM", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the button is not used.", + "fullName": "Is idle", + "functionType": "Condition", + "name": "IsIdle", + "sentence": "_PARAM0_ is idle", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Idle\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PanelSpriteButton::ButtonFSM", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the button was just clicked.", + "fullName": "Is clicked", + "functionType": "Condition", + "name": "IsClicked", + "sentence": "_PARAM0_ is clicked", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Validated\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PanelSpriteButton::ButtonFSM", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the cursor is hovered over the button.", + "fullName": "Is hovered", + "functionType": "Condition", + "name": "IsHovered", + "sentence": "_PARAM0_ is hovered", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Hovered\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PanelSpriteButton::ButtonFSM", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the button is either hovered or pressed but not hovered.", + "fullName": "Is focused", + "functionType": "Condition", + "name": "IsFocused", + "sentence": "_PARAM0_ is focused", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"Hovered\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedOutside\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PanelSpriteButton::ButtonFSM", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the button is currently being pressed with mouse or touch.", + "fullName": "Is pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "_PARAM0_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedInside\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PanelSpriteButton::ButtonFSM", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the button is currently being pressed outside with mouse or touch.", + "fullName": "Is held outside", + "functionType": "Condition", + "name": "IsPressedOutside", + "sentence": "_PARAM0_ is held outside", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "State", + "=", + "\"PressedOutside\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PanelSpriteButton::ButtonFSM", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "the touch id that is using the button or 0 if none.", + "fullName": "Touch id", + "functionType": "ExpressionAndCondition", + "name": "TouchId", + "sentence": "the touch id", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "TouchId" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PanelSpriteButton::ButtonFSM", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "doStepPostEvents" + }, + { + "functionName": "onDeActivate" + }, + { + "functionName": "ResetState" + }, + { + "functionName": "IsIdle" + }, + { + "functionName": "IsClicked" + }, + { + "functionName": "IsHovered" + }, + { + "functionName": "IsFocused" + }, + { + "functionName": "IsPressed" + }, + { + "functionName": "IsPressedOutside" + }, + { + "functionName": "TouchId" + } + ] + }, + "propertyDescriptors": [ + { + "value": "true", + "type": "Boolean", + "label": "", + "description": "Should check hovering", + "hidden": true, + "name": "ShouldCheckHovering" + }, + { + "value": "Idle", + "type": "Choice", + "label": "State", + "choices": [ + { + "label": "Idle", + "value": "Idle" + }, + { + "label": "Hovered", + "value": "Hovered" + }, + { + "label": "PressedInside", + "value": "PressedInside" + }, + { + "label": "PressedOutside", + "value": "PressedOutside" + }, + { + "label": "Validated", + "value": "Validated" + } + ], + "hidden": true, + "name": "State" + }, + { + "value": "0", + "type": "Number", + "label": "Touch id", + "hidden": true, + "name": "TouchId" + }, + { + "value": "", + "type": "Boolean", + "label": "Touch is inside", + "hidden": true, + "name": "TouchIsInside" + }, + { + "value": "", + "type": "Boolean", + "label": "Mouse is inside", + "hidden": true, + "name": "MouseIsInside" + }, + { + "value": "", + "type": "Number", + "label": "", + "hidden": true, + "name": "Index" + } + ], + "propertiesFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "propertyName": "ShouldCheckHovering" + }, + { + "propertyName": "State" + }, + { + "propertyName": "TouchId" + }, + { + "propertyName": "TouchIsInside" + }, + { + "propertyName": "MouseIsInside" + }, + { + "propertyName": "Index" + } + ] + } + }, + { + "description": "Change the text style when the button is hovered.", + "fullName": "Hover text style", + "helpPath": "", + "iconUrl": "", + "name": "TextStyleState", + "objectType": "TextObject::Text", + "previewIconUrl": "", + "private": true, + "eventsFunctions": [ + { + "description": "Check if isHovered.", + "fullName": "IsHovered", + "functionType": "Condition", + "name": "IsHovered", + "sentence": "_PARAM0_ isHovered", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsHovered", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "TextObject::Text", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PanelSpriteButton::TextStyleState", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change if isHovered.", + "fullName": "IsHovered", + "functionType": "Action", + "name": "SetIsHovered", + "sentence": "_PARAM0_ isHovered: _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsHovered", + "False", + "" + ] + }, + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Value", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsHovered", + "True", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "HoverFontSize", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "IdleFontSize", + "=", + "Object.FontSize()" + ] + }, + { + "type": { + "value": "TextObject::Text::SetFontSize" + }, + "parameters": [ + "Object", + "=", + "HoverFontSize" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "HoverColor", + "!=", + "\"\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "IdleColor", + "=", + "Object.Behavior::Color()" + ] + }, + { + "type": { + "value": "TextObject::ChangeColor" + }, + "parameters": [ + "Object", + "HoverColor" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldEnableShadowOnHover", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TextObject::ShowShadow" + }, + "parameters": [ + "Object", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldEnableOutlineOnHover", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TextObject::Text::SetOutlineEnabled" + }, + "parameters": [ + "Object", + "yes" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsHovered", + "True", + "" + ] + }, + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Value", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsHovered", + "False", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "HoverFontSize", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "TextObject::Text::SetFontSize" + }, + "parameters": [ + "Object", + "=", + "IdleFontSize" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "HoverColor", + "!=", + "\"\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "TextObject::ChangeColor" + }, + "parameters": [ + "Object", + "IdleColor" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldEnableShadowOnHover", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TextObject::ShowShadow" + }, + "parameters": [ + "Object", + "no" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldEnableOutlineOnHover", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "TextObject::Text::SetOutlineEnabled" + }, + "parameters": [ + "Object", + "no" + ] + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "TextObject::Text", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PanelSpriteButton::TextStyleState", + "type": "behavior" + }, + { + "defaultValue": "yes", + "description": "IsHovered", + "name": "Value", + "optional": true, + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Return the text color", + "fullName": "Text color", + "functionType": "StringExpression", + "name": "Color", + "private": true, + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {gdjs.TextRuntimeObject} */", + "const object = eventsFunctionContext.getObjects(\"Object\")[0];", + "", + "eventsFunctionContext.returnValue = object._color.join(\";\");" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "expressionType": { + "type": "color" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "TextObject::Text", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PanelSpriteButton::TextStyleState", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "IsHovered" + }, + { + "functionName": "SetIsHovered" + }, + { + "functionName": "Color" + } + ] + }, + "propertyDescriptors": [ + { + "value": "", + "type": "Boolean", + "label": "Outline on hover", + "name": "ShouldEnableOutlineOnHover" + }, + { + "value": "", + "type": "Color", + "label": "Hover color", + "name": "HoverColor" + }, + { + "value": "", + "type": "Boolean", + "label": "Enable shadow on hover", + "name": "ShouldEnableShadowOnHover" + }, + { + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "Hover font size", + "name": "HoverFontSize" + }, + { + "value": "", + "type": "Boolean", + "label": "", + "hidden": true, + "name": "IsHovered" + }, + { + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "Idle font size", + "hidden": true, + "name": "IdleFontSize" + }, + { + "value": "", + "type": "Color", + "label": "Idle color", + "hidden": true, + "name": "IdleColor" + } + ], + "propertiesFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "propertyName": "IsHovered" + }, + { + "propertyName": "HoverFontSize" + }, + { + "propertyName": "IdleFontSize" + }, + { + "propertyName": "HoverColor" + }, + { + "propertyName": "IdleColor" + }, + { + "propertyName": "ShouldEnableOutlineOnHover" + }, + { + "propertyName": "ShouldEnableShadowOnHover" + } + ] + } + }, + { + "description": "Change the text style when the button is hovered.", + "fullName": "Hover bitmap text style", + "helpPath": "", + "iconUrl": "", + "name": "BitmapTextStyleState", + "objectType": "BitmapText::BitmapTextObject", + "previewIconUrl": "", + "private": true, + "eventsFunctions": [ + { + "description": "Check if isHovered.", + "fullName": "IsHovered", + "functionType": "Condition", + "name": "IsHovered", + "sentence": "_PARAM0_ isHovered", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsHovered", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "BitmapText::BitmapTextObject", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PanelSpriteButton::BitmapTextStyleState", + "type": "behavior" + } + ], + "objectGroups": [] + }, + { + "description": "Change if isHovered.", + "fullName": "IsHovered", + "functionType": "Action", + "name": "SetIsHovered", + "sentence": "_PARAM0_ isHovered: _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsHovered", + "False", + "" + ] + }, + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Value", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsHovered", + "True", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "HoverColor", + "!=", + "\"\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "IdleColor", + "=", + "Object.Behavior::Color()" + ] + }, + { + "type": { + "value": "BitmapText::SetTint" + }, + "parameters": [ + "Object", + "HoverColor" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "HoverPrefix", + "!=", + "\"\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "HoverSuffix", + "!=", + "\"\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "IdleText", + "=", + "Object.Text::Value()" + ] + }, + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Object", + "Text", + "=", + "HoverPrefix + Object.Text::Value() + HoverSuffix" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "IsHovered", + "True", + "" + ] + }, + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "Value", + "False", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetBooleanVariable" + }, + "parameters": [ + "IsHovered", + "False", + "" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "HoverColor", + "!=", + "\"\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "BitmapText::SetTint" + }, + "parameters": [ + "Object", + "IdleColor" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Or" + }, + "parameters": [], + "subInstructions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "HoverPrefix", + "!=", + "\"\"" + ] + }, + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "HoverSuffix", + "!=", + "\"\"" + ] + } + ] + } + ], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Object", + "Text", + "=", + "IdleText" + ] + } + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "BitmapText::BitmapTextObject", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PanelSpriteButton::BitmapTextStyleState", + "type": "behavior" + }, + { + "defaultValue": "yes", + "description": "IsHovered", + "name": "Value", + "optional": true, + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Return the text color", + "fullName": "Text color", + "functionType": "StringExpression", + "name": "Color", + "private": true, + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {gdjs.BitmapTextRuntimeObject} */", + "const object = eventsFunctionContext.getObjects(\"Object\")[0];", + "", + "eventsFunctionContext.returnValue = object._tint.join(\";\");" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "expressionType": { + "type": "color" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "BitmapText::BitmapTextObject", + "type": "object" + }, + { + "description": "Behavior", + "name": "Behavior", + "supplementaryInformation": "PanelSpriteButton::BitmapTextStyleState", + "type": "behavior" + } + ], + "objectGroups": [] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "IsHovered" + }, + { + "functionName": "SetIsHovered" + }, + { + "functionName": "Color" + } + ] + }, + "propertyDescriptors": [ + { + "value": "", + "type": "Color", + "label": "Hover color", + "name": "HoverColor" + }, + { + "value": "", + "type": "String", + "label": "Hover prefix", + "name": "HoverPrefix" + }, + { + "value": "", + "type": "String", + "label": "Hover suffix", + "name": "HoverSuffix" + }, + { + "value": "", + "type": "Boolean", + "label": "", + "hidden": true, + "name": "IsHovered" + }, + { + "value": "", + "type": "String", + "label": "Idle text", + "hidden": true, + "name": "IdleText" + }, + { + "value": "", + "type": "Color", + "label": "Idle color", + "hidden": true, + "name": "IdleColor" + } + ], + "propertiesFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "propertyName": "IsHovered" + }, + { + "propertyName": "HoverPrefix" + }, + { + "propertyName": "HoverSuffix" + }, + { + "propertyName": "IdleText" + }, + { + "propertyName": "HoverColor" + }, + { + "propertyName": "IdleColor" + } + ] + } + } + ], + "eventsBasedObjects": [ + { + "areaMaxX": 256, + "areaMaxY": 64, + "areaMaxZ": 64, + "areaMinX": 0, + "areaMinY": 0, + "areaMinZ": 0, + "assetStoreTag": "menu buttons", + "defaultName": "Button", + "description": "Button with a label.", + "fullName": "Labeled button", + "helpPath": "", + "iconUrl": "", + "isInnerAreaFollowingParentSize": true, + "isUsingLegacyInstancesRenderer": false, + "name": "PanelSpriteButton", + "previewIconUrl": "", + "objects": [ + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "Label", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 4, + "topEdgeAnchor": 4, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "TextStyleState", + "type": "PanelSpriteButton::TextStyleState", + "ShouldEnableOutlineOnHover": false, + "HoverColor": "", + "ShouldEnableShadowOnHover": false, + "HoverFontSize": 0, + "IsHovered": false, + "IdleFontSize": 0, + "IdleColor": "" + } + ], + "string": "Text", + "font": "", + "textAlignment": "center", + "characterSize": 20, + "color": { + "b": 0, + "g": 0, + "r": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "Text", + "font": "", + "textAlignment": "center", + "verticalTextAlignment": "center", + "characterSize": 20, + "lineHeight": 0, + "color": "0;0;0" + } + }, + { + "assetStoreId": "", + "bottomMargin": 0, + "height": 32, + "leftMargin": 0, + "name": "Idle", + "rightMargin": 0, + "texture": "", + "tiled": false, + "topMargin": 0, + "type": "PanelSpriteObject::PanelSprite", + "width": 32, + "variables": [ + { + "folded": true, + "name": "State", + "type": "string", + "value": "Idle" + } + ], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 2, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 1, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "ButtonFSM", + "type": "PanelSpriteButton::ButtonFSM", + "ShouldCheckHovering": true + } + ] + }, + { + "assetStoreId": "", + "bottomMargin": 0, + "height": 32, + "leftMargin": 0, + "name": "Hovered", + "rightMargin": 0, + "texture": "", + "tiled": false, + "topMargin": 0, + "type": "PanelSpriteObject::PanelSprite", + "width": 32, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 2, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 1, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ] + }, + { + "assetStoreId": "", + "bottomMargin": 0, + "height": 32, + "leftMargin": 0, + "name": "Pressed", + "rightMargin": 0, + "texture": "", + "tiled": false, + "topMargin": 0, + "type": "PanelSpriteObject::PanelSprite", + "width": 32, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 2, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 1, + "useLegacyBottomAndRightAnchors": false + } + ] + }, + { + "assetStoreId": "", + "name": "BitmapLabel", + "type": "BitmapText::BitmapTextObject", + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 4, + "topEdgeAnchor": 4, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "BitmapTextStyleState", + "type": "PanelSpriteButton::BitmapTextStyleState", + "HoverColor": "", + "HoverPrefix": "", + "HoverSuffix": "", + "IsHovered": false, + "IdleText": "", + "IdleColor": "" + } + ], + "content": { + "text": "Text", + "opacity": 255, + "scale": 1, + "fontSize": 20, + "tint": "255;255;255", + "bitmapFontResourceName": "", + "textureAtlasResourceName": "", + "align": "center", + "verticalTextAlignment": "center" + } + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Label" + }, + { + "objectName": "BitmapLabel" + }, + { + "objectName": "Idle" + }, + { + "objectName": "Hovered" + }, + { + "objectName": "Pressed" + } + ] + }, + "objectsGroups": [ + { + "name": "Background", + "objects": [ + { + "name": "Idle" + }, + { + "name": "Hovered" + }, + { + "name": "Pressed" + } + ] + }, + { + "name": "Labels", + "objects": [ + { + "name": "Label" + }, + { + "name": "BitmapLabel" + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera2DPlaneMaxDrawingDistance": 5000, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "followBaseLayerCamera": false, + "isLightingLayer": false, + "isLocked": false, + "name": "", + "renderingType": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "instances": [ + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 64, + "layer": "", + "name": "Idle", + "persistentUuid": "24882334-eec8-403e-8bf1-70fc928a46e6", + "width": 256, + "x": 0, + "y": 0, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 64, + "layer": "", + "name": "Label", + "persistentUuid": "3b29c95c-5363-4e25-bf47-eecf13e8a226", + "width": 256, + "x": 0, + "y": 32, + "zOrder": 2, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "editionSettings": { + "grid": false, + "gridType": "rectangular", + "gridWidth": 32, + "gridHeight": 32, + "gridDepth": 32, + "gridOffsetX": 0, + "gridOffsetY": 0, + "gridOffsetZ": 0, + "gridColor": 10401023, + "gridAlpha": 0.8, + "snap": false, + "zoomFactor": 2.734375, + "windowMask": false, + "selectedLayer": "", + "gameEditorMode": "instances-editor" + }, + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onCreated", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Create one background instance for of each state.\nOnly the instance for the current state is shown." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "Hovered", + "0", + "0", + "" + ] + }, + { + "type": { + "value": "Create" + }, + "parameters": [ + "", + "Pressed", + "0", + "0", + "" + ] + }, + { + "type": { + "value": "ResizableCapability::ResizableBehavior::SetSize" + }, + "parameters": [ + "Hovered", + "Resizable", + "Idle.Width()", + "Idle.Height()" + ] + }, + { + "type": { + "value": "ResizableCapability::ResizableBehavior::SetSize" + }, + "parameters": [ + "Pressed", + "Resizable", + "Idle.Width()", + "Idle.Height()" + ] + }, + { + "type": { + "value": "Hide" + }, + "parameters": [ + "Hovered" + ] + }, + { + "type": { + "value": "Hide" + }, + "parameters": [ + "Pressed" + ] + }, + { + "type": { + "value": "SetZOrder" + }, + "parameters": [ + "Hovered", + "=", + "1" + ] + }, + { + "type": { + "value": "SetZOrder" + }, + "parameters": [ + "Pressed", + "=", + "1" + ] + }, + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Labels", + "Text", + "=", + "LabelText" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + } + ], + "objectGroups": [ + { + "name": "Background", + "objects": [ + { + "name": "Idle" + }, + { + "name": "Hovered" + }, + { + "name": "Pressed" + } + ] + } + ] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onHotReloading", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsPressed" + }, + "parameters": [ + "Object", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::SetLabelOffset" + }, + "parameters": [ + "Object", + "=", + "PressedLabelOffsetY", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Labels", + "Text", + "=", + "LabelText" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "doStepPostEvents", + "sentence": "", + "events": [ + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "name": "Apply states", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Show the right background accordingly to the new state." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsIdle" + }, + "parameters": [ + "Object", + "ButtonFSM" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "PanelSpriteButton::TextStyleState::SetIsHovered" + }, + "parameters": [ + "Label", + "TextStyleState", + "no", + "" + ] + }, + { + "type": { + "value": "PanelSpriteButton::BitmapTextStyleState::SetIsHovered" + }, + "parameters": [ + "BitmapLabel", + "BitmapTextStyleState", + "no", + "" + ] + }, + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::SetLabelOffset" + }, + "parameters": [ + "Object", + "=", + "0", + "" + ] + }, + { + "type": { + "value": "Show" + }, + "parameters": [ + "Idle", + "" + ] + }, + { + "type": { + "value": "Hide" + }, + "parameters": [ + "Pressed" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Visible" + }, + "parameters": [ + "Hovered" + ] + }, + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "HoveredFadeOutDuration", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::TweenBehavior::AddObjectOpacityTween2" + }, + "parameters": [ + "Hovered", + "Tween", + "\"Fadeout\"", + "0", + "\"linear\"", + "HoveredFadeOutDuration", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "HoveredFadeOutDuration", + "=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "Hide" + }, + "parameters": [ + "Hovered" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "OpacityCapability::OpacityBehavior::Value" + }, + "parameters": [ + "Hovered", + "Opacity", + "=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "Hide" + }, + "parameters": [ + "Hovered" + ] + }, + { + "type": { + "value": "OpacityCapability::OpacityBehavior::SetValue" + }, + "parameters": [ + "Hovered", + "Opacity", + "=", + "255" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsHovered" + }, + "parameters": [ + "Object", + "ButtonFSM" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "PanelSpriteButton::TextStyleState::SetIsHovered" + }, + "parameters": [ + "Label", + "TextStyleState", + "", + "" + ] + }, + { + "type": { + "value": "PanelSpriteButton::BitmapTextStyleState::SetIsHovered" + }, + "parameters": [ + "BitmapLabel", + "BitmapTextStyleState", + "yes", + "" + ] + }, + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::SetLabelOffset" + }, + "parameters": [ + "Object", + "=", + "0", + "" + ] + }, + { + "type": { + "value": "Hide" + }, + "parameters": [ + "Idle" + ] + }, + { + "type": { + "value": "Show" + }, + "parameters": [ + "Hovered", + "" + ] + }, + { + "type": { + "value": "Hide" + }, + "parameters": [ + "Pressed" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "HoveredFadeOutDuration", + ">", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "Tween::RemoveTween" + }, + "parameters": [ + "Hovered", + "Tween", + "\"Fadeout\"" + ] + }, + { + "type": { + "value": "OpacityCapability::OpacityBehavior::SetValue" + }, + "parameters": [ + "Hovered", + "Opacity", + "=", + "255" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsPressed" + }, + "parameters": [ + "Object", + "ButtonFSM" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "PanelSpriteButton::TextStyleState::SetIsHovered" + }, + "parameters": [ + "Label", + "TextStyleState", + "no", + "" + ] + }, + { + "type": { + "value": "PanelSpriteButton::BitmapTextStyleState::SetIsHovered" + }, + "parameters": [ + "BitmapLabel", + "BitmapTextStyleState", + "no", + "" + ] + }, + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::SetLabelOffset" + }, + "parameters": [ + "Object", + "=", + "PressedLabelOffsetY", + "" + ] + }, + { + "type": { + "value": "Hide" + }, + "parameters": [ + "Idle" + ] + }, + { + "type": { + "value": "Hide" + }, + "parameters": [ + "Hovered" + ] + }, + { + "type": { + "value": "Show" + }, + "parameters": [ + "Pressed", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::IsFocused" + }, + "parameters": [ + "Object", + "ButtonFSM" + ] + }, + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "PanelSpriteButton::TextStyleState::SetIsHovered" + }, + "parameters": [ + "Label", + "TextStyleState", + "yes", + "" + ] + }, + { + "type": { + "value": "PanelSpriteButton::BitmapTextStyleState::SetIsHovered" + }, + "parameters": [ + "BitmapLabel", + "BitmapTextStyleState", + "yes", + "" + ] + }, + { + "type": { + "value": "PanelSpriteButton::PanelSpriteButton::SetLabelOffset" + }, + "parameters": [ + "Object", + "=", + "0", + "" + ] + }, + { + "type": { + "value": "Hide" + }, + "parameters": [ + "Idle" + ] + }, + { + "type": { + "value": "Show" + }, + "parameters": [ + "Hovered", + "" + ] + }, + { + "type": { + "value": "Hide" + }, + "parameters": [ + "Pressed" + ] + } + ] + } + ], + "parameters": [] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the button is not used.", + "fullName": "Is idle", + "functionType": "Condition", + "name": "IsIdle", + "sentence": "_PARAM0_ is idle", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::ButtonFSM::IsIdle" + }, + "parameters": [ + "Idle", + "ButtonFSM", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the button was just clicked.", + "fullName": "Is clicked", + "functionType": "Condition", + "name": "IsClicked", + "sentence": "_PARAM0_ is clicked", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::ButtonFSM::IsClicked" + }, + "parameters": [ + "Idle", + "ButtonFSM", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the cursor is hovered over the button.", + "fullName": "Is hovered", + "functionType": "Condition", + "name": "IsHovered", + "sentence": "_PARAM0_ is hovered", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::ButtonFSM::IsHovered" + }, + "parameters": [ + "Idle", + "ButtonFSM", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the button is either hovered or pressed but not hovered.", + "fullName": "Is focused", + "functionType": "Condition", + "name": "IsFocused", + "sentence": "_PARAM0_ is focused", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::ButtonFSM::IsFocused" + }, + "parameters": [ + "Idle", + "ButtonFSM", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "Check if the button is currently being pressed with mouse or touch.", + "fullName": "Is pressed", + "functionType": "Condition", + "name": "IsPressed", + "sentence": "_PARAM0_ is pressed", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "PanelSpriteButton::ButtonFSM::IsPressed" + }, + "parameters": [ + "Idle", + "ButtonFSM", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "Change the text of the button label.", + "fullName": "Label text", + "functionType": "Action", + "name": "SetLabelText", + "private": true, + "sentence": "Change the text of _PARAM0_ to _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Labels", + "Text", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + }, + { + "description": "Text", + "name": "Value", + "type": "string" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "LabelText", + "name": "SetLabelTextOp", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "TextContainerCapability::TextContainerBehavior::SetValue" + }, + "parameters": [ + "Labels", + "Text", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "the label text.", + "fullName": "Label text", + "functionType": "ExpressionAndCondition", + "name": "LabelText", + "sentence": "the label text", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "Labels.Text::Value()" + ] + } + ] + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "De/activate interactions with the button.", + "fullName": "De/activate interactions", + "functionType": "Action", + "name": "Activate", + "sentence": "Activate interactions with _PARAM0_: _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldActivate", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ActivateBehavior" + }, + "parameters": [ + "Idle", + "ButtonFSM", + "yes" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "BooleanVariable" + }, + "parameters": [ + "ShouldActivate", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "ActivateBehavior" + }, + "parameters": [ + "Idle", + "ButtonFSM", + "no" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + }, + { + "description": "Activate", + "name": "ShouldActivate", + "type": "yesorno" + } + ], + "objectGroups": [] + }, + { + "description": "Check if interactions are activated on the button.", + "fullName": "Interactions activated", + "functionType": "Condition", + "name": "IsActivated", + "sentence": "Interactions on _PARAM0_ are activated", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BehaviorActivated" + }, + "parameters": [ + "Idle", + "ButtonFSM" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "description": "the labelOffset of the object.", + "fullName": "LabelOffset", + "functionType": "ExpressionAndCondition", + "name": "LabelOffset", + "private": true, + "sentence": "the labelOffset", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "LabelOffset" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "ActionWithOperator", + "getterName": "LabelOffset", + "name": "SetLabelOffset", + "private": true, + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetCenterY" + }, + "parameters": [ + "Labels", + "+", + "Value - LabelOffset" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "LabelOffset", + "=", + "Value" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Object", + "name": "Object", + "supplementaryInformation": "PanelSpriteButton::PanelSpriteButton", + "type": "object" + } + ], + "objectGroups": [] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "onCreated" + }, + { + "functionName": "onHotReloading" + }, + { + "functionName": "doStepPostEvents" + }, + { + "functionName": "IsIdle" + }, + { + "functionName": "IsClicked" + }, + { + "functionName": "IsHovered" + }, + { + "functionName": "IsFocused" + }, + { + "functionName": "IsPressed" + }, + { + "functionName": "SetLabelText" + }, + { + "functionName": "SetLabelTextOp" + }, + { + "functionName": "LabelText" + }, + { + "functionName": "Activate" + }, + { + "functionName": "IsActivated" + }, + { + "functionName": "LabelOffset" + }, + { + "functionName": "SetLabelOffset" + } + ] + }, + "propertyDescriptors": [ + { + "value": "", + "type": "MultilineString", + "label": "Label", + "name": "LabelText" + }, + { + "value": "0.25", + "type": "Number", + "unit": "Second", + "label": "Hovered fade out duration", + "group": "States", + "name": "HoveredFadeOutDuration" + }, + { + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "Label offset on Y axis when pressed", + "group": "States", + "name": "PressedLabelOffsetY" + }, + { + "value": "0", + "type": "Number", + "unit": "Pixel", + "label": "", + "group": "States", + "hidden": true, + "name": "LabelOffset" + }, + { + "value": "", + "type": "Choice", + "label": "", + "choices": [ + { + "label": "Label.Text=LabelText", + "value": "Label.Text=LabelText" + }, + { + "label": "BitmapLabel.Text=LabelText", + "value": "BitmapLabel.Text=LabelText" + } + ], + "hidden": true, + "name": "_PropertyMapping" + } + ], + "propertiesFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "propertyName": "LabelText" + }, + { + "propertyName": "_PropertyMapping" + }, + { + "folderName": "States", + "children": [ + { + "propertyName": "HoveredFadeOutDuration" + }, + { + "propertyName": "PressedLabelOffsetY" + }, + { + "propertyName": "LabelOffset" + } + ] + } + ] + }, + "variants": [ + { + "areaMaxX": 128, + "areaMaxY": 48, + "areaMaxZ": 64, + "areaMinX": 0, + "areaMinY": 0, + "areaMinZ": 0, + "assetStoreAssetId": "80b9ddd78c8727888bb53c7524f443682746667b1ba493c223114c04e7661bbf", + "assetStoreOriginalName": "Small Blue Button", + "name": "Small Blue Button", + "objects": [ + { + "assetStoreId": "", + "bold": false, + "italic": false, + "name": "Label", + "smoothed": true, + "type": "TextObject::Text", + "underlined": false, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 4, + "topEdgeAnchor": 4, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "TextStyleState", + "type": "PanelSpriteButton::TextStyleState", + "ShouldEnableOutlineOnHover": false, + "HoverColor": "", + "ShouldEnableShadowOnHover": false, + "HoverFontSize": 0, + "IsHovered": false, + "IdleFontSize": 0, + "IdleColor": "" + } + ], + "string": "Text", + "font": "", + "textAlignment": "center", + "characterSize": 20, + "color": { + "b": 0, + "g": 0, + "r": 0 + }, + "content": { + "bold": false, + "isOutlineEnabled": false, + "isShadowEnabled": false, + "italic": false, + "outlineColor": "255;255;255", + "outlineThickness": 2, + "shadowAngle": 90, + "shadowBlurRadius": 2, + "shadowColor": "0;0;0", + "shadowDistance": 4, + "shadowOpacity": 127, + "smoothed": true, + "underlined": false, + "text": "Text", + "font": "", + "textAlignment": "center", + "verticalTextAlignment": "center", + "characterSize": 20, + "lineHeight": 0, + "color": "0;0;0" + } + }, + { + "assetStoreId": "", + "bottomMargin": 5, + "height": 32, + "leftMargin": 3, + "name": "Idle", + "rightMargin": 3, + "texture": "assets\\Small Blue Button_Idle.png", + "tiled": false, + "topMargin": 3, + "type": "PanelSpriteObject::PanelSprite", + "width": 32, + "variables": [ + { + "folded": true, + "name": "State", + "type": "string", + "value": "Idle" + } + ], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 2, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 1, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "ButtonFSM", + "type": "PanelSpriteButton::ButtonFSM", + "ShouldCheckHovering": true + } + ] + }, + { + "assetStoreId": "", + "bottomMargin": 5, + "height": 32, + "leftMargin": 3, + "name": "Hovered", + "rightMargin": 3, + "texture": "assets\\Small Blue Button_Hovered.png", + "tiled": false, + "topMargin": 3, + "type": "PanelSpriteObject::PanelSprite", + "width": 32, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 2, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 1, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "Tween", + "type": "Tween::TweenBehavior" + } + ] + }, + { + "assetStoreId": "", + "bottomMargin": 3, + "height": 32, + "leftMargin": 3, + "name": "Pressed", + "rightMargin": 3, + "texture": "assets\\Small Blue Button_Pressed.png", + "tiled": false, + "topMargin": 3, + "type": "PanelSpriteObject::PanelSprite", + "width": 32, + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 2, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "topEdgeAnchor": 1, + "useLegacyBottomAndRightAnchors": false + } + ] + }, + { + "assetStoreId": "", + "name": "BitmapLabel", + "type": "BitmapText::BitmapTextObject", + "variables": [], + "effects": [], + "behaviors": [ + { + "name": "Anchor", + "type": "AnchorBehavior::AnchorBehavior", + "bottomEdgeAnchor": 4, + "topEdgeAnchor": 4, + "leftEdgeAnchor": 1, + "relativeToOriginalWindowSize": true, + "rightEdgeAnchor": 2, + "useLegacyBottomAndRightAnchors": false + }, + { + "name": "BitmapTextStyleState", + "type": "PanelSpriteButton::BitmapTextStyleState", + "HoverColor": "", + "HoverPrefix": "", + "HoverSuffix": "", + "IsHovered": false, + "IdleText": "", + "IdleColor": "" + } + ], + "content": { + "text": "Button", + "opacity": 255, + "scale": 1, + "fontSize": 20, + "tint": "255;255;255", + "bitmapFontResourceName": "assets\\8BitOperatorPlus8Regular_Edited.fnt", + "textureAtlasResourceName": "assets\\8BitOperatorPlus8Regular_Edited.png", + "align": "center", + "verticalTextAlignment": "center" + } + } + ], + "objectsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "objectName": "Label" + }, + { + "objectName": "BitmapLabel" + }, + { + "objectName": "Idle" + }, + { + "objectName": "Hovered" + }, + { + "objectName": "Pressed" + } + ] + }, + "objectsGroups": [ + { + "name": "Background", + "objects": [ + { + "name": "Idle" + }, + { + "name": "Hovered" + }, + { + "name": "Pressed" + } + ] + }, + { + "name": "Labels", + "objects": [ + { + "name": "Label" + }, + { + "name": "BitmapLabel" + } + ] + } + ], + "layers": [ + { + "ambientLightColorB": 200, + "ambientLightColorG": 200, + "ambientLightColorR": 200, + "camera2DPlaneMaxDrawingDistance": 5000, + "camera3DFarPlaneDistance": 10000, + "camera3DFieldOfView": 45, + "camera3DNearPlaneDistance": 3, + "cameraType": "", + "followBaseLayerCamera": false, + "isLightingLayer": false, + "isLocked": false, + "name": "", + "renderingType": "", + "visibility": true, + "cameras": [ + { + "defaultSize": true, + "defaultViewport": true, + "height": 0, + "viewportBottom": 1, + "viewportLeft": 0, + "viewportRight": 1, + "viewportTop": 0, + "width": 0 + } + ], + "effects": [] + } + ], + "instances": [ + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 48, + "layer": "", + "name": "Idle", + "persistentUuid": "24882334-eec8-403e-8bf1-70fc928a46e6", + "width": 128, + "x": 0, + "y": 0, + "zOrder": 1, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + }, + { + "angle": 0, + "customSize": true, + "depth": 1, + "height": 48, + "keepRatio": true, + "layer": "", + "name": "BitmapLabel", + "persistentUuid": "c3c3200d-dec4-4ac4-9dc5-4715d8989830", + "width": 128, + "x": 5, + "y": 26, + "zOrder": 2, + "numberProperties": [], + "stringProperties": [], + "initialVariables": [] + } + ], + "editionSettings": [] + } + ] + } + ] + }, + { + "author": "", + "category": "General", + "dimension": "", + "extensionNamespace": "", + "fullName": "JSON Resource Loading", + "gdevelopVersion": ">=5.5.222", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWZpbGUtY29kZS1vdXRsaW5lIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTE0IDJINkM0Ljg5IDIgNCAyLjkgNCA0VjIwQzQgMjEuMTEgNC44OSAyMiA2IDIySDE4QzE5LjExIDIyIDIwIDIxLjExIDIwIDIwVjhMMTQgMk0xOCAyMEg2VjRIMTNWOUgxOFYyME05LjU0IDE1LjY1TDExLjYzIDE3Ljc0TDEwLjM1IDE5TDcgMTUuNjVMMTAuMzUgMTIuM0wxMS42MyAxMy41Nkw5LjU0IDE1LjY1TTE3IDE1LjY1TDEzLjY1IDE5TDEyLjM4IDE3Ljc0TDE0LjQ3IDE1LjY1TDEyLjM4IDEzLjU2TDEzLjY1IDEyLjNMMTcgMTUuNjVaIiAvPjwvc3ZnPg==", + "name": "JSONResourceLoader", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/file-code-outline.svg", + "shortDescription": "Loads a JSON resource into a variable.", + "version": "1.1.0", + "description": [ + "Loads a (static) JSON resource from your project files into a global, scene, or object variable.", + "", + "NEVER use this to load your game.json into a variable - this would increase your game size by a lot and make your whole project file available for anyone to open!" + ], + "origin": { + "identifier": "JSONResourceLoader", + "name": "gdevelop-extension-store" + }, + "tags": [ + "json", + "resource", + "load", + "open", + "file", + "data", + "static", + "file" + ], + "authorIds": [ + "ZgrsWuRTAkXgeuPV9bo0zuEcA2w1" + ], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [], + "eventsFunctions": [ + { + "description": "Loads a JSON resource into a scene structure variable.", + "fullName": "Load a JSON resource in a scene variable", + "functionType": "Action", + "name": "LoadJSONToScene", + "private": true, + "sentence": "Load _PARAM1_ into scene variable _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "eventsFunctionContext", + " .getArgument(\"Variable\")", + " .fromJSObject(", + " runtimeScene", + " .getGame()", + " .getJsonManager()", + " .getLoadedJson(eventsFunctionContext.getArgument(\"Resource\"))", + " );", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "The resource to load the JSON from", + "name": "Resource", + "type": "jsonResource" + }, + { + "description": "The scene variable to load the JSON to", + "name": "Variable", + "type": "scenevar" + } + ], + "objectGroups": [] + }, + { + "description": "Loads a JSON resource into a global structure variable.", + "fullName": "Load a JSON resource in a global variable", + "functionType": "Action", + "name": "LoadJSONToGlobal", + "private": true, + "sentence": "Load _PARAM1_ into global variable _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "eventsFunctionContext", + " .getArgument(\"Variable\")", + " .fromJSObject(", + " runtimeScene", + " .getGame()", + " .getJsonManager()", + " .getLoadedJson(eventsFunctionContext.getArgument(\"Resource\"))", + " );", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "The resource to load the JSON from", + "name": "Resource", + "type": "jsonResource" + }, + { + "description": "The global variable to load the JSON to", + "name": "Variable", + "type": "globalvar" + } + ], + "objectGroups": [] + }, + { + "description": "Loads a JSON resource into an object structure variable.", + "fullName": "Load a JSON resource in an object variable", + "functionType": "Action", + "name": "LoadJSONToObject", + "sentence": "Load _PARAM1_ into object variable _PARAM3_ of object _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "eventsFunctionContext", + " .getArgument(\"Variable\")", + " .fromJSObject(", + " runtimeScene", + " .getGame()", + " .getJsonManager()", + " .getLoadedJson(eventsFunctionContext.getArgument(\"Resource\"))", + " );", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "parameters": [ + { + "description": "The resource to load the JSON from", + "name": "Resource", + "type": "jsonResource" + }, + { + "description": "The object where to find the variable", + "name": "Object", + "type": "objectList" + }, + { + "description": "The object variable to load the JSON to", + "name": "Variable", + "type": "objectvar" + } + ], + "objectGroups": [] + }, + { + "description": "Loads a JSON resource into a structure variable.", + "fullName": "Load a JSON resource in a variable", + "functionType": "Action", + "name": "LoadJSONToVariable", + "sentence": "Load _PARAM1_ into variable _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "/** @type {gdjs.Variable} */", + "//@ts-ignore", + "const variable = eventsFunctionContext.getArgument(\"Variable\");", + "variable.fromJSObject(", + " runtimeScene", + " .getGame()", + " .getJsonManager()", + " .getLoadedJson(eventsFunctionContext.getArgument(\"Resource\"))", + ");", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "The resource to load the JSON from", + "name": "Resource", + "type": "jsonResource" + }, + { + "description": "The variable to load the JSON to", + "name": "Variable", + "type": "variable" + } + ], + "objectGroups": [] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "LoadJSONToVariable" + }, + { + "functionName": "LoadJSONToScene" + }, + { + "functionName": "LoadJSONToGlobal" + }, + { + "functionName": "LoadJSONToObject" + } + ] + }, + "eventsBasedBehaviors": [], + "eventsBasedObjects": [] + }, + { + "author": "@Bouh", + "category": "User interface", + "dimension": "", + "extensionNamespace": "", + "fullName": "Time formatting", + "gdevelopVersion": ">=5.5.222", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWNsb2NrLWRpZ2l0YWwiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMiw2QTIsMiAwIDAsMCAwLDhWMTZBMiwyIDAgMCwwIDIsMThIMjJBMiwyIDAgMCwwIDI0LDE2VjhBMiwyIDAgMCwwIDIyLDZNMiw4SDIyVjE2SDJNMyw5VjEwLjVINi4yNUwzLDE1SDQuNzVMOCwxMC41VjlNOS4yNSw5VjEwLjVIMTAuNzVWOU0xMiw5VjEwLjVIMTMuNVYxNUgxNVY5TTE3LDlBMSwxIDAgMCwwIDE2LDEwVjE0QTEsMSAwIDAsMCAxNywxNUgyMEExLDEgMCAwLDAgMjEsMTRWMTBBMSwxIDAgMCwwIDIwLDlNMTcuNSwxMC41SDE5LjVWMTMuNUgxNy41TTkuMjUsMTMuNVYxNUgxMC43NVYxMy41IiAvPjwvc3ZnPg==", + "name": "TimeFormatter", + "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/clock-digital.svg", + "shortDescription": "Format seconds into HH:MM:SS or HH:MM:SS.000 time display strings.", + "version": "0.0.2", + "description": [ + "Ideal for displaying timers on screen.", + "", + "Formats included:", + "* HH:MM:SS", + "* HH:MM:SS.000 (displays milliseconds)" + ], + "origin": { + "identifier": "TimeFormatter", + "name": "gdevelop-extension-store" + }, + "tags": [ + "time", + "timer", + "format", + "hours", + "minutes", + "seconds", + "milliseconds" + ], + "authorIds": [ + "2OwwM8ToR9dx9RJ2sAKTcrLmCB92" + ], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [], + "eventsFunctions": [ + { + "description": "Format time in seconds to HH:MM:SS.", + "fullName": "Format time in seconds to HH:MM:SS", + "functionType": "StringExpression", + "name": "SecondsToHHMMSS", + "sentence": "Format time _PARAM1_ to HH:MM:SS in _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "var format_time = function (time_second) {\r", + " date = new Date(null);\r", + " date.setSeconds(time_second);\r", + " if (time_second >= 3600) {\r", + " return date.toISOString().substr(11, 8); // MM:SS\r", + " } else {\r", + " return date.toISOString().substr(14, 5); // HH:MM:SS\r", + " }\r", + "}\r", + "\r", + "eventsFunctionContext.returnValue = format_time(eventsFunctionContext.getArgument(\"TimeInSeconds\"));" + ], + "parameterObjects": "", + "useStrict": false, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Time, in seconds", + "name": "TimeInSeconds", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Format time in seconds to HH:MM:SS.000, including milliseconds.", + "fullName": "Format time in seconds to HH:MM:SS.000", + "functionType": "StringExpression", + "name": "SecondsToHHMMSS000", + "sentence": "Format time _PARAM1_ to HH:MM:SS in _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "var format_time = function (time_second) {\r", + " date = new Date(null);\r", + " date.setMilliseconds(1000*time_second);\r", + " if (time_second >= 3600) {\r", + " return date.toISOString().substr(11, 12); // MM:SS.000\r", + " } else {\r", + " return date.toISOString().substr(14, 9); // HH:MM:SS.000\r", + " }\r", + "}\r", + "\r", + "eventsFunctionContext.returnValue = format_time(eventsFunctionContext.getArgument(\"TimeInSeconds\"));" + ], + "parameterObjects": "", + "useStrict": false, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "Time, in seconds", + "name": "TimeInSeconds", + "type": "expression" + } + ], + "objectGroups": [] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "SecondsToHHMMSS" + }, + { + "functionName": "SecondsToHHMMSS000" + } + ] + }, + "eventsBasedBehaviors": [], + "eventsBasedObjects": [] + } + ], + "externalLayouts": [] +} diff --git a/MultiplayerTest01.json.autosave b/MultiplayerTest01.json.autosave new file mode 100644 index 0000000..d17b985 --- /dev/null +++ b/MultiplayerTest01.json.autosave @@ -0,0 +1 @@ +{"firstLayout":"Login","gdVersion":{"build":274,"major":5,"minor":6,"revision":0},"initialGDVersion":"5.6.274","properties":{"adaptGameResolutionAtRuntime":true,"antialiasingMode":"MSAA","antialisingEnabledOnMobile":false,"folderProject":false,"orientation":"landscape","packageName":"com.example.gamename","pixelsRounding":true,"projectUuid":"95fbe47f-9217-4b08-9d51-4fe99f117474","scaleMode":"nearest","sizeOnStartupMode":"adaptWidth","templateSlug":"","version":"1.0.0","name":"MultiplayerTest01","description":"","author":"","windowWidth":1280,"windowHeight":720,"latestCompilationDirectory":"","maxFPS":60,"minFPS":20,"verticalSync":false,"platformSpecificAssets":{},"loadingScreen":{"backgroundColor":0,"backgroundFadeInDuration":0.2,"backgroundImageResourceName":"","gdevelopLogoStyle":"light","logoAndProgressFadeInDuration":0.2,"logoAndProgressLogoFadeInDelay":0.0,"minDuration":1.5,"progressBarColor":16777215,"progressBarHeight":20.0,"progressBarMaxWidth":200.0,"progressBarMinWidth":40.0,"progressBarWidthPercent":30.0,"showGDevelopSplash":true,"showProgressBar":true},"watermark":{"placement":"bottom-left","showWatermark":true},"authorIds":[],"authorUsernames":[],"categories":[],"playableDevices":[],"extensionProperties":[],"platforms":[{"name":"GDevelop JS platform"}],"currentPlatform":"GDevelop JS platform"},"resources":{"resources":[{"file":"assets/8BitOperatorPlus8Regular_Edited.png","kind":"image","metadata":"","name":"assets\\8BitOperatorPlus8Regular_Edited.png","smoothed":false,"userAdded":false,"origin":{"identifier":"https://asset-resources.gdevelop.io/public-resources/Menu buttons/Pixel art/15c1797cbcb41c3a753b6bbb21cfa60284cfaf81c9891c3abf78a8e0e1cacf59_8BitOperatorPlus8Regular_Edited.png","name":"8BitOperatorPlus8Regular_Edited.png"}},{"file":"assets/Small Blue Button_Hovered.png","kind":"image","metadata":"","name":"assets\\Small Blue Button_Hovered.png","smoothed":false,"userAdded":false,"origin":{"identifier":"https://asset-resources.gdevelop.io/public-resources/Menu buttons/Pixel art/f80ae062891a0a4612c0160ed931165461392019f89a8545f28c195f645ebc48_Small Blue Button_Hovered.png","name":"Small Blue Button_Hovered.png"}},{"file":"assets/Small Blue Button_Idle.png","kind":"image","metadata":"","name":"assets\\Small Blue Button_Idle.png","smoothed":false,"userAdded":false,"origin":{"identifier":"https://asset-resources.gdevelop.io/public-resources/Menu buttons/Pixel art/c22b15c77047f1545806141e1129900bdc985d191b7ab5ebaae834a90c270ed2_Small Blue Button_Idle.png","name":"Small Blue Button_Idle.png"}},{"file":"assets/Small Blue Button_Pressed.png","kind":"image","metadata":"","name":"assets\\Small Blue Button_Pressed.png","smoothed":false,"userAdded":false,"origin":{"identifier":"https://asset-resources.gdevelop.io/public-resources/Menu buttons/Pixel art/9e01b09016c6a200b53a55cac3cf34f083785eb6b9f55de490a71ad352858b36_Small Blue Button_Pressed.png","name":"Small Blue Button_Pressed.png"}},{"file":"assets/8BitOperatorPlus8Regular_Edited.fnt","kind":"bitmapFont","metadata":"","name":"assets\\8BitOperatorPlus8Regular_Edited.fnt","userAdded":false,"origin":{"identifier":"https://asset-resources.gdevelop.io/public-resources/Menu buttons/Pixel art/6b410f07a3a02e721a49d41795e84b56707ef28ac4d095d55f1fd1093760e134_8BitOperatorPlus8Regular_Edited.fnt","name":"8BitOperatorPlus8Regular_Edited.fnt"}},{"file":"assets/NewSprite.png","kind":"image","metadata":"{\"extension\":\".png\"}","name":"NewSprite","smoothed":false,"userAdded":false},{"file":"assets/NewSprite2.png","kind":"image","metadata":"{\"extension\":\".png\"}","name":"NewSprite2","smoothed":false,"userAdded":false},{"file":"assets/NewSprite3.png","kind":"image","metadata":"{\"extension\":\".png\"}","name":"NewSprite3","smoothed":false,"userAdded":false},{"file":"assets/01Down.png","kind":"image","metadata":"{\"extension\":\".png\",\"localFilePath\":\"assets/01Down.png\"}","name":"01Down","smoothed":false,"userAdded":false},{"file":"assets/01Down2.png","kind":"image","metadata":"{\"extension\":\".png\",\"localFilePath\":\"assets/01Down2.png\"}","name":"01Down2","smoothed":false,"userAdded":false},{"file":"assets/01Down3.png","kind":"image","metadata":"{\"extension\":\".png\",\"localFilePath\":\"assets/01Down3.png\"}","name":"01Down3","smoothed":false,"userAdded":false},{"file":"assets/01Down4.png","kind":"image","metadata":"{\"extension\":\".png\"}","name":"01Down4","smoothed":false,"userAdded":false},{"file":"assets/01Down5.png","kind":"image","metadata":"{\"extension\":\".png\"}","name":"01Down5","smoothed":false,"userAdded":false},{"file":"assets/01Down6.png","kind":"image","metadata":"{\"extension\":\".png\"}","name":"01Down6","smoothed":false,"userAdded":false},{"file":"assets/01Down7.png","kind":"image","metadata":"{\"extension\":\".png\"}","name":"01Down7","smoothed":false,"userAdded":false},{"file":"assets/01Down8.png","kind":"image","metadata":"{\"extension\":\".png\"}","name":"01Down8","smoothed":false,"userAdded":false},{"file":"assets/01Left.png","kind":"image","metadata":"{\"extension\":\".png\"}","name":"01Left","smoothed":false,"userAdded":false},{"file":"assets/01Left2.png","kind":"image","metadata":"{\"extension\":\".png\"}","name":"01Left2","smoothed":false,"userAdded":false},{"file":"assets/01Left3.png","kind":"image","metadata":"{\"extension\":\".png\"}","name":"01Left3","smoothed":false,"userAdded":false},{"file":"assets/01Left4.png","kind":"image","metadata":"{\"extension\":\".png\"}","name":"01Left4","smoothed":false,"userAdded":false},{"file":"assets/01Up.png","kind":"image","metadata":"{\"extension\":\".png\"}","name":"01Up","smoothed":false,"userAdded":false},{"file":"assets/01Up2.png","kind":"image","metadata":"{\"extension\":\".png\"}","name":"01Up2","smoothed":false,"userAdded":false},{"file":"assets/01Up3.png","kind":"image","metadata":"{\"extension\":\".png\"}","name":"01Up3","smoothed":false,"userAdded":false},{"file":"assets/01Up4.png","kind":"image","metadata":"{\"extension\":\".png\"}","name":"01Up4","smoothed":false,"userAdded":false}]},"objects":[{"adaptCollisionMaskAutomatically":true,"assetStoreId":"","name":"spr_player","persistentUuid":"d03a1af6-4615-4ebe-92c5-a2678ed69ba6","type":"Sprite","updateIfNotVisible":false,"variables":[{"name":"player_id","persistentUuid":"946a6f26-ee26-4e20-811d-9674dc90ace4","type":"number","value":0.0}],"effects":[],"behaviors":[{"name":"TopDownMovement","type":"TopDownMovementBehavior::TopDownMovementBehavior","acceleration":99999.0,"allowDiagonals":false,"angleOffset":0.0,"angularMaxSpeed":180.0,"customIsometryAngle":30.0,"deceleration":99999.0,"ignoreDefaultControls":false,"maxSpeed":200.0,"movementAngleOffset":0.0,"rotateObject":false,"useLegacyTurnBack":false,"viewpoint":"TopDown"}],"animations":[{"name":"NewSprite","useMultipleDirections":false,"directions":[{"looping":false,"metadata":"{\"pskl\":{}}","timeBetweenFrames":0.08,"sprites":[{"hasCustomCollisionMask":true,"image":"NewSprite2","points":[],"originPoint":{"name":"origine","x":0.0,"y":0.0},"centerPoint":{"automatic":true,"name":"centre","x":0.0,"y":0.0},"customCollisionMask":[[{"x":0.0,"y":0.0},{"x":64.0,"y":0.0},{"x":64.0,"y":64.0},{"x":0.0,"y":64.0}]]}]}]}]},{"adaptCollisionMaskAutomatically":true,"assetStoreId":"","name":"spr_otherPlayers","persistentUuid":"1a256d41-16be-45af-a2c0-d555c42c2cb0","type":"Sprite","updateIfNotVisible":false,"variables":[{"name":"player_id","persistentUuid":"d4f11f2a-8cdb-4dd0-a45c-393c3de1719a","type":"number","value":0.0}],"effects":[],"behaviors":[{"name":"TopDownMovement","type":"TopDownMovementBehavior::TopDownMovementBehavior","acceleration":99999.0,"allowDiagonals":false,"angleOffset":0.0,"angularMaxSpeed":180.0,"customIsometryAngle":30.0,"deceleration":99999.0,"ignoreDefaultControls":true,"maxSpeed":200.0,"movementAngleOffset":0.0,"rotateObject":false,"useLegacyTurnBack":false,"viewpoint":"TopDown"}],"animations":[{"name":"NewSprite","useMultipleDirections":false,"directions":[{"looping":false,"metadata":"{\"pskl\":{}}","timeBetweenFrames":0.08,"sprites":[{"hasCustomCollisionMask":true,"image":"NewSprite2","points":[],"originPoint":{"name":"origine","x":0.0,"y":0.0},"centerPoint":{"automatic":true,"name":"centre","x":0.0,"y":0.0},"customCollisionMask":[[{"x":0.0,"y":0.0},{"x":64.0,"y":0.0},{"x":64.0,"y":64.0},{"x":0.0,"y":64.0}]]}]}]}]},{"adaptCollisionMaskAutomatically":true,"assetStoreId":"","name":"spr_door","persistentUuid":"8b7cf3ce-40c8-4a17-925a-0c70b66838a4","type":"Sprite","updateIfNotVisible":false,"variables":[{"name":"var_doorway","persistentUuid":"06f73534-50b8-404f-9883-0d70149713d7","type":"string","value":"000001"}],"effects":[],"behaviors":[],"animations":[{"name":"NewSprite","useMultipleDirections":false,"directions":[{"looping":false,"metadata":"{\"pskl\":{}}","timeBetweenFrames":0.08,"sprites":[{"hasCustomCollisionMask":true,"image":"NewSprite3","points":[],"originPoint":{"name":"origine","x":0.0,"y":0.0},"centerPoint":{"automatic":true,"name":"centre","x":0.0,"y":0.0},"customCollisionMask":[[{"x":4.0,"y":3.0},{"x":62.0,"y":3.0},{"x":62.0,"y":60.0},{"x":4.0,"y":60.0}]]}]}]}]},{"assetStoreId":"80b9ddd78c8727888bb53c7524f443682746667b1ba493c223114c04e7661bbf","name":"btn_Logout","persistentUuid":"c920ea77-7ccf-456f-aabb-496c1250d6f1","type":"PanelSpriteButton::PanelSpriteButton","variant":"Small Blue Button","variables":[],"effects":[],"behaviors":[],"content":{"LabelText":"Log Out","PressedLabelOffsetY":2.0}},{"assetStoreId":"80b9ddd78c8727888bb53c7524f443682746667b1ba493c223114c04e7661bbf","name":"btn_Fullscreen","persistentUuid":"56fd8b1d-175c-4840-97fe-f76e7d829e9f","type":"PanelSpriteButton::PanelSpriteButton","variant":"Small Blue Button","variables":[],"effects":[],"behaviors":[],"content":{"LabelText":"[ ]","PressedLabelOffsetY":2.0}}],"objectsFolderStructure":{"folderName":"__ROOT","children":[{"objectName":"spr_player"},{"objectName":"spr_otherPlayers"},{"objectName":"spr_door"},{"objectName":"btn_Logout"},{"objectName":"btn_Fullscreen"}]},"objectsGroups":[],"variables":[{"name":"var_playerInfo","persistentUuid":"1fb97af7-5f6a-4907-9164-628713a29d54","type":"structure","children":[]},{"name":"var_jsonAddress","persistentUuid":"78b897a8-e843-4a0c-be02-63ddb7f70eae","type":"string","value":"http://192.168.3.250:3000"},{"name":"var_mqttAddress","persistentUuid":"0048bbcb-0ca6-4b6e-a90e-be2218ce7a47","type":"string","value":"192.168.3.250:9001"},{"name":"var_RTC","persistentUuid":"1ba271fb-6df8-4662-8e0c-d6554e2702c9","type":"structure","children":[]},{"name":"var_date","persistentUuid":"7a18cea8-1a20-46d8-a276-77880277c26a","type":"number","value":0.0}],"layouts":[{"b":255,"disableInputWhenNotFocused":true,"mangledName":"Login","name":"Login","r":247,"standardSortMethod":true,"stopSoundsOnStartup":true,"title":"","v":249,"uiSettings":{"grid":true,"gridType":"rectangular","gridWidth":16.0,"gridHeight":16.0,"gridDepth":32.0,"gridOffsetX":0.0,"gridOffsetY":0.0,"gridOffsetZ":0.0,"gridColor":10401023.0,"gridAlpha":0.8,"snap":true,"zoomFactor":0.8416428125373118,"windowMask":false,"selectedLayer":"","gameEditorMode":"instances-editor"},"objectsGroups":[],"variables":[{"name":"var_username","persistentUuid":"43ebc160-5d2f-4769-8bab-6f2b03b0006b","type":"string","value":""},{"name":"var_password","persistentUuid":"714571eb-af1a-4f97-aead-d7b9f5de9afb","type":"string","value":""},{"name":"var_jsonReply","persistentUuid":"2898cef6-8fdf-4718-bf6b-1cdb5e030acb","type":"string","value":""},{"name":"var_jsonParse","persistentUuid":"5b1b0b96-6ef9-411f-bc42-b287f548f2b6","type":"structure","children":[]}],"instances":[{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"txtbx_Username","persistentUuid":"632731bc-b1bd-4383-9acd-12cd653efcdf","width":0.0,"x":480.0,"y":192.0,"zOrder":1,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"txtbx_Password","persistentUuid":"44c2f0bc-a292-45be-8cf5-c4d8893b1ed3","width":0.0,"x":480.0,"y":288.0,"zOrder":2,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"btn_Login","persistentUuid":"b3d700fe-d3d1-4e3c-8961-1305b2ae4168","width":0.0,"x":560.0,"y":384.0,"zOrder":3,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"btn_Register","persistentUuid":"9b8441ec-dfee-4296-bdd5-6e1b0425d56d","width":0.0,"x":560.0,"y":480.0,"zOrder":4,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"txt_lblServerStatus","persistentUuid":"2b11514e-c2b0-4bbe-b292-93c3240449d2","width":0.0,"x":32.0,"y":640.0,"zOrder":5,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"txt_lblMQTTStatus","persistentUuid":"c02d52f2-3e7a-45ec-ab25-e274a2aba45b","width":0.0,"x":32.0,"y":672.0,"zOrder":6,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"txt_ServerStatus","persistentUuid":"178406cc-fe38-44d9-ab83-fac3479e6cba","width":0.0,"x":112.0,"y":640.0,"zOrder":7,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"txt_MQTTStatus","persistentUuid":"c4ecc711-8ead-4310-b1b4-4e528d66eab6","width":0.0,"x":112.0,"y":672.0,"zOrder":8,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"txt_gameTitle","persistentUuid":"9a6eb8ef-3e39-479e-9631-b2e2cc1fa161","width":0.0,"x":320.0,"y":84.0,"zOrder":10,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"txt_date","persistentUuid":"d824c9ba-8961-4047-ba4c-13e66b8f44d3","width":0.0,"x":32.0,"y":16.0,"zOrder":12,"numberProperties":[],"stringProperties":[],"initialVariables":[]}],"objects":[{"assetStoreId":"","name":"txtbx_Username","persistentUuid":"c3ee77af-838b-4e52-84e5-9edfdec72fdf","type":"TextInput::TextInputObject","variables":[],"effects":[],"behaviors":[],"content":{"initialValue":"","placeholder":"Username","fontResourceName":"","fontSize":20.0,"inputType":"text","textColor":"0;0;0","fillColor":"255;255;255","fillOpacity":255.0,"borderColor":"0;0;0","borderOpacity":255.0,"borderWidth":1.0,"readOnly":false,"disabled":false,"spellCheck":false,"paddingX":2.0,"paddingY":1.0,"textAlign":"left","maxLength":0.0}},{"assetStoreId":"","name":"txtbx_Password","persistentUuid":"ffd66276-22b2-46bc-bc58-2010837dc5f2","type":"TextInput::TextInputObject","variables":[],"effects":[],"behaviors":[],"content":{"initialValue":"","placeholder":"Password","fontResourceName":"","fontSize":20.0,"inputType":"password","textColor":"0;0;0","fillColor":"255;255;255","fillOpacity":255.0,"borderColor":"0;0;0","borderOpacity":255.0,"borderWidth":1.0,"readOnly":false,"disabled":false,"spellCheck":false,"paddingX":2.0,"paddingY":1.0,"textAlign":"left","maxLength":0.0}},{"assetStoreId":"80b9ddd78c8727888bb53c7524f443682746667b1ba493c223114c04e7661bbf","name":"btn_Login","persistentUuid":"ae3aaba7-ff4b-463f-bb17-eb233ab5a68c","type":"PanelSpriteButton::PanelSpriteButton","variant":"Small Blue Button","variables":[],"effects":[],"behaviors":[],"content":{"LabelText":"Login","PressedLabelOffsetY":2.0}},{"assetStoreId":"80b9ddd78c8727888bb53c7524f443682746667b1ba493c223114c04e7661bbf","name":"btn_Register","persistentUuid":"548a436e-bc77-426e-9048-9501732084ed","type":"PanelSpriteButton::PanelSpriteButton","variant":"Small Blue Button","variables":[],"effects":[],"behaviors":[],"content":{"LabelText":"Register","PressedLabelOffsetY":2.0}},{"assetStoreId":"","bold":false,"italic":false,"name":"txt_lblServerStatus","persistentUuid":"e45fe9f3-cdc8-4d58-9e6a-ba2b71e3e734","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[],"string":"Server:","font":"","textAlignment":"left","characterSize":20.0,"color":{"b":0,"g":0,"r":0},"content":{"bold":false,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"Server:","font":"","textAlignment":"left","verticalTextAlignment":"top","characterSize":20.0,"lineHeight":0.0,"color":"0;0;0"}},{"assetStoreId":"","bold":false,"italic":false,"name":"txt_lblMQTTStatus","persistentUuid":"a5dcdfbf-e3c2-4853-a7a2-113be9442012","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[],"string":"Broker:","font":"","textAlignment":"left","characterSize":20.0,"color":{"b":0,"g":0,"r":0},"content":{"bold":false,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"Broker:","font":"","textAlignment":"left","verticalTextAlignment":"top","characterSize":20.0,"lineHeight":0.0,"color":"0;0;0"}},{"assetStoreId":"","bold":true,"italic":false,"name":"txt_ServerStatus","persistentUuid":"0f4b8881-8813-490b-9b44-21561d04f0c4","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[],"string":"OFFLINE","font":"","textAlignment":"left","characterSize":20.0,"color":{"b":0,"g":0,"r":255},"content":{"bold":true,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"OFFLINE","font":"","textAlignment":"left","verticalTextAlignment":"top","characterSize":20.0,"lineHeight":0.0,"color":"255;0;0"}},{"assetStoreId":"","bold":true,"italic":false,"name":"txt_MQTTStatus","persistentUuid":"3dd0f168-5e38-4ae4-955c-1eb13063c3bc","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[],"string":"OFFLINE","font":"","textAlignment":"left","characterSize":20.0,"color":{"b":0,"g":0,"r":255},"content":{"bold":true,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"OFFLINE","font":"","textAlignment":"left","verticalTextAlignment":"top","characterSize":20.0,"lineHeight":0.0,"color":"255;0;0"}},{"assetStoreId":"","bold":false,"italic":false,"name":"txt_debug","persistentUuid":"00343022-da8d-4af2-8a21-4e1dd750735a","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[],"string":"Text","font":"","textAlignment":"left","characterSize":20.0,"color":{"b":0,"g":0,"r":0},"content":{"bold":false,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"Text","font":"","textAlignment":"left","verticalTextAlignment":"top","characterSize":20.0,"lineHeight":0.0,"color":"0;0;0"}},{"assetStoreId":"","bold":false,"italic":false,"name":"txt_gameTitle","persistentUuid":"574c3ce1-cb11-4dab-a2ec-f195258ed913","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[],"string":"SQUARE GAME: MULTIPLAYER!","font":"","textAlignment":"left","characterSize":40.0,"color":{"b":0,"g":0,"r":0},"content":{"bold":false,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"SQUARE GAME: MULTIPLAYER!","font":"","textAlignment":"left","verticalTextAlignment":"top","characterSize":40.0,"lineHeight":0.0,"color":"0;0;0"}},{"assetStoreId":"","bold":false,"italic":false,"name":"txt_date","persistentUuid":"604cf4c5-d211-4b59-bc56-bdf7bf611ca7","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[],"string":"Date","font":"","textAlignment":"left","characterSize":20.0,"color":{"b":0,"g":0,"r":0},"content":{"bold":false,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"Date","font":"","textAlignment":"left","verticalTextAlignment":"top","characterSize":20.0,"lineHeight":0.0,"color":"0;0;0"}}],"objectsFolderStructure":{"folderName":"__ROOT","children":[{"objectName":"txtbx_Username"},{"objectName":"txtbx_Password"},{"objectName":"btn_Login"},{"objectName":"btn_Register"},{"objectName":"txt_lblServerStatus"},{"objectName":"txt_ServerStatus"},{"objectName":"txt_lblMQTTStatus"},{"objectName":"txt_MQTTStatus"},{"objectName":"txt_debug"},{"objectName":"txt_gameTitle"},{"objectName":"txt_date"}]},"events":[{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"RegisterButton","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["btn_Register",""]}],"actions":[{"type":{"value":"Scene"},"parameters":["","\"Register\"",""]}]}],"parameters":[]},{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Server Status","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"SceneJustBegins"},"parameters":[""]}],"actions":[{"type":{"value":"MQTT::connect"},"parameters":["","var_mqttAddress","\"\"","",""]},{"type":{"value":"SendAsyncRequest"},"parameters":["var_jsonAddress+\"/users\"","","\"GET\"","","var_jsonReply",""]},{"type":{"value":"SendAsyncRequest"},"parameters":["var_jsonAddress+\"/server\"","","\"GET\"","","var_jsonReply",""]},{"type":{"value":"Wait"},"parameters":[".1"]},{"type":{"value":"JSONToVariableStructure2"},"parameters":["var_jsonReply","var_RTC"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_jsonReply","!=","\"[]\""]}],"actions":[{"type":{"value":"TextContainerCapability::TextContainerBehavior::SetValue"},"parameters":["txt_ServerStatus","Text","=","\"ONLINE\""]},{"type":{"value":"TextObject::ChangeColor"},"parameters":["txt_ServerStatus","\"0;255;0\""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"MQTT::isConnected"},"parameters":["",""]}],"actions":[{"type":{"value":"TextContainerCapability::TextContainerBehavior::SetValue"},"parameters":["txt_MQTTStatus","Text","=","\"ONLINE\""]},{"type":{"value":"TextObject::ChangeColor"},"parameters":["txt_MQTTStatus","\"0;255;0\""]}]}],"parameters":[]},{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Log In","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["btn_Login",""]},{"type":{"value":"TextContainerCapability::TextContainerBehavior::Value"},"parameters":["txtbx_Username","Text","!=","\"\""]},{"type":{"value":"TextContainerCapability::TextContainerBehavior::Value"},"parameters":["txtbx_Password","Text","!=","\"\""]}],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["var_username","=","txtbx_Username.Text::Value()"]},{"type":{"value":"SetStringVariable"},"parameters":["var_password","=","txtbx_Password.Text::Value()"]},{"type":{"value":"SendAsyncRequest"},"parameters":["var_jsonAddress+\"/users?username=\" + var_username +\"&password=\" + var_password","","\"GET\"","","var_jsonReply",""]},{"type":{"value":"Wait"},"parameters":[".1"]},{"type":{"value":"JSONToVariableStructure2"},"parameters":["var_jsonReply","var_jsonParse"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_jsonParse[0].username","=","var_username"]},{"type":{"value":"StringVariable"},"parameters":["var_jsonParse[0].password","=","var_password"]}],"actions":[{"type":{"value":"JSONToVariableStructure2"},"parameters":["var_jsonReply","var_playerInfo"]},{"type":{"value":"SendAsyncRequest"},"parameters":["var_jsonAddress+\"/users/\"+var_playerInfo[0].id","\"{\\\"online\\\":true}\"","\"PATCH\"","\"application/json\"","",""]},{"type":{"value":"Scene"},"parameters":["","\"Logged in\"",""]}]}],"parameters":[]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["btn_Fullscreen",""]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"IsFullScreen"},"parameters":[""]}],"actions":[{"type":{"value":"SetFullScreen"},"parameters":["","yes",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"IsFullScreen"},"parameters":[""]}],"actions":[{"type":{"value":"SetFullScreen"},"parameters":["","no",""]}]}]},{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Date/Time","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"TextContainerCapability::TextContainerBehavior::SetValue"},"parameters":["txt_date","Text","=","var_RTC[\"hour\"]+\":\"+var_RTC[\"minute\"]"]}]}],"parameters":[]}],"layers":[{"ambientLightColorB":200,"ambientLightColorG":200,"ambientLightColorR":200,"camera2DPlaneMaxDrawingDistance":5000.0,"camera3DFarPlaneDistance":10000.0,"camera3DFieldOfView":45.0,"camera3DNearPlaneDistance":3.0,"cameraType":"","followBaseLayerCamera":false,"isLightingLayer":false,"isLocked":false,"name":"","renderingType":"","visibility":true,"cameras":[{"defaultSize":true,"defaultViewport":true,"height":0.0,"viewportBottom":1.0,"viewportLeft":0.0,"viewportRight":1.0,"viewportTop":0.0,"width":0.0}],"effects":[{"effectType":"Scene3D::HemisphereLight","name":"3D Ambient Hemisphere Light","doubleParameters":{"elevation":40.0,"intensity":0.33,"rotation":300.0},"stringParameters":{"groundColor":"127;127;127","skyColor":"255;255;255","top":"Z+"},"booleanParameters":{}},{"effectType":"Scene3D::DirectionalLight","name":"3D Sun Light","doubleParameters":{"distanceFromCamera":1500.0,"elevation":40.0,"frustumSize":4000.0,"intensity":0.75,"minimumShadowBias":0.0,"rotation":300.0},"stringParameters":{"color":"255;255;255","shadowQuality":"medium","top":"Z+"},"booleanParameters":{"isCastingShadow":true}}]}],"behaviorsSharedData":[{"name":"Animation","type":"AnimatableCapability::AnimatableBehavior"},{"name":"Effect","type":"EffectCapability::EffectBehavior"},{"name":"Flippable","type":"FlippableCapability::FlippableBehavior"},{"name":"Opacity","type":"OpacityCapability::OpacityBehavior"},{"name":"Resizable","type":"ResizableCapability::ResizableBehavior"},{"name":"Scale","type":"ScalableCapability::ScalableBehavior"},{"name":"Text","type":"TextContainerCapability::TextContainerBehavior"},{"name":"TopDownMovement","type":"TopDownMovementBehavior::TopDownMovementBehavior"}]},{"b":255,"disableInputWhenNotFocused":true,"mangledName":"Register","name":"Register","r":247,"standardSortMethod":true,"stopSoundsOnStartup":true,"title":"","v":249,"uiSettings":{"grid":true,"gridType":"rectangular","gridWidth":16.0,"gridHeight":16.0,"gridDepth":32.0,"gridOffsetX":0.0,"gridOffsetY":0.0,"gridOffsetZ":0.0,"gridColor":10401023.0,"gridAlpha":0.8,"snap":true,"zoomFactor":1.528913289223325,"windowMask":false,"selectedLayer":"","gameEditorMode":"instances-editor"},"objectsGroups":[],"variables":[{"name":"var_password01","persistentUuid":"9b38d1eb-2fc4-4744-b61a-b901092ab536","type":"string","value":""},{"name":"var_password02","persistentUuid":"73bfe239-ff40-4b6f-8505-ea724078f6ee","type":"string","value":""},{"name":"var_username","persistentUuid":"79b2dd33-921b-4817-9e5c-ebaa38a21834","type":"string","value":""},{"name":"var_jsonReply","persistentUuid":"e4d7e8bd-3595-4aef-9ec7-0fb470bb3ecd","type":"string","value":"[]"},{"name":"var_jsonParse","persistentUuid":"8a602891-d0e3-4492-a2b0-14d0f4fe64fb","type":"array","children":[]},{"name":"var_colorGen","persistentUuid":"5381318f-fa30-4456-8351-f814f8ecadbd","type":"string","value":""}],"instances":[{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"txtbx_regUsername","persistentUuid":"66377f44-b1e3-4eab-a9c0-bc3752017e4e","width":0.0,"x":480.0,"y":322.0,"zOrder":1,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"txtbx_regPassword01","persistentUuid":"b2099cad-5ab7-4a38-b939-31869e362657","width":0.0,"x":480.0,"y":368.0,"zOrder":2,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"btn_regRegister","persistentUuid":"41a1f2cd-107b-4058-8bc6-eb51487ac180","width":0.0,"x":560.0,"y":480.0,"zOrder":4,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"txt_RegMessageUser","persistentUuid":"4b4c3bd0-ffdf-440c-97a6-1992a4ae80d8","width":0.0,"x":512.0,"y":649.0,"zOrder":5,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"btn_Back","persistentUuid":"af79ebf6-4ccf-4335-bab9-df40fbb263d8","width":0.0,"x":560.0,"y":560.0,"zOrder":6,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"spr_sqaure","persistentUuid":"9c413fc9-26ab-4cc4-b4c8-b84a8ac651ef","width":0.0,"x":592.0,"y":112.0,"zOrder":8,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"btn_NewColor","persistentUuid":"248ac7e7-6ac9-4c9f-a7ec-a83df84e6d27","width":0.0,"x":560.0,"y":224.0,"zOrder":9,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"txtbx_regPassword02","persistentUuid":"7106be72-f61f-4ab7-8659-4b87a1b8668b","width":0.0,"x":480.0,"y":416.0,"zOrder":11,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"txt_RegMessagePassword","persistentUuid":"16a3c795-1cfa-4633-bc35-3a823ceaf916","width":0.0,"x":517.0,"y":688.0,"zOrder":12,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"txt_RegMessageSuccess","persistentUuid":"268fa5ba-bfd7-467f-80e6-1bf428f66436","width":0.0,"x":521.0,"y":617.0,"zOrder":13,"numberProperties":[],"stringProperties":[],"initialVariables":[]}],"objects":[{"assetStoreId":"","name":"txtbx_regUsername","persistentUuid":"5bfb2de7-1947-4660-b896-ccac584f70f5","type":"TextInput::TextInputObject","variables":[],"effects":[],"behaviors":[],"content":{"initialValue":"","placeholder":"Username","fontResourceName":"","fontSize":20.0,"inputType":"text","textColor":"0;0;0","fillColor":"255;255;255","fillOpacity":255.0,"borderColor":"0;0;0","borderOpacity":255.0,"borderWidth":1.0,"readOnly":false,"disabled":false,"spellCheck":false,"paddingX":2.0,"paddingY":1.0,"textAlign":"left","maxLength":0.0}},{"assetStoreId":"","name":"txtbx_regPassword01","persistentUuid":"e32982f7-fc73-4866-9b15-fd09d926a819","type":"TextInput::TextInputObject","variables":[],"effects":[],"behaviors":[],"content":{"initialValue":"","placeholder":"Password","fontResourceName":"","fontSize":20.0,"inputType":"password","textColor":"0;0;0","fillColor":"255;255;255","fillOpacity":255.0,"borderColor":"0;0;0","borderOpacity":255.0,"borderWidth":1.0,"readOnly":false,"disabled":false,"spellCheck":false,"paddingX":2.0,"paddingY":1.0,"textAlign":"left","maxLength":0.0}},{"assetStoreId":"80b9ddd78c8727888bb53c7524f443682746667b1ba493c223114c04e7661bbf","name":"btn_regRegister","persistentUuid":"f4f70ee8-da7b-4666-8780-a69ad9879791","type":"PanelSpriteButton::PanelSpriteButton","variant":"Small Blue Button","variables":[],"effects":[],"behaviors":[],"content":{"LabelText":"Register","PressedLabelOffsetY":2.0}},{"assetStoreId":"","bold":false,"italic":false,"name":"txt_RegMessageUser","persistentUuid":"cb2b72b5-1e20-4241-b4e3-3406a240cb33","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[],"string":"Username is not available","font":"","textAlignment":"center","characterSize":20.0,"color":{"b":0,"g":0,"r":255},"content":{"bold":false,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"Username is not available","font":"","textAlignment":"center","verticalTextAlignment":"top","characterSize":20.0,"lineHeight":0.0,"color":"255;0;0"}},{"assetStoreId":"80b9ddd78c8727888bb53c7524f443682746667b1ba493c223114c04e7661bbf","name":"btn_Back","persistentUuid":"a735af63-2e06-4548-a596-7eb24268783a","type":"PanelSpriteButton::PanelSpriteButton","variant":"Small Blue Button","variables":[],"effects":[],"behaviors":[],"content":{"LabelText":"Back","PressedLabelOffsetY":2.0}},{"assetStoreId":"","bold":false,"italic":false,"name":"txt_JSONReply","persistentUuid":"cde1bbef-cbc8-4fc3-9d5b-d0f2c9e02dec","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[],"string":"[]","font":"","textAlignment":"left","characterSize":20.0,"color":{"b":0,"g":0,"r":0},"content":{"bold":false,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"[]","font":"","textAlignment":"left","verticalTextAlignment":"top","characterSize":20.0,"lineHeight":0.0,"color":"0;0;0"}},{"adaptCollisionMaskAutomatically":true,"assetStoreId":"","name":"spr_sqaure","persistentUuid":"8e29f65a-9088-4d1e-b7b8-b947d7f9b407","type":"Sprite","updateIfNotVisible":false,"variables":[],"effects":[],"behaviors":[],"animations":[{"name":"NewSprite","useMultipleDirections":false,"directions":[{"looping":false,"metadata":"{\"pskl\":{}}","timeBetweenFrames":0.08,"sprites":[{"hasCustomCollisionMask":true,"image":"NewSprite","points":[],"originPoint":{"name":"origine","x":0.0,"y":0.0},"centerPoint":{"automatic":true,"name":"centre","x":0.0,"y":0.0},"customCollisionMask":[[{"x":0.0,"y":0.0},{"x":64.0,"y":0.0},{"x":64.0,"y":64.0},{"x":0.0,"y":64.0}]]}]}]}]},{"assetStoreId":"80b9ddd78c8727888bb53c7524f443682746667b1ba493c223114c04e7661bbf","name":"btn_NewColor","persistentUuid":"5428983b-7262-40a0-9d70-e7b3aa5d0175","type":"PanelSpriteButton::PanelSpriteButton","variant":"Small Blue Button","variables":[],"effects":[],"behaviors":[],"content":{"LabelText":"New Color","PressedLabelOffsetY":2.0}},{"assetStoreId":"","name":"txtbx_regPassword02","persistentUuid":"5f39eff0-637f-46e3-b032-923b512aaa70","type":"TextInput::TextInputObject","variables":[],"effects":[],"behaviors":[],"content":{"initialValue":"","placeholder":"Repeat Password","fontResourceName":"","fontSize":20.0,"inputType":"password","textColor":"0;0;0","fillColor":"255;255;255","fillOpacity":255.0,"borderColor":"0;0;0","borderOpacity":255.0,"borderWidth":1.0,"readOnly":false,"disabled":false,"spellCheck":false,"paddingX":2.0,"paddingY":1.0,"textAlign":"left","maxLength":0.0}},{"assetStoreId":"","bold":false,"italic":false,"name":"txt_RegMessagePassword","persistentUuid":"366c40cc-d4d1-4858-8b9c-5c959e69c941","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[],"string":"Passwords do not match","font":"","textAlignment":"center","characterSize":20.0,"color":{"b":0,"g":0,"r":255},"content":{"bold":false,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"Passwords do not match","font":"","textAlignment":"center","verticalTextAlignment":"top","characterSize":20.0,"lineHeight":0.0,"color":"255;0;0"}},{"assetStoreId":"","bold":false,"italic":false,"name":"txt_RegMessageSuccess","persistentUuid":"bb5d6c4b-2eb6-4005-a464-2d3392769eb1","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[],"string":"Registration Successful!","font":"","textAlignment":"center","characterSize":20.0,"color":{"b":0,"g":255,"r":0},"content":{"bold":false,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"Registration Successful!","font":"","textAlignment":"center","verticalTextAlignment":"top","characterSize":20.0,"lineHeight":0.0,"color":"0;255;0"}}],"objectsFolderStructure":{"folderName":"__ROOT","children":[{"objectName":"txtbx_regUsername"},{"objectName":"spr_sqaure"},{"objectName":"txtbx_regPassword01"},{"objectName":"txtbx_regPassword02"},{"objectName":"btn_regRegister"},{"objectName":"btn_Back"},{"objectName":"btn_NewColor"},{"objectName":"txt_RegMessageUser"},{"objectName":"txt_RegMessageSuccess"},{"objectName":"txt_RegMessagePassword"},{"objectName":"txt_JSONReply"}]},"events":[{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Hide Registration Message/Random Color Gen","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"SceneJustBegins"},"parameters":[""]}],"actions":[{"type":{"value":"Hide"},"parameters":["txt_RegMessageUser"]},{"type":{"value":"Hide"},"parameters":["txt_RegMessagePassword"]},{"type":{"value":"Hide"},"parameters":["txt_RegMessageSuccess"]},{"type":{"value":"SetCenterX"},"parameters":["txt_RegMessageUser","=","btn_Back.CenterX()"]},{"type":{"value":"SetCenterX"},"parameters":["txt_RegMessagePassword","=","btn_Back.CenterX()"]},{"type":{"value":"SetCenterX"},"parameters":["txt_RegMessageSuccess","=","btn_Back.CenterX()"]},{"type":{"value":"SetStringVariable"},"parameters":["var_colorGen","=","ToString(RandomInRange(0,255)) + \";\" + ToString(RandomInRange(0,255)) + \";\" + ToString(RandomInRange(0,255))"]},{"type":{"value":"ChangeColor"},"parameters":["spr_sqaure","var_colorGen"]}]}],"parameters":[]},{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Back Button","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["btn_Back",""]}],"actions":[{"type":{"value":"Scene"},"parameters":["","\"Login\"",""]}]}],"parameters":[]},{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"folded":true,"name":"Register Button","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"Check if username exists"},{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"TextContainerCapability::TextContainerBehavior::Value"},"parameters":["txtbx_regUsername","Text","!=","\"\""]},{"type":{"inverted":true,"value":"TextInput::TextInputObject::Focused"},"parameters":["txtbx_regUsername"]}],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["var_username","=","txtbx_regUsername.Text::Value()"]},{"type":{"value":"SendAsyncRequest"},"parameters":["var_jsonAddress+\"/users?username=\" + var_username","","\"GET\"","","var_jsonReply",""]},{"type":{"value":"TextContainerCapability::TextContainerBehavior::SetValue"},"parameters":["txt_JSONReply","Text","=","var_jsonReply"]}]},{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"Password Match"},{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"TextInput::TextInputObject::Focused"},"parameters":["txtbx_regPassword01"]}],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["var_password01","=","txtbx_regPassword01.Text::Value()"]},{"type":{"value":"SetStringVariable"},"parameters":["var_password02","=","txtbx_regPassword02.Text::Value()"]}],"events":[{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_password01","!=","var_password02"]}],"actions":[{"type":{"value":"TextContainerCapability::TextContainerBehavior::SetValue"},"parameters":["txt_RegMessagePassword","Text","=","\"Password do not match\""]},{"type":{"value":"Show"},"parameters":["txt_RegMessagePassword",""]},{"type":{"value":"TextObject::ChangeColor"},"parameters":["txt_RegMessagePassword","\"255;0;0\""]},{"type":{"value":"SetCenterX"},"parameters":["txt_RegMessagePassword","=","btn_Back.CenterX()"]}]},{"disabled":true,"type":"BuiltinCommonInstructions::Else","conditions":[],"actions":[{"type":{"value":"Hide"},"parameters":["txt_RegMessagePassword"]}]}]},{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"If username does not exist, write to database"},{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["btn_regRegister",""]},{"type":{"value":"TextContainerCapability::TextContainerBehavior::Value"},"parameters":["txtbx_regUsername","Text","!=","\"\""]},{"type":{"value":"TextContainerCapability::TextContainerBehavior::Value"},"parameters":["txtbx_regPassword01","Text","!=","\"\""]},{"type":{"value":"StringVariable"},"parameters":["var_jsonReply","=","\"[]\""]}],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["var_password01","=","txtbx_regPassword01.Text::Value()"]},{"type":{"value":"SendAsyncRequest"},"parameters":["var_jsonAddress+\"/users\"","\"{\\\"username\\\":\\\"\" + var_username + \"\\\",\\\"password\\\":\\\"\" + var_password01 + \"\\\",\\\"color\\\":\\\"\" + var_colorGen+ \"\\\",\\\"room\\\":\\\"000000\\\"}\"","\"POST\"","\"application/json\"","",""]},{"type":{"value":"TextContainerCapability::TextContainerBehavior::SetValue"},"parameters":["txt_RegMessageUser","Text","=","\"Registration Successful! Please Log In\""]},{"type":{"value":"Show"},"parameters":["txt_RegMessageUser",""]},{"type":{"value":"Wait"},"parameters":["3"]},{"type":{"value":"Scene"},"parameters":["","\"Login\"",""]}]}],"parameters":[]},{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Randomize Color","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["btn_NewColor",""]}],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["var_colorGen","=","ToString(RandomInRange(0,255)) + \";\" + ToString(RandomInRange(0,255)) + \";\" + ToString(RandomInRange(0,255))"]},{"type":{"value":"ChangeColor"},"parameters":["spr_sqaure","var_colorGen"]}]}],"parameters":[]},{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Registration","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["btn_regRegister",""]},{"type":{"value":"TextContainerCapability::TextContainerBehavior::Value"},"parameters":["txtbx_regUsername","Text","!=","\"\""]},{"type":{"value":"TextContainerCapability::TextContainerBehavior::Value"},"parameters":["txtbx_regPassword01","Text","!=","\"\""]},{"type":{"value":"TextContainerCapability::TextContainerBehavior::Value"},"parameters":["txtbx_regPassword02","Text","!=","\"\""]}],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["var_username","=","txtbx_regUsername.Text::Value()"]},{"type":{"value":"SetStringVariable"},"parameters":["var_password01","=","txtbx_regPassword01.Text::Value()"]},{"type":{"value":"SetStringVariable"},"parameters":["var_password02","=","txtbx_regPassword02.Text::Value()"]},{"type":{"value":"SendAsyncRequest"},"parameters":["var_jsonAddress+\"/users?username=\" + var_username","","\"GET\"","","var_jsonReply",""]}],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_password01","!=","var_password02"]}],"actions":[{"type":{"value":"Show"},"parameters":["txt_RegMessagePassword",""]}]},{"type":"BuiltinCommonInstructions::Else","conditions":[],"actions":[{"type":{"value":"Hide"},"parameters":["txt_RegMessagePassword"]}],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_jsonReply","!=","\"[]\""]}],"actions":[{"type":{"value":"Show"},"parameters":["txt_RegMessageUser",""]}]},{"type":"BuiltinCommonInstructions::Else","conditions":[],"actions":[{"type":{"value":"Hide"},"parameters":["txt_RegMessageUser"]},{"type":{"value":"Show"},"parameters":["txt_RegMessageSuccess",""]},{"type":{"value":"SendAsyncRequest"},"parameters":["var_jsonAddress+\"/users\"","\"{\\\"username\\\":\\\"\" + var_username + \"\\\",\\\"password\\\":\\\"\" + var_password01 + \"\\\",\\\"color\\\":\\\"\" + var_colorGen + \"\\\",\\\"room\\\":\\\"000000\\\",\\\"last_room\\\":\\\"000000\\\"}\"","\"POST\"","\"application/json\"","",""]},{"type":{"value":"Wait"},"parameters":["3"]},{"type":{"value":"Scene"},"parameters":["","\"Login\"",""]}]}]}]}],"parameters":[]}],"layers":[{"ambientLightColorB":200,"ambientLightColorG":200,"ambientLightColorR":200,"camera2DPlaneMaxDrawingDistance":5000.0,"camera3DFarPlaneDistance":10000.0,"camera3DFieldOfView":45.0,"camera3DNearPlaneDistance":3.0,"cameraType":"","followBaseLayerCamera":false,"isLightingLayer":false,"isLocked":false,"name":"","renderingType":"","visibility":true,"cameras":[{"defaultSize":true,"defaultViewport":true,"height":0.0,"viewportBottom":1.0,"viewportLeft":0.0,"viewportRight":1.0,"viewportTop":0.0,"width":0.0}],"effects":[{"effectType":"Scene3D::HemisphereLight","name":"3D Ambient Hemisphere Light","doubleParameters":{"elevation":40.0,"intensity":0.33,"rotation":300.0},"stringParameters":{"groundColor":"127;127;127","skyColor":"255;255;255","top":"Z+"},"booleanParameters":{}},{"effectType":"Scene3D::DirectionalLight","name":"3D Sun Light","doubleParameters":{"distanceFromCamera":1500.0,"elevation":40.0,"frustumSize":4000.0,"intensity":0.75,"minimumShadowBias":0.0,"rotation":300.0},"stringParameters":{"color":"255;255;255","shadowQuality":"medium","top":"Z+"},"booleanParameters":{"isCastingShadow":true}}]}],"behaviorsSharedData":[{"name":"Animation","type":"AnimatableCapability::AnimatableBehavior"},{"name":"Effect","type":"EffectCapability::EffectBehavior"},{"name":"Flippable","type":"FlippableCapability::FlippableBehavior"},{"name":"Opacity","type":"OpacityCapability::OpacityBehavior"},{"name":"Resizable","type":"ResizableCapability::ResizableBehavior"},{"name":"Scale","type":"ScalableCapability::ScalableBehavior"},{"name":"Text","type":"TextContainerCapability::TextContainerBehavior"},{"name":"TopDownMovement","type":"TopDownMovementBehavior::TopDownMovementBehavior"}]},{"b":255,"disableInputWhenNotFocused":true,"mangledName":"Logged_32in","name":"Logged in","r":247,"standardSortMethod":true,"stopSoundsOnStartup":true,"title":"","v":249,"uiSettings":{"grid":true,"gridType":"rectangular","gridWidth":16.0,"gridHeight":16.0,"gridDepth":32.0,"gridOffsetX":0.0,"gridOffsetY":0.0,"gridOffsetZ":0.0,"gridColor":10401023.0,"gridAlpha":0.8,"snap":true,"zoomFactor":0.546875,"windowMask":false,"selectedLayer":"","gameEditorMode":"instances-editor"},"objectsGroups":[],"variables":[{"name":"password01","persistentUuid":"9b38d1eb-2fc4-4744-b61a-b901092ab536","type":"string","value":""},{"name":"password02","persistentUuid":"73bfe239-ff40-4b6f-8505-ea724078f6ee","type":"string","value":""},{"name":"username","persistentUuid":"79b2dd33-921b-4817-9e5c-ebaa38a21834","type":"string","value":""},{"name":"var_jsonReply","persistentUuid":"e4d7e8bd-3595-4aef-9ec7-0fb470bb3ecd","type":"string","value":""},{"name":"var_jsonParsed","persistentUuid":"a00f1f38-a6b3-4bd6-a53c-f2f3e63a9055","type":"array","children":[]}],"instances":[{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"txt_loggedIn","persistentUuid":"f1b704b5-1bb2-4076-9230-0c0f7551a2d0","width":0.0,"x":576.0,"y":336.0,"zOrder":1,"numberProperties":[],"stringProperties":[],"initialVariables":[]}],"objects":[{"assetStoreId":"","bold":false,"italic":false,"name":"txt_loggedIn","persistentUuid":"886a7a42-1339-4fc5-971d-67526b782479","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[],"string":"LOGGED IN!","font":"","textAlignment":"left","characterSize":20.0,"color":{"b":0,"g":0,"r":0},"content":{"bold":false,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"LOGGED IN!","font":"","textAlignment":"left","verticalTextAlignment":"top","characterSize":20.0,"lineHeight":0.0,"color":"0;0;0"}}],"objectsFolderStructure":{"folderName":"__ROOT","children":[{"objectName":"txt_loggedIn"}]},"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"SceneJustBegins"},"parameters":[""]}],"actions":[{"type":{"value":"Wait"},"parameters":["3"]},{"type":{"value":"Scene"},"parameters":["","var_playerInfo[0].room",""]}]}],"layers":[{"ambientLightColorB":200,"ambientLightColorG":200,"ambientLightColorR":200,"camera2DPlaneMaxDrawingDistance":5000.0,"camera3DFarPlaneDistance":10000.0,"camera3DFieldOfView":45.0,"camera3DNearPlaneDistance":3.0,"cameraType":"","followBaseLayerCamera":false,"isLightingLayer":false,"isLocked":false,"name":"","renderingType":"","visibility":true,"cameras":[{"defaultSize":true,"defaultViewport":true,"height":0.0,"viewportBottom":1.0,"viewportLeft":0.0,"viewportRight":1.0,"viewportTop":0.0,"width":0.0}],"effects":[{"effectType":"Scene3D::HemisphereLight","name":"3D Ambient Hemisphere Light","doubleParameters":{"elevation":40.0,"intensity":0.33,"rotation":300.0},"stringParameters":{"groundColor":"127;127;127","skyColor":"255;255;255","top":"Z+"},"booleanParameters":{}},{"effectType":"Scene3D::DirectionalLight","name":"3D Sun Light","doubleParameters":{"distanceFromCamera":1500.0,"elevation":40.0,"frustumSize":4000.0,"intensity":0.75,"minimumShadowBias":0.0,"rotation":300.0},"stringParameters":{"color":"255;255;255","shadowQuality":"medium","top":"Z+"},"booleanParameters":{"isCastingShadow":true}}]}],"behaviorsSharedData":[{"name":"Animation","type":"AnimatableCapability::AnimatableBehavior"},{"name":"Effect","type":"EffectCapability::EffectBehavior"},{"name":"Flippable","type":"FlippableCapability::FlippableBehavior"},{"name":"Opacity","type":"OpacityCapability::OpacityBehavior"},{"name":"Resizable","type":"ResizableCapability::ResizableBehavior"},{"name":"Scale","type":"ScalableCapability::ScalableBehavior"},{"name":"Text","type":"TextContainerCapability::TextContainerBehavior"},{"name":"TopDownMovement","type":"TopDownMovementBehavior::TopDownMovementBehavior"}]},{"b":255,"disableInputWhenNotFocused":true,"mangledName":"_4800000","name":"000000","r":247,"standardSortMethod":true,"stopSoundsOnStartup":true,"title":"","v":249,"uiSettings":{"grid":true,"gridType":"rectangular","gridWidth":16.0,"gridHeight":16.0,"gridDepth":32.0,"gridOffsetX":0.0,"gridOffsetY":0.0,"gridOffsetZ":0.0,"gridColor":10401023.0,"gridAlpha":0.8,"snap":true,"zoomFactor":0.6672773998330006,"windowMask":false,"selectedLayer":"","gameEditorMode":"instances-editor"},"objectsGroups":[],"variables":[{"name":"var_mqttParse","persistentUuid":"62bd9deb-3848-4176-9eef-2adf2b38198b","type":"structure","children":[]},{"name":"var_jsonParse","persistentUuid":"0563153c-5ac3-487f-ab2a-050e5b806bc7","type":"structure","children":[]},{"name":"var_jsonReply","persistentUuid":"f4f4161d-90a5-4937-abfe-755a64fb6f2f","type":"string","value":""},{"name":"var_child","persistentUuid":"457c6438-da2b-4d26-af01-34653736b679","type":"structure","children":[]},{"name":"var_childName","persistentUuid":"a7769c54-2f75-4661-bd4f-af2bf1d036d3","type":"string","value":""}],"instances":[{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"spr_door","persistentUuid":"1691a9cb-54f2-444c-9c3f-38f4edf26eb6","width":0.0,"x":1168.0,"y":352.0,"zOrder":1,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"txt_debug","persistentUuid":"9ba688b3-55ca-4771-8b64-7c7e4ff5efac","width":0.0,"x":112.0,"y":624.0,"zOrder":2,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"btn_Logout","persistentUuid":"acb3eb14-97fe-4a1c-b4c5-f01b9c7c6eeb","width":0.0,"x":16.0,"y":16.0,"zOrder":3,"numberProperties":[],"stringProperties":[],"initialVariables":[]}],"objects":[{"assetStoreId":"","bold":false,"italic":false,"name":"txt_debug","persistentUuid":"73e827f1-d8f8-45e5-95f5-ff8a2715886b","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[],"string":"Text","font":"","textAlignment":"left","characterSize":20.0,"color":{"b":0,"g":0,"r":0},"content":{"bold":false,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"Text","font":"","textAlignment":"left","verticalTextAlignment":"top","characterSize":20.0,"lineHeight":0.0,"color":"0;0;0"}}],"objectsFolderStructure":{"folderName":"__ROOT","children":[{"objectName":"txt_debug"}]},"events":[{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Scene Start","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"Spawn Logic"},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"SceneJustBegins"},"parameters":[""]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_playerInfo[0].last_room","=","\"null\""]}],"actions":[{"type":{"value":"Create"},"parameters":["","spr_player","var_playerInfo[0].x","var_playerInfo[0].y",""]},{"type":{"value":"SetNumberObjectVariable"},"parameters":["spr_player","player_id","=","var_playerInfo[0].id"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_playerInfo[0].last_room","=","\"000000\""]}],"actions":[{"type":{"value":"Create"},"parameters":["","spr_player","560","352",""]},{"type":{"value":"SetNumberObjectVariable"},"parameters":["spr_player","player_id","=","var_playerInfo[0].id"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_playerInfo[0].last_room","=","\"000001\""]}],"actions":[{"type":{"value":"Create"},"parameters":["","spr_player","1088","352",""]},{"type":{"value":"SetNumberObjectVariable"},"parameters":["spr_player","player_id","=","var_playerInfo[0].id"]}]}]}],"parameters":[]},{"type":"BuiltinCommonInstructions::Link","include":{"includeConfig":0},"target":"Functions"}],"layers":[{"ambientLightColorB":200,"ambientLightColorG":200,"ambientLightColorR":200,"camera2DPlaneMaxDrawingDistance":5000.0,"camera3DFarPlaneDistance":10000.0,"camera3DFieldOfView":45.0,"camera3DNearPlaneDistance":3.0,"cameraType":"","followBaseLayerCamera":false,"isLightingLayer":false,"isLocked":false,"name":"","renderingType":"","visibility":true,"cameras":[{"defaultSize":true,"defaultViewport":true,"height":0.0,"viewportBottom":1.0,"viewportLeft":0.0,"viewportRight":1.0,"viewportTop":0.0,"width":0.0}],"effects":[{"effectType":"Scene3D::HemisphereLight","name":"3D Ambient Hemisphere Light","doubleParameters":{"elevation":40.0,"intensity":0.33,"rotation":300.0},"stringParameters":{"groundColor":"127;127;127","skyColor":"255;255;255","top":"Z+"},"booleanParameters":{}},{"effectType":"Scene3D::DirectionalLight","name":"3D Sun Light","doubleParameters":{"distanceFromCamera":1500.0,"elevation":40.0,"frustumSize":4000.0,"intensity":0.75,"minimumShadowBias":0.0,"rotation":300.0},"stringParameters":{"color":"255;255;255","shadowQuality":"medium","top":"Z+"},"booleanParameters":{"isCastingShadow":true}}]}],"behaviorsSharedData":[{"name":"Animation","type":"AnimatableCapability::AnimatableBehavior"},{"name":"Effect","type":"EffectCapability::EffectBehavior"},{"name":"Flippable","type":"FlippableCapability::FlippableBehavior"},{"name":"Opacity","type":"OpacityCapability::OpacityBehavior"},{"name":"Resizable","type":"ResizableCapability::ResizableBehavior"},{"name":"Scale","type":"ScalableCapability::ScalableBehavior"},{"name":"Text","type":"TextContainerCapability::TextContainerBehavior"},{"name":"TopDownMovement","type":"TopDownMovementBehavior::TopDownMovementBehavior"}]},{"b":255,"disableInputWhenNotFocused":true,"mangledName":"_4800001","name":"000001","r":247,"standardSortMethod":true,"stopSoundsOnStartup":true,"title":"","v":249,"uiSettings":{"grid":true,"gridType":"rectangular","gridWidth":16.0,"gridHeight":16.0,"gridDepth":32.0,"gridOffsetX":0.0,"gridOffsetY":0.0,"gridOffsetZ":0.0,"gridColor":10401023.0,"gridAlpha":0.8,"snap":true,"zoomFactor":0.6672773998329975,"windowMask":false,"selectedLayer":"","gameEditorMode":"instances-editor"},"objectsGroups":[],"variables":[{"name":"var_jsonReply","persistentUuid":"600e1cff-2b6c-4e86-aa45-0926f9210a1d","type":"string","value":""},{"name":"var_jsonParse","persistentUuid":"9b38abfa-427b-4c21-bd59-ddc7057a418e","type":"structure","children":[]},{"name":"var_mqttParse","persistentUuid":"5c8c99af-3003-442d-bd7f-d123dea72ac4","type":"structure","children":[]},{"name":"var_child","persistentUuid":"fb409cbe-b641-4d67-9c0e-d640b65f7cbe","type":"structure","children":[]},{"name":"var_childName","persistentUuid":"dc06c4ec-9998-46e8-97b5-0ae6d6088f1e","type":"string","value":""}],"instances":[{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"spr_door","persistentUuid":"1691a9cb-54f2-444c-9c3f-38f4edf26eb6","width":0.0,"x":32.0,"y":352.0,"zOrder":1,"numberProperties":[],"stringProperties":[],"initialVariables":[{"name":"var_doorway","type":"string","value":"000000"}]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"spr_otherPlayers","persistentUuid":"820898fb-18c6-4c97-9d7d-05ee26a3d4fc","width":0.0,"x":112.0,"y":352.0,"zOrder":2,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":false,"height":0.0,"keepRatio":true,"layer":"","name":"btn_Logout","persistentUuid":"7c951776-884b-4af0-a13a-97e5ee085499","width":0.0,"x":16.0,"y":16.0,"zOrder":3,"numberProperties":[],"stringProperties":[],"initialVariables":[]}],"objects":[{"assetStoreId":"","bold":false,"italic":false,"name":"txt_debug","persistentUuid":"9ec31fcd-7fdb-4daa-88e5-561ccee06c4c","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[],"string":"Text","font":"","textAlignment":"left","characterSize":20.0,"color":{"b":0,"g":0,"r":0},"content":{"bold":false,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"Text","font":"","textAlignment":"left","verticalTextAlignment":"top","characterSize":20.0,"lineHeight":0.0,"color":"0;0;0"}}],"objectsFolderStructure":{"folderName":"__ROOT","children":[{"objectName":"txt_debug"}]},"events":[{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Scene Start","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"Spawn Logic"},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"SceneJustBegins"},"parameters":[""]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_playerInfo[0].last_room","=","\"null\""]}],"actions":[{"type":{"value":"Create"},"parameters":["","spr_player","var_playerInfo[0].x","var_playerInfo[0].y",""]},{"type":{"value":"SetNumberObjectVariable"},"parameters":["spr_player","player_id","=","var_playerInfo[0].id"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_playerInfo[0].last_room","=","\"000001\""]}],"actions":[{"type":{"value":"Create"},"parameters":["","spr_player","1088","352",""]},{"type":{"value":"SetNumberObjectVariable"},"parameters":["spr_player","player_id","=","var_playerInfo[0].id"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_playerInfo[0].last_room","=","\"000000\""]}],"actions":[{"type":{"value":"Create"},"parameters":["","spr_player","112","352",""]}]}]}],"parameters":[]},{"type":"BuiltinCommonInstructions::Link","include":{"includeConfig":0},"target":"Functions"}],"layers":[{"ambientLightColorB":200,"ambientLightColorG":200,"ambientLightColorR":200,"camera2DPlaneMaxDrawingDistance":5000.0,"camera3DFarPlaneDistance":10000.0,"camera3DFieldOfView":45.0,"camera3DNearPlaneDistance":3.0,"cameraType":"","followBaseLayerCamera":false,"isLightingLayer":false,"isLocked":false,"name":"","renderingType":"","visibility":true,"cameras":[{"defaultSize":true,"defaultViewport":true,"height":0.0,"viewportBottom":1.0,"viewportLeft":0.0,"viewportRight":1.0,"viewportTop":0.0,"width":0.0}],"effects":[{"effectType":"Scene3D::HemisphereLight","name":"3D Ambient Hemisphere Light","doubleParameters":{"elevation":40.0,"intensity":0.33,"rotation":300.0},"stringParameters":{"groundColor":"127;127;127","skyColor":"255;255;255","top":"Z+"},"booleanParameters":{}},{"effectType":"Scene3D::DirectionalLight","name":"3D Sun Light","doubleParameters":{"distanceFromCamera":1500.0,"elevation":40.0,"frustumSize":4000.0,"intensity":0.75,"minimumShadowBias":0.0,"rotation":300.0},"stringParameters":{"color":"255;255;255","shadowQuality":"medium","top":"Z+"},"booleanParameters":{"isCastingShadow":true}}]}],"behaviorsSharedData":[{"name":"Animation","type":"AnimatableCapability::AnimatableBehavior"},{"name":"Effect","type":"EffectCapability::EffectBehavior"},{"name":"Flippable","type":"FlippableCapability::FlippableBehavior"},{"name":"Opacity","type":"OpacityCapability::OpacityBehavior"},{"name":"Resizable","type":"ResizableCapability::ResizableBehavior"},{"name":"Scale","type":"ScalableCapability::ScalableBehavior"},{"name":"Text","type":"TextContainerCapability::TextContainerBehavior"},{"name":"TopDownMovement","type":"TopDownMovementBehavior::TopDownMovementBehavior"}]},{"b":255,"disableInputWhenNotFocused":true,"mangledName":"Functions","name":"Functions","r":247,"standardSortMethod":true,"stopSoundsOnStartup":true,"title":"","v":249,"uiSettings":{"grid":false,"gridType":"rectangular","gridWidth":32.0,"gridHeight":32.0,"gridDepth":32.0,"gridOffsetX":0.0,"gridOffsetY":0.0,"gridOffsetZ":0.0,"gridColor":10401023.0,"gridAlpha":0.8,"snap":false,"zoomFactor":0.546875,"windowMask":false,"selectedLayer":"","gameEditorMode":"instances-editor"},"objectsGroups":[],"variables":[{"name":"var_jsonReply","persistentUuid":"e04c3e03-0cb7-4e3d-8f02-7bd32268195c","type":"string","value":""},{"name":"var_jsonParse","persistentUuid":"becd4ac5-49ec-4fd7-b926-45259680bb42","type":"structure","children":[]},{"name":"var_mqttParse","persistentUuid":"b4fe2c70-e8ab-4665-9d0a-7126bb52f64b","type":"structure","children":[]},{"name":"var_child","persistentUuid":"64d0682b-fde0-404e-9b34-17034c997c4c","type":"structure","children":[]},{"name":"var_childName","persistentUuid":"792ced2c-6b39-44d1-8550-02127dd84b45","type":"string","value":""}],"instances":[],"objects":[{"assetStoreId":"","bold":false,"italic":false,"name":"txt_debug","persistentUuid":"29da99d2-6fb0-4d86-841b-b57124673767","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[],"string":"Text","font":"","textAlignment":"left","characterSize":20.0,"color":{"b":0,"g":0,"r":0},"content":{"bold":false,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"Text","font":"","textAlignment":"left","verticalTextAlignment":"top","characterSize":20.0,"lineHeight":0.0,"color":"0;0;0"}}],"objectsFolderStructure":{"folderName":"__ROOT","children":[{"objectName":"txt_debug"}]},"events":[{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Scene Start","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"SceneJustBegins"},"parameters":[""]}],"actions":[{"type":{"value":"ChangeColor"},"parameters":["spr_player","var_playerInfo[0].color"]},{"type":{"value":"SendAsyncRequest"},"parameters":["var_jsonAddress+\"/users/\"+var_playerInfo[0].id","\"{\\\"x\\\":\\\"\" + ToString(round(spr_player.X()))+ \"\\\",\\\"y\\\":\\\"\" + ToString(round(spr_player.Y())) + \"\\\"}\"","\"PATCH\"","\"application/json\"","",""]},{"type":{"value":"SendAsyncRequest"},"parameters":["var_jsonAddress+\"/users?online=true&room=\"+CurrentSceneName()","","\"GET\"","","var_jsonReply",""]},{"type":{"value":"Wait"},"parameters":[".1"]},{"type":{"value":"JSONToVariableStructure2"},"parameters":["var_jsonReply","var_jsonParse"]}],"events":[{"type":"BuiltinCommonInstructions::ForEachChildVariable","iterableVariableName":"var_jsonParse","valueIteratorVariableName":"var_child","keyIteratorVariableName":"var_childName","conditions":[],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_child[\"id\"]","!=","var_playerInfo[0].id"]}],"actions":[{"type":{"value":"Create"},"parameters":["","spr_otherPlayers","var_child[\"x\"]","var_child[\"y\"]",""]},{"type":{"value":"ChangeColor"},"parameters":["spr_otherPlayers","var_child[\"color\"]"]},{"type":{"value":"SetNumberObjectVariable"},"parameters":["spr_otherPlayers","player_id","=","var_child[\"id\"]"]}]}]}]}],"parameters":[]},{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"MQTT","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"MQTT::isConnected"},"parameters":["",""]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"MQTT::subscribe"},"parameters":["","\"/game/rooms/\"+CurrentSceneName()","","no",""]},{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"join\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"x\\\":\" + ToString(round(spr_player.X())) + \",\\\"y\\\":\" + ToString(round(spr_player.Y())) + \",\\\"color\\\":\\\"\" + var_playerInfo[0].color + \"\\\"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]}]},{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"MQTT on button press"},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"TopDownMovementBehavior::IsMoving"},"parameters":["spr_player","TopDownMovement"]},{"type":{"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsMovementAngleAround"},"parameters":["spr_player","TopDownMovement","0","0"]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"right\\\"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"TopDownMovementBehavior::IsMoving"},"parameters":["spr_player","TopDownMovement"]},{"type":{"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsMovementAngleAround"},"parameters":["spr_player","TopDownMovement","90","0"]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"down\\\"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"TopDownMovementBehavior::IsMoving"},"parameters":["spr_player","TopDownMovement"]},{"type":{"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsMovementAngleAround"},"parameters":["spr_player","TopDownMovement","180","0"]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"left\\\"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"TopDownMovementBehavior::IsMoving"},"parameters":["spr_player","TopDownMovement"]},{"type":{"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsMovementAngleAround"},"parameters":["spr_player","TopDownMovement","270","0"]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"up\\\"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]}]},{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Right\""]},{"type":{"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Up\""]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"up\\\"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]}]},{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Right\""]},{"type":{"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Down\""]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"down\\\"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]}]},{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Left\""]},{"type":{"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Up\""]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"up\\\"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]}]},{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Left\""]},{"type":{"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Down\""]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"down\\\"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]}]},{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Up\""]},{"type":{"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Right\""]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"right\\\"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]}]},{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Up\""]},{"type":{"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Left\""]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"left\\\"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]}]},{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Down\""]},{"type":{"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Right\""]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"right\\\"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]}]},{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Down\""]},{"type":{"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Left\""]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"left\\\"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]}]},{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Right\""]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"right\\\"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]}]},{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Left\""]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"left\\\"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]}]},{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Up\""]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"up\\\"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]}]},{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"TopDownMovementBehavior::TopDownMovementBehavior::IsUsingControl"},"parameters":["spr_player","TopDownMovement","\"Down\""]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"move_start\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"direction\\\":\\\"down\\\"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"TopDownMovementBehavior::IsMoving"},"parameters":["spr_player","TopDownMovement"]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"move_stop\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \",\\\"x\\\":\" + ToString(round(spr_player.X())) + \",\\\"y\\\":\" + ToString(round(spr_player.Y())) + \"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"MQTT::onMessage"},"parameters":["","\"/game/rooms/\"+CurrentSceneName()",""]}],"actions":[{"type":{"value":"JSONToVariableStructure2"},"parameters":["MQTT::GetLastMessage(\"/game/rooms/\"+CurrentSceneName())","var_mqttParse"]},{"type":{"value":"TextContainerCapability::TextContainerBehavior::SetValue"},"parameters":["txt_debug","Text","=","MQTT::GetLastMessage(\"/game/rooms/\"+CurrentSceneName())"]}],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_mqttParse[\"player_id\"]","!=","var_playerInfo[0].id"]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_mqttParse[\"type\"]","=","\"move_start\""]},{"type":{"value":"StringVariable"},"parameters":["var_mqttParse[\"direction\"]","=","\"right\""]},{"type":{"value":"NumberObjectVariable"},"parameters":["spr_otherPlayers","player_id","=","var_mqttParse[\"player_id\"]"]}],"actions":[{"type":{"value":"ClearForces"},"parameters":["spr_otherPlayers"]},{"type":{"value":"AddForceXY"},"parameters":["spr_otherPlayers","200","0","1"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_mqttParse[\"type\"]","=","\"move_start\""]},{"type":{"value":"StringVariable"},"parameters":["var_mqttParse[\"direction\"]","=","\"left\""]},{"type":{"value":"NumberObjectVariable"},"parameters":["spr_otherPlayers","player_id","=","var_mqttParse[\"player_id\"]"]}],"actions":[{"type":{"value":"ClearForces"},"parameters":["spr_otherPlayers"]},{"type":{"value":"AddForceXY"},"parameters":["spr_otherPlayers","-200","0","1"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_mqttParse[\"type\"]","=","\"move_start\""]},{"type":{"value":"StringVariable"},"parameters":["var_mqttParse[\"direction\"]","=","\"up\""]},{"type":{"value":"NumberObjectVariable"},"parameters":["spr_otherPlayers","player_id","=","var_mqttParse[\"player_id\"]"]}],"actions":[{"type":{"value":"ClearForces"},"parameters":["spr_otherPlayers"]},{"type":{"value":"AddForceXY"},"parameters":["spr_otherPlayers","0","-200","1"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_mqttParse[\"type\"]","=","\"move_start\""]},{"type":{"value":"StringVariable"},"parameters":["var_mqttParse[\"direction\"]","=","\"down\""]},{"type":{"value":"NumberObjectVariable"},"parameters":["spr_otherPlayers","player_id","=","var_mqttParse[\"player_id\"]"]}],"actions":[{"type":{"value":"ClearForces"},"parameters":["spr_otherPlayers"]},{"type":{"value":"AddForceXY"},"parameters":["spr_otherPlayers","0","200","1"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_mqttParse[\"type\"]","=","\"move_stop\""]},{"type":{"value":"NumberObjectVariable"},"parameters":["spr_otherPlayers","player_id","=","var_mqttParse[\"player_id\"]"]}],"actions":[{"type":{"value":"ClearForces"},"parameters":["spr_otherPlayers"]},{"type":{"value":"SetXY"},"parameters":["spr_otherPlayers","=","var_mqttParse[\"x\"]","=","var_mqttParse[\"y\"]"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_mqttParse[\"type\"]","=","\"join\""]}],"actions":[{"type":{"value":"Create"},"parameters":["","spr_otherPlayers","var_mqttParse[\"x\"]","var_mqttParse[\"y\"]",""]},{"type":{"value":"SetNumberObjectVariable"},"parameters":["spr_otherPlayers","player_id","=","var_mqttParse[\"player_id\"]"]},{"type":{"value":"ChangeColor"},"parameters":["spr_otherPlayers","var_mqttParse[\"color\"]"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["var_mqttParse[\"type\"]","=","\"leave\""]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::ForEach","object":"spr_otherPlayers","conditions":[{"type":{"value":"NumberObjectVariable"},"parameters":["spr_otherPlayers","player_id","=","var_mqttParse[\"player_id\"]"]}],"actions":[{"type":{"value":"Delete"},"parameters":["spr_otherPlayers",""]}]}]}]}]}],"parameters":[]},{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Doorways","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"CollisionNP"},"parameters":["spr_player","spr_door","","",""]}],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["var_playerInfo[0].last_room","=","var_playerInfo[0].room"]},{"type":{"value":"SetStringVariable"},"parameters":["var_playerInfo[0].room","=","spr_door.var_doorway"]},{"type":{"value":"SendAsyncRequest"},"parameters":["var_jsonAddress+\"/users/\"+var_playerInfo[0].id","\"{\\\"room\\\":\\\"\" + var_playerInfo[0].room + \"\\\",\\\"last_room\\\":\\\"\" + var_playerInfo[0].last_room + \"\\\"}\"","\"PATCH\"","\"application/json\"","",""]},{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"leave\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]},{"type":{"value":"Scene"},"parameters":["","spr_door.var_doorway",""]}]}],"parameters":[]},{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Log Out","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsClicked"},"parameters":["btn_Logout",""]}],"actions":[{"type":{"value":"SendAsyncRequest"},"parameters":["var_jsonAddress+\"/users/\"+var_playerInfo[0].id","\"{\\\"online\\\":false,\\\"last_room\\\":\\\"null\\\",\\\"x\\\":\" + ToString(round(spr_player.X())) + \",\\\"y\\\":\" + ToString(round(spr_player.Y())) + \"}\"","\"PATCH\"","\"application/json\"","",""]},{"type":{"value":"MQTT::publish"},"parameters":["","\"{\\\"type\\\":\\\"leave\\\",\\\"player_id\\\":\" + ToString(var_playerInfo[0].id) + \"}\"","\"/game/rooms/\"+CurrentSceneName()","","",""]},{"type":{"value":"Scene"},"parameters":["","\"Login\"",""]}]}],"parameters":[]},{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Update XY","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"TopDownMovementBehavior::IsMoving"},"parameters":["spr_player","TopDownMovement"]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"SendAsyncRequest"},"parameters":["var_jsonAddress+\"/users/\"+var_playerInfo[0].id","\"{\\\"x\\\":\\\"\" + ToString(round(spr_player.X()))+ \"\\\",\\\"y\\\":\\\"\" + ToString(round(spr_player.Y())) + \"\\\"}\"","\"PATCH\"","\"application/json\"","",""]}]}],"parameters":[]}],"layers":[{"ambientLightColorB":200,"ambientLightColorG":200,"ambientLightColorR":200,"camera2DPlaneMaxDrawingDistance":5000.0,"camera3DFarPlaneDistance":10000.0,"camera3DFieldOfView":45.0,"camera3DNearPlaneDistance":3.0,"cameraType":"","followBaseLayerCamera":false,"isLightingLayer":false,"isLocked":false,"name":"","renderingType":"","visibility":true,"cameras":[{"defaultSize":true,"defaultViewport":true,"height":0.0,"viewportBottom":1.0,"viewportLeft":0.0,"viewportRight":1.0,"viewportTop":0.0,"width":0.0}],"effects":[{"effectType":"Scene3D::HemisphereLight","name":"3D Ambient Hemisphere Light","doubleParameters":{"elevation":40.0,"intensity":0.33,"rotation":300.0},"stringParameters":{"groundColor":"127;127;127","skyColor":"255;255;255","top":"Z+"},"booleanParameters":{}},{"effectType":"Scene3D::DirectionalLight","name":"3D Sun Light","doubleParameters":{"distanceFromCamera":1500.0,"elevation":40.0,"frustumSize":4000.0,"intensity":0.75,"minimumShadowBias":0.0,"rotation":300.0},"stringParameters":{"color":"255;255;255","shadowQuality":"medium","top":"Z+"},"booleanParameters":{"isCastingShadow":true}}]}],"behaviorsSharedData":[{"name":"Animation","type":"AnimatableCapability::AnimatableBehavior"},{"name":"Effect","type":"EffectCapability::EffectBehavior"},{"name":"Flippable","type":"FlippableCapability::FlippableBehavior"},{"name":"Opacity","type":"OpacityCapability::OpacityBehavior"},{"name":"Resizable","type":"ResizableCapability::ResizableBehavior"},{"name":"Scale","type":"ScalableCapability::ScalableBehavior"},{"name":"Text","type":"TextContainerCapability::TextContainerBehavior"},{"name":"TopDownMovement","type":"TopDownMovementBehavior::TopDownMovementBehavior"}]},{"b":255,"disableInputWhenNotFocused":true,"mangledName":"Sprite_32Test","name":"Sprite Test","r":247,"standardSortMethod":true,"stopSoundsOnStartup":true,"title":"","v":249,"uiSettings":{"grid":false,"gridType":"rectangular","gridWidth":32.0,"gridHeight":32.0,"gridDepth":32.0,"gridOffsetX":0.0,"gridOffsetY":0.0,"gridOffsetZ":0.0,"gridColor":10401023.0,"gridAlpha":0.8,"snap":false,"zoomFactor":0.546875,"windowMask":false,"selectedLayer":"","gameEditorMode":"instances-editor"},"objectsGroups":[],"variables":[],"instances":[],"objects":[],"objectsFolderStructure":{"folderName":"__ROOT"},"events":[],"layers":[{"ambientLightColorB":200,"ambientLightColorG":200,"ambientLightColorR":200,"camera2DPlaneMaxDrawingDistance":5000.0,"camera3DFarPlaneDistance":10000.0,"camera3DFieldOfView":45.0,"camera3DNearPlaneDistance":3.0,"cameraType":"","followBaseLayerCamera":false,"isLightingLayer":false,"isLocked":false,"name":"","renderingType":"","visibility":true,"cameras":[{"defaultSize":true,"defaultViewport":true,"height":0.0,"viewportBottom":1.0,"viewportLeft":0.0,"viewportRight":1.0,"viewportTop":0.0,"width":0.0}],"effects":[{"effectType":"Scene3D::HemisphereLight","name":"3D Ambient Hemisphere Light","doubleParameters":{"elevation":40.0,"intensity":0.33,"rotation":300.0},"stringParameters":{"groundColor":"127;127;127","skyColor":"255;255;255","top":"Z+"},"booleanParameters":{}},{"effectType":"Scene3D::DirectionalLight","name":"3D Sun Light","doubleParameters":{"distanceFromCamera":1500.0,"elevation":40.0,"frustumSize":4000.0,"intensity":0.75,"minimumShadowBias":0.0,"rotation":300.0},"stringParameters":{"color":"255;255;255","shadowQuality":"medium","top":"Z+"},"booleanParameters":{"isCastingShadow":true}}]}],"behaviorsSharedData":[{"name":"Animation","type":"AnimatableCapability::AnimatableBehavior"},{"name":"Effect","type":"EffectCapability::EffectBehavior"},{"name":"Flippable","type":"FlippableCapability::FlippableBehavior"},{"name":"Opacity","type":"OpacityCapability::OpacityBehavior"},{"name":"Resizable","type":"ResizableCapability::ResizableBehavior"},{"name":"Scale","type":"ScalableCapability::ScalableBehavior"},{"name":"TopDownMovement","type":"TopDownMovementBehavior::TopDownMovementBehavior"}]}],"externalEvents":[],"eventsFunctionsExtensions":[{"author":"Arthur Pacaud (@arthuro555)","category":"Network","dimension":"","extensionNamespace":"","fullName":"MQTT Client (advanced)","gdevelopVersion":">=5.5.222","helpPath":"","iconUrl":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLW1lc3NhZ2UtZmxhc2giIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMjIgNEMyMiAyLjkgMjEuMSAyIDIwIDJINEMyLjkgMiAyIDIuOSAyIDRWMjJMNiAxOEgxNVYxMEgyMlY0TTIyLjUgMTZIMjAuM0wyMiAxMkgxN1YxOEgxOVYyM0wyMi41IDE2WiIgLz48L3N2Zz4=","name":"MQTT","previewIconUrl":"https://resources.gdevelop-app.com/assets/Icons/message-flash.svg","shortDescription":"MQTT client: connect to broker, publish/subscribe topics, send/receive messages.","version":"1.0.1","description":["This extension wraps [MQTT.js](https://github.com/mqttjs/MQTT.js) to allow connections to a MQTT server and communication via pub/sub. The only transport method is Websockets. Make sure to use a broker that support those!","","## Dataloss","","The dataloss let you chose how to handle data. Due to how the GDevelop event loop is made, only one message per topic can be processed per frame. When dataloss is on, when you get 2 messages from one topic in one frame, only the latest one is remembered. When it is off, the first message is processed and the second is queued for the next frame.","","## QoS (Quality of service)","","Here is how QoS works:",""," - QoS 0 (received at most once): The packet is sent, and that's it. There is no validation about whether it has been received."," - QoS 1 (received at least once): The packet is sent and stored as long as the client has not received a confirmation from the server. MQTT ensures that it will be received, but there can be duplicates."," - QoS 2 (received exactly once): Same as QoS 1 but there is no duplicates.","","About data consumption: QoS 2 will consume more than QoS 1, which will consume more than QoS 0.","","## Test Broker","","You can find a free test broker server over at https://test.mosquitto.org/ - keep in mind, anyone can read and write data sent there, and it offers no uptime guarantees!"],"origin":{"identifier":"MQTT","name":"gdevelop-extension-store"},"tags":["mqtt","iot","connection","networking","pubsub","messaging","online","connect","multiplayer","send","message","recieve","notify","notification","home assistant","smart home","control"],"authorIds":["ZgrsWuRTAkXgeuPV9bo0zuEcA2w1"],"dependencies":[],"globalVariables":[],"sceneVariables":[],"eventsFunctions":[{"fullName":"","functionType":"Action","name":"onFirstSceneLoaded","sentence":"","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["/**"," * @typedef MQTTEvent Corresponds to a message coming from a subcribed topic."," * @property {boolean} loss Descibes how to handle multiple packages in one frame."," * @property {string || Array} data The last message received by that event."," */","","/**"," * The mqtt tools"," * @namespace"," */","gdjs.evtTools.mqtt = {"," /** The current connection to the MQTT broker server */"," connection: null,"," /** "," * The last error that occured "," * @type {string}"," */"," lastError: \"\","," /**"," * A list of events triggered."," * @type {Object.}"," */"," events: {},"," empty: Symbol(\"No event\"),","};","","// MQTT.js: https://github.com/mqttjs/MQTT.js (v5.10.3)","window.mqtt=(()=>{var ys=Object.defineProperty;var Kg=Object.getOwnPropertyDescriptor;var Gg=Object.getOwnPropertyNames;var Qg=Object.prototype.hasOwnProperty;var _e=(t,e)=>()=>(t&&(e=t(t=0)),e);var M=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Jt=(t,e)=>{for(var r in e)ys(t,r,{get:e[r],enumerable:!0})},Yg=(t,e,r,i)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let n of Gg(e))!Qg.call(t,n)&&n!==r&&ys(t,n,{get:()=>e[n],enumerable:!(i=Kg(e,n))||i.enumerable});return t};var X=t=>Yg(ys({},\"__esModule\",{value:!0}),t);var _=_e(()=>{});var B={};Jt(B,{_debugEnd:()=>yu,_debugProcess:()=>gu,_events:()=>Ou,_eventsCount:()=>xu,_exiting:()=>Yl,_fatalExceptions:()=>cu,_getActiveHandles:()=>eu,_getActiveRequests:()=>Zl,_kill:()=>ru,_linkedBinding:()=>Gl,_maxListeners:()=>ku,_preload_modules:()=>Cu,_rawDebug:()=>zl,_startProfilerIdleNotifier:()=>bu,_stopProfilerIdleNotifier:()=>wu,_tickCallback:()=>pu,abort:()=>Eu,addListener:()=>Mu,allowedNodeEnvironmentFlags:()=>lu,arch:()=>xl,argv:()=>Ul,argv0:()=>Ru,assert:()=>uu,binding:()=>Fl,chdir:()=>Hl,config:()=>Jl,cpuUsage:()=>$i,cwd:()=>$l,debugPort:()=>Tu,default:()=>$u,dlopen:()=>Xl,domain:()=>Ql,emit:()=>Du,emitWarning:()=>jl,env:()=>Ll,execArgv:()=>Nl,execPath:()=>Iu,exit:()=>ou,features:()=>fu,hasUncaughtExceptionCaptureCallback:()=>du,hrtime:()=>Wi,kill:()=>su,listeners:()=>Wu,memoryUsage:()=>nu,moduleLoadList:()=>Kl,nextTick:()=>Pl,off:()=>Uu,on:()=>wt,once:()=>Lu,openStdin:()=>au,pid:()=>Su,platform:()=>Ml,ppid:()=>Au,prependListener:()=>ju,prependOnceListener:()=>Fu,reallyExit:()=>tu,release:()=>Vl,removeAllListeners:()=>qu,removeListener:()=>Nu,resourceUsage:()=>iu,setSourceMapsEnabled:()=>Bu,setUncaughtExceptionCaptureCallback:()=>hu,stderr:()=>mu,stdin:()=>vu,stdout:()=>_u,title:()=>Ol,umask:()=>Wl,uptime:()=>Pu,version:()=>ql,versions:()=>Dl});function _s(t){throw new Error(\"Node.js process \"+t+\" is not supported by JSPM core outside of Node.js\")}function Jg(){!Lr||!Xt||(Lr=!1,Xt.length?bt=Xt.concat(bt):Fi=-1,bt.length&&Bl())}function Bl(){if(!Lr){var t=setTimeout(Jg,0);Lr=!0;for(var e=bt.length;e;){for(Xt=bt,bt=[];++Fi1)for(var r=1;r{_();v();m();bt=[],Lr=!1,Fi=-1;kl.prototype.run=function(){this.fun.apply(null,this.array)};Ol=\"browser\",xl=\"x64\",Ml=\"browser\",Ll={PATH:\"/usr/bin\",LANG:navigator.language+\".UTF-8\",PWD:\"/\",HOME:\"/home\",TMP:\"/tmp\"},Ul=[\"/usr/bin/node\"],Nl=[],ql=\"v16.8.0\",Dl={},jl=function(t,e){console.warn((e?e+\": \":\"\")+t)},Fl=function(t){_s(\"binding\")},Wl=function(t){return 0},$l=function(){return\"/\"},Hl=function(t){},Vl={name:\"node\",sourceUrl:\"\",headersUrl:\"\",libUrl:\"\"};zl=Ee,Kl=[];Ql={},Yl=!1,Jl={};tu=Ee,ru=Ee,$i=function(){return{}},iu=$i,nu=$i,su=Ee,ou=Ee,au=Ee,lu={};fu={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},cu=Ee,hu=Ee;pu=Ee,gu=Ee,yu=Ee,bu=Ee,wu=Ee,_u=void 0,mu=void 0,vu=void 0,Eu=Ee,Su=2,Au=1,Iu=\"/bin/usr/node\",Tu=9229,Ru=\"node\",Cu=[],Bu=Ee,Lt={now:typeof performance<\"u\"?performance.now.bind(performance):void 0,timing:typeof performance<\"u\"?performance.timing:void 0};Lt.now===void 0&&(bs=Date.now(),Lt.timing&&Lt.timing.navigationStart&&(bs=Lt.timing.navigationStart),Lt.now=()=>Date.now()-bs);ws=1e9;Wi.bigint=function(t){var e=Wi(t);return typeof BigInt>\"u\"?e[0]*ws+e[1]:BigInt(e[0]*ws)+BigInt(e[1])};ku=10,Ou={},xu=0;Mu=wt,Lu=wt,Uu=wt,Nu=wt,qu=wt,Du=Ee,ju=wt,Fu=wt;$u={version:ql,versions:Dl,arch:xl,platform:Ml,release:Vl,_rawDebug:zl,moduleLoadList:Kl,binding:Fl,_linkedBinding:Gl,_events:Ou,_eventsCount:xu,_maxListeners:ku,on:wt,addListener:Mu,once:Lu,off:Uu,removeListener:Nu,removeAllListeners:qu,emit:Du,prependListener:ju,prependOnceListener:Fu,listeners:Wu,domain:Ql,_exiting:Yl,config:Jl,dlopen:Xl,uptime:Pu,_getActiveRequests:Zl,_getActiveHandles:eu,reallyExit:tu,_kill:ru,cpuUsage:$i,resourceUsage:iu,memoryUsage:nu,kill:su,exit:ou,openStdin:au,allowedNodeEnvironmentFlags:lu,assert:uu,features:fu,_fatalExceptions:cu,setUncaughtExceptionCaptureCallback:hu,hasUncaughtExceptionCaptureCallback:du,emitWarning:jl,nextTick:Pl,_tickCallback:pu,_debugProcess:gu,_debugEnd:yu,_startProfilerIdleNotifier:bu,_stopProfilerIdleNotifier:wu,stdout:_u,stdin:vu,stderr:mu,abort:Eu,umask:Wl,chdir:Hl,cwd:$l,env:Ll,title:Ol,argv:Ul,execArgv:Nl,pid:Su,ppid:Au,execPath:Iu,debugPort:Tu,hrtime:Wi,argv0:Ru,_preload_modules:Cu,setSourceMapsEnabled:Bu}});var m=_e(()=>{Hu()});var me={};Jt(me,{Buffer:()=>x,INSPECT_MAX_BYTES:()=>ty,default:()=>Ut,kMaxLength:()=>ry});function Xg(){if(Vu)return ci;Vu=!0,ci.byteLength=a,ci.toByteArray=c,ci.fromByteArray=g;for(var t=[],e=[],r=typeof Uint8Array<\"u\"?Uint8Array:Array,i=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",n=0,o=i.length;n0)throw new Error(\"Invalid string. Length must be a multiple of 4\");var S=y.indexOf(\"=\");S===-1&&(S=w);var E=S===w?0:4-S%4;return[S,E]}function a(y){var w=s(y),S=w[0],E=w[1];return(S+E)*3/4-E}function l(y,w,S){return(w+S)*3/4-S}function c(y){var w,S=s(y),E=S[0],I=S[1],C=new r(l(y,E,I)),R=0,U=I>0?E-4:E,N;for(N=0;N>16&255,C[R++]=w>>8&255,C[R++]=w&255;return I===2&&(w=e[y.charCodeAt(N)]<<2|e[y.charCodeAt(N+1)]>>4,C[R++]=w&255),I===1&&(w=e[y.charCodeAt(N)]<<10|e[y.charCodeAt(N+1)]<<4|e[y.charCodeAt(N+2)]>>2,C[R++]=w>>8&255,C[R++]=w&255),C}function h(y){return t[y>>18&63]+t[y>>12&63]+t[y>>6&63]+t[y&63]}function d(y,w,S){for(var E,I=[],C=w;CU?U:R+C));return E===1?(w=y[S-1],I.push(t[w>>2]+t[w<<4&63]+\"==\")):E===2&&(w=(y[S-2]<<8)+y[S-1],I.push(t[w>>10]+t[w>>4&63]+t[w<<2&63]+\"=\")),I.join(\"\")}return ci}function Zg(){if(zu)return Hi;zu=!0;return Hi.read=function(t,e,r,i,n){var o,s,a=n*8-i-1,l=(1<>1,h=-7,d=r?n-1:0,g=r?-1:1,y=t[e+d];for(d+=g,o=y&(1<<-h)-1,y>>=-h,h+=a;h>0;o=o*256+t[e+d],d+=g,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=i;h>0;s=s*256+t[e+d],d+=g,h-=8);if(o===0)o=1-c;else{if(o===l)return s?NaN:(y?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-c}return(y?-1:1)*s*Math.pow(2,o-i)},Hi.write=function(t,e,r,i,n,o){var s,a,l,c=o*8-n-1,h=(1<>1,g=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=i?0:o-1,w=i?1:-1,S=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+d>=1?e+=g/l:e+=g*Math.pow(2,1-d),e*l>=2&&(s++,l/=2),s+d>=h?(a=0,s=h):s+d>=1?(a=(e*l-1)*Math.pow(2,n),s=s+d):(a=e*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;t[r+y]=a&255,y+=w,a/=256,n-=8);for(s=s<0;t[r+y]=s&255,y+=w,s/=256,c-=8);t[r+y-w]|=S*128},Hi}function ey(){if(Ku)return Zt;Ku=!0;let t=Xg(),e=Zg(),r=typeof Symbol==\"function\"&&typeof Symbol.for==\"function\"?Symbol.for(\"nodejs.util.inspect.custom\"):null;Zt.Buffer=s,Zt.SlowBuffer=I,Zt.INSPECT_MAX_BYTES=50;let i=2147483647;Zt.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=n(),!s.TYPED_ARRAY_SUPPORT&&typeof console<\"u\"&&typeof console.error==\"function\"&&console.error(\"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.\");function n(){try{let p=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(p,u),p.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,\"parent\",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,\"offset\",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(p){if(p>i)throw new RangeError('The value \"'+p+'\" is invalid for option \"size\"');let u=new Uint8Array(p);return Object.setPrototypeOf(u,s.prototype),u}function s(p,u,f){if(typeof p==\"number\"){if(typeof u==\"string\")throw new TypeError('The \"string\" argument must be of type string. Received type number');return h(p)}return a(p,u,f)}s.poolSize=8192;function a(p,u,f){if(typeof p==\"string\")return d(p,u);if(ArrayBuffer.isView(p))return y(p);if(p==null)throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof p);if(Ye(p,ArrayBuffer)||p&&Ye(p.buffer,ArrayBuffer)||typeof SharedArrayBuffer<\"u\"&&(Ye(p,SharedArrayBuffer)||p&&Ye(p.buffer,SharedArrayBuffer)))return w(p,u,f);if(typeof p==\"number\")throw new TypeError('The \"value\" argument must not be of type number. Received type number');let b=p.valueOf&&p.valueOf();if(b!=null&&b!==p)return s.from(b,u,f);let A=S(p);if(A)return A;if(typeof Symbol<\"u\"&&Symbol.toPrimitive!=null&&typeof p[Symbol.toPrimitive]==\"function\")return s.from(p[Symbol.toPrimitive](\"string\"),u,f);throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof p)}s.from=function(p,u,f){return a(p,u,f)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(p){if(typeof p!=\"number\")throw new TypeError('\"size\" argument must be of type number');if(p<0)throw new RangeError('The value \"'+p+'\" is invalid for option \"size\"')}function c(p,u,f){return l(p),p<=0?o(p):u!==void 0?typeof f==\"string\"?o(p).fill(u,f):o(p).fill(u):o(p)}s.alloc=function(p,u,f){return c(p,u,f)};function h(p){return l(p),o(p<0?0:E(p)|0)}s.allocUnsafe=function(p){return h(p)},s.allocUnsafeSlow=function(p){return h(p)};function d(p,u){if((typeof u!=\"string\"||u===\"\")&&(u=\"utf8\"),!s.isEncoding(u))throw new TypeError(\"Unknown encoding: \"+u);let f=C(p,u)|0,b=o(f),A=b.write(p,u);return A!==f&&(b=b.slice(0,A)),b}function g(p){let u=p.length<0?0:E(p.length)|0,f=o(u);for(let b=0;b=i)throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\"+i.toString(16)+\" bytes\");return p|0}function I(p){return+p!=p&&(p=0),s.alloc(+p)}s.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==s.prototype},s.compare=function(u,f){if(Ye(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),Ye(f,Uint8Array)&&(f=s.from(f,f.offset,f.byteLength)),!s.isBuffer(u)||!s.isBuffer(f))throw new TypeError('The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array');if(u===f)return 0;let b=u.length,A=f.length;for(let T=0,P=Math.min(b,A);TA.length?(s.isBuffer(P)||(P=s.from(P)),P.copy(A,T)):Uint8Array.prototype.set.call(A,P,T);else if(s.isBuffer(P))P.copy(A,T);else throw new TypeError('\"list\" argument must be an Array of Buffers');T+=P.length}return A};function C(p,u){if(s.isBuffer(p))return p.length;if(ArrayBuffer.isView(p)||Ye(p,ArrayBuffer))return p.byteLength;if(typeof p!=\"string\")throw new TypeError('The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof p);let f=p.length,b=arguments.length>2&&arguments[2]===!0;if(!b&&f===0)return 0;let A=!1;for(;;)switch(u){case\"ascii\":case\"latin1\":case\"binary\":return f;case\"utf8\":case\"utf-8\":return ps(p).length;case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return f*2;case\"hex\":return f>>>1;case\"base64\":return Cl(p).length;default:if(A)return b?-1:ps(p).length;u=(\"\"+u).toLowerCase(),A=!0}}s.byteLength=C;function R(p,u,f){let b=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((f===void 0||f>this.length)&&(f=this.length),f<=0)||(f>>>=0,u>>>=0,f<=u))return\"\";for(p||(p=\"utf8\");;)switch(p){case\"hex\":return qg(this,u,f);case\"utf8\":case\"utf-8\":return Pr(this,u,f);case\"ascii\":return hs(this,u,f);case\"latin1\":case\"binary\":return Ng(this,u,f);case\"base64\":return ge(this,u,f);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return Dg(this,u,f);default:if(b)throw new TypeError(\"Unknown encoding: \"+p);p=(p+\"\").toLowerCase(),b=!0}}s.prototype._isBuffer=!0;function U(p,u,f){let b=p[u];p[u]=p[f],p[f]=b}s.prototype.swap16=function(){let u=this.length;if(u%2!==0)throw new RangeError(\"Buffer size must be a multiple of 16-bits\");for(let f=0;ff&&(u+=\" ... \"),\"\"},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(u,f,b,A,T){if(Ye(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),!s.isBuffer(u))throw new TypeError('The \"target\" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(f===void 0&&(f=0),b===void 0&&(b=u?u.length:0),A===void 0&&(A=0),T===void 0&&(T=this.length),f<0||b>u.length||A<0||T>this.length)throw new RangeError(\"out of range index\");if(A>=T&&f>=b)return 0;if(A>=T)return-1;if(f>=b)return 1;if(f>>>=0,b>>>=0,A>>>=0,T>>>=0,this===u)return 0;let P=T-A,$=b-f,se=Math.min(P,$),te=this.slice(A,T),oe=u.slice(f,b);for(let J=0;J2147483647?f=2147483647:f<-2147483648&&(f=-2147483648),f=+f,gs(f)&&(f=A?0:p.length-1),f<0&&(f=p.length+f),f>=p.length){if(A)return-1;f=p.length-1}else if(f<0)if(A)f=0;else return-1;if(typeof u==\"string\"&&(u=s.from(u,b)),s.isBuffer(u))return u.length===0?-1:W(p,u,f,b,A);if(typeof u==\"number\")return u=u&255,typeof Uint8Array.prototype.indexOf==\"function\"?A?Uint8Array.prototype.indexOf.call(p,u,f):Uint8Array.prototype.lastIndexOf.call(p,u,f):W(p,[u],f,b,A);throw new TypeError(\"val must be string, number or Buffer\")}function W(p,u,f,b,A){let T=1,P=p.length,$=u.length;if(b!==void 0&&(b=String(b).toLowerCase(),b===\"ucs2\"||b===\"ucs-2\"||b===\"utf16le\"||b===\"utf-16le\")){if(p.length<2||u.length<2)return-1;T=2,P/=2,$/=2,f/=2}function se(oe,J){return T===1?oe[J]:oe.readUInt16BE(J*T)}let te;if(A){let oe=-1;for(te=f;teP&&(f=P-$),te=f;te>=0;te--){let oe=!0;for(let J=0;J<$;J++)if(se(p,te+J)!==se(u,J)){oe=!1;break}if(oe)return te}return-1}s.prototype.includes=function(u,f,b){return this.indexOf(u,f,b)!==-1},s.prototype.indexOf=function(u,f,b){return N(this,u,f,b,!0)},s.prototype.lastIndexOf=function(u,f,b){return N(this,u,f,b,!1)};function K(p,u,f,b){f=Number(f)||0;let A=p.length-f;b?(b=Number(b),b>A&&(b=A)):b=A;let T=u.length;b>T/2&&(b=T/2);let P;for(P=0;P>>0,isFinite(b)?(b=b>>>0,A===void 0&&(A=\"utf8\")):(A=b,b=void 0);else throw new Error(\"Buffer.write(string, encoding, offset[, length]) is no longer supported\");let T=this.length-f;if((b===void 0||b>T)&&(b=T),u.length>0&&(b<0||f<0)||f>this.length)throw new RangeError(\"Attempt to write outside buffer bounds\");A||(A=\"utf8\");let P=!1;for(;;)switch(A){case\"hex\":return K(this,u,f,b);case\"utf8\":case\"utf-8\":return z(this,u,f,b);case\"ascii\":case\"latin1\":case\"binary\":return Q(this,u,f,b);case\"base64\":return pe(this,u,f,b);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return Yt(this,u,f,b);default:if(P)throw new TypeError(\"Unknown encoding: \"+A);A=(\"\"+A).toLowerCase(),P=!0}},s.prototype.toJSON=function(){return{type:\"Buffer\",data:Array.prototype.slice.call(this._arr||this,0)}};function ge(p,u,f){return u===0&&f===p.length?t.fromByteArray(p):t.fromByteArray(p.slice(u,f))}function Pr(p,u,f){f=Math.min(p.length,f);let b=[],A=u;for(;A239?4:T>223?3:T>191?2:1;if(A+$<=f){let se,te,oe,J;switch($){case 1:T<128&&(P=T);break;case 2:se=p[A+1],(se&192)===128&&(J=(T&31)<<6|se&63,J>127&&(P=J));break;case 3:se=p[A+1],te=p[A+2],(se&192)===128&&(te&192)===128&&(J=(T&15)<<12|(se&63)<<6|te&63,J>2047&&(J<55296||J>57343)&&(P=J));break;case 4:se=p[A+1],te=p[A+2],oe=p[A+3],(se&192)===128&&(te&192)===128&&(oe&192)===128&&(J=(T&15)<<18|(se&63)<<12|(te&63)<<6|oe&63,J>65535&&J<1114112&&(P=J))}}P===null?(P=65533,$=1):P>65535&&(P-=65536,b.push(P>>>10&1023|55296),P=56320|P&1023),b.push(P),A+=$}return Or(b)}let kr=4096;function Or(p){let u=p.length;if(u<=kr)return String.fromCharCode.apply(String,p);let f=\"\",b=0;for(;bb)&&(f=b);let A=\"\";for(let T=u;Tb&&(u=b),f<0?(f+=b,f<0&&(f=0)):f>b&&(f=b),ff)throw new RangeError(\"Trying to access beyond buffer length\")}s.prototype.readUintLE=s.prototype.readUIntLE=function(u,f,b){u=u>>>0,f=f>>>0,b||ye(u,f,this.length);let A=this[u],T=1,P=0;for(;++P>>0,f=f>>>0,b||ye(u,f,this.length);let A=this[u+--f],T=1;for(;f>0&&(T*=256);)A+=this[u+--f]*T;return A},s.prototype.readUint8=s.prototype.readUInt8=function(u,f){return u=u>>>0,f||ye(u,1,this.length),this[u]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(u,f){return u=u>>>0,f||ye(u,2,this.length),this[u]|this[u+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(u,f){return u=u>>>0,f||ye(u,2,this.length),this[u]<<8|this[u+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(u,f){return u=u>>>0,f||ye(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(u,f){return u=u>>>0,f||ye(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},s.prototype.readBigUInt64LE=Mt(function(u){u=u>>>0,Mr(u,\"offset\");let f=this[u],b=this[u+7];(f===void 0||b===void 0)&&fi(u,this.length-8);let A=f+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24,T=this[++u]+this[++u]*2**8+this[++u]*2**16+b*2**24;return BigInt(A)+(BigInt(T)<>>0,Mr(u,\"offset\");let f=this[u],b=this[u+7];(f===void 0||b===void 0)&&fi(u,this.length-8);let A=f*2**24+this[++u]*2**16+this[++u]*2**8+this[++u],T=this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+b;return(BigInt(A)<>>0,f=f>>>0,b||ye(u,f,this.length);let A=this[u],T=1,P=0;for(;++P=T&&(A-=Math.pow(2,8*f)),A},s.prototype.readIntBE=function(u,f,b){u=u>>>0,f=f>>>0,b||ye(u,f,this.length);let A=f,T=1,P=this[u+--A];for(;A>0&&(T*=256);)P+=this[u+--A]*T;return T*=128,P>=T&&(P-=Math.pow(2,8*f)),P},s.prototype.readInt8=function(u,f){return u=u>>>0,f||ye(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},s.prototype.readInt16LE=function(u,f){u=u>>>0,f||ye(u,2,this.length);let b=this[u]|this[u+1]<<8;return b&32768?b|4294901760:b},s.prototype.readInt16BE=function(u,f){u=u>>>0,f||ye(u,2,this.length);let b=this[u+1]|this[u]<<8;return b&32768?b|4294901760:b},s.prototype.readInt32LE=function(u,f){return u=u>>>0,f||ye(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},s.prototype.readInt32BE=function(u,f){return u=u>>>0,f||ye(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},s.prototype.readBigInt64LE=Mt(function(u){u=u>>>0,Mr(u,\"offset\");let f=this[u],b=this[u+7];(f===void 0||b===void 0)&&fi(u,this.length-8);let A=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(b<<24);return(BigInt(A)<>>0,Mr(u,\"offset\");let f=this[u],b=this[u+7];(f===void 0||b===void 0)&&fi(u,this.length-8);let A=(f<<24)+this[++u]*2**16+this[++u]*2**8+this[++u];return(BigInt(A)<>>0,f||ye(u,4,this.length),e.read(this,u,!0,23,4)},s.prototype.readFloatBE=function(u,f){return u=u>>>0,f||ye(u,4,this.length),e.read(this,u,!1,23,4)},s.prototype.readDoubleLE=function(u,f){return u=u>>>0,f||ye(u,8,this.length),e.read(this,u,!0,52,8)},s.prototype.readDoubleBE=function(u,f){return u=u>>>0,f||ye(u,8,this.length),e.read(this,u,!1,52,8)};function Ce(p,u,f,b,A,T){if(!s.isBuffer(p))throw new TypeError('\"buffer\" argument must be a Buffer instance');if(u>A||up.length)throw new RangeError(\"Index out of range\")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(u,f,b,A){if(u=+u,f=f>>>0,b=b>>>0,!A){let $=Math.pow(2,8*b)-1;Ce(this,u,f,b,$,0)}let T=1,P=0;for(this[f]=u&255;++P>>0,b=b>>>0,!A){let $=Math.pow(2,8*b)-1;Ce(this,u,f,b,$,0)}let T=b-1,P=1;for(this[f+T]=u&255;--T>=0&&(P*=256);)this[f+T]=u/P&255;return f+b},s.prototype.writeUint8=s.prototype.writeUInt8=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,1,255,0),this[f]=u&255,f+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,2,65535,0),this[f]=u&255,this[f+1]=u>>>8,f+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,2,65535,0),this[f]=u>>>8,this[f+1]=u&255,f+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,4,4294967295,0),this[f+3]=u>>>24,this[f+2]=u>>>16,this[f+1]=u>>>8,this[f]=u&255,f+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,4,4294967295,0),this[f]=u>>>24,this[f+1]=u>>>16,this[f+2]=u>>>8,this[f+3]=u&255,f+4};function vl(p,u,f,b,A){Rl(u,b,A,p,f,7);let T=Number(u&BigInt(4294967295));p[f++]=T,T=T>>8,p[f++]=T,T=T>>8,p[f++]=T,T=T>>8,p[f++]=T;let P=Number(u>>BigInt(32)&BigInt(4294967295));return p[f++]=P,P=P>>8,p[f++]=P,P=P>>8,p[f++]=P,P=P>>8,p[f++]=P,f}function El(p,u,f,b,A){Rl(u,b,A,p,f,7);let T=Number(u&BigInt(4294967295));p[f+7]=T,T=T>>8,p[f+6]=T,T=T>>8,p[f+5]=T,T=T>>8,p[f+4]=T;let P=Number(u>>BigInt(32)&BigInt(4294967295));return p[f+3]=P,P=P>>8,p[f+2]=P,P=P>>8,p[f+1]=P,P=P>>8,p[f]=P,f+8}s.prototype.writeBigUInt64LE=Mt(function(u,f=0){return vl(this,u,f,BigInt(0),BigInt(\"0xffffffffffffffff\"))}),s.prototype.writeBigUInt64BE=Mt(function(u,f=0){return El(this,u,f,BigInt(0),BigInt(\"0xffffffffffffffff\"))}),s.prototype.writeIntLE=function(u,f,b,A){if(u=+u,f=f>>>0,!A){let se=Math.pow(2,8*b-1);Ce(this,u,f,b,se-1,-se)}let T=0,P=1,$=0;for(this[f]=u&255;++T>0)-$&255;return f+b},s.prototype.writeIntBE=function(u,f,b,A){if(u=+u,f=f>>>0,!A){let se=Math.pow(2,8*b-1);Ce(this,u,f,b,se-1,-se)}let T=b-1,P=1,$=0;for(this[f+T]=u&255;--T>=0&&(P*=256);)u<0&&$===0&&this[f+T+1]!==0&&($=1),this[f+T]=(u/P>>0)-$&255;return f+b},s.prototype.writeInt8=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,1,127,-128),u<0&&(u=255+u+1),this[f]=u&255,f+1},s.prototype.writeInt16LE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,2,32767,-32768),this[f]=u&255,this[f+1]=u>>>8,f+2},s.prototype.writeInt16BE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,2,32767,-32768),this[f]=u>>>8,this[f+1]=u&255,f+2},s.prototype.writeInt32LE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,4,2147483647,-2147483648),this[f]=u&255,this[f+1]=u>>>8,this[f+2]=u>>>16,this[f+3]=u>>>24,f+4},s.prototype.writeInt32BE=function(u,f,b){return u=+u,f=f>>>0,b||Ce(this,u,f,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[f]=u>>>24,this[f+1]=u>>>16,this[f+2]=u>>>8,this[f+3]=u&255,f+4},s.prototype.writeBigInt64LE=Mt(function(u,f=0){return vl(this,u,f,-BigInt(\"0x8000000000000000\"),BigInt(\"0x7fffffffffffffff\"))}),s.prototype.writeBigInt64BE=Mt(function(u,f=0){return El(this,u,f,-BigInt(\"0x8000000000000000\"),BigInt(\"0x7fffffffffffffff\"))});function Sl(p,u,f,b,A,T){if(f+b>p.length)throw new RangeError(\"Index out of range\");if(f<0)throw new RangeError(\"Index out of range\")}function Al(p,u,f,b,A){return u=+u,f=f>>>0,A||Sl(p,u,f,4),e.write(p,u,f,b,23,4),f+4}s.prototype.writeFloatLE=function(u,f,b){return Al(this,u,f,!0,b)},s.prototype.writeFloatBE=function(u,f,b){return Al(this,u,f,!1,b)};function Il(p,u,f,b,A){return u=+u,f=f>>>0,A||Sl(p,u,f,8),e.write(p,u,f,b,52,8),f+8}s.prototype.writeDoubleLE=function(u,f,b){return Il(this,u,f,!0,b)},s.prototype.writeDoubleBE=function(u,f,b){return Il(this,u,f,!1,b)},s.prototype.copy=function(u,f,b,A){if(!s.isBuffer(u))throw new TypeError(\"argument should be a Buffer\");if(b||(b=0),!A&&A!==0&&(A=this.length),f>=u.length&&(f=u.length),f||(f=0),A>0&&A=this.length)throw new RangeError(\"Index out of range\");if(A<0)throw new RangeError(\"sourceEnd out of bounds\");A>this.length&&(A=this.length),u.length-f>>0,b=b===void 0?this.length:b>>>0,u||(u=0);let T;if(typeof u==\"number\")for(T=f;T2**32?A=Tl(String(f)):typeof f==\"bigint\"&&(A=String(f),(f>BigInt(2)**BigInt(32)||f<-(BigInt(2)**BigInt(32)))&&(A=Tl(A)),A+=\"n\"),b+=` It must be ${u}. Received ${A}`,b},RangeError);function Tl(p){let u=\"\",f=p.length,b=p[0]===\"-\"?1:0;for(;f>=b+4;f-=3)u=`_${p.slice(f-3,f)}${u}`;return`${p.slice(0,f)}${u}`}function jg(p,u,f){Mr(u,\"offset\"),(p[u]===void 0||p[u+f]===void 0)&&fi(u,p.length-(f+1))}function Rl(p,u,f,b,A,T){if(p>f||p3?u===0||u===BigInt(0)?$=`>= 0${P} and < 2${P} ** ${(T+1)*8}${P}`:$=`>= -(2${P} ** ${(T+1)*8-1}${P}) and < 2 ** ${(T+1)*8-1}${P}`:$=`>= ${u}${P} and <= ${f}${P}`,new xr.ERR_OUT_OF_RANGE(\"value\",$,p)}jg(b,A,T)}function Mr(p,u){if(typeof p!=\"number\")throw new xr.ERR_INVALID_ARG_TYPE(u,\"number\",p)}function fi(p,u,f){throw Math.floor(p)!==p?(Mr(p,f),new xr.ERR_OUT_OF_RANGE(f||\"offset\",\"an integer\",p)):u<0?new xr.ERR_BUFFER_OUT_OF_BOUNDS:new xr.ERR_OUT_OF_RANGE(f||\"offset\",`>= ${f?1:0} and <= ${u}`,p)}let Fg=/[^+/0-9A-Za-z-_]/g;function Wg(p){if(p=p.split(\"=\")[0],p=p.trim().replace(Fg,\"\"),p.length<2)return\"\";for(;p.length%4!==0;)p=p+\"=\";return p}function ps(p,u){u=u||1/0;let f,b=p.length,A=null,T=[];for(let P=0;P55295&&f<57344){if(!A){if(f>56319){(u-=3)>-1&&T.push(239,191,189);continue}else if(P+1===b){(u-=3)>-1&&T.push(239,191,189);continue}A=f;continue}if(f<56320){(u-=3)>-1&&T.push(239,191,189),A=f;continue}f=(A-55296<<10|f-56320)+65536}else A&&(u-=3)>-1&&T.push(239,191,189);if(A=null,f<128){if((u-=1)<0)break;T.push(f)}else if(f<2048){if((u-=2)<0)break;T.push(f>>6|192,f&63|128)}else if(f<65536){if((u-=3)<0)break;T.push(f>>12|224,f>>6&63|128,f&63|128)}else if(f<1114112){if((u-=4)<0)break;T.push(f>>18|240,f>>12&63|128,f>>6&63|128,f&63|128)}else throw new Error(\"Invalid code point\")}return T}function $g(p){let u=[];for(let f=0;f>8,A=f%256,T.push(A),T.push(b);return T}function Cl(p){return t.toByteArray(Wg(p))}function ji(p,u,f,b){let A;for(A=0;A=u.length||A>=p.length);++A)u[A+f]=p[A];return A}function Ye(p,u){return p instanceof u||p!=null&&p.constructor!=null&&p.constructor.name!=null&&p.constructor.name===u.name}function gs(p){return p!==p}let Vg=function(){let p=\"0123456789abcdef\",u=new Array(256);for(let f=0;f<16;++f){let b=f*16;for(let A=0;A<16;++A)u[b+A]=p[f]+p[A]}return u}();function Mt(p){return typeof BigInt>\"u\"?zg:p}function zg(){throw new Error(\"BigInt not supported\")}return Zt}var ci,Vu,Hi,zu,Zt,Ku,Ut,x,ty,ry,be=_e(()=>{_();v();m();ci={},Vu=!1;Hi={},zu=!1;Zt={},Ku=!1;Ut=ey();Ut.Buffer;Ut.SlowBuffer;Ut.INSPECT_MAX_BYTES;Ut.kMaxLength;x=Ut.Buffer,ty=Ut.INSPECT_MAX_BYTES,ry=Ut.kMaxLength});var v=_e(()=>{be()});var Gu=M(vs=>{\"use strict\";_();v();m();Object.defineProperty(vs,\"__esModule\",{value:!0});var ms=class{constructor(e){this.aliasToTopic={},this.max=e}put(e,r){return r===0||r>this.max?!1:(this.aliasToTopic[r]=e,this.length=Object.keys(this.aliasToTopic).length,!0)}getTopicByAlias(e){return this.aliasToTopic[e]}clear(){this.aliasToTopic={}}};vs.default=ms});var ce=M((AA,Qu)=>{\"use strict\";_();v();m();Qu.exports={ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Uint8Array}});var Je=M((kA,Ss)=>{\"use strict\";_();v();m();var iy=(be(),X(me)),ny=Object.getPrototypeOf(async function(){}).constructor,Yu=globalThis.Blob||iy.Blob,sy=typeof Yu<\"u\"?function(e){return e instanceof Yu}:function(e){return!1},Es=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r=\"\";for(let i=0;i{t=i,e=n}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((i,...n)=>i?r(i):e(...n))})},debuglog(){return function(){}},format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,i]){let n=e.shift();return i===\"f\"?n.toFixed(6):i===\"j\"?JSON.stringify(n):i===\"s\"&&typeof n==\"object\"?`${n.constructor!==Object?n.constructor.name:\"\"} {}`.trim():n.toString()})},inspect(t){switch(typeof t){case\"string\":if(t.includes(\"'\"))if(t.includes('\"')){if(!t.includes(\"`\")&&!t.includes(\"${\"))return`\\`${t}\\``}else return`\"${t}\"`;return`'${t}'`;case\"number\":return isNaN(t)?\"NaN\":Object.is(t,-0)?String(t):t;case\"bigint\":return`${String(t)}n`;case\"boolean\":case\"undefined\":return String(t);case\"object\":return\"{}\"}},types:{isAsyncFunction(t){return t instanceof ny},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:sy};Ss.exports.promisify.custom=Symbol.for(\"nodejs.util.promisify.custom\")});var zi=M((qA,Vi)=>{\"use strict\";_();v();m();var{AbortController:Ju,AbortSignal:oy}=typeof self<\"u\"?self:typeof window<\"u\"?window:void 0;Vi.exports=Ju;Vi.exports.AbortSignal=oy;Vi.exports.default=Ju});var Ae=M((VA,ef)=>{\"use strict\";_();v();m();var{format:ay,inspect:Ki,AggregateError:ly}=Je(),uy=globalThis.AggregateError||ly,fy=Symbol(\"kIsNodeError\"),cy=[\"string\",\"function\",\"number\",\"object\",\"Function\",\"Object\",\"boolean\",\"bigint\",\"symbol\"],hy=/^([A-Z][a-z0-9]*)+$/,dy=\"__node_internal_\",Gi={};function er(t,e){if(!t)throw new Gi.ERR_INTERNAL_ASSERTION(e)}function Xu(t){let e=\"\",r=t.length,i=t[0]===\"-\"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function py(t,e,r){if(typeof e==\"function\")return er(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let i=(e.match(/%[dfijoOs]/g)||[]).length;return er(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:ay(e,...r)}function ve(t,e,r){r||(r=Error);class i extends r{constructor(...o){super(py(t,e,o))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=t,i.prototype[fy]=!0,Gi[t]=i}function Zu(t){let e=dy+t.name;return Object.defineProperty(t,\"name\",{value:e}),t}function gy(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new uy([e,t],e.message);return r.code=e.code,r}return t||e}var As=class extends Error{constructor(e=\"The operation was aborted\",r=void 0){if(r!==void 0&&typeof r!=\"object\")throw new Gi.ERR_INVALID_ARG_TYPE(\"options\",\"Object\",r);super(e,r),this.code=\"ABORT_ERR\",this.name=\"AbortError\"}};ve(\"ERR_ASSERTION\",\"%s\",Error);ve(\"ERR_INVALID_ARG_TYPE\",(t,e,r)=>{er(typeof t==\"string\",\"'name' must be a string\"),Array.isArray(e)||(e=[e]);let i=\"The \";t.endsWith(\" argument\")?i+=`${t} `:i+=`\"${t}\" ${t.includes(\".\")?\"property\":\"argument\"} `,i+=\"must be \";let n=[],o=[],s=[];for(let l of e)er(typeof l==\"string\",\"All expected entries have to be of type string\"),cy.includes(l)?n.push(l.toLowerCase()):hy.test(l)?o.push(l):(er(l!==\"object\",'The value \"object\" should be written as \"Object\"'),s.push(l));if(o.length>0){let l=n.indexOf(\"object\");l!==-1&&(n.splice(n,l,1),o.push(\"Object\"))}if(n.length>0){switch(n.length){case 1:i+=`of type ${n[0]}`;break;case 2:i+=`one of type ${n[0]} or ${n[1]}`;break;default:{let l=n.pop();i+=`one of type ${n.join(\", \")}, or ${l}`}}(o.length>0||s.length>0)&&(i+=\" or \")}if(o.length>0){switch(o.length){case 1:i+=`an instance of ${o[0]}`;break;case 2:i+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let l=o.pop();i+=`an instance of ${o.join(\", \")}, or ${l}`}}s.length>0&&(i+=\" or \")}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(i+=\"an \"),i+=`${s[0]}`;break;case 2:i+=`one of ${s[0]} or ${s[1]}`;break;default:{let l=s.pop();i+=`one of ${s.join(\", \")}, or ${l}`}}if(r==null)i+=`. Received ${r}`;else if(typeof r==\"function\"&&r.name)i+=`. Received function ${r.name}`;else if(typeof r==\"object\"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)i+=`. Received an instance of ${r.constructor.name}`;else{let l=Ki(r,{depth:-1});i+=`. Received ${l}`}}else{let l=Ki(r,{colors:!1});l.length>25&&(l=`${l.slice(0,25)}...`),i+=`. Received type ${typeof r} (${l})`}return i},TypeError);ve(\"ERR_INVALID_ARG_VALUE\",(t,e,r=\"is invalid\")=>{let i=Ki(e);return i.length>128&&(i=i.slice(0,128)+\"...\"),`The ${t.includes(\".\")?\"property\":\"argument\"} '${t}' ${r}. Received ${i}`},TypeError);ve(\"ERR_INVALID_RETURN_VALUE\",(t,e,r)=>{var i;let n=r!=null&&(i=r.constructor)!==null&&i!==void 0&&i.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the \"${e}\" function but got ${n}.`},TypeError);ve(\"ERR_MISSING_ARGS\",(...t)=>{er(t.length>0,\"At least one arg needs to be specified\");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(i=>`\"${i}\"`).join(\" or \"),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let i=t.pop();e+=`The ${t.join(\", \")}, and ${i} arguments`}break}return`${e} must be specified`},TypeError);ve(\"ERR_OUT_OF_RANGE\",(t,e,r)=>{er(e,'Missing \"range\" argument');let i;return Number.isInteger(r)&&Math.abs(r)>2**32?i=Xu(String(r)):typeof r==\"bigint\"?(i=String(r),(r>2n**32n||r<-(2n**32n))&&(i=Xu(i)),i+=\"n\"):i=Ki(r),`The value of \"${t}\" is out of range. It must be ${e}. Received ${i}`},RangeError);ve(\"ERR_MULTIPLE_CALLBACK\",\"Callback called multiple times\",Error);ve(\"ERR_METHOD_NOT_IMPLEMENTED\",\"The %s method is not implemented\",Error);ve(\"ERR_STREAM_ALREADY_FINISHED\",\"Cannot call %s after a stream was finished\",Error);ve(\"ERR_STREAM_CANNOT_PIPE\",\"Cannot pipe, not readable\",Error);ve(\"ERR_STREAM_DESTROYED\",\"Cannot call %s after a stream was destroyed\",Error);ve(\"ERR_STREAM_NULL_VALUES\",\"May not write null values to stream\",TypeError);ve(\"ERR_STREAM_PREMATURE_CLOSE\",\"Premature close\",Error);ve(\"ERR_STREAM_PUSH_AFTER_EOF\",\"stream.push() after EOF\",Error);ve(\"ERR_STREAM_UNSHIFT_AFTER_END_EVENT\",\"stream.unshift() after end event\",Error);ve(\"ERR_STREAM_WRITE_AFTER_END\",\"write after end\",Error);ve(\"ERR_UNKNOWN_ENCODING\",\"Unknown encoding: %s\",TypeError);ef.exports={AbortError:As,aggregateTwoErrors:Zu(gy),hideStackFrames:Zu,codes:Gi}});var hi=M((XA,ff)=>{\"use strict\";_();v();m();var{ArrayIsArray:Ts,ArrayPrototypeIncludes:sf,ArrayPrototypeJoin:of,ArrayPrototypeMap:yy,NumberIsInteger:Rs,NumberIsNaN:by,NumberMAX_SAFE_INTEGER:wy,NumberMIN_SAFE_INTEGER:_y,NumberParseInt:my,ObjectPrototypeHasOwnProperty:vy,RegExpPrototypeExec:af,String:Ey,StringPrototypeToUpperCase:Sy,StringPrototypeTrim:Ay}=ce(),{hideStackFrames:Ue,codes:{ERR_SOCKET_BAD_PORT:Iy,ERR_INVALID_ARG_TYPE:Ie,ERR_INVALID_ARG_VALUE:Ur,ERR_OUT_OF_RANGE:tr,ERR_UNKNOWN_SIGNAL:tf}}=Ae(),{normalizeEncoding:Ty}=Je(),{isAsyncFunction:Ry,isArrayBufferView:Cy}=Je().types,rf={};function By(t){return t===(t|0)}function Py(t){return t===t>>>0}var ky=/^[0-7]+$/,Oy=\"must be a 32-bit unsigned integer or an octal string\";function xy(t,e,r){if(typeof t>\"u\"&&(t=r),typeof t==\"string\"){if(af(ky,t)===null)throw new Ur(e,t,Oy);t=my(t,8)}return lf(t,e),t}var My=Ue((t,e,r=_y,i=wy)=>{if(typeof t!=\"number\")throw new Ie(e,\"number\",t);if(!Rs(t))throw new tr(e,\"an integer\",t);if(ti)throw new tr(e,`>= ${r} && <= ${i}`,t)}),Ly=Ue((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!=\"number\")throw new Ie(e,\"number\",t);if(!Rs(t))throw new tr(e,\"an integer\",t);if(ti)throw new tr(e,`>= ${r} && <= ${i}`,t)}),lf=Ue((t,e,r=!1)=>{if(typeof t!=\"number\")throw new Ie(e,\"number\",t);if(!Rs(t))throw new tr(e,\"an integer\",t);let i=r?1:0,n=4294967295;if(tn)throw new tr(e,`>= ${i} && <= ${n}`,t)});function Cs(t,e){if(typeof t!=\"string\")throw new Ie(e,\"string\",t)}function Uy(t,e,r=void 0,i){if(typeof t!=\"number\")throw new Ie(e,\"number\",t);if(r!=null&&ti||(r!=null||i!=null)&&by(t))throw new tr(e,`${r!=null?`>= ${r}`:\"\"}${r!=null&&i!=null?\" && \":\"\"}${i!=null?`<= ${i}`:\"\"}`,t)}var Ny=Ue((t,e,r)=>{if(!sf(r,t)){let n=\"must be one of: \"+of(yy(r,o=>typeof o==\"string\"?`'${o}'`:Ey(o)),\", \");throw new Ur(e,t,n)}});function uf(t,e){if(typeof t!=\"boolean\")throw new Ie(e,\"boolean\",t)}function Is(t,e,r){return t==null||!vy(t,e)?r:t[e]}var qy=Ue((t,e,r=null)=>{let i=Is(r,\"allowArray\",!1),n=Is(r,\"allowFunction\",!1);if(!Is(r,\"nullable\",!1)&&t===null||!i&&Ts(t)||typeof t!=\"object\"&&(!n||typeof t!=\"function\"))throw new Ie(e,\"Object\",t)}),Dy=Ue((t,e)=>{if(t!=null&&typeof t!=\"object\"&&typeof t!=\"function\")throw new Ie(e,\"a dictionary\",t)}),Bs=Ue((t,e,r=0)=>{if(!Ts(t))throw new Ie(e,\"Array\",t);if(t.length{if(!Cy(t))throw new Ie(e,[\"Buffer\",\"TypedArray\",\"DataView\"],t)});function Hy(t,e){let r=Ty(e),i=t.length;if(r===\"hex\"&&i%2!==0)throw new Ur(\"encoding\",e,`is invalid for data of length ${i}`)}function Vy(t,e=\"Port\",r=!0){if(typeof t!=\"number\"&&typeof t!=\"string\"||typeof t==\"string\"&&Ay(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new Iy(e,t,r);return t|0}var zy=Ue((t,e)=>{if(t!==void 0&&(t===null||typeof t!=\"object\"||!(\"aborted\"in t)))throw new Ie(e,\"AbortSignal\",t)}),Ky=Ue((t,e)=>{if(typeof t!=\"function\")throw new Ie(e,\"Function\",t)}),Gy=Ue((t,e)=>{if(typeof t!=\"function\"||Ry(t))throw new Ie(e,\"Function\",t)}),Qy=Ue((t,e)=>{if(t!==void 0)throw new Ie(e,\"undefined\",t)});function Yy(t,e,r){if(!sf(r,t))throw new Ie(e,`('${of(r,\"|\")}')`,t)}var Jy=/^(?:<[^>]*>)(?:\\s*;\\s*[^;\"\\s]+(?:=(\")?[^;\"\\s]*\\1)?)*$/;function nf(t,e){if(typeof t>\"u\"||!af(Jy,t))throw new Ur(e,t,'must be an array or string of format \"; rel=preload; as=style\"')}function Xy(t){if(typeof t==\"string\")return nf(t,\"hints\"),t;if(Ts(t)){let e=t.length,r=\"\";if(e===0)return r;for(let i=0;i; rel=preload; as=style\"')}ff.exports={isInt32:By,isUint32:Py,parseFileMode:xy,validateArray:Bs,validateStringArray:jy,validateBooleanArray:Fy,validateBoolean:uf,validateBuffer:$y,validateDictionary:Dy,validateEncoding:Hy,validateFunction:Ky,validateInt32:Ly,validateInteger:My,validateNumber:Uy,validateObject:qy,validateOneOf:Ny,validatePlainFunction:Gy,validatePort:Vy,validateSignalName:Wy,validateString:Cs,validateUint32:lf,validateUndefined:Qy,validateUnion:Yy,validateAbortSignal:zy,validateLinkHeaderValue:Xy}});var Nt=M((sI,pf)=>{_();v();m();var ae=pf.exports={},Xe,Ze;function Ps(){throw new Error(\"setTimeout has not been defined\")}function ks(){throw new Error(\"clearTimeout has not been defined\")}(function(){try{typeof setTimeout==\"function\"?Xe=setTimeout:Xe=Ps}catch{Xe=Ps}try{typeof clearTimeout==\"function\"?Ze=clearTimeout:Ze=ks}catch{Ze=ks}})();function cf(t){if(Xe===setTimeout)return setTimeout(t,0);if((Xe===Ps||!Xe)&&setTimeout)return Xe=setTimeout,setTimeout(t,0);try{return Xe(t,0)}catch{try{return Xe.call(null,t,0)}catch{return Xe.call(this,t,0)}}}function Zy(t){if(Ze===clearTimeout)return clearTimeout(t);if((Ze===ks||!Ze)&&clearTimeout)return Ze=clearTimeout,clearTimeout(t);try{return Ze(t)}catch{try{return Ze.call(null,t)}catch{return Ze.call(this,t)}}}var _t=[],Nr=!1,rr,Qi=-1;function eb(){!Nr||!rr||(Nr=!1,rr.length?_t=rr.concat(_t):Qi=-1,_t.length&&hf())}function hf(){if(!Nr){var t=cf(eb);Nr=!0;for(var e=_t.length;e;){for(rr=_t,_t=[];++Qi1)for(var r=1;r{\"use strict\";_();v();m();var{Symbol:Yi,SymbolAsyncIterator:gf,SymbolIterator:yf,SymbolFor:bf}=ce(),wf=Yi(\"kDestroyed\"),_f=Yi(\"kIsErrored\"),Os=Yi(\"kIsReadable\"),mf=Yi(\"kIsDisturbed\"),tb=bf(\"nodejs.webstream.isClosedPromise\"),rb=bf(\"nodejs.webstream.controllerErrorFunction\");function Ji(t,e=!1){var r;return!!(t&&typeof t.pipe==\"function\"&&typeof t.on==\"function\"&&(!e||typeof t.pause==\"function\"&&typeof t.resume==\"function\")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function Xi(t){var e;return!!(t&&typeof t.write==\"function\"&&typeof t.on==\"function\"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function ib(t){return!!(t&&typeof t.pipe==\"function\"&&t._readableState&&typeof t.on==\"function\"&&typeof t.write==\"function\")}function et(t){return t&&(t._readableState||t._writableState||typeof t.write==\"function\"&&typeof t.on==\"function\"||typeof t.pipe==\"function\"&&typeof t.on==\"function\")}function vf(t){return!!(t&&!et(t)&&typeof t.pipeThrough==\"function\"&&typeof t.getReader==\"function\"&&typeof t.cancel==\"function\")}function Ef(t){return!!(t&&!et(t)&&typeof t.getWriter==\"function\"&&typeof t.abort==\"function\")}function Sf(t){return!!(t&&!et(t)&&typeof t.readable==\"object\"&&typeof t.writable==\"object\")}function nb(t){return vf(t)||Ef(t)||Sf(t)}function sb(t,e){return t==null?!1:e===!0?typeof t[gf]==\"function\":e===!1?typeof t[yf]==\"function\":typeof t[gf]==\"function\"||typeof t[yf]==\"function\"}function Zi(t){if(!et(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!!(t.destroyed||t[wf]||i!=null&&i.destroyed)}function Af(t){if(!Xi(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!=\"boolean\"?null:e.ended}function ob(t,e){if(!Xi(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!=\"boolean\"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function ab(t){if(!Ji(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!=\"boolean\"?null:e.ended}function If(t,e){if(!Ji(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!=\"boolean\"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function Tf(t){return t&&t[Os]!=null?t[Os]:typeof t?.readable!=\"boolean\"?null:Zi(t)?!1:Ji(t)&&t.readable&&!If(t)}function Rf(t){return typeof t?.writable!=\"boolean\"?null:Zi(t)?!1:Xi(t)&&t.writable&&!Af(t)}function lb(t,e){return et(t)?Zi(t)?!0:!(e?.readable!==!1&&Tf(t)||e?.writable!==!1&&Rf(t)):null}function ub(t){var e,r;return et(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function fb(t){var e,r;return et(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function cb(t){if(!et(t))return null;if(typeof t.closed==\"boolean\")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed==\"boolean\"||typeof r?.closed==\"boolean\"?e?.closed||r?.closed:typeof t._closed==\"boolean\"&&Cf(t)?t._closed:null}function Cf(t){return typeof t._closed==\"boolean\"&&typeof t._defaultKeepAlive==\"boolean\"&&typeof t._removedConnection==\"boolean\"&&typeof t._removedContLen==\"boolean\"}function Bf(t){return typeof t._sent100==\"boolean\"&&Cf(t)}function hb(t){var e;return typeof t._consuming==\"boolean\"&&typeof t._dumped==\"boolean\"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function db(t){if(!et(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!i&&Bf(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}function pb(t){var e;return!!(t&&((e=t[mf])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function gb(t){var e,r,i,n,o,s,a,l,c,h;return!!(t&&((e=(r=(i=(n=(o=(s=t[_f])!==null&&s!==void 0?s:t.readableErrored)!==null&&o!==void 0?o:t.writableErrored)!==null&&n!==void 0?n:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&i!==void 0?i:(l=t._writableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&r!==void 0?r:(c=t._readableState)===null||c===void 0?void 0:c.errored)!==null&&e!==void 0?e:!((h=t._writableState)===null||h===void 0)&&h.errored))}Pf.exports={kDestroyed:wf,isDisturbed:pb,kIsDisturbed:mf,isErrored:gb,kIsErrored:_f,isReadable:Tf,kIsReadable:Os,kIsClosedPromise:tb,kControllerErrorFunction:rb,isClosed:cb,isDestroyed:Zi,isDuplexNodeStream:ib,isFinished:lb,isIterable:sb,isReadableNodeStream:Ji,isReadableStream:vf,isReadableEnded:ab,isReadableFinished:If,isReadableErrored:fb,isNodeStream:et,isWebStream:nb,isWritable:Rf,isWritableNodeStream:Xi,isWritableStream:Ef,isWritableEnded:Af,isWritableFinished:ob,isWritableErrored:ub,isServerRequest:hb,isServerResponse:Bf,willEmitClose:db,isTransformStream:Sf}});var vt=M((_I,Ns)=>{_();v();m();var qt=Nt(),{AbortError:Df,codes:yb}=Ae(),{ERR_INVALID_ARG_TYPE:bb,ERR_STREAM_PREMATURE_CLOSE:kf}=yb,{kEmptyObject:Ms,once:Ls}=Je(),{validateAbortSignal:wb,validateFunction:_b,validateObject:mb,validateBoolean:vb}=hi(),{Promise:Eb,PromisePrototypeThen:Sb}=ce(),{isClosed:Ab,isReadable:Of,isReadableNodeStream:xs,isReadableStream:Ib,isReadableFinished:xf,isReadableErrored:Mf,isWritable:Lf,isWritableNodeStream:Uf,isWritableStream:Tb,isWritableFinished:Nf,isWritableErrored:qf,isNodeStream:Rb,willEmitClose:Cb,kIsClosedPromise:Bb}=tt();function Pb(t){return t.setHeader&&typeof t.abort==\"function\"}var Us=()=>{};function jf(t,e,r){var i,n;if(arguments.length===2?(r=e,e=Ms):e==null?e=Ms:mb(e,\"options\"),_b(r,\"callback\"),wb(e.signal,\"options.signal\"),r=Ls(r),Ib(t)||Tb(t))return kb(t,e,r);if(!Rb(t))throw new bb(\"stream\",[\"ReadableStream\",\"WritableStream\",\"Stream\"],t);let o=(i=e.readable)!==null&&i!==void 0?i:xs(t),s=(n=e.writable)!==null&&n!==void 0?n:Uf(t),a=t._writableState,l=t._readableState,c=()=>{t.writable||g()},h=Cb(t)&&xs(t)===o&&Uf(t)===s,d=Nf(t,!1),g=()=>{d=!0,t.destroyed&&(h=!1),!(h&&(!t.readable||o))&&(!o||y)&&r.call(t)},y=xf(t,!1),w=()=>{y=!0,t.destroyed&&(h=!1),!(h&&(!t.writable||s))&&(!s||d)&&r.call(t)},S=N=>{r.call(t,N)},E=Ab(t),I=()=>{E=!0;let N=qf(t)||Mf(t);if(N&&typeof N!=\"boolean\")return r.call(t,N);if(o&&!y&&xs(t,!0)&&!xf(t,!1))return r.call(t,new kf);if(s&&!d&&!Nf(t,!1))return r.call(t,new kf);r.call(t)},C=()=>{E=!0;let N=qf(t)||Mf(t);if(N&&typeof N!=\"boolean\")return r.call(t,N);r.call(t)},R=()=>{t.req.on(\"finish\",g)};Pb(t)?(t.on(\"complete\",g),h||t.on(\"abort\",I),t.req?R():t.on(\"request\",R)):s&&!a&&(t.on(\"end\",c),t.on(\"close\",c)),!h&&typeof t.aborted==\"boolean\"&&t.on(\"aborted\",I),t.on(\"end\",w),t.on(\"finish\",g),e.error!==!1&&t.on(\"error\",S),t.on(\"close\",I),E?qt.nextTick(I):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?h||qt.nextTick(C):(!o&&(!h||Of(t))&&(d||Lf(t)===!1)||!s&&(!h||Lf(t))&&(y||Of(t)===!1)||l&&t.req&&t.aborted)&&qt.nextTick(C);let U=()=>{r=Us,t.removeListener(\"aborted\",I),t.removeListener(\"complete\",g),t.removeListener(\"abort\",I),t.removeListener(\"request\",R),t.req&&t.req.removeListener(\"finish\",g),t.removeListener(\"end\",c),t.removeListener(\"close\",c),t.removeListener(\"finish\",g),t.removeListener(\"end\",w),t.removeListener(\"error\",S),t.removeListener(\"close\",I)};if(e.signal&&!E){let N=()=>{let W=r;U(),W.call(t,new Df(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)qt.nextTick(N);else{let W=r;r=Ls((...K)=>{e.signal.removeEventListener(\"abort\",N),W.apply(t,K)}),e.signal.addEventListener(\"abort\",N)}}return U}function kb(t,e,r){let i=!1,n=Us;if(e.signal)if(n=()=>{i=!0,r.call(t,new Df(void 0,{cause:e.signal.reason}))},e.signal.aborted)qt.nextTick(n);else{let s=r;r=Ls((...a)=>{e.signal.removeEventListener(\"abort\",n),s.apply(t,a)}),e.signal.addEventListener(\"abort\",n)}let o=(...s)=>{i||qt.nextTick(()=>r.apply(t,s))};return Sb(t[Bb].promise,o,o),Us}function Ob(t,e){var r;let i=!1;return e===null&&(e=Ms),(r=e)!==null&&r!==void 0&&r.cleanup&&(vb(e.cleanup,\"cleanup\"),i=e.cleanup),new Eb((n,o)=>{let s=jf(t,e,a=>{i&&s(),a?o(a):n()})})}Ns.exports=jf;Ns.exports.finished=Ob});var ir=M((TI,Gf)=>{\"use strict\";_();v();m();var rt=Nt(),{aggregateTwoErrors:xb,codes:{ERR_MULTIPLE_CALLBACK:Mb},AbortError:Lb}=Ae(),{Symbol:$f}=ce(),{kDestroyed:Ub,isDestroyed:Nb,isFinished:qb,isServerRequest:Db}=tt(),Hf=$f(\"kDestroy\"),qs=$f(\"kConstruct\");function Vf(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function jb(t,e){let r=this._readableState,i=this._writableState,n=i||r;return i!=null&&i.destroyed||r!=null&&r.destroyed?(typeof e==\"function\"&&e(),this):(Vf(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?Ff(this,t,e):this.once(Hf,function(o){Ff(this,xb(o,t),e)}),this)}function Ff(t,e,r){let i=!1;function n(o){if(i)return;i=!0;let s=t._readableState,a=t._writableState;Vf(o,a,s),a&&(a.closed=!0),s&&(s.closed=!0),typeof r==\"function\"&&r(o),o?rt.nextTick(Fb,t,o):rt.nextTick(zf,t)}try{t._destroy(e||null,n)}catch(o){n(o)}}function Fb(t,e){Ds(t,e),zf(t)}function zf(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit(\"close\")}function Ds(t,e){let r=t._readableState,i=t._writableState;i!=null&&i.errorEmitted||r!=null&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit(\"error\",e))}function Wb(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function js(t,e,r){let i=t._readableState,n=t._writableState;if(n!=null&&n.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||n!=null&&n.autoDestroy?t.destroy(e):e&&(e.stack,n&&!n.errored&&(n.errored=e),i&&!i.errored&&(i.errored=e),r?rt.nextTick(Ds,t,e):Ds(t,e))}function $b(t,e){if(typeof t._construct!=\"function\")return;let r=t._readableState,i=t._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),t.once(qs,e),!(t.listenerCount(qs)>1)&&rt.nextTick(Hb,t)}function Hb(t){let e=!1;function r(i){if(e){js(t,i??new Mb);return}e=!0;let n=t._readableState,o=t._writableState,s=o||n;n&&(n.constructed=!0),o&&(o.constructed=!0),s.destroyed?t.emit(Hf,i):i?js(t,i,!0):rt.nextTick(Vb,t)}try{t._construct(i=>{rt.nextTick(r,i)})}catch(i){rt.nextTick(r,i)}}function Vb(t){t.emit(qs)}function Wf(t){return t?.setHeader&&typeof t.abort==\"function\"}function Kf(t){t.emit(\"close\")}function zb(t,e){t.emit(\"error\",e),rt.nextTick(Kf,t)}function Kb(t,e){!t||Nb(t)||(!e&&!qb(t)&&(e=new Lb),Db(t)?(t.socket=null,t.destroy(e)):Wf(t)?t.abort():Wf(t.req)?t.req.abort():typeof t.destroy==\"function\"?t.destroy(e):typeof t.close==\"function\"?t.close():e?rt.nextTick(zb,t,e):rt.nextTick(Kf,t),t.destroyed||(t[Ub]=!0))}Gf.exports={construct:$b,destroyer:Kb,destroy:jb,undestroy:Wb,errorOrDestroy:js}});function Y(){Y.init.call(this)}function en(t){if(typeof t!=\"function\")throw new TypeError('The \"listener\" argument must be of type Function. Received type '+typeof t)}function nc(t){return t._maxListeners===void 0?Y.defaultMaxListeners:t._maxListeners}function Xf(t,e,r,i){var n,o,s,a;if(en(r),(o=t._events)===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit(\"newListener\",e,r.listener?r.listener:r),o=t._events),s=o[e]),s===void 0)s=o[e]=r,++t._eventsCount;else if(typeof s==\"function\"?s=o[e]=i?[r,s]:[s,r]:i?s.unshift(r):s.push(r),(n=nc(t))>0&&s.length>n&&!s.warned){s.warned=!0;var l=new Error(\"Possible EventEmitter memory leak detected. \"+s.length+\" \"+String(e)+\" listeners added. Use emitter.setMaxListeners() to increase limit\");l.name=\"MaxListenersExceededWarning\",l.emitter=t,l.type=e,l.count=s.length,a=l,console&&console.warn&&console.warn(a)}return t}function Gb(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Zf(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=Gb.bind(i);return n.listener=r,i.wrapFn=n,n}function ec(t,e,r){var i=t._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n==\"function\"?r?[n.listener||n]:[n]:r?function(o){for(var s=new Array(o.length),a=0;a{_();v();m();qr=typeof Reflect==\"object\"?Reflect:null,Qf=qr&&typeof qr.apply==\"function\"?qr.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};ic=qr&&typeof qr.ownKeys==\"function\"?qr.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};Yf=Number.isNaN||function(t){return t!=t};rc=Y,Y.EventEmitter=Y,Y.prototype._events=void 0,Y.prototype._eventsCount=0,Y.prototype._maxListeners=void 0;Jf=10;Object.defineProperty(Y,\"defaultMaxListeners\",{enumerable:!0,get:function(){return Jf},set:function(t){if(typeof t!=\"number\"||t<0||Yf(t))throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received '+t+\".\");Jf=t}}),Y.init=function(){this._events!==void 0&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Y.prototype.setMaxListeners=function(t){if(typeof t!=\"number\"||t<0||Yf(t))throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received '+t+\".\");return this._maxListeners=t,this},Y.prototype.getMaxListeners=function(){return nc(this)},Y.prototype.emit=function(t){for(var e=[],r=1;r0&&(o=e[0]),o instanceof Error)throw o;var s=new Error(\"Unhandled error.\"+(o?\" (\"+o.message+\")\":\"\"));throw s.context=o,s}var a=n[t];if(a===void 0)return!1;if(typeof a==\"function\")Qf(a,this,e);else{var l=a.length,c=sc(a,l);for(r=0;r=0;o--)if(r[o]===e||r[o].listener===e){s=r[o].listener,n=o;break}if(n<0)return this;n===0?r.shift():function(a,l){for(;l+1=0;i--)this.removeListener(t,e[i]);return this},Y.prototype.listeners=function(t){return ec(this,t,!0)},Y.prototype.rawListeners=function(t){return ec(this,t,!1)},Y.listenerCount=function(t,e){return typeof t.listenerCount==\"function\"?t.listenerCount(e):tc.call(t,e)},Y.prototype.listenerCount=tc,Y.prototype.eventNames=function(){return this._eventsCount>0?ic(this._events):[]};Be=rc;Be.EventEmitter;Be.defaultMaxListeners;Be.init;Be.listenerCount;Be.EventEmitter;Be.defaultMaxListeners;Be.init;Be.listenerCount});var nr={};Jt(nr,{EventEmitter:()=>Qb,default:()=>Be,defaultMaxListeners:()=>Yb,init:()=>Jb,listenerCount:()=>Xb,on:()=>Zb,once:()=>ew});var Qb,Yb,Jb,Xb,Zb,ew,sr=_e(()=>{_();v();m();Fs();Fs();Be.once=function(t,e){return new Promise((r,i)=>{function n(...s){o!==void 0&&t.removeListener(\"error\",o),r(s)}let o;e!==\"error\"&&(o=s=>{t.removeListener(name,n),i(s)},t.once(\"error\",o)),t.once(e,n)})};Be.on=function(t,e){let r=[],i=[],n=null,o=!1,s={async next(){let c=r.shift();if(c)return createIterResult(c,!1);if(n){let h=Promise.reject(n);return n=null,h}return o?createIterResult(void 0,!0):new Promise((h,d)=>i.push({resolve:h,reject:d}))},async return(){t.removeListener(e,a),t.removeListener(\"error\",l),o=!0;for(let c of i)c.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(c){n=c,t.removeListener(e,a),t.removeListener(\"error\",l)},[Symbol.asyncIterator](){return this}};return t.on(e,a),t.on(\"error\",l),s;function a(...c){let h=i.shift();h?h.resolve(createIterResult(c,!1)):r.push(c)}function l(c){o=!0;let h=i.shift();h?h.reject(c):n=c,s.return()}};({EventEmitter:Qb,defaultMaxListeners:Yb,init:Jb,listenerCount:Xb,on:Zb,once:ew}=Be)});var nn=M((GI,ac)=>{\"use strict\";_();v();m();var{ArrayIsArray:tw,ObjectSetPrototypeOf:oc}=ce(),{EventEmitter:tn}=(sr(),X(nr));function rn(t){tn.call(this,t)}oc(rn.prototype,tn.prototype);oc(rn,tn);rn.prototype.pipe=function(t,e){let r=this;function i(h){t.writable&&t.write(h)===!1&&r.pause&&r.pause()}r.on(\"data\",i);function n(){r.readable&&r.resume&&r.resume()}t.on(\"drain\",n),!t._isStdio&&(!e||e.end!==!1)&&(r.on(\"end\",s),r.on(\"close\",a));let o=!1;function s(){o||(o=!0,t.end())}function a(){o||(o=!0,typeof t.destroy==\"function\"&&t.destroy())}function l(h){c(),tn.listenerCount(this,\"error\")===0&&this.emit(\"error\",h)}Ws(r,\"error\",l),Ws(t,\"error\",l);function c(){r.removeListener(\"data\",i),t.removeListener(\"drain\",n),r.removeListener(\"end\",s),r.removeListener(\"close\",a),r.removeListener(\"error\",l),t.removeListener(\"error\",l),r.removeListener(\"end\",c),r.removeListener(\"close\",c),t.removeListener(\"close\",c)}return r.on(\"end\",c),r.on(\"close\",c),t.on(\"close\",c),t.emit(\"pipe\",r),t};function Ws(t,e,r){if(typeof t.prependListener==\"function\")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):tw(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}ac.exports={Stream:rn,prependListener:Ws}});var di=M((tT,sn)=>{\"use strict\";_();v();m();var{AbortError:lc,codes:rw}=Ae(),{isNodeStream:uc,isWebStream:iw,kControllerErrorFunction:nw}=tt(),sw=vt(),{ERR_INVALID_ARG_TYPE:fc}=rw,ow=(t,e)=>{if(typeof t!=\"object\"||!(\"aborted\"in t))throw new fc(e,\"AbortSignal\",t)};sn.exports.addAbortSignal=function(e,r){if(ow(e,\"signal\"),!uc(r)&&!iw(r))throw new fc(\"stream\",[\"ReadableStream\",\"WritableStream\",\"Stream\"],r);return sn.exports.addAbortSignalNoValidate(e,r)};sn.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!=\"object\"||!(\"aborted\"in t))return e;let r=uc(e)?()=>{e.destroy(new lc(void 0,{cause:t.reason}))}:()=>{e[nw](new lc(void 0,{cause:t.reason}))};return t.aborted?r():(t.addEventListener(\"abort\",r),sw(e,()=>t.removeEventListener(\"abort\",r))),e}});var dc=M((uT,hc)=>{\"use strict\";_();v();m();var{StringPrototypeSlice:cc,SymbolIterator:aw,TypedArrayPrototypeSet:on,Uint8Array:lw}=ce(),{Buffer:$s}=(be(),X(me)),{inspect:uw}=Je();hc.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return\"\";let r=this.head,i=\"\"+r.data;for(;(r=r.next)!==null;)i+=e+r.data;return i}concat(e){if(this.length===0)return $s.alloc(0);let r=$s.allocUnsafe(e>>>0),i=this.head,n=0;for(;i;)on(r,i.data,n),n+=i.data.length,i=i.next;return r}consume(e,r){let i=this.head.data;if(eo.length)r+=o,e-=o.length;else{e===o.length?(r+=o,++n,i.next?this.head=i.next:this.head=this.tail=null):(r+=cc(o,0,e),this.head=i,i.data=cc(o,e));break}++n}while((i=i.next)!==null);return this.length-=n,r}_getBuffer(e){let r=$s.allocUnsafe(e),i=e,n=this.head,o=0;do{let s=n.data;if(e>s.length)on(r,s,i-e),e-=s.length;else{e===s.length?(on(r,s,i-e),++o,n.next?this.head=n.next:this.head=this.tail=null):(on(r,new lw(s.buffer,s.byteOffset,e),i-e),this.head=n,n.data=s.slice(e));break}++o}while((n=n.next)!==null);return this.length-=o,r}[Symbol.for(\"nodejs.util.inspect.custom\")](e,r){return uw(this,{...r,depth:0,customInspect:!1})}}});var an=M((yT,gc)=>{\"use strict\";_();v();m();var{MathFloor:fw,NumberIsInteger:cw}=ce(),{ERR_INVALID_ARG_VALUE:hw}=Ae().codes;function dw(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function pc(t){return t?16:16*1024}function pw(t,e,r,i){let n=dw(e,i,r);if(n!=null){if(!cw(n)||n<0){let o=i?`options.${r}`:\"options.highWaterMark\";throw new hw(o,n)}return fw(n)}return pc(t.objectMode)}gc.exports={getHighWaterMark:pw,getDefaultHighWaterMark:pc}});function wc(t){var e=t.length;if(e%4>0)throw new Error(\"Invalid string. Length must be a multiple of 4\");var r=t.indexOf(\"=\");return r===-1&&(r=e),[r,r===e?0:4-r%4]}function gw(t,e,r){for(var i,n,o=[],s=e;s>18&63]+$e[n>>12&63]+$e[n>>6&63]+$e[63&n]);return o.join(\"\")}function Et(t){if(t>2147483647)throw new RangeError('The value \"'+t+'\" is invalid for option \"size\"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,O.prototype),e}function O(t,e,r){if(typeof t==\"number\"){if(typeof e==\"string\")throw new TypeError('The \"string\" argument must be of type string. Received type number');return Ks(t)}return Cc(t,e,r)}function Cc(t,e,r){if(typeof t==\"string\")return function(o,s){if(typeof s==\"string\"&&s!==\"\"||(s=\"utf8\"),!O.isEncoding(s))throw new TypeError(\"Unknown encoding: \"+s);var a=0|Pc(o,s),l=Et(a),c=l.write(o,s);return c!==a&&(l=l.slice(0,c)),l}(t,e);if(ArrayBuffer.isView(t))return Hs(t);if(t==null)throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof t);if(St(t,ArrayBuffer)||t&&St(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<\"u\"&&(St(t,SharedArrayBuffer)||t&&St(t.buffer,SharedArrayBuffer)))return mc(t,e,r);if(typeof t==\"number\")throw new TypeError('The \"value\" argument must not be of type number. Received type number');var i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return O.from(i,e,r);var n=function(o){if(O.isBuffer(o)){var s=0|Ys(o.length),a=Et(s);return a.length===0||o.copy(a,0,0,s),a}if(o.length!==void 0)return typeof o.length!=\"number\"||Js(o.length)?Et(0):Hs(o);if(o.type===\"Buffer\"&&Array.isArray(o.data))return Hs(o.data)}(t);if(n)return n;if(typeof Symbol<\"u\"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]==\"function\")return O.from(t[Symbol.toPrimitive](\"string\"),e,r);throw new TypeError(\"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type \"+typeof t)}function Bc(t){if(typeof t!=\"number\")throw new TypeError('\"size\" argument must be of type number');if(t<0)throw new RangeError('The value \"'+t+'\" is invalid for option \"size\"')}function Ks(t){return Bc(t),Et(t<0?0:0|Ys(t))}function Hs(t){for(var e=t.length<0?0:0|Ys(t.length),r=Et(e),i=0;i=2147483647)throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\"+2147483647 .toString(16)+\" bytes\");return 0|t}function Pc(t,e){if(O.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||St(t,ArrayBuffer))return t.byteLength;if(typeof t!=\"string\")throw new TypeError('The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;for(var n=!1;;)switch(e){case\"ascii\":case\"latin1\":case\"binary\":return r;case\"utf8\":case\"utf-8\":return Gs(t).length;case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return 2*r;case\"hex\":return r>>>1;case\"base64\":return Mc(t).length;default:if(n)return i?-1:Gs(t).length;e=(\"\"+e).toLowerCase(),n=!0}}function bw(t,e,r){var i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0)<=(e>>>=0))return\"\";for(t||(t=\"utf8\");;)switch(t){case\"hex\":return Tw(this,e,r);case\"utf8\":case\"utf-8\":return Oc(this,e,r);case\"ascii\":return Aw(this,e,r);case\"latin1\":case\"binary\":return Iw(this,e,r);case\"base64\":return Sw(this,e,r);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return Rw(this,e,r);default:if(i)throw new TypeError(\"Unknown encoding: \"+t);t=(t+\"\").toLowerCase(),i=!0}}function ar(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function vc(t,e,r,i,n){if(t.length===0)return-1;if(typeof r==\"string\"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Js(r=+r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if(typeof e==\"string\"&&(e=O.from(e,i)),O.isBuffer(e))return e.length===0?-1:Ec(t,e,r,i,n);if(typeof e==\"number\")return e&=255,typeof Uint8Array.prototype.indexOf==\"function\"?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Ec(t,[e],r,i,n);throw new TypeError(\"val must be string, number or Buffer\")}function Ec(t,e,r,i,n){var o,s=1,a=t.length,l=e.length;if(i!==void 0&&((i=String(i).toLowerCase())===\"ucs2\"||i===\"ucs-2\"||i===\"utf16le\"||i===\"utf-16le\")){if(t.length<2||e.length<2)return-1;s=2,a/=2,l/=2,r/=2}function c(y,w){return s===1?y[w]:y.readUInt16BE(w*s)}if(n){var h=-1;for(o=r;oa&&(r=a-l),o=r;o>=0;o--){for(var d=!0,g=0;gn&&(i=n):i=n;var o=e.length;i>o/2&&(i=o/2);for(var s=0;s>8,l=s%256,c.push(l),c.push(a);return c}(e,t.length-r),t,r,i)}function Sw(t,e,r){return e===0&&r===t.length?zs.fromByteArray(t):zs.fromByteArray(t.slice(e,r))}function Oc(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:c>223?3:c>191?2:1;if(n+d<=r)switch(d){case 1:c<128&&(h=c);break;case 2:(192&(o=t[n+1]))==128&&(l=(31&c)<<6|63&o)>127&&(h=l);break;case 3:o=t[n+1],s=t[n+2],(192&o)==128&&(192&s)==128&&(l=(15&c)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(h=l);break;case 4:o=t[n+1],s=t[n+2],a=t[n+3],(192&o)==128&&(192&s)==128&&(192&a)==128&&(l=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(h=l)}h===null?(h=65533,d=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h),n+=d}return function(g){var y=g.length;if(y<=4096)return String.fromCharCode.apply(String,g);for(var w=\"\",S=0;Si)&&(r=i);for(var n=\"\",o=e;or)throw new RangeError(\"Trying to access beyond buffer length\")}function Pe(t,e,r,i,n,o){if(!O.isBuffer(t))throw new TypeError('\"buffer\" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError(\"Index out of range\")}function xc(t,e,r,i,n,o){if(r+i>t.length)throw new RangeError(\"Index out of range\");if(r<0)throw new RangeError(\"Index out of range\")}function Sc(t,e,r,i,n){return e=+e,r>>>=0,n||xc(t,0,r,4),Dr.write(t,e,r,i,23,4),r+4}function Ac(t,e,r,i,n){return e=+e,r>>>=0,n||xc(t,0,r,8),Dr.write(t,e,r,i,52,8),r+8}function Gs(t,e){var r;e=e||1/0;for(var i=t.length,n=null,o=[],s=0;s55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error(\"Invalid code point\");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Mc(t){return zs.toByteArray(function(e){if((e=(e=e.split(\"=\")[0]).trim().replace(Cw,\"\")).length<2)return\"\";for(;e.length%4!=0;)e+=\"=\";return e}(t))}function cn(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function St(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Js(t){return t!=t}function Ic(t,e){for(var r in t)e[r]=t[r]}function lr(t,e,r){return it(t,e,r)}function pi(t){var e;switch(this.encoding=function(r){var i=function(n){if(!n)return\"utf8\";for(var o;;)switch(n){case\"utf8\":case\"utf-8\":return\"utf8\";case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return\"utf16le\";case\"latin1\":case\"binary\":return\"latin1\";case\"base64\":case\"ascii\":case\"hex\":return n;default:if(o)return;n=(\"\"+n).toLowerCase(),o=!0}}(r);if(typeof i!=\"string\"&&(Qs.isEncoding===Tc||!Tc(r)))throw new Error(\"Unknown encoding: \"+r);return i||r}(t),this.encoding){case\"utf16le\":this.text=Ow,this.end=xw,e=4;break;case\"utf8\":this.fillLast=kw,e=4;break;case\"base64\":this.text=Mw,this.end=Lw,e=3;break;default:return this.write=Uw,this.end=Nw,void 0}this.lastNeed=0,this.lastTotal=0,this.lastChar=Qs.allocUnsafe(e)}function Vs(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function kw(t){var e=this.lastTotal-this.lastNeed,r=function(i,n,o){if((192&n[0])!=128)return i.lastNeed=0,\"\\uFFFD\";if(i.lastNeed>1&&n.length>1){if((192&n[1])!=128)return i.lastNeed=1,\"\\uFFFD\";if(i.lastNeed>2&&n.length>2&&(192&n[2])!=128)return i.lastNeed=2,\"\\uFFFD\"}}(this,t);return r!==void 0?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length,void 0)}function Ow(t,e){if((t.length-e)%2==0){var r=t.toString(\"utf16le\",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString(\"utf16le\",e,t.length-1)}function xw(t){var e=t&&t.length?this.write(t):\"\";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString(\"utf16le\",0,r)}return e}function Mw(t,e){var r=(t.length-e)%3;return r===0?t.toString(\"base64\",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString(\"base64\",e,t.length-r))}function Lw(t){var e=t&&t.length?this.write(t):\"\";return this.lastNeed?e+this.lastChar.toString(\"base64\",0,3-this.lastNeed):e}function Uw(t){return t.toString(this.encoding)}function Nw(t){return t&&t.length?this.write(t):\"\"}var Rc,$e,Oe,yc,ln,or,bc,yw,At,zs,Dr,_c,Cw,Bw,un,fn,it,Pw,ur,Qs,Tc,Xs=_e(()=>{_();v();m();for(Rc={byteLength:function(t){var e=wc(t),r=e[0],i=e[1];return 3*(r+i)/4-i},toByteArray:function(t){var e,r,i=wc(t),n=i[0],o=i[1],s=new yc(function(c,h,d){return 3*(h+d)/4-d}(0,n,o)),a=0,l=o>0?n-4:n;for(r=0;r>16&255,s[a++]=e>>8&255,s[a++]=255&e;return o===2&&(e=Oe[t.charCodeAt(r)]<<2|Oe[t.charCodeAt(r+1)]>>4,s[a++]=255&e),o===1&&(e=Oe[t.charCodeAt(r)]<<10|Oe[t.charCodeAt(r+1)]<<4|Oe[t.charCodeAt(r+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s},fromByteArray:function(t){for(var e,r=t.length,i=r%3,n=[],o=0,s=r-i;os?s:o+16383));return i===1?(e=t[r-1],n.push($e[e>>2]+$e[e<<4&63]+\"==\")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push($e[e>>10]+$e[e>>4&63]+$e[e<<2&63]+\"=\")),n.join(\"\")}},$e=[],Oe=[],yc=typeof Uint8Array<\"u\"?Uint8Array:Array,ln=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",or=0,bc=ln.length;or>1,h=-7,d=r?n-1:0,g=r?-1:1,y=t[e+d];for(d+=g,o=y&(1<<-h)-1,y>>=-h,h+=a;h>0;o=256*o+t[e+d],d+=g,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=i;h>0;s=256*s+t[e+d],d+=g,h-=8);if(o===0)o=1-c;else{if(o===l)return s?NaN:1/0*(y?-1:1);s+=Math.pow(2,i),o-=c}return(y?-1:1)*s*Math.pow(2,o-i)},write:function(t,e,r,i,n,o){var s,a,l,c=8*o-n-1,h=(1<>1,g=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=i?0:o-1,w=i?1:-1,S=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),(e+=s+d>=1?g/l:g*Math.pow(2,1-d))*l>=2&&(s++,l/=2),s+d>=h?(a=0,s=h):s+d>=1?(a=(e*l-1)*Math.pow(2,n),s+=d):(a=e*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;t[r+y]=255&a,y+=w,a/=256,n-=8);for(s=s<0;t[r+y]=255&s,y+=w,s/=256,c-=8);t[r+y-w]|=128*S}},At={},zs=Rc,Dr=yw,_c=typeof Symbol==\"function\"&&typeof Symbol.for==\"function\"?Symbol.for(\"nodejs.util.inspect.custom\"):null;At.Buffer=O,At.SlowBuffer=function(t){return+t!=t&&(t=0),O.alloc(+t)},At.INSPECT_MAX_BYTES=50;At.kMaxLength=2147483647,O.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}(),O.TYPED_ARRAY_SUPPORT||typeof console>\"u\"||typeof console.error!=\"function\"||console.error(\"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.\"),Object.defineProperty(O.prototype,\"parent\",{enumerable:!0,get:function(){if(O.isBuffer(this))return this.buffer}}),Object.defineProperty(O.prototype,\"offset\",{enumerable:!0,get:function(){if(O.isBuffer(this))return this.byteOffset}}),O.poolSize=8192,O.from=function(t,e,r){return Cc(t,e,r)},Object.setPrototypeOf(O.prototype,Uint8Array.prototype),Object.setPrototypeOf(O,Uint8Array),O.alloc=function(t,e,r){return function(i,n,o){return Bc(i),i<=0?Et(i):n!==void 0?typeof o==\"string\"?Et(i).fill(n,o):Et(i).fill(n):Et(i)}(t,e,r)},O.allocUnsafe=function(t){return Ks(t)},O.allocUnsafeSlow=function(t){return Ks(t)},O.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==O.prototype},O.compare=function(t,e){if(St(t,Uint8Array)&&(t=O.from(t,t.offset,t.byteLength)),St(e,Uint8Array)&&(e=O.from(e,e.offset,e.byteLength)),!O.isBuffer(t)||!O.isBuffer(e))throw new TypeError('The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,i=e.length,n=0,o=Math.min(r,i);ne&&(t+=\" ... \"),\"\"},_c&&(O.prototype[_c]=O.prototype.inspect),O.prototype.compare=function(t,e,r,i,n){if(St(t,Uint8Array)&&(t=O.from(t,t.offset,t.byteLength)),!O.isBuffer(t))throw new TypeError('The \"target\" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),n===void 0&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError(\"out of range index\");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(n>>>=0)-(i>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),l=this.slice(i,n),c=t.slice(e,r),h=0;h>>=0,isFinite(r)?(r>>>=0,i===void 0&&(i=\"utf8\")):(i=r,r=void 0)}var n=this.length-e;if((r===void 0||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError(\"Attempt to write outside buffer bounds\");i||(i=\"utf8\");for(var o=!1;;)switch(i){case\"hex\":return ww(this,t,e,r);case\"utf8\":case\"utf-8\":return _w(this,t,e,r);case\"ascii\":return kc(this,t,e,r);case\"latin1\":case\"binary\":return mw(this,t,e,r);case\"base64\":return vw(this,t,e,r);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return Ew(this,t,e,r);default:if(o)throw new TypeError(\"Unknown encoding: \"+i);i=(\"\"+i).toLowerCase(),o=!0}},O.prototype.toJSON=function(){return{type:\"Buffer\",data:Array.prototype.slice.call(this._arr||this,0)}};O.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=e===void 0?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||we(t,e,this.length);for(var i=this[t],n=1,o=0;++o>>=0,e>>>=0,r||we(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},O.prototype.readUInt8=function(t,e){return t>>>=0,e||we(t,1,this.length),this[t]},O.prototype.readUInt16LE=function(t,e){return t>>>=0,e||we(t,2,this.length),this[t]|this[t+1]<<8},O.prototype.readUInt16BE=function(t,e){return t>>>=0,e||we(t,2,this.length),this[t]<<8|this[t+1]},O.prototype.readUInt32LE=function(t,e){return t>>>=0,e||we(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},O.prototype.readUInt32BE=function(t,e){return t>>>=0,e||we(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},O.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||we(t,e,this.length);for(var i=this[t],n=1,o=0;++o=(n*=128)&&(i-=Math.pow(2,8*e)),i},O.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||we(t,e,this.length);for(var i=e,n=1,o=this[t+--i];i>0&&(n*=256);)o+=this[t+--i]*n;return o>=(n*=128)&&(o-=Math.pow(2,8*e)),o},O.prototype.readInt8=function(t,e){return t>>>=0,e||we(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},O.prototype.readInt16LE=function(t,e){t>>>=0,e||we(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},O.prototype.readInt16BE=function(t,e){t>>>=0,e||we(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},O.prototype.readInt32LE=function(t,e){return t>>>=0,e||we(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},O.prototype.readInt32BE=function(t,e){return t>>>=0,e||we(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},O.prototype.readFloatLE=function(t,e){return t>>>=0,e||we(t,4,this.length),Dr.read(this,t,!0,23,4)},O.prototype.readFloatBE=function(t,e){return t>>>=0,e||we(t,4,this.length),Dr.read(this,t,!1,23,4)},O.prototype.readDoubleLE=function(t,e){return t>>>=0,e||we(t,8,this.length),Dr.read(this,t,!0,52,8)},O.prototype.readDoubleBE=function(t,e){return t>>>=0,e||we(t,8,this.length),Dr.read(this,t,!1,52,8)},O.prototype.writeUIntLE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||Pe(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,i||Pe(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,o=1;for(this[e+n]=255&t;--n>=0&&(o*=256);)this[e+n]=t/o&255;return e+r},O.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,1,255,0),this[e]=255&t,e+1},O.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},O.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},O.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},O.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},O.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);Pe(this,t,e,r,n-1,-n)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+r},O.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);Pe(this,t,e,r,n-1,-n)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&a===0&&this[e+o+1]!==0&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},O.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},O.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},O.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},O.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},O.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||Pe(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},O.prototype.writeFloatLE=function(t,e,r){return Sc(this,t,e,!0,r)},O.prototype.writeFloatBE=function(t,e,r){return Sc(this,t,e,!1,r)},O.prototype.writeDoubleLE=function(t,e,r){return Ac(this,t,e,!0,r)},O.prototype.writeDoubleBE=function(t,e,r){return Ac(this,t,e,!1,r)},O.prototype.copy=function(t,e,r,i){if(!O.isBuffer(t))throw new TypeError(\"argument should be a Buffer\");if(r||(r=0),i||i===0||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError(\"Index out of range\");if(i<0)throw new RangeError(\"sourceEnd out of bounds\");i>this.length&&(i=this.length),t.length-e=0;--o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,i),e);return n},O.prototype.fill=function(t,e,r,i){if(typeof t==\"string\"){if(typeof e==\"string\"?(i=e,e=0,r=this.length):typeof r==\"string\"&&(i=r,r=this.length),i!==void 0&&typeof i!=\"string\")throw new TypeError(\"encoding must be a string\");if(typeof i==\"string\"&&!O.isEncoding(i))throw new TypeError(\"Unknown encoding: \"+i);if(t.length===1){var n=t.charCodeAt(0);(i===\"utf8\"&&n<128||i===\"latin1\")&&(t=n)}}else typeof t==\"number\"?t&=255:typeof t==\"boolean\"&&(t=Number(t));if(e<0||this.length>>=0,r=r===void 0?this.length:r>>>0,t||(t=0),typeof t==\"number\")for(o=e;o=0?(l>0&&(n.lastNeed=l-1),l):--a=0?(l>0&&(n.lastNeed=l-2),l):--a=0?(l>0&&(l===2?l=0:n.lastNeed=l-3),l):0}(this,t,e);if(!this.lastNeed)return t.toString(\"utf8\",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString(\"utf8\",e,i)},pi.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};ur.StringDecoder;ur.StringDecoder});var Lc={};Jt(Lc,{StringDecoder:()=>qw,default:()=>ur});var qw,Uc=_e(()=>{_();v();m();Xs();Xs();qw=ur.StringDecoder});var Zs=M((qT,jc)=>{\"use strict\";_();v();m();var Nc=Nt(),{PromisePrototypeThen:Dw,SymbolAsyncIterator:qc,SymbolIterator:Dc}=ce(),{Buffer:jw}=(be(),X(me)),{ERR_INVALID_ARG_TYPE:Fw,ERR_STREAM_NULL_VALUES:Ww}=Ae().codes;function $w(t,e,r){let i;if(typeof e==\"string\"||e instanceof jw)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let n;if(e&&e[qc])n=!0,i=e[qc]();else if(e&&e[Dc])n=!1,i=e[Dc]();else throw new Fw(\"iterable\",[\"Iterable\"],e);let o=new t({objectMode:!0,highWaterMark:1,...r}),s=!1;o._read=function(){s||(s=!0,l())},o._destroy=function(c,h){Dw(a(c),()=>Nc.nextTick(h,c),d=>Nc.nextTick(h,d||c))};async function a(c){let h=c!=null,d=typeof i.throw==\"function\";if(h&&d){let{value:g,done:y}=await i.throw(c);if(await g,y)return}if(typeof i.return==\"function\"){let{value:g}=await i.return();await g}}async function l(){for(;;){try{let{value:c,done:h}=n?await i.next():i.next();if(h)o.push(null);else{let d=c&&typeof c.then==\"function\"?await c:c;if(d===null)throw s=!1,new Ww;if(o.push(d))continue;s=!1}}catch(c){o.destroy(c)}break}}return o}jc.exports=$w});var gi=M((VT,Zc)=>{_();v();m();var He=Nt(),{ArrayPrototypeIndexOf:Hw,NumberIsInteger:Vw,NumberIsNaN:zw,NumberParseInt:Kw,ObjectDefineProperties:$c,ObjectKeys:Gw,ObjectSetPrototypeOf:Hc,Promise:Qw,SafeSet:Yw,SymbolAsyncIterator:Jw,Symbol:Xw}=ce();Zc.exports=F;F.ReadableState=so;var{EventEmitter:Zw}=(sr(),X(nr)),{Stream:Dt,prependListener:e_}=nn(),{Buffer:eo}=(be(),X(me)),{addAbortSignal:t_}=di(),r_=vt(),H=Je().debuglog(\"stream\",t=>{H=t}),i_=dc(),Fr=ir(),{getHighWaterMark:n_,getDefaultHighWaterMark:s_}=an(),{aggregateTwoErrors:Fc,codes:{ERR_INVALID_ARG_TYPE:o_,ERR_METHOD_NOT_IMPLEMENTED:a_,ERR_OUT_OF_RANGE:l_,ERR_STREAM_PUSH_AFTER_EOF:u_,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:f_}}=Ae(),{validateObject:c_}=hi(),fr=Xw(\"kPaused\"),{StringDecoder:Vc}=(Uc(),X(Lc)),h_=Zs();Hc(F.prototype,Dt.prototype);Hc(F,Dt);var to=()=>{},{errorOrDestroy:jr}=Fr;function so(t,e,r){typeof r!=\"boolean\"&&(r=e instanceof nt()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.readableObjectMode)),this.highWaterMark=t?n_(this,t,\"readableHighWaterMark\",r):s_(!1),this.buffer=new i_,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[fr]=null,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=t&&t.defaultEncoding||\"utf8\",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Vc(t.encoding),this.encoding=t.encoding)}function F(t){if(!(this instanceof F))return new F(t);let e=this instanceof nt();this._readableState=new so(t,this,e),t&&(typeof t.read==\"function\"&&(this._read=t.read),typeof t.destroy==\"function\"&&(this._destroy=t.destroy),typeof t.construct==\"function\"&&(this._construct=t.construct),t.signal&&!e&&t_(t.signal,this)),Dt.call(this,t),Fr.construct(this,()=>{this._readableState.needReadable&&hn(this,this._readableState)})}F.prototype.destroy=Fr.destroy;F.prototype._undestroy=Fr.undestroy;F.prototype._destroy=function(t,e){e(t)};F.prototype[Zw.captureRejectionSymbol]=function(t){this.destroy(t)};F.prototype.push=function(t,e){return zc(this,t,e,!1)};F.prototype.unshift=function(t,e){return zc(this,t,e,!0)};function zc(t,e,r,i){H(\"readableAddChunk\",e);let n=t._readableState,o;if(n.objectMode||(typeof e==\"string\"?(r=r||n.defaultEncoding,n.encoding!==r&&(i&&n.encoding?e=eo.from(e,r).toString(n.encoding):(e=eo.from(e,r),r=\"\"))):e instanceof eo?r=\"\":Dt._isUint8Array(e)?(e=Dt._uint8ArrayToBuffer(e),r=\"\"):e!=null&&(o=new o_(\"chunk\",[\"string\",\"Buffer\",\"Uint8Array\"],e))),o)jr(t,o);else if(e===null)n.reading=!1,g_(t,n);else if(n.objectMode||e&&e.length>0)if(i)if(n.endEmitted)jr(t,new f_);else{if(n.destroyed||n.errored)return!1;ro(t,n,e,!0)}else if(n.ended)jr(t,new u_);else{if(n.destroyed||n.errored)return!1;n.reading=!1,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?ro(t,n,e,!1):hn(t,n)):ro(t,n,e,!1)}else i||(n.reading=!1,hn(t,n));return!n.ended&&(n.length0?(e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit(\"data\",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&dn(t)),hn(t,e)}F.prototype.isPaused=function(){let t=this._readableState;return t[fr]===!0||t.flowing===!1};F.prototype.setEncoding=function(t){let e=new Vc(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,i=\"\";for(let n of r)i+=e.write(n);return r.clear(),i!==\"\"&&r.push(i),this._readableState.length=i.length,this};var d_=1073741824;function p_(t){if(t>d_)throw new l_(\"size\",\"<= 1GiB\",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Wc(t,e){return t<=0||e.length===0&&e.ended?0:e.objectMode?1:zw(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}F.prototype.read=function(t){H(\"read\",t),t===void 0?t=NaN:Vw(t)||(t=Kw(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=p_(t)),t!==0&&(e.emittedReadable=!1),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return H(\"read: emitReadable\",e.length,e.ended),e.length===0&&e.ended?io(this):dn(this),null;if(t=Wc(t,e),t===0&&e.ended)return e.length===0&&io(this),null;let i=e.needReadable;if(H(\"need readable\",i),(e.length===0||e.length-t0?n=Jc(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&io(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit(\"data\",n)),n};function g_(t,e){if(H(\"onEofChunk\"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?dn(t):(e.needReadable=!1,e.emittedReadable=!0,Kc(t))}}function dn(t){let e=t._readableState;H(\"emitReadable\",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(H(\"emitReadable\",e.flowing),e.emittedReadable=!0,He.nextTick(Kc,t))}function Kc(t){let e=t._readableState;H(\"emitReadable_\",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit(\"readable\"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Qc(t)}function hn(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,He.nextTick(y_,t,e))}function y_(t,e){for(;!e.reading&&!e.ended&&(e.length1&&i.pipes.includes(t)&&(H(\"false write response, pause\",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),r.pause()),l||(l=b_(r,t),t.on(\"drain\",l))}r.on(\"data\",g);function g(I){H(\"ondata\");let C=t.write(I);H(\"dest.write\",C),C===!1&&d()}function y(I){if(H(\"onerror\",I),E(),t.removeListener(\"error\",y),t.listenerCount(\"error\")===0){let C=t._writableState||t._readableState;C&&!C.errorEmitted?jr(t,I):t.emit(\"error\",I)}}e_(t,\"error\",y);function w(){t.removeListener(\"finish\",S),E()}t.once(\"close\",w);function S(){H(\"onfinish\"),t.removeListener(\"close\",w),E()}t.once(\"finish\",S);function E(){H(\"unpipe\"),r.unpipe(t)}return t.emit(\"pipe\",r),t.writableNeedDrain===!0?i.flowing&&d():i.flowing||(H(\"pipe resume\"),r.resume()),t};function b_(t,e){return function(){let i=t._readableState;i.awaitDrainWriters===e?(H(\"pipeOnDrain\",1),i.awaitDrainWriters=null):i.multiAwaitDrain&&(H(\"pipeOnDrain\",i.awaitDrainWriters.size),i.awaitDrainWriters.delete(e)),(!i.awaitDrainWriters||i.awaitDrainWriters.size===0)&&t.listenerCount(\"data\")&&t.resume()}}F.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let n=e.pipes;e.pipes=[],this.pause();for(let o=0;o0,i.flowing!==!1&&this.resume()):t===\"readable\"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,H(\"on readable\",i.length,i.reading),i.length?dn(this):i.reading||He.nextTick(w_,this)),r};F.prototype.addListener=F.prototype.on;F.prototype.removeListener=function(t,e){let r=Dt.prototype.removeListener.call(this,t,e);return t===\"readable\"&&He.nextTick(Gc,this),r};F.prototype.off=F.prototype.removeListener;F.prototype.removeAllListeners=function(t){let e=Dt.prototype.removeAllListeners.apply(this,arguments);return(t===\"readable\"||t===void 0)&&He.nextTick(Gc,this),e};function Gc(t){let e=t._readableState;e.readableListening=t.listenerCount(\"readable\")>0,e.resumeScheduled&&e[fr]===!1?e.flowing=!0:t.listenerCount(\"data\")>0?t.resume():e.readableListening||(e.flowing=null)}function w_(t){H(\"readable nexttick read 0\"),t.read(0)}F.prototype.resume=function(){let t=this._readableState;return t.flowing||(H(\"resume\"),t.flowing=!t.readableListening,__(this,t)),t[fr]=!1,this};function __(t,e){e.resumeScheduled||(e.resumeScheduled=!0,He.nextTick(m_,t,e))}function m_(t,e){H(\"resume\",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit(\"resume\"),Qc(t),e.flowing&&!e.reading&&t.read(0)}F.prototype.pause=function(){return H(\"call pause flowing=%j\",this._readableState.flowing),this._readableState.flowing!==!1&&(H(\"pause\"),this._readableState.flowing=!1,this.emit(\"pause\")),this._readableState[fr]=!0,this};function Qc(t){let e=t._readableState;for(H(\"flow\",e.flowing);e.flowing&&t.read()!==null;);}F.prototype.wrap=function(t){let e=!1;t.on(\"data\",i=>{!this.push(i)&&t.pause&&(e=!0,t.pause())}),t.on(\"end\",()=>{this.push(null)}),t.on(\"error\",i=>{jr(this,i)}),t.on(\"close\",()=>{this.destroy()}),t.on(\"destroy\",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=Gw(t);for(let i=1;i{n=s?Fc(n,s):null,r(),r=to});try{for(;;){let s=t.destroyed?null:t.read();if(s!==null)yield s;else{if(n)throw n;if(n===null)return;await new Qw(i)}}}catch(s){throw n=Fc(n,s),n}finally{(n||e?.destroyOnReturn!==!1)&&(n===void 0||t._readableState.autoDestroy)?Fr.destroyer(t,null):(t.off(\"readable\",i),o())}}$c(F.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});$c(so.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[fr]!==!1},set(t){this[fr]=!!t}}});F._fromList=Jc;function Jc(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(\"\"):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function io(t){let e=t._readableState;H(\"endReadable\",e.endEmitted),e.endEmitted||(e.ended=!0,He.nextTick(E_,e,t))}function E_(t,e){if(H(\"endReadableNT\",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit(\"end\"),e.writable&&e.allowHalfOpen===!1)He.nextTick(S_,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function S_(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}F.from=function(t,e){return h_(F,t,e)};var no;function Xc(){return no===void 0&&(no={}),no}F.fromWeb=function(t,e){return Xc().newStreamReadableFromReadableStream(t,e)};F.toWeb=function(t,e){return Xc().newReadableStreamFromStreamReadable(t,e)};F.wrap=function(t,e){var r,i;return new F({objectMode:(r=(i=t.readableObjectMode)!==null&&i!==void 0?i:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(n,o){Fr.destroyer(t,n),o(n)}}).wrap(t)}});var ho=M((XT,ch)=>{_();v();m();var cr=Nt(),{ArrayPrototypeSlice:rh,Error:A_,FunctionPrototypeSymbolHasInstance:ih,ObjectDefineProperty:nh,ObjectDefineProperties:I_,ObjectSetPrototypeOf:sh,StringPrototypeToLowerCase:T_,Symbol:R_,SymbolHasInstance:C_}=ce();ch.exports=ie;ie.WritableState=wi;var{EventEmitter:B_}=(sr(),X(nr)),yi=nn().Stream,{Buffer:pn}=(be(),X(me)),bn=ir(),{addAbortSignal:P_}=di(),{getHighWaterMark:k_,getDefaultHighWaterMark:O_}=an(),{ERR_INVALID_ARG_TYPE:x_,ERR_METHOD_NOT_IMPLEMENTED:M_,ERR_MULTIPLE_CALLBACK:oh,ERR_STREAM_CANNOT_PIPE:L_,ERR_STREAM_DESTROYED:bi,ERR_STREAM_ALREADY_FINISHED:U_,ERR_STREAM_NULL_VALUES:N_,ERR_STREAM_WRITE_AFTER_END:q_,ERR_UNKNOWN_ENCODING:ah}=Ae().codes,{errorOrDestroy:Wr}=bn;sh(ie.prototype,yi.prototype);sh(ie,yi);function lo(){}var $r=R_(\"kOnFinished\");function wi(t,e,r){typeof r!=\"boolean\"&&(r=e instanceof nt()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?k_(this,t,\"writableHighWaterMark\",r):O_(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let i=!!(t&&t.decodeStrings===!1);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||\"utf8\",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=j_.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,yn(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[$r]=[]}function yn(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}wi.prototype.getBuffer=function(){return rh(this.buffered,this.bufferedIndex)};nh(wi.prototype,\"bufferedRequestCount\",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function ie(t){let e=this instanceof nt();if(!e&&!ih(ie,this))return new ie(t);this._writableState=new wi(t,this,e),t&&(typeof t.write==\"function\"&&(this._write=t.write),typeof t.writev==\"function\"&&(this._writev=t.writev),typeof t.destroy==\"function\"&&(this._destroy=t.destroy),typeof t.final==\"function\"&&(this._final=t.final),typeof t.construct==\"function\"&&(this._construct=t.construct),t.signal&&P_(t.signal,this)),yi.call(this,t),bn.construct(this,()=>{let r=this._writableState;r.writing||fo(this,r),co(this,r)})}nh(ie,C_,{__proto__:null,value:function(t){return ih(this,t)?!0:this!==ie?!1:t&&t._writableState instanceof wi}});ie.prototype.pipe=function(){Wr(this,new L_)};function lh(t,e,r,i){let n=t._writableState;if(typeof r==\"function\")i=r,r=n.defaultEncoding;else{if(!r)r=n.defaultEncoding;else if(r!==\"buffer\"&&!pn.isEncoding(r))throw new ah(r);typeof i!=\"function\"&&(i=lo)}if(e===null)throw new N_;if(!n.objectMode)if(typeof e==\"string\")n.decodeStrings!==!1&&(e=pn.from(e,r),r=\"buffer\");else if(e instanceof pn)r=\"buffer\";else if(yi._isUint8Array(e))e=yi._uint8ArrayToBuffer(e),r=\"buffer\";else throw new x_(\"chunk\",[\"string\",\"Buffer\",\"Uint8Array\"],e);let o;return n.ending?o=new q_:n.destroyed&&(o=new bi(\"write\")),o?(cr.nextTick(i,o),Wr(t,o,!0),o):(n.pendingcb++,D_(t,n,e,r,i))}ie.prototype.write=function(t,e,r){return lh(this,t,e,r)===!0};ie.prototype.cork=function(){this._writableState.corked++};ie.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||fo(this,t))};ie.prototype.setDefaultEncoding=function(e){if(typeof e==\"string\"&&(e=T_(e)),!pn.isEncoding(e))throw new ah(e);return this._writableState.defaultEncoding=e,this};function D_(t,e,r,i,n){let o=e.objectMode?1:r.length;e.length+=o;let s=e.lengthr.bufferedIndex&&fo(t,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===n?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:n,stream:t,state:r},cr.nextTick(F_,r.afterWriteTickInfo)):uh(t,r,1,n))}function F_({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,uh(t,e,r,i)}function uh(t,e,r,i){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit(\"drain\"));r-- >0;)e.pendingcb--,i();e.destroyed&&uo(e),co(t,e)}function uo(t){if(t.writing)return;for(let n=t.bufferedIndex;n1&&t._writev){e.pendingcb-=o-1;let a=e.allNoop?lo:c=>{for(let h=s;h256?(r.splice(0,s),e.bufferedIndex=0):e.bufferedIndex=s}e.bufferProcessing=!1}ie.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new M_(\"_write()\")};ie.prototype._writev=null;ie.prototype.end=function(t,e,r){let i=this._writableState;typeof t==\"function\"?(r=t,t=null,e=null):typeof e==\"function\"&&(r=e,e=null);let n;if(t!=null){let o=lh(this,t,e);o instanceof A_&&(n=o)}return i.corked&&(i.corked=1,this.uncork()),n||(!i.errored&&!i.ending?(i.ending=!0,co(this,i,!0),i.ended=!0):i.finished?n=new U_(\"end\"):i.destroyed&&(n=new bi(\"end\"))),typeof r==\"function\"&&(n||i.finished?cr.nextTick(r,n):i[$r].push(r)),this};function gn(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function W_(t,e){let r=!1;function i(n){if(r){Wr(t,n??oh());return}if(r=!0,e.pendingcb--,n){let o=e[$r].splice(0);for(let s=0;s{gn(n)?ao(i,n):n.pendingcb--},t,e)):gn(e)&&(e.pendingcb++,ao(t,e))))}function ao(t,e){e.pendingcb--,e.finished=!0;let r=e[$r].splice(0);for(let i=0;i{_();v();m();var po=Nt(),V_=(be(),X(me)),{isReadable:z_,isWritable:K_,isIterable:hh,isNodeStream:G_,isReadableNodeStream:dh,isWritableNodeStream:ph,isDuplexNodeStream:Q_}=tt(),gh=vt(),{AbortError:vh,codes:{ERR_INVALID_ARG_TYPE:Y_,ERR_INVALID_RETURN_VALUE:yh}}=Ae(),{destroyer:Hr}=ir(),J_=nt(),X_=gi(),{createDeferredPromise:bh}=Je(),wh=Zs(),_h=globalThis.Blob||V_.Blob,Z_=typeof _h<\"u\"?function(e){return e instanceof _h}:function(e){return!1},e0=globalThis.AbortController||zi().AbortController,{FunctionPrototypeCall:mh}=ce(),hr=class extends J_{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};Eh.exports=function t(e,r){if(Q_(e))return e;if(dh(e))return wn({readable:e});if(ph(e))return wn({writable:e});if(G_(e))return wn({writable:!1,readable:!1});if(typeof e==\"function\"){let{value:n,write:o,final:s,destroy:a}=t0(e);if(hh(n))return wh(hr,n,{objectMode:!0,write:o,final:s,destroy:a});let l=n?.then;if(typeof l==\"function\"){let c,h=mh(l,n,d=>{if(d!=null)throw new yh(\"nully\",\"body\",d)},d=>{Hr(c,d)});return c=new hr({objectMode:!0,readable:!1,write:o,final(d){s(async()=>{try{await h,po.nextTick(d,null)}catch(g){po.nextTick(d,g)}})},destroy:a})}throw new yh(\"Iterable, AsyncIterable or AsyncFunction\",r,n)}if(Z_(e))return t(e.arrayBuffer());if(hh(e))return wh(hr,e,{objectMode:!0,writable:!1});if(typeof e?.writable==\"object\"||typeof e?.readable==\"object\"){let n=e!=null&&e.readable?dh(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?ph(e?.writable)?e?.writable:t(e.writable):void 0;return wn({readable:n,writable:o})}let i=e?.then;if(typeof i==\"function\"){let n;return mh(i,e,o=>{o!=null&&n.push(o),n.push(null)},o=>{Hr(n,o)}),n=new hr({objectMode:!0,writable:!1,read(){}})}throw new Y_(r,[\"Blob\",\"ReadableStream\",\"WritableStream\",\"Stream\",\"Iterable\",\"AsyncIterable\",\"Function\",\"{ readable, writable } pair\",\"Promise\"],e)};function t0(t){let{promise:e,resolve:r}=bh(),i=new e0,n=i.signal;return{value:t(async function*(){for(;;){let s=e;e=null;let{chunk:a,done:l,cb:c}=await s;if(po.nextTick(c),l)return;if(n.aborted)throw new vh(void 0,{cause:n.reason});({promise:e,resolve:r}=bh()),yield a}}(),{signal:n}),write(s,a,l){let c=r;r=null,c({chunk:s,done:!1,cb:l})},final(s){let a=r;r=null,a({done:!0,cb:s})},destroy(s,a){i.abort(),a(s)}}}function wn(t){let e=t.readable&&typeof t.readable.read!=\"function\"?X_.wrap(t.readable):t.readable,r=t.writable,i=!!z_(e),n=!!K_(r),o,s,a,l,c;function h(d){let g=l;l=null,g?g(d):d&&c.destroy(d)}return c=new hr({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&(gh(r,d=>{n=!1,d&&Hr(e,d),h(d)}),c._write=function(d,g,y){r.write(d,g)?y():o=y},c._final=function(d){r.end(),s=d},r.on(\"drain\",function(){if(o){let d=o;o=null,d()}}),r.on(\"finish\",function(){if(s){let d=s;s=null,d()}})),i&&(gh(e,d=>{i=!1,d&&Hr(e,d),h(d)}),e.on(\"readable\",function(){if(a){let d=a;a=null,d()}}),e.on(\"end\",function(){c.push(null)}),c._read=function(){for(;;){let d=e.read();if(d===null){a=c._read;return}if(!c.push(d))return}}),c._destroy=function(d,g){!d&&l!==null&&(d=new vh),a=null,o=null,s=null,l===null?g(d):(l=g,Hr(r,d),Hr(e,d))},c}});var nt=M((h2,Th)=>{\"use strict\";_();v();m();var{ObjectDefineProperties:r0,ObjectGetOwnPropertyDescriptor:It,ObjectKeys:i0,ObjectSetPrototypeOf:Ah}=ce();Th.exports=Ve;var bo=gi(),Ne=ho();Ah(Ve.prototype,bo.prototype);Ah(Ve,bo);{let t=i0(Ne.prototype);for(let e=0;e{\"use strict\";_();v();m();var{ObjectSetPrototypeOf:Rh,Symbol:n0}=ce();Ch.exports=Tt;var{ERR_METHOD_NOT_IMPLEMENTED:s0}=Ae().codes,_o=nt(),{getHighWaterMark:o0}=an();Rh(Tt.prototype,_o.prototype);Rh(Tt,_o);var _i=n0(\"kCallback\");function Tt(t){if(!(this instanceof Tt))return new Tt(t);let e=t?o0(this,t,\"readableHighWaterMark\",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),_o.call(this,t),this._readableState.sync=!1,this[_i]=null,t&&(typeof t.transform==\"function\"&&(this._transform=t.transform),typeof t.flush==\"function\"&&(this._flush=t.flush)),this.on(\"prefinish\",a0)}function wo(t){typeof this._flush==\"function\"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}function a0(){this._final!==wo&&wo.call(this)}Tt.prototype._final=wo;Tt.prototype._transform=function(t,e,r){throw new s0(\"_transform()\")};Tt.prototype._write=function(t,e,r){let i=this._readableState,n=this._writableState,o=i.length;this._transform(t,e,(s,a)=>{if(s){r(s);return}a!=null&&this.push(a),n.ended||o===i.length||i.length{\"use strict\";_();v();m();var{ObjectSetPrototypeOf:Bh}=ce();Ph.exports=Vr;var vo=mo();Bh(Vr.prototype,vo.prototype);Bh(Vr,vo);function Vr(t){if(!(this instanceof Vr))return new Vr(t);vo.call(this,t)}Vr.prototype._transform=function(t,e,r){r(null,t)}});var En=M((x2,Lh)=>{_();v();m();var mi=Nt(),{ArrayIsArray:l0,Promise:u0,SymbolAsyncIterator:f0}=ce(),vn=vt(),{once:c0}=Je(),h0=ir(),kh=nt(),{aggregateTwoErrors:d0,codes:{ERR_INVALID_ARG_TYPE:Po,ERR_INVALID_RETURN_VALUE:So,ERR_MISSING_ARGS:p0,ERR_STREAM_DESTROYED:g0,ERR_STREAM_PREMATURE_CLOSE:y0},AbortError:b0}=Ae(),{validateFunction:w0,validateAbortSignal:_0}=hi(),{isIterable:dr,isReadable:Ao,isReadableNodeStream:mn,isNodeStream:Oh,isTransformStream:zr,isWebStream:m0,isReadableStream:Io,isReadableEnded:v0}=tt(),E0=globalThis.AbortController||zi().AbortController,To,Ro;function xh(t,e,r){let i=!1;t.on(\"close\",()=>{i=!0});let n=vn(t,{readable:e,writable:r},o=>{i=!o});return{destroy:o=>{i||(i=!0,h0.destroyer(t,o||new g0(\"pipe\")))},cleanup:n}}function S0(t){return w0(t[t.length-1],\"streams[stream.length - 1]\"),t.pop()}function Co(t){if(dr(t))return t;if(mn(t))return A0(t);throw new Po(\"val\",[\"Readable\",\"Iterable\",\"AsyncIterable\"],t)}async function*A0(t){Ro||(Ro=gi()),yield*Ro.prototype[f0].call(t)}async function _n(t,e,r,{end:i}){let n,o=null,s=c=>{if(c&&(n=c),o){let h=o;o=null,h()}},a=()=>new u0((c,h)=>{n?h(n):o=()=>{n?h(n):c()}});e.on(\"drain\",s);let l=vn(e,{readable:!1},s);try{e.writableNeedDrain&&await a();for await(let c of t)e.write(c)||await a();i&&e.end(),await a(),r()}catch(c){r(n!==c?d0(n,c):c)}finally{l(),e.off(\"drain\",s)}}async function Bo(t,e,r,{end:i}){zr(e)&&(e=e.writable);let n=e.getWriter();try{for await(let o of t)await n.ready,n.write(o).catch(()=>{});await n.ready,i&&await n.close(),r()}catch(o){try{await n.abort(o),r(o)}catch(s){r(s)}}}function I0(...t){return Mh(t,c0(S0(t)))}function Mh(t,e,r){if(t.length===1&&l0(t[0])&&(t=t[0]),t.length<2)throw new p0(\"streams\");let i=new E0,n=i.signal,o=r?.signal,s=[];_0(o,\"options.signal\");function a(){y(new b0)}o?.addEventListener(\"abort\",a);let l,c,h=[],d=0;function g(C){y(C,--d===0)}function y(C,R){if(C&&(!l||l.code===\"ERR_STREAM_PREMATURE_CLOSE\")&&(l=C),!(!l&&!R)){for(;h.length;)h.shift()(l);o?.removeEventListener(\"abort\",a),i.abort(),R&&(l||s.forEach(U=>U()),mi.nextTick(e,l,c))}}let w;for(let C=0;C0,W=U||r?.end!==!1,K=C===t.length-1;if(Oh(R)){let z=function(Q){Q&&Q.name!==\"AbortError\"&&Q.code!==\"ERR_STREAM_PREMATURE_CLOSE\"&&g(Q)};var I=z;if(W){let{destroy:Q,cleanup:pe}=xh(R,U,N);h.push(Q),Ao(R)&&K&&s.push(pe)}R.on(\"error\",z),Ao(R)&&K&&s.push(()=>{R.removeListener(\"error\",z)})}if(C===0)if(typeof R==\"function\"){if(w=R({signal:n}),!dr(w))throw new So(\"Iterable, AsyncIterable or Stream\",\"source\",w)}else dr(R)||mn(R)||zr(R)?w=R:w=kh.from(R);else if(typeof R==\"function\"){if(zr(w)){var S;w=Co((S=w)===null||S===void 0?void 0:S.readable)}else w=Co(w);if(w=R(w,{signal:n}),U){if(!dr(w,!0))throw new So(\"AsyncIterable\",`transform[${C-1}]`,w)}else{var E;To||(To=Eo());let z=new To({objectMode:!0}),Q=(E=w)===null||E===void 0?void 0:E.then;if(typeof Q==\"function\")d++,Q.call(w,ge=>{c=ge,ge!=null&&z.write(ge),W&&z.end(),mi.nextTick(g)},ge=>{z.destroy(ge),mi.nextTick(g,ge)});else if(dr(w,!0))d++,_n(w,z,g,{end:W});else if(Io(w)||zr(w)){let ge=w.readable||w;d++,_n(ge,z,g,{end:W})}else throw new So(\"AsyncIterable or Promise\",\"destination\",w);w=z;let{destroy:pe,cleanup:Yt}=xh(w,!1,!0);h.push(pe),K&&s.push(Yt)}}else if(Oh(R)){if(mn(w)){d+=2;let z=T0(w,R,g,{end:W});Ao(R)&&K&&s.push(z)}else if(zr(w)||Io(w)){let z=w.readable||w;d++,_n(z,R,g,{end:W})}else if(dr(w))d++,_n(w,R,g,{end:W});else throw new Po(\"val\",[\"Readable\",\"Iterable\",\"AsyncIterable\",\"ReadableStream\",\"TransformStream\"],w);w=R}else if(m0(R)){if(mn(w))d++,Bo(Co(w),R,g,{end:W});else if(Io(w)||dr(w))d++,Bo(w,R,g,{end:W});else if(zr(w))d++,Bo(w.readable,R,g,{end:W});else throw new Po(\"val\",[\"Readable\",\"Iterable\",\"AsyncIterable\",\"ReadableStream\",\"TransformStream\"],w);w=R}else w=kh.from(R)}return(n!=null&&n.aborted||o!=null&&o.aborted)&&mi.nextTick(a),w}function T0(t,e,r,{end:i}){let n=!1;if(e.on(\"close\",()=>{n||r(new y0)}),t.pipe(e,{end:!1}),i){let s=function(){n=!0,e.end()};var o=s;v0(t)?mi.nextTick(s):t.once(\"end\",s)}else r();return vn(t,{readable:!0,writable:!1},s=>{let a=t._readableState;s&&s.code===\"ERR_STREAM_PREMATURE_CLOSE\"&&a&&a.ended&&!a.errored&&!a.errorEmitted?t.once(\"end\",r).once(\"error\",r):r(s)}),vn(e,{readable:!1,writable:!0},r)}Lh.exports={pipelineImpl:Mh,pipeline:I0}});var Oo=M((j2,Fh)=>{\"use strict\";_();v();m();var{pipeline:R0}=En(),Sn=nt(),{destroyer:C0}=ir(),{isNodeStream:An,isReadable:Uh,isWritable:Nh,isWebStream:ko,isTransformStream:pr,isWritableStream:qh,isReadableStream:Dh}=tt(),{AbortError:B0,codes:{ERR_INVALID_ARG_VALUE:jh,ERR_MISSING_ARGS:P0}}=Ae(),k0=vt();Fh.exports=function(...e){if(e.length===0)throw new P0(\"streams\");if(e.length===1)return Sn.from(e[0]);let r=[...e];if(typeof e[0]==\"function\"&&(e[0]=Sn.from(e[0])),typeof e[e.length-1]==\"function\"){let y=e.length-1;e[y]=Sn.from(e[y])}for(let y=0;y0&&!(Nh(e[y])||qh(e[y])||pr(e[y])))throw new jh(`streams[${y}]`,r[y],\"must be writable\")}let i,n,o,s,a;function l(y){let w=s;s=null,w?w(y):y?a.destroy(y):!g&&!d&&a.destroy()}let c=e[0],h=R0(e,l),d=!!(Nh(c)||qh(c)||pr(c)),g=!!(Uh(h)||Dh(h)||pr(h));if(a=new Sn({writableObjectMode:!!(c!=null&&c.writableObjectMode),readableObjectMode:!!(h!=null&&h.writableObjectMode),writable:d,readable:g}),d){if(An(c))a._write=function(w,S,E){c.write(w,S)?E():i=E},a._final=function(w){c.end(),n=w},c.on(\"drain\",function(){if(i){let w=i;i=null,w()}});else if(ko(c)){let S=(pr(c)?c.writable:c).getWriter();a._write=async function(E,I,C){try{await S.ready,S.write(E).catch(()=>{}),C()}catch(R){C(R)}},a._final=async function(E){try{await S.ready,S.close().catch(()=>{}),n=E}catch(I){E(I)}}}let y=pr(h)?h.readable:h;k0(y,()=>{if(n){let w=n;n=null,w()}})}if(g){if(An(h))h.on(\"readable\",function(){if(o){let y=o;o=null,y()}}),h.on(\"end\",function(){a.push(null)}),a._read=function(){for(;;){let y=h.read();if(y===null){o=a._read;return}if(!a.push(y))return}};else if(ko(h)){let w=(pr(h)?h.readable:h).getReader();a._read=async function(){for(;;)try{let{value:S,done:E}=await w.read();if(!a.push(S))return;if(E){a.push(null);return}}catch{return}}}}return a._destroy=function(y,w){!y&&s!==null&&(y=new B0),o=null,i=null,n=null,s===null?w(y):(s=w,An(h)&&C0(h,y))},a}});var Qh=M((K2,Lo)=>{\"use strict\";_();v();m();var Vh=globalThis.AbortController||zi().AbortController,{codes:{ERR_INVALID_ARG_VALUE:O0,ERR_INVALID_ARG_TYPE:vi,ERR_MISSING_ARGS:x0,ERR_OUT_OF_RANGE:M0},AbortError:st}=Ae(),{validateAbortSignal:gr,validateInteger:L0,validateObject:yr}=hi(),U0=ce().Symbol(\"kWeak\"),{finished:N0}=vt(),q0=Oo(),{addAbortSignalNoValidate:D0}=di(),{isWritable:j0,isNodeStream:F0}=tt(),{ArrayPrototypePush:W0,MathFloor:$0,Number:H0,NumberIsNaN:V0,Promise:Wh,PromiseReject:$h,PromisePrototypeThen:z0,Symbol:zh}=ce(),In=zh(\"kEmpty\"),Hh=zh(\"kEof\");function K0(t,e){if(e!=null&&yr(e,\"options\"),e?.signal!=null&&gr(e.signal,\"options.signal\"),F0(t)&&!j0(t))throw new O0(\"stream\",t,\"must be writable\");let r=q0(this,t);return e!=null&&e.signal&&D0(e.signal,r),r}function Tn(t,e){if(typeof t!=\"function\")throw new vi(\"fn\",[\"Function\",\"AsyncFunction\"],t);e!=null&&yr(e,\"options\"),e?.signal!=null&&gr(e.signal,\"options.signal\");let r=1;return e?.concurrency!=null&&(r=$0(e.concurrency)),L0(r,\"concurrency\",1),async function*(){var n,o;let s=new Vh,a=this,l=[],c=s.signal,h={signal:c},d=()=>s.abort();e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted&&d(),e==null||(o=e.signal)===null||o===void 0||o.addEventListener(\"abort\",d);let g,y,w=!1;function S(){w=!0}async function E(){try{for await(let R of a){var I;if(w)return;if(c.aborted)throw new st;try{R=t(R,h)}catch(U){R=$h(U)}R!==In&&(typeof((I=R)===null||I===void 0?void 0:I.catch)==\"function\"&&R.catch(S),l.push(R),g&&(g(),g=null),!w&&l.length&&l.length>=r&&await new Wh(U=>{y=U}))}l.push(Hh)}catch(R){let U=$h(R);z0(U,void 0,S),l.push(U)}finally{var C;w=!0,g&&(g(),g=null),e==null||(C=e.signal)===null||C===void 0||C.removeEventListener(\"abort\",d)}}E();try{for(;;){for(;l.length>0;){let I=await l[0];if(I===Hh)return;if(c.aborted)throw new st;I!==In&&(yield I),l.shift(),y&&(y(),y=null)}await new Wh(I=>{g=I})}}finally{s.abort(),w=!0,y&&(y(),y=null)}}.call(this)}function G0(t=void 0){return t!=null&&yr(t,\"options\"),t?.signal!=null&&gr(t.signal,\"options.signal\"),async function*(){let r=0;for await(let n of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new st({cause:t.signal.reason});yield[r++,n]}}.call(this)}async function Kh(t,e=void 0){for await(let r of Mo.call(this,t,e))return!0;return!1}async function Q0(t,e=void 0){if(typeof t!=\"function\")throw new vi(\"fn\",[\"Function\",\"AsyncFunction\"],t);return!await Kh.call(this,async(...r)=>!await t(...r),e)}async function Y0(t,e){for await(let r of Mo.call(this,t,e))return r}async function J0(t,e){if(typeof t!=\"function\")throw new vi(\"fn\",[\"Function\",\"AsyncFunction\"],t);async function r(i,n){return await t(i,n),In}for await(let i of Tn.call(this,r,e));}function Mo(t,e){if(typeof t!=\"function\")throw new vi(\"fn\",[\"Function\",\"AsyncFunction\"],t);async function r(i,n){return await t(i,n)?i:In}return Tn.call(this,r,e)}var xo=class extends x0{constructor(){super(\"reduce\"),this.message=\"Reduce of an empty stream requires an initial value\"}};async function X0(t,e,r){var i;if(typeof t!=\"function\")throw new vi(\"reducer\",[\"Function\",\"AsyncFunction\"],t);r!=null&&yr(r,\"options\"),r?.signal!=null&&gr(r.signal,\"options.signal\");let n=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){let c=new st(void 0,{cause:r.signal.reason});throw this.once(\"error\",()=>{}),await N0(this.destroy(c)),c}let o=new Vh,s=o.signal;if(r!=null&&r.signal){let c={once:!0,[U0]:this};r.signal.addEventListener(\"abort\",()=>o.abort(),c)}let a=!1;try{for await(let c of this){var l;if(a=!0,r!=null&&(l=r.signal)!==null&&l!==void 0&&l.aborted)throw new st;n?e=await t(e,c,{signal:s}):(e=c,n=!0)}if(!a&&!n)throw new xo}finally{o.abort()}return e}async function Z0(t){t!=null&&yr(t,\"options\"),t?.signal!=null&&gr(t.signal,\"options.signal\");let e=[];for await(let i of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new st(void 0,{cause:t.signal.reason});W0(e,i)}return e}function em(t,e){let r=Tn.call(this,t,e);return async function*(){for await(let n of r)yield*n}.call(this)}function Gh(t){if(t=H0(t),V0(t))return 0;if(t<0)throw new M0(\"number\",\">= 0\",t);return t}function tm(t,e=void 0){return e!=null&&yr(e,\"options\"),e?.signal!=null&&gr(e.signal,\"options.signal\"),t=Gh(t),async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new st;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new st;t--<=0&&(yield o)}}.call(this)}function rm(t,e=void 0){return e!=null&&yr(e,\"options\"),e?.signal!=null&&gr(e.signal,\"options.signal\"),t=Gh(t),async function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new st;for await(let o of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new st;if(t-- >0)yield o;else return}}.call(this)}Lo.exports.streamReturningOperators={asIndexedPairs:G0,drop:tm,filter:Mo,flatMap:em,map:Tn,take:rm,compose:K0};Lo.exports.promiseReturningOperators={every:Q0,forEach:J0,reduce:X0,toArray:Z0,some:Kh,find:Y0}});var Uo=M((eR,Yh)=>{\"use strict\";_();v();m();var{ArrayPrototypePop:im,Promise:nm}=ce(),{isIterable:sm,isNodeStream:om,isWebStream:am}=tt(),{pipelineImpl:lm}=En(),{finished:um}=vt();No();function fm(...t){return new nm((e,r)=>{let i,n,o=t[t.length-1];if(o&&typeof o==\"object\"&&!om(o)&&!sm(o)&&!am(o)){let s=im(t);i=s.signal,n=s.end}lm(t,(s,a)=>{s?r(s):e(a)},{signal:i,end:n})})}Yh.exports={finished:um,pipeline:fm}});var No=M((aR,sd)=>{_();v();m();var{Buffer:cm}=(be(),X(me)),{ObjectDefineProperty:Rt,ObjectKeys:Zh,ReflectApply:ed}=ce(),{promisify:{custom:td}}=Je(),{streamReturningOperators:Jh,promiseReturningOperators:Xh}=Qh(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:rd}}=Ae(),hm=Oo(),{pipeline:id}=En(),{destroyer:dm}=ir(),nd=vt(),qo=Uo(),Do=tt(),le=sd.exports=nn().Stream;le.isDisturbed=Do.isDisturbed;le.isErrored=Do.isErrored;le.isReadable=Do.isReadable;le.Readable=gi();for(let t of Zh(Jh)){let r=function(...i){if(new.target)throw rd();return le.Readable.from(ed(e,this,i))};jo=r;let e=Jh[t];Rt(r,\"name\",{__proto__:null,value:e.name}),Rt(r,\"length\",{__proto__:null,value:e.length}),Rt(le.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var jo;for(let t of Zh(Xh)){let r=function(...n){if(new.target)throw rd();return ed(e,this,n)};jo=r;let e=Xh[t];Rt(r,\"name\",{__proto__:null,value:e.name}),Rt(r,\"length\",{__proto__:null,value:e.length}),Rt(le.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var jo;le.Writable=ho();le.Duplex=nt();le.Transform=mo();le.PassThrough=Eo();le.pipeline=id;var{addAbortSignal:pm}=di();le.addAbortSignal=pm;le.finished=nd;le.destroy=dm;le.compose=hm;Rt(le,\"promises\",{__proto__:null,configurable:!0,enumerable:!0,get(){return qo}});Rt(id,td,{__proto__:null,enumerable:!0,get(){return qo.pipeline}});Rt(nd,td,{__proto__:null,enumerable:!0,get(){return qo.finished}});le.Stream=le;le._isUint8Array=function(e){return e instanceof Uint8Array};le._uint8ArrayToBuffer=function(e){return cm.from(e.buffer,e.byteOffset,e.byteLength)}});var jt=M((pR,ue)=>{\"use strict\";_();v();m();var he=No(),gm=Uo(),ym=he.Readable.destroy;ue.exports=he.Readable;ue.exports._uint8ArrayToBuffer=he._uint8ArrayToBuffer;ue.exports._isUint8Array=he._isUint8Array;ue.exports.isDisturbed=he.isDisturbed;ue.exports.isErrored=he.isErrored;ue.exports.isReadable=he.isReadable;ue.exports.Readable=he.Readable;ue.exports.Writable=he.Writable;ue.exports.Duplex=he.Duplex;ue.exports.Transform=he.Transform;ue.exports.PassThrough=he.PassThrough;ue.exports.addAbortSignal=he.addAbortSignal;ue.exports.finished=he.finished;ue.exports.destroy=he.destroy;ue.exports.destroy=ym;ue.exports.pipeline=he.pipeline;ue.exports.compose=he.compose;Object.defineProperty(he,\"promises\",{configurable:!0,enumerable:!0,get(){return gm}});ue.exports.Stream=he.Stream;ue.exports.default=ue.exports});var od=M((vR,Fo)=>{_();v();m();typeof Object.create==\"function\"?Fo.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Fo.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}});var ud=M((CR,ld)=>{\"use strict\";_();v();m();var{Buffer:ze}=(be(),X(me)),ad=Symbol.for(\"BufferList\");function ee(t){if(!(this instanceof ee))return new ee(t);ee._init.call(this,t)}ee._init=function(e){Object.defineProperty(this,ad,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)};ee.prototype._new=function(e){return new ee(e)};ee.prototype._offset=function(e){if(e===0)return[0,0];let r=0;for(let i=0;ithis.length||e<0)return;let r=this._offset(e);return this._bufs[r[0]][r[1]]};ee.prototype.slice=function(e,r){return typeof e==\"number\"&&e<0&&(e+=this.length),typeof r==\"number\"&&r<0&&(r+=this.length),this.copy(null,0,e,r)};ee.prototype.copy=function(e,r,i,n){if((typeof i!=\"number\"||i<0)&&(i=0),(typeof n!=\"number\"||n>this.length)&&(n=this.length),i>=this.length||n<=0)return e||ze.alloc(0);let o=!!e,s=this._offset(i),a=n-i,l=a,c=o&&r||0,h=s[1];if(i===0&&n===this.length){if(!o)return this._bufs.length===1?this._bufs[0]:ze.concat(this._bufs,this.length);for(let d=0;dg)this._bufs[d].copy(e,c,h),c+=g;else{this._bufs[d].copy(e,c,h,h+l),c+=g;break}l-=g,h&&(h=0)}return e.length>c?e.slice(0,c):e};ee.prototype.shallowSlice=function(e,r){if(e=e||0,r=typeof r!=\"number\"?this.length:r,e<0&&(e+=this.length),r<0&&(r+=this.length),e===r)return this._new();let i=this._offset(e),n=this._offset(r),o=this._bufs.slice(i[0],n[0]+1);return n[1]===0?o.pop():o[o.length-1]=o[o.length-1].slice(0,n[1]),i[1]!==0&&(o[0]=o[0].slice(i[1])),this._new(o)};ee.prototype.toString=function(e,r,i){return this.slice(r,i).toString(e)};ee.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;)if(e>=this._bufs[0].length)e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}return this};ee.prototype.duplicate=function(){let e=this._new();for(let r=0;rthis.length?this.length:e;let i=this._offset(e),n=i[0],o=i[1];for(;n=t.length){let l=s.indexOf(t,o);if(l!==-1)return this._reverseOffset([n,l]);o=s.length-t.length+1}else{let l=this._reverseOffset([n,o]);if(this._match(l,t))return l;o++}o=0}return-1};ee.prototype._match=function(t,e){if(this.length-t{\"use strict\";_();v();m();var Wo=jt().Duplex,bm=od(),Ei=ud();function Se(t){if(!(this instanceof Se))return new Se(t);if(typeof t==\"function\"){this._callback=t;let e=function(i){this._callback&&(this._callback(i),this._callback=null)}.bind(this);this.on(\"pipe\",function(i){i.on(\"error\",e)}),this.on(\"unpipe\",function(i){i.removeListener(\"error\",e)}),t=null}Ei._init.call(this,t),Wo.call(this)}bm(Se,Wo);Object.assign(Se.prototype,Ei.prototype);Se.prototype._new=function(e){return new Se(e)};Se.prototype._write=function(e,r,i){this._appendBuffer(e),typeof i==\"function\"&&i()};Se.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)};Se.prototype.end=function(e){Wo.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)};Se.prototype._destroy=function(e,r){this._bufs.length=0,this.length=0,r(e)};Se.prototype._isBufferList=function(e){return e instanceof Se||e instanceof Ei||Se.isBufferList(e)};Se.isBufferList=Ei.isBufferList;Rn.exports=Se;Rn.exports.BufferListStream=Se;Rn.exports.BufferList=Ei});var hd=M((WR,cd)=>{_();v();m();var $o=class{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}};cd.exports=$o});var Ho=M((QR,dd)=>{_();v();m();var L=dd.exports,{Buffer:ke}=(be(),X(me));L.types={0:\"reserved\",1:\"connect\",2:\"connack\",3:\"publish\",4:\"puback\",5:\"pubrec\",6:\"pubrel\",7:\"pubcomp\",8:\"subscribe\",9:\"suback\",10:\"unsubscribe\",11:\"unsuback\",12:\"pingreq\",13:\"pingresp\",14:\"disconnect\",15:\"auth\"};L.requiredHeaderFlags={1:0,2:0,4:0,5:0,6:2,7:0,8:2,9:0,10:2,11:0,12:0,13:0,14:0,15:0};L.requiredHeaderFlagsErrors={};for(let t in L.requiredHeaderFlags){let e=L.requiredHeaderFlags[t];L.requiredHeaderFlagsErrors[t]=\"Invalid header flag bits, must be 0x\"+e.toString(16)+\" for \"+L.types[t]+\" packet\"}L.codes={};for(let t in L.types){let e=L.types[t];L.codes[e]=t}L.CMD_SHIFT=4;L.CMD_MASK=240;L.DUP_MASK=8;L.QOS_MASK=3;L.QOS_SHIFT=1;L.RETAIN_MASK=1;L.VARBYTEINT_MASK=127;L.VARBYTEINT_FIN_MASK=128;L.VARBYTEINT_MAX=268435455;L.SESSIONPRESENT_MASK=1;L.SESSIONPRESENT_HEADER=ke.from([L.SESSIONPRESENT_MASK]);L.CONNACK_HEADER=ke.from([L.codes.connack<[0,1].map(r=>[0,1].map(i=>{let n=ke.alloc(1);return n.writeUInt8(L.codes[t]<ke.from([t]));L.EMPTY={pingreq:ke.from([L.codes.pingreq<<4,0]),pingresp:ke.from([L.codes.pingresp<<4,0]),disconnect:ke.from([L.codes.disconnect<<4,0])};L.MQTT5_PUBACK_PUBREC_CODES={0:\"Success\",16:\"No matching subscribers\",128:\"Unspecified error\",131:\"Implementation specific error\",135:\"Not authorized\",144:\"Topic Name invalid\",145:\"Packet identifier in use\",151:\"Quota exceeded\",153:\"Payload format invalid\"};L.MQTT5_PUBREL_PUBCOMP_CODES={0:\"Success\",146:\"Packet Identifier not found\"};L.MQTT5_SUBACK_CODES={0:\"Granted QoS 0\",1:\"Granted QoS 1\",2:\"Granted QoS 2\",128:\"Unspecified error\",131:\"Implementation specific error\",135:\"Not authorized\",143:\"Topic Filter invalid\",145:\"Packet Identifier in use\",151:\"Quota exceeded\",158:\"Shared Subscriptions not supported\",161:\"Subscription Identifiers not supported\",162:\"Wildcard Subscriptions not supported\"};L.MQTT5_UNSUBACK_CODES={0:\"Success\",17:\"No subscription existed\",128:\"Unspecified error\",131:\"Implementation specific error\",135:\"Not authorized\",143:\"Topic Filter invalid\",145:\"Packet Identifier in use\"};L.MQTT5_DISCONNECT_CODES={0:\"Normal disconnection\",4:\"Disconnect with Will Message\",128:\"Unspecified error\",129:\"Malformed Packet\",130:\"Protocol Error\",131:\"Implementation specific error\",135:\"Not authorized\",137:\"Server busy\",139:\"Server shutting down\",141:\"Keep Alive timeout\",142:\"Session taken over\",143:\"Topic Filter invalid\",144:\"Topic Name invalid\",147:\"Receive Maximum exceeded\",148:\"Topic Alias invalid\",149:\"Packet too large\",150:\"Message rate too high\",151:\"Quota exceeded\",152:\"Administrative action\",153:\"Payload format invalid\",154:\"Retain not supported\",155:\"QoS not supported\",156:\"Use another server\",157:\"Server moved\",158:\"Shared Subscriptions not supported\",159:\"Connection rate exceeded\",160:\"Maximum connect time\",161:\"Subscription Identifiers not supported\",162:\"Wildcard Subscriptions not supported\"};L.MQTT5_AUTH_CODES={0:\"Success\",24:\"Continue authentication\",25:\"Re-authenticate\"}});var gd=M((rC,pd)=>{_();v();m();var Kr=1e3,Gr=Kr*60,Qr=Gr*60,br=Qr*24,wm=br*7,_m=br*365.25;pd.exports=function(t,e){e=e||{};var r=typeof t;if(r===\"string\"&&t.length>0)return mm(t);if(r===\"number\"&&isFinite(t))return e.long?Em(t):vm(t);throw new Error(\"val is not a non-empty string or a valid number. val=\"+JSON.stringify(t))};function mm(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),i=(e[2]||\"ms\").toLowerCase();switch(i){case\"years\":case\"year\":case\"yrs\":case\"yr\":case\"y\":return r*_m;case\"weeks\":case\"week\":case\"w\":return r*wm;case\"days\":case\"day\":case\"d\":return r*br;case\"hours\":case\"hour\":case\"hrs\":case\"hr\":case\"h\":return r*Qr;case\"minutes\":case\"minute\":case\"mins\":case\"min\":case\"m\":return r*Gr;case\"seconds\":case\"second\":case\"secs\":case\"sec\":case\"s\":return r*Kr;case\"milliseconds\":case\"millisecond\":case\"msecs\":case\"msec\":case\"ms\":return r;default:return}}}}function vm(t){var e=Math.abs(t);return e>=br?Math.round(t/br)+\"d\":e>=Qr?Math.round(t/Qr)+\"h\":e>=Gr?Math.round(t/Gr)+\"m\":e>=Kr?Math.round(t/Kr)+\"s\":t+\"ms\"}function Em(t){var e=Math.abs(t);return e>=br?Cn(t,e,br,\"day\"):e>=Qr?Cn(t,e,Qr,\"hour\"):e>=Gr?Cn(t,e,Gr,\"minute\"):e>=Kr?Cn(t,e,Kr,\"second\"):t+\" ms\"}function Cn(t,e,r,i){var n=e>=r*1.5;return Math.round(t/r)+\" \"+i+(n?\"s\":\"\")}});var bd=M((uC,yd)=>{_();v();m();function Sm(t){r.debug=r,r.default=r,r.coerce=l,r.disable=o,r.enable=n,r.enabled=s,r.humanize=gd(),r.destroy=c,Object.keys(t).forEach(h=>{r[h]=t[h]}),r.names=[],r.skips=[],r.formatters={};function e(h){let d=0;for(let g=0;g{if(W===\"%%\")return\"%\";U++;let z=r.formatters[K];if(typeof z==\"function\"){let Q=E[U];W=z.call(I,Q),E.splice(U,1),U--}return W}),r.formatArgs.call(I,E),(I.log||r.log).apply(I,E)}return S.namespace=h,S.useColors=r.useColors(),S.color=r.selectColor(h),S.extend=i,S.destroy=r.destroy,Object.defineProperty(S,\"enabled\",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(y!==r.namespaces&&(y=r.namespaces,w=r.enabled(h)),w),set:E=>{g=E}}),typeof r.init==\"function\"&&r.init(S),S}function i(h,d){let g=r(this.namespace+(typeof d>\"u\"?\":\":d)+h);return g.log=this.log,g}function n(h){r.save(h),r.namespaces=h,r.names=[],r.skips=[];let d,g=(typeof h==\"string\"?h:\"\").split(/[\\s,]+/),y=g.length;for(d=0;d\"-\"+d)].join(\",\");return r.enable(\"\"),h}function s(h){if(h[h.length-1]===\"*\")return!0;let d,g;for(d=0,g=r.skips.length;d{_();v();m();xe.formatArgs=Im;xe.save=Tm;xe.load=Rm;xe.useColors=Am;xe.storage=Cm();xe.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn(\"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.\"))}})();xe.colors=[\"#0000CC\",\"#0000FF\",\"#0033CC\",\"#0033FF\",\"#0066CC\",\"#0066FF\",\"#0099CC\",\"#0099FF\",\"#00CC00\",\"#00CC33\",\"#00CC66\",\"#00CC99\",\"#00CCCC\",\"#00CCFF\",\"#3300CC\",\"#3300FF\",\"#3333CC\",\"#3333FF\",\"#3366CC\",\"#3366FF\",\"#3399CC\",\"#3399FF\",\"#33CC00\",\"#33CC33\",\"#33CC66\",\"#33CC99\",\"#33CCCC\",\"#33CCFF\",\"#6600CC\",\"#6600FF\",\"#6633CC\",\"#6633FF\",\"#66CC00\",\"#66CC33\",\"#9900CC\",\"#9900FF\",\"#9933CC\",\"#9933FF\",\"#99CC00\",\"#99CC33\",\"#CC0000\",\"#CC0033\",\"#CC0066\",\"#CC0099\",\"#CC00CC\",\"#CC00FF\",\"#CC3300\",\"#CC3333\",\"#CC3366\",\"#CC3399\",\"#CC33CC\",\"#CC33FF\",\"#CC6600\",\"#CC6633\",\"#CC9900\",\"#CC9933\",\"#CCCC00\",\"#CCCC33\",\"#FF0000\",\"#FF0033\",\"#FF0066\",\"#FF0099\",\"#FF00CC\",\"#FF00FF\",\"#FF3300\",\"#FF3333\",\"#FF3366\",\"#FF3399\",\"#FF33CC\",\"#FF33FF\",\"#FF6600\",\"#FF6633\",\"#FF9900\",\"#FF9933\",\"#FFCC00\",\"#FFCC33\"];function Am(){return typeof window<\"u\"&&window.process&&(window.process.type===\"renderer\"||window.process.__nwjs)?!0:typeof navigator<\"u\"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)?!1:typeof document<\"u\"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<\"u\"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<\"u\"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<\"u\"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/)}function Im(t){if(t[0]=(this.useColors?\"%c\":\"\")+this.namespace+(this.useColors?\" %c\":\" \")+t[0]+(this.useColors?\"%c \":\" \")+\"+\"+Bn.exports.humanize(this.diff),!this.useColors)return;let e=\"color: \"+this.color;t.splice(1,0,e,\"color: inherit\");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,n=>{n!==\"%%\"&&(r++,n===\"%c\"&&(i=r))}),t.splice(i,0,e)}xe.log=console.debug||console.log||(()=>{});function Tm(t){try{t?xe.storage.setItem(\"debug\",t):xe.storage.removeItem(\"debug\")}catch{}}function Rm(){let t;try{t=xe.storage.getItem(\"debug\")}catch{}return!t&&typeof B<\"u\"&&\"env\"in B&&(t=B.env.DEBUG),t}function Cm(){try{return localStorage}catch{}}Bn.exports=bd()(xe);var{formatters:Bm}=Bn.exports;Bm.j=function(t){try{return JSON.stringify(t)}catch(e){return\"[UnexpectedJSONParseError]: \"+e.message}}});var md=M((EC,_d)=>{_();v();m();var Pm=fd(),{EventEmitter:km}=(sr(),X(nr)),wd=hd(),V=Ho(),D=ot()(\"mqtt-packet:parser\"),Vo=class t extends km{constructor(){super(),this.parser=this.constructor.parser}static parser(e){return this instanceof t?(this.settings=e||{},this._states=[\"_parseHeader\",\"_parseLength\",\"_parsePayload\",\"_newPacket\"],this._resetState(),this):new t().parser(e)}_resetState(){D(\"_resetState: resetting packet, error, _list, and _stateCounter\"),this.packet=new wd,this.error=null,this._list=Pm(),this._stateCounter=0}parse(e){for(this.error&&this._resetState(),this._list.append(e),D(\"parse: current state: %s\",this._states[this._stateCounter]);(this.packet.length!==-1||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,D(\"parse: state complete. _stateCounter is now: %d\",this._stateCounter),D(\"parse: packet.length: %d, buffer list length: %d\",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return D(\"parse: exited while loop. packet: %d, buffer list length: %d\",this.packet.length,this._list.length),this._list.length}_parseHeader(){let e=this._list.readUInt8(0),r=e>>V.CMD_SHIFT;this.packet.cmd=V.types[r];let i=e&15,n=V.requiredHeaderFlags[r];return n!=null&&i!==n?this._emitError(new Error(V.requiredHeaderFlagsErrors[r])):(this.packet.retain=(e&V.RETAIN_MASK)!==0,this.packet.qos=e>>V.QOS_SHIFT&V.QOS_MASK,this.packet.qos>2?this._emitError(new Error(\"Packet must not have both QoS bits set to 1\")):(this.packet.dup=(e&V.DUP_MASK)!==0,D(\"_parseHeader: packet: %o\",this.packet),this._list.consume(1),!0))}_parseLength(){let e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),D(\"_parseLength %d\",e.value),!!e}_parsePayload(){D(\"_parsePayload: payload %O\",this._list);let e=!1;if(this.packet.length===0||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case\"connect\":this._parseConnect();break;case\"connack\":this._parseConnack();break;case\"publish\":this._parsePublish();break;case\"puback\":case\"pubrec\":case\"pubrel\":case\"pubcomp\":this._parseConfirmation();break;case\"subscribe\":this._parseSubscribe();break;case\"suback\":this._parseSuback();break;case\"unsubscribe\":this._parseUnsubscribe();break;case\"unsuback\":this._parseUnsuback();break;case\"pingreq\":case\"pingresp\":break;case\"disconnect\":this._parseDisconnect();break;case\"auth\":this._parseAuth();break;default:this._emitError(new Error(\"Not supported\"))}e=!0}return D(\"_parsePayload complete result: %s\",e),e}_parseConnect(){D(\"_parseConnect\");let e,r,i,n,o={},s=this.packet,a=this._parseString();if(a===null)return this._emitError(new Error(\"Cannot parse protocolId\"));if(a!==\"MQTT\"&&a!==\"MQIsdp\")return this._emitError(new Error(\"Invalid protocolId\"));if(s.protocolId=a,this._pos>=this._list.length)return this._emitError(new Error(\"Packet too short\"));if(s.protocolVersion=this._list.readUInt8(this._pos),s.protocolVersion>=128&&(s.bridgeMode=!0,s.protocolVersion=s.protocolVersion-128),s.protocolVersion!==3&&s.protocolVersion!==4&&s.protocolVersion!==5)return this._emitError(new Error(\"Invalid protocol version\"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error(\"Packet too short\"));if(this._list.readUInt8(this._pos)&1)return this._emitError(new Error(\"Connect flag bit 0 must be 0, but got 1\"));o.username=this._list.readUInt8(this._pos)&V.USERNAME_MASK,o.password=this._list.readUInt8(this._pos)&V.PASSWORD_MASK,o.will=this._list.readUInt8(this._pos)&V.WILL_FLAG_MASK;let l=!!(this._list.readUInt8(this._pos)&V.WILL_RETAIN_MASK),c=(this._list.readUInt8(this._pos)&V.WILL_QOS_MASK)>>V.WILL_QOS_SHIFT;if(o.will)s.will={},s.will.retain=l,s.will.qos=c;else{if(l)return this._emitError(new Error(\"Will Retain Flag must be set to zero when Will Flag is set to 0\"));if(c)return this._emitError(new Error(\"Will QoS must be set to zero when Will Flag is set to 0\"))}if(s.clean=(this._list.readUInt8(this._pos)&V.CLEAN_SESSION_MASK)!==0,this._pos++,s.keepalive=this._parseNum(),s.keepalive===-1)return this._emitError(new Error(\"Packet too short\"));if(s.protocolVersion===5){let d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(s.properties=d)}let h=this._parseString();if(h===null)return this._emitError(new Error(\"Packet too short\"));if(s.clientId=h,D(\"_parseConnect: packet.clientId: %s\",s.clientId),o.will){if(s.protocolVersion===5){let d=this._parseProperties();Object.getOwnPropertyNames(d).length&&(s.will.properties=d)}if(e=this._parseString(),e===null)return this._emitError(new Error(\"Cannot parse will topic\"));if(s.will.topic=e,D(\"_parseConnect: packet.will.topic: %s\",s.will.topic),r=this._parseBuffer(),r===null)return this._emitError(new Error(\"Cannot parse will payload\"));s.will.payload=r,D(\"_parseConnect: packet.will.paylaod: %s\",s.will.payload)}if(o.username){if(n=this._parseString(),n===null)return this._emitError(new Error(\"Cannot parse username\"));s.username=n,D(\"_parseConnect: packet.username: %s\",s.username)}if(o.password){if(i=this._parseBuffer(),i===null)return this._emitError(new Error(\"Cannot parse password\"));s.password=i}return this.settings=s,D(\"_parseConnect: complete\"),s}_parseConnack(){D(\"_parseConnack\");let e=this.packet;if(this._list.length<1)return null;let r=this._list.readUInt8(this._pos++);if(r>1)return this._emitError(new Error(\"Invalid connack flags, bits 7-1 must be set to 0\"));if(e.sessionPresent=!!(r&V.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?e.reasonCode=this._list.readUInt8(this._pos++):e.reasonCode=0;else{if(this._list.length<2)return null;e.returnCode=this._list.readUInt8(this._pos++)}if(e.returnCode===-1||e.reasonCode===-1)return this._emitError(new Error(\"Cannot parse return code\"));if(this.settings.protocolVersion===5){let i=this._parseProperties();Object.getOwnPropertyNames(i).length&&(e.properties=i)}D(\"_parseConnack: complete\")}_parsePublish(){D(\"_parsePublish\");let e=this.packet;if(e.topic=this._parseString(),e.topic===null)return this._emitError(new Error(\"Cannot parse topic\"));if(!(e.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}e.payload=this._list.slice(this._pos,e.length),D(\"_parsePublish: payload from buffer list: %o\",e.payload)}}_parseSubscribe(){D(\"_parseSubscribe\");let e=this.packet,r,i,n,o,s,a,l;if(e.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let c=this._parseProperties();Object.getOwnPropertyNames(c).length&&(e.properties=c)}if(e.length<=0)return this._emitError(new Error(\"Malformed subscribe, no payload specified\"));for(;this._pos=e.length)return this._emitError(new Error(\"Malformed Subscribe Payload\"));if(i=this._parseByte(),this.settings.protocolVersion===5){if(i&192)return this._emitError(new Error(\"Invalid subscribe topic flag bits, bits 7-6 must be 0\"))}else if(i&252)return this._emitError(new Error(\"Invalid subscribe topic flag bits, bits 7-2 must be 0\"));if(n=i&V.SUBSCRIBE_OPTIONS_QOS_MASK,n>2)return this._emitError(new Error(\"Invalid subscribe QoS, must be <= 2\"));if(a=(i>>V.SUBSCRIBE_OPTIONS_NL_SHIFT&V.SUBSCRIBE_OPTIONS_NL_MASK)!==0,s=(i>>V.SUBSCRIBE_OPTIONS_RAP_SHIFT&V.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,o=i>>V.SUBSCRIBE_OPTIONS_RH_SHIFT&V.SUBSCRIBE_OPTIONS_RH_MASK,o>2)return this._emitError(new Error(\"Invalid retain handling, must be <= 2\"));l={topic:r,qos:n},this.settings.protocolVersion===5?(l.nl=a,l.rap=s,l.rh=o):this.settings.bridgeMode&&(l.rh=0,l.rap=!0,l.nl=!0),D(\"_parseSubscribe: push subscription `%s` to subscription\",l),e.subscriptions.push(l)}}}_parseSuback(){D(\"_parseSuback\");let e=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}if(e.length<=0)return this._emitError(new Error(\"Malformed suback, no payload specified\"));for(;this._pos2&&r!==128)return this._emitError(new Error(\"Invalid suback QoS, must be 0, 1, 2 or 128\"));this.packet.granted.push(r)}}}_parseUnsubscribe(){D(\"_parseUnsubscribe\");let e=this.packet;if(e.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}if(e.length<=0)return this._emitError(new Error(\"Malformed unsubscribe, no payload specified\"));for(;this._pos2){switch(e.reasonCode=this._parseByte(),this.packet.cmd){case\"puback\":case\"pubrec\":if(!V.MQTT5_PUBACK_PUBREC_CODES[e.reasonCode])return this._emitError(new Error(\"Invalid \"+this.packet.cmd+\" reason code\"));break;case\"pubrel\":case\"pubcomp\":if(!V.MQTT5_PUBREL_PUBCOMP_CODES[e.reasonCode])return this._emitError(new Error(\"Invalid \"+this.packet.cmd+\" reason code\"));break}D(\"_parseConfirmation: packet.reasonCode `%d`\",e.reasonCode)}else e.reasonCode=0;if(e.length>3){let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}}return!0}_parseDisconnect(){let e=this.packet;if(D(\"_parseDisconnect\"),this.settings.protocolVersion===5){this._list.length>0?(e.reasonCode=this._parseByte(),V.MQTT5_DISCONNECT_CODES[e.reasonCode]||this._emitError(new Error(\"Invalid disconnect reason code\"))):e.reasonCode=0;let r=this._parseProperties();Object.getOwnPropertyNames(r).length&&(e.properties=r)}return D(\"_parseDisconnect result: true\"),!0}_parseAuth(){D(\"_parseAuth\");let e=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error(\"Not supported auth packet for this version MQTT\"));if(e.reasonCode=this._parseByte(),!V.MQTT5_AUTH_CODES[e.reasonCode])return this._emitError(new Error(\"Invalid auth reason code\"));let r=this._parseProperties();return Object.getOwnPropertyNames(r).length&&(e.properties=r),D(\"_parseAuth: result: true\"),!0}_parseMessageId(){let e=this.packet;return e.messageId=this._parseNum(),e.messageId===null?(this._emitError(new Error(\"Cannot parse messageId\")),!1):(D(\"_parseMessageId: packet.messageId %d\",e.messageId),!0)}_parseString(e){let r=this._parseNum(),i=r+this._pos;if(r===-1||i>this._list.length||i>this.packet.length)return null;let n=this._list.toString(\"utf8\",this._pos,i);return this._pos+=r,D(\"_parseString: result: %s\",n),n}_parseStringPair(){return D(\"_parseStringPair\"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){let e=this._parseNum(),r=e+this._pos;if(e===-1||r>this._list.length||r>this.packet.length)return null;let i=this._list.slice(this._pos,r);return this._pos+=e,D(\"_parseBuffer: result: %o\",i),i}_parseNum(){if(this._list.length-this._pos<2)return-1;let e=this._list.readUInt16BE(this._pos);return this._pos+=2,D(\"_parseNum: result: %s\",e),e}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;let e=this._list.readUInt32BE(this._pos);return this._pos+=4,D(\"_parse4ByteNum: result: %s\",e),e}_parseVarByteNum(e){D(\"_parseVarByteNum\");let r=4,i=0,n=1,o=0,s=!1,a,l=this._pos?this._pos:0;for(;i=i&&this._emitError(new Error(\"Invalid variable byte integer\")),l&&(this._pos+=i),s?e?s={bytes:i,value:o}:s=o:s=!1,D(\"_parseVarByteNum: result: %o\",s),s}_parseByte(){let e;return this._pos{_();v();m();var{Buffer:Si}=(be(),X(me)),Om=65536,vd={},xm=Si.isBuffer(Si.from([1,2]).subarray(0,1));function Ed(t){let e=Si.allocUnsafe(2);return e.writeUInt8(t>>8,0),e.writeUInt8(t&255,0+1),e}function Mm(){for(let t=0;t0&&(r=r|128),n.writeUInt8(r,i++);while(t>0&&i<4);return t>0&&(i=0),xm?n.subarray(0,i):n.slice(0,i)}function Um(t){let e=Si.allocUnsafe(4);return e.writeUInt32BE(t,0),e}Sd.exports={cache:vd,generateCache:Mm,generateNumber:Ed,genBufVariableByteInt:Lm,generate4ByteBuffer:Um}});var Id=M((UC,zo)=>{\"use strict\";_();v();m();typeof B>\"u\"||!B.version||B.version.indexOf(\"v0.\")===0||B.version.indexOf(\"v1.\")===0&&B.version.indexOf(\"v1.8.\")!==0?zo.exports={nextTick:Nm}:zo.exports=B;function Nm(t,e,r,i){if(typeof t!=\"function\")throw new TypeError('\"callback\" argument must be a function');var n=arguments.length,o,s;switch(n){case 0:case 1:return B.nextTick(t);case 2:return B.nextTick(function(){t.call(null,e)});case 3:return B.nextTick(function(){t.call(null,e,r)});case 4:return B.nextTick(function(){t.call(null,e,r,i)});default:for(o=new Array(n-1),s=0;s{_();v();m();var j=Ho(),{Buffer:q}=(be(),X(me)),qm=q.allocUnsafe(0),Dm=q.from([0]),Ai=Ad(),jm=Id().nextTick,qe=ot()(\"mqtt-packet:writeToStream\"),Pn=Ai.cache,Fm=Ai.generateNumber,Wm=Ai.generateCache,Ko=Ai.genBufVariableByteInt,$m=Ai.generate4ByteBuffer,Te=Go,kn=!0;function kd(t,e,r){switch(qe(\"generate called\"),e.cork&&(e.cork(),jm(Hm,e)),kn&&(kn=!1,Wm()),qe(\"generate: packet.cmd: %s\",t.cmd),t.cmd){case\"connect\":return Vm(t,e,r);case\"connack\":return zm(t,e,r);case\"publish\":return Km(t,e,r);case\"puback\":case\"pubrec\":case\"pubrel\":case\"pubcomp\":return Gm(t,e,r);case\"subscribe\":return Qm(t,e,r);case\"suback\":return Ym(t,e,r);case\"unsubscribe\":return Jm(t,e,r);case\"unsuback\":return Xm(t,e,r);case\"pingreq\":case\"pingresp\":return Zm(t,e,r);case\"disconnect\":return e1(t,e,r);case\"auth\":return t1(t,e,r);default:return e.destroy(new Error(\"Unknown command\")),!1}}Object.defineProperty(kd,\"cacheNumbers\",{get(){return Te===Go},set(t){t?((!Pn||Object.keys(Pn).length===0)&&(kn=!0),Te=Go):(kn=!1,Te=r1)}});function Hm(t){t.uncork()}function Vm(t,e,r){let i=t||{},n=i.protocolId||\"MQTT\",o=i.protocolVersion||4,s=i.will,a=i.clean,l=i.keepalive||0,c=i.clientId||\"\",h=i.username,d=i.password,g=i.properties;a===void 0&&(a=!0);let y=0;if(!n||typeof n!=\"string\"&&!q.isBuffer(n))return e.destroy(new Error(\"Invalid protocolId\")),!1;if(y+=n.length+2,o!==3&&o!==4&&o!==5)return e.destroy(new Error(\"Invalid protocol version\")),!1;if(y+=1,(typeof c==\"string\"||q.isBuffer(c))&&(c||o>=4)&&(c||a))y+=q.byteLength(c)+2;else{if(o<4)return e.destroy(new Error(\"clientId must be supplied before 3.1.1\")),!1;if(a*1===0)return e.destroy(new Error(\"clientId must be given if cleanSession set to 0\")),!1}if(typeof l!=\"number\"||l<0||l>65535||l%1!==0)return e.destroy(new Error(\"Invalid keepalive\")),!1;y+=2,y+=1;let w,S;if(o===5){if(w=Wt(e,g),!w)return!1;y+=w.length}if(s){if(typeof s!=\"object\")return e.destroy(new Error(\"Invalid will\")),!1;if(!s.topic||typeof s.topic!=\"string\")return e.destroy(new Error(\"Invalid will topic\")),!1;if(y+=q.byteLength(s.topic)+2,y+=2,s.payload)if(s.payload.length>=0)typeof s.payload==\"string\"?y+=q.byteLength(s.payload):y+=s.payload.length;else return e.destroy(new Error(\"Invalid will payload\")),!1;if(S={},o===5){if(S=Wt(e,s.properties),!S)return!1;y+=S.length}}let E=!1;if(h!=null)if(Pd(h))E=!0,y+=q.byteLength(h)+2;else return e.destroy(new Error(\"Invalid username\")),!1;if(d!=null){if(!E)return e.destroy(new Error(\"Username is required to use password\")),!1;if(Pd(d))y+=Od(d)+2;else return e.destroy(new Error(\"Invalid password\")),!1}e.write(j.CONNECT_HEADER),De(e,y),Yr(e,n),i.bridgeMode&&(o+=128),e.write(o===131?j.VERSION131:o===132?j.VERSION132:o===4?j.VERSION4:o===5?j.VERSION5:j.VERSION3);let I=0;return I|=h!=null?j.USERNAME_MASK:0,I|=d!=null?j.PASSWORD_MASK:0,I|=s&&s.retain?j.WILL_RETAIN_MASK:0,I|=s&&s.qos?s.qos<0&&Te(e,c),g?.write(),qe(\"publish: payload: %o\",l),e.write(l)}function Gm(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.cmd||\"puback\",s=n.messageId,a=n.dup&&o===\"pubrel\"?j.DUP_MASK:0,l=0,c=n.reasonCode,h=n.properties,d=i===5?3:2;if(o===\"pubrel\"&&(l=1),typeof s!=\"number\")return e.destroy(new Error(\"Invalid messageId\")),!1;let g=null;if(i===5&&typeof h==\"object\"){if(g=Ii(e,h,r,d),!g)return!1;d+=g.length}return e.write(j.ACKS[o][l][a][0]),d===3&&(d+=c!==0?1:-1),De(e,d),Te(e,s),i===5&&d!==2&&e.write(q.from([c])),g!==null?g.write():d===4&&e.write(q.from([0])),!0}function Qm(t,e,r){qe(\"subscribe: packet: \");let i=r?r.protocolVersion:4,n=t||{},o=n.dup?j.DUP_MASK:0,s=n.messageId,a=n.subscriptions,l=n.properties,c=0;if(typeof s!=\"number\")return e.destroy(new Error(\"Invalid messageId\")),!1;c+=2;let h=null;if(i===5){if(h=Wt(e,l),!h)return!1;c+=h.length}if(typeof a==\"object\"&&a.length)for(let g=0;g2)return e.destroy(new Error(\"Invalid subscriptions - invalid Retain Handling\")),!1}c+=q.byteLength(y)+2+1}else return e.destroy(new Error(\"Invalid subscriptions\")),!1;qe(\"subscribe: writing to stream: %o\",j.SUBSCRIBE_HEADER),e.write(j.SUBSCRIBE_HEADER[1][o?1:0][0]),De(e,c),Te(e,s),h!==null&&h.write();let d=!0;for(let g of a){let y=g.topic,w=g.qos,S=+g.nl,E=+g.rap,I=g.rh,C;wr(e,y),C=j.SUBSCRIBE_OPTIONS_QOS[w],i===5&&(C|=S?j.SUBSCRIBE_OPTIONS_NL:0,C|=E?j.SUBSCRIBE_OPTIONS_RAP:0,C|=I?j.SUBSCRIBE_OPTIONS_RH[I]:0),d=e.write(q.from([C]))}return d}function Ym(t,e,r){let i=r?r.protocolVersion:4,n=t||{},o=n.messageId,s=n.granted,a=n.properties,l=0;if(typeof o!=\"number\")return e.destroy(new Error(\"Invalid messageId\")),!1;if(l+=2,typeof s==\"object\"&&s.length)for(let h=0;hj.VARBYTEINT_MAX)return t.destroy(new Error(`Invalid variable byte integer: ${e}`)),!1;let r=Td[e];return r||(r=Ko(e),e<16384&&(Td[e]=r)),qe(\"writeVarByteInt: writing to stream: %o\",r),t.write(r)}function wr(t,e){let r=q.byteLength(e);return Te(t,r),qe(\"writeString: %s\",e),t.write(e,\"utf8\")}function Rd(t,e,r){wr(t,e),wr(t,r)}function Go(t,e){return qe(\"writeNumberCached: number: %d\",e),qe(\"writeNumberCached: %o\",Pn[e]),t.write(Pn[e])}function r1(t,e){let r=Fm(e);return qe(\"writeNumberGenerated: %o\",r),t.write(r)}function i1(t,e){let r=$m(e);return qe(\"write4ByteNumber: %o\",r),t.write(r)}function Yr(t,e){typeof e==\"string\"?wr(t,e):e?(Te(t,e.length),t.write(e)):Te(t,0)}function Wt(t,e){if(typeof e!=\"object\"||e.length!=null)return{length:1,write(){Bd(t,{},0)}};let r=0;function i(o,s){let a=j.propertiesTypes[o],l=0;switch(a){case\"byte\":{if(typeof s!=\"boolean\")return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+1;break}case\"int8\":{if(typeof s!=\"number\"||s<0||s>255)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+1;break}case\"binary\":{if(s&&s===null)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+q.byteLength(s)+2;break}case\"int16\":{if(typeof s!=\"number\"||s<0||s>65535)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+2;break}case\"int32\":{if(typeof s!=\"number\"||s<0||s>4294967295)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+4;break}case\"var\":{if(typeof s!=\"number\"||s<0||s>268435455)return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+q.byteLength(Ko(s));break}case\"string\":{if(typeof s!=\"string\")return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=1+2+q.byteLength(s.toString());break}case\"pair\":{if(typeof s!=\"object\")return t.destroy(new Error(`Invalid ${o}: ${s}`)),!1;l+=Object.getOwnPropertyNames(s).reduce((c,h)=>{let d=s[h];return Array.isArray(d)?c+=d.reduce((g,y)=>(g+=1+2+q.byteLength(h.toString())+2+q.byteLength(y.toString()),g),0):c+=1+2+q.byteLength(h.toString())+2+q.byteLength(s[h].toString()),c},0);break}default:return t.destroy(new Error(`Invalid property ${o}: ${s}`)),!1}return l}if(e)for(let o in e){let s=0,a=0,l=e[o];if(Array.isArray(l))for(let c=0;co;){let a=n.shift();if(a&&e[a])delete e[a],s=Wt(t,e);else return!1}return s}function Cd(t,e,r){switch(j.propertiesTypes[e]){case\"byte\":{t.write(q.from([j.properties[e]])),t.write(q.from([+r]));break}case\"int8\":{t.write(q.from([j.properties[e]])),t.write(q.from([r]));break}case\"binary\":{t.write(q.from([j.properties[e]])),Yr(t,r);break}case\"int16\":{t.write(q.from([j.properties[e]])),Te(t,r);break}case\"int32\":{t.write(q.from([j.properties[e]])),i1(t,r);break}case\"var\":{t.write(q.from([j.properties[e]])),De(t,r);break}case\"string\":{t.write(q.from([j.properties[e]])),wr(t,r);break}case\"pair\":{Object.getOwnPropertyNames(r).forEach(n=>{let o=r[n];Array.isArray(o)?o.forEach(s=>{t.write(q.from([j.properties[e]])),Rd(t,n.toString(),s.toString())}):(t.write(q.from([j.properties[e]])),Rd(t,n.toString(),o.toString()))});break}default:return t.destroy(new Error(`Invalid property ${e} value: ${r}`)),!1}}function Bd(t,e,r){De(t,r);for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!==null){let n=e[i];if(Array.isArray(n))for(let o=0;o{_();v();m();var n1=Qo(),{EventEmitter:s1}=(sr(),X(nr)),{Buffer:Md}=(be(),X(me));function o1(t,e){let r=new Yo;return n1(t,r,e),r.concat()}var Yo=class extends s1{constructor(){super(),this._array=new Array(20),this._i=0}write(e){return this._array[this._i++]=e,!0}concat(){let e=0,r=new Array(this._array.length),i=this._array,n=0,o;for(o=0;o{_();v();m();On.parser=md().parser;On.generate=Ud();On.writeToStream=Qo()});var Zo=M(Xo=>{\"use strict\";_();v();m();Object.defineProperty(Xo,\"__esModule\",{value:!0});var Jo=class{constructor(){this.nextId=Math.max(1,Math.floor(Math.random()*65535))}allocate(){let e=this.nextId++;return this.nextId===65536&&(this.nextId=1),e}getLastAllocated(){return this.nextId===1?65535:this.nextId-1}register(e){return!0}deallocate(e){}clear(){}};Xo.default=Jo});var Dd=M((bB,qd)=>{\"use strict\";_();v();m();qd.exports=a1;function Jr(t){return t instanceof x?x.from(t):new t.constructor(t.buffer.slice(),t.byteOffset,t.length)}function a1(t){if(t=t||{},t.circles)return l1(t);return t.proto?i:r;function e(n,o){for(var s=Object.keys(n),a=new Array(s.length),l=0;l{\"use strict\";_();v();m();jd.exports=Dd()()});var $d=M(Xr=>{\"use strict\";_();v();m();Object.defineProperty(Xr,\"__esModule\",{value:!0});Xr.validateTopics=Xr.validateTopic=void 0;function Wd(t){let e=t.split(\"/\");for(let r=0;r{\"use strict\";_();v();m();Object.defineProperty(ta,\"__esModule\",{value:!0});var f1=jt(),c1={objectMode:!0},h1={clean:!0},ea=class{constructor(e){this.options=e||{},this.options=Object.assign(Object.assign({},h1),e),this._inflights=new Map}put(e,r){return this._inflights.set(e.messageId,e),r&&r(),this}createStream(){let e=new f1.Readable(c1),r=[],i=!1,n=0;return this._inflights.forEach((o,s)=>{r.push(o)}),e._read=()=>{!i&&n{if(!i)return i=!0,setTimeout(()=>{e.emit(\"close\")},0),e},e}del(e,r){let i=this._inflights.get(e.messageId);return i?(this._inflights.delete(e.messageId),r(null,i)):r&&r(new Error(\"missing packet\")),this}get(e,r){let i=this._inflights.get(e.messageId);return i?r(null,i):r&&r(new Error(\"missing packet\")),this}close(e){this.options.clean&&(this._inflights=null),e&&e()}};ta.default=ea});var Vd=M(ia=>{\"use strict\";_();v();m();Object.defineProperty(ia,\"__esModule\",{value:!0});var Hd=[0,16,128,131,135,144,145,151,153],d1=(t,e,r)=>{t.log(\"handlePublish: packet %o\",e),r=typeof r<\"u\"?r:t.noop;let i=e.topic.toString(),n=e.payload,{qos:o}=e,{messageId:s}=e,{options:a}=t;if(t.options.protocolVersion===5){let l;if(e.properties&&(l=e.properties.topicAlias),typeof l<\"u\")if(i.length===0)if(l>0&&l<=65535){let c=t.topicAliasRecv.getTopicByAlias(l);if(c)i=c,t.log(\"handlePublish :: topic complemented by alias. topic: %s - alias: %d\",i,l);else{t.log(\"handlePublish :: unregistered topic alias. alias: %d\",l),t.emit(\"error\",new Error(\"Received unregistered Topic Alias\"));return}}else{t.log(\"handlePublish :: topic alias out of range. alias: %d\",l),t.emit(\"error\",new Error(\"Received Topic Alias is out of range\"));return}else if(t.topicAliasRecv.put(i,l))t.log(\"handlePublish :: registered topic: %s - alias: %d\",i,l);else{t.log(\"handlePublish :: topic alias out of range. alias: %d\",l),t.emit(\"error\",new Error(\"Received Topic Alias is out of range\"));return}}switch(t.log(\"handlePublish: qos %d\",o),o){case 2:{a.customHandleAcks(i,n,e,(l,c)=>{if(typeof l==\"number\"&&(c=l,l=null),l)return t.emit(\"error\",l);if(Hd.indexOf(c)===-1)return t.emit(\"error\",new Error(\"Wrong reason code for pubrec\"));c?t._sendPacket({cmd:\"pubrec\",messageId:s,reasonCode:c},r):t.incomingStore.put(e,()=>{t._sendPacket({cmd:\"pubrec\",messageId:s},r)})});break}case 1:{a.customHandleAcks(i,n,e,(l,c)=>{if(typeof l==\"number\"&&(c=l,l=null),l)return t.emit(\"error\",l);if(Hd.indexOf(c)===-1)return t.emit(\"error\",new Error(\"Wrong reason code for puback\"));c||t.emit(\"message\",i,n,e),t.handleMessage(e,h=>{if(h)return r&&r(h);t._sendPacket({cmd:\"puback\",messageId:s,reasonCode:c},r)})});break}case 0:t.emit(\"message\",i,n,e),t.handleMessage(e,r);break;default:t.log(\"handlePublish: unknown QoS. Doing nothing.\");break}};ia.default=d1});var zd=M((XB,p1)=>{p1.exports={version:\"5.10.3\"}});var _r=M(at=>{\"use strict\";_();v();m();Object.defineProperty(at,\"__esModule\",{value:!0});at.MQTTJS_VERSION=at.nextTick=at.applyMixin=at.ErrorWithReasonCode=void 0;var na=class t extends Error{constructor(e,r){super(e),this.code=r,Object.setPrototypeOf(this,t.prototype),Object.getPrototypeOf(this).name=\"ErrorWithReasonCode\"}};at.ErrorWithReasonCode=na;function g1(t,e,r=!1){var i;let n=[e];for(;;){let o=n[0],s=Object.getPrototypeOf(o);if(s?.prototype)n.unshift(s);else break}for(let o of n)for(let s of Object.getOwnPropertyNames(o.prototype))(r||s!==\"constructor\")&&Object.defineProperty(t.prototype,s,(i=Object.getOwnPropertyDescriptor(o.prototype,s))!==null&&i!==void 0?i:Object.create(null))}at.applyMixin=g1;at.nextTick=typeof(B===null||B===void 0?void 0:B.nextTick)==\"function\"?B.nextTick:t=>{setTimeout(t,0)};at.MQTTJS_VERSION=zd().version});var Ti=M($t=>{\"use strict\";_();v();m();Object.defineProperty($t,\"__esModule\",{value:!0});$t.ReasonCodes=void 0;var Kd=_r();$t.ReasonCodes={0:\"\",1:\"Unacceptable protocol version\",2:\"Identifier rejected\",3:\"Server unavailable\",4:\"Bad username or password\",5:\"Not authorized\",16:\"No matching subscribers\",17:\"No subscription existed\",128:\"Unspecified error\",129:\"Malformed Packet\",130:\"Protocol Error\",131:\"Implementation specific error\",132:\"Unsupported Protocol Version\",133:\"Client Identifier not valid\",134:\"Bad User Name or Password\",135:\"Not authorized\",136:\"Server unavailable\",137:\"Server busy\",138:\"Banned\",139:\"Server shutting down\",140:\"Bad authentication method\",141:\"Keep Alive timeout\",142:\"Session taken over\",143:\"Topic Filter invalid\",144:\"Topic Name invalid\",145:\"Packet identifier in use\",146:\"Packet Identifier not found\",147:\"Receive Maximum exceeded\",148:\"Topic Alias invalid\",149:\"Packet too large\",150:\"Message rate too high\",151:\"Quota exceeded\",152:\"Administrative action\",153:\"Payload format invalid\",154:\"Retain not supported\",155:\"QoS not supported\",156:\"Use another server\",157:\"Server moved\",158:\"Shared Subscriptions not supported\",159:\"Connection rate exceeded\",160:\"Maximum connect time\",161:\"Subscription Identifiers not supported\",162:\"Wildcard Subscriptions not supported\"};var y1=(t,e)=>{let{messageId:r}=e,i=e.cmd,n=null,o=t.outgoing[r]?t.outgoing[r].cb:null,s=null;if(!o){t.log(\"_handleAck :: Server sent an ack in error. Ignoring.\");return}switch(t.log(\"_handleAck :: packet type\",i),i){case\"pubcomp\":case\"puback\":{let a=e.reasonCode;a&&a>0&&a!==16?(s=new Kd.ErrorWithReasonCode(`Publish error: ${$t.ReasonCodes[a]}`,a),t._removeOutgoingAndStoreMessage(r,()=>{o(s,e)})):t._removeOutgoingAndStoreMessage(r,o);break}case\"pubrec\":{n={cmd:\"pubrel\",qos:2,messageId:r};let a=e.reasonCode;a&&a>0&&a!==16?(s=new Kd.ErrorWithReasonCode(`Publish error: ${$t.ReasonCodes[a]}`,a),t._removeOutgoingAndStoreMessage(r,()=>{o(s,e)})):t._sendPacket(n);break}case\"suback\":{delete t.outgoing[r],t.messageIdProvider.deallocate(r);let a=e.granted;for(let l=0;l{delete t._resubscribeTopics[d]})}}delete t.messageIdToTopic[r],t._invokeStoreProcessingQueue(),o(s,e);break}case\"unsuback\":{delete t.outgoing[r],t.messageIdProvider.deallocate(r),t._invokeStoreProcessingQueue(),o(null,e);break}default:t.emit(\"error\",new Error(\"unrecognized packet type\"))}t.disconnecting&&Object.keys(t.outgoing).length===0&&t.emit(\"outgoingEmpty\")};$t.default=y1});var Qd=M(sa=>{\"use strict\";_();v();m();Object.defineProperty(sa,\"__esModule\",{value:!0});var Gd=_r(),b1=Ti(),w1=(t,e)=>{let{options:r}=t,i=r.protocolVersion,n=i===5?e.reasonCode:e.returnCode;if(i!==5){let o=new Gd.ErrorWithReasonCode(`Protocol error: Auth packets are only supported in MQTT 5. Your version:${i}`,n);t.emit(\"error\",o);return}t.handleAuth(e,(o,s)=>{if(o){t.emit(\"error\",o);return}if(n===24)t.reconnecting=!1,t._sendPacket(s);else{let a=new Gd.ErrorWithReasonCode(`Connection refused: ${b1.ReasonCodes[n]}`,n);t.emit(\"error\",a)}})};sa.default=w1});var ep=M(Mn=>{\"use strict\";_();v();m();Object.defineProperty(Mn,\"__esModule\",{value:!0});Mn.LRUCache=void 0;var Ri=typeof performance==\"object\"&&performance&&typeof performance.now==\"function\"?performance:Date,Jd=new Set,oa=typeof B==\"object\"&&B?B:{},Xd=(t,e,r,i)=>{typeof oa.emitWarning==\"function\"?oa.emitWarning(t,e,r,i):console.error(`[${r}] ${e}: ${t}`)},xn=globalThis.AbortController,Yd=globalThis.AbortSignal;if(typeof xn>\"u\"){Yd=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(i,n){this._onabort.push(n)}},xn=class{constructor(){e()}signal=new Yd;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=!0;for(let n of this.signal._onabort)n(i);this.signal.onabort?.(i)}}};let t=oa.env?.LRU_CACHE_IGNORE_AC_WARNING!==\"1\",e=()=>{t&&(t=!1,Xd(\"AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.\",\"NO_ABORT_CONTROLLER\",\"ENOTSUP\",e))}}var _1=t=>!Jd.has(t),EP=Symbol(\"type\"),Ht=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Zd=t=>Ht(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?Zr:null:null,Zr=class extends Array{constructor(e){super(e),this.fill(0)}},aa=class t{heap;length;static#l=!1;static create(e){let r=Zd(e);if(!r)return[];t.#l=!0;let i=new t(e,r);return t.#l=!1,i}constructor(e,r){if(!t.#l)throw new TypeError(\"instantiate Stack using Stack.create(n)\");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},la=class t{#l;#c;#p;#g;#B;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#i;#y;#n;#r;#e;#u;#h;#a;#s;#b;#o;#E;#S;#w;#_;#I;#f;static unsafeExposeInternals(e){return{starts:e.#S,ttls:e.#w,sizes:e.#E,keyMap:e.#n,keyList:e.#r,valList:e.#e,next:e.#u,prev:e.#h,get head(){return e.#a},get tail(){return e.#s},free:e.#b,isBackgroundFetch:r=>e.#t(r),backgroundFetch:(r,i,n,o)=>e.#O(r,i,n,o),moveToTail:r=>e.#C(r),indexes:r=>e.#m(r),rindexes:r=>e.#v(r),isStale:r=>e.#d(r)}}get max(){return this.#l}get maxSize(){return this.#c}get calculatedSize(){return this.#y}get size(){return this.#i}get fetchMethod(){return this.#B}get dispose(){return this.#p}get disposeAfter(){return this.#g}constructor(e){let{max:r=0,ttl:i,ttlResolution:n=1,ttlAutopurge:o,updateAgeOnGet:s,updateAgeOnHas:a,allowStale:l,dispose:c,disposeAfter:h,noDisposeOnSet:d,noUpdateTTL:g,maxSize:y=0,maxEntrySize:w=0,sizeCalculation:S,fetchMethod:E,noDeleteOnFetchRejection:I,noDeleteOnStaleGet:C,allowStaleOnFetchRejection:R,allowStaleOnFetchAbort:U,ignoreFetchAbort:N}=e;if(r!==0&&!Ht(r))throw new TypeError(\"max option must be a nonnegative integer\");let W=r?Zd(r):Array;if(!W)throw new Error(\"invalid max value: \"+r);if(this.#l=r,this.#c=y,this.maxEntrySize=w||this.#c,this.sizeCalculation=S,this.sizeCalculation){if(!this.#c&&!this.maxEntrySize)throw new TypeError(\"cannot set sizeCalculation without setting maxSize or maxEntrySize\");if(typeof this.sizeCalculation!=\"function\")throw new TypeError(\"sizeCalculation set to non-function\")}if(E!==void 0&&typeof E!=\"function\")throw new TypeError(\"fetchMethod must be a function if specified\");if(this.#B=E,this.#I=!!E,this.#n=new Map,this.#r=new Array(r).fill(void 0),this.#e=new Array(r).fill(void 0),this.#u=new W(r),this.#h=new W(r),this.#a=0,this.#s=0,this.#b=aa.create(r),this.#i=0,this.#y=0,typeof c==\"function\"&&(this.#p=c),typeof h==\"function\"?(this.#g=h,this.#o=[]):(this.#g=void 0,this.#o=void 0),this.#_=!!this.#p,this.#f=!!this.#g,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!g,this.noDeleteOnFetchRejection=!!I,this.allowStaleOnFetchRejection=!!R,this.allowStaleOnFetchAbort=!!U,this.ignoreFetchAbort=!!N,this.maxEntrySize!==0){if(this.#c!==0&&!Ht(this.#c))throw new TypeError(\"maxSize must be a positive integer if specified\");if(!Ht(this.maxEntrySize))throw new TypeError(\"maxEntrySize must be a positive integer if specified\");this.#q()}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!C,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!a,this.ttlResolution=Ht(n)||n===0?n:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!Ht(this.ttl))throw new TypeError(\"ttl must be a positive integer if specified\");this.#x()}if(this.#l===0&&this.ttl===0&&this.#c===0)throw new TypeError(\"At least one of max, maxSize, or ttl is required\");if(!this.ttlAutopurge&&!this.#l&&!this.#c){let K=\"LRU_CACHE_UNBOUNDED\";_1(K)&&(Jd.add(K),Xd(\"TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.\",\"UnboundedCacheWarning\",K,t))}}getRemainingTTL(e){return this.#n.has(e)?1/0:0}#x(){let e=new Zr(this.#l),r=new Zr(this.#l);this.#w=e,this.#S=r,this.#M=(o,s,a=Ri.now())=>{if(r[o]=s!==0?a:0,e[o]=s,s!==0&&this.ttlAutopurge){let l=setTimeout(()=>{this.#d(o)&&this.delete(this.#r[o])},s+1);l.unref&&l.unref()}},this.#T=o=>{r[o]=e[o]!==0?Ri.now():0},this.#A=(o,s)=>{if(e[s]){let a=e[s],l=r[s];o.ttl=a,o.start=l,o.now=i||n();let c=o.now-l;o.remainingTTL=a-c}};let i=0,n=()=>{let o=Ri.now();if(this.ttlResolution>0){i=o;let s=setTimeout(()=>i=0,this.ttlResolution);s.unref&&s.unref()}return o};this.getRemainingTTL=o=>{let s=this.#n.get(o);if(s===void 0)return 0;let a=e[s],l=r[s];if(a===0||l===0)return 1/0;let c=(i||n())-l;return a-c},this.#d=o=>e[o]!==0&&r[o]!==0&&(i||n())-r[o]>e[o]}#T=()=>{};#A=()=>{};#M=()=>{};#d=()=>!1;#q(){let e=new Zr(this.#l);this.#y=0,this.#E=e,this.#R=r=>{this.#y-=e[r],e[r]=0},this.#L=(r,i,n,o)=>{if(this.#t(i))return 0;if(!Ht(n))if(o){if(typeof o!=\"function\")throw new TypeError(\"sizeCalculation must be a function\");if(n=o(i,r),!Ht(n))throw new TypeError(\"sizeCalculation return invalid (expect positive integer)\")}else throw new TypeError(\"invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.\");return n},this.#P=(r,i,n)=>{if(e[r]=i,this.#c){let o=this.#c-e[r];for(;this.#y>o;)this.#k(!0)}this.#y+=e[r],n&&(n.entrySize=i,n.totalCalculatedSize=this.#y)}}#R=e=>{};#P=(e,r,i)=>{};#L=(e,r,i,n)=>{if(i||n)throw new TypeError(\"cannot set size without setting maxSize or maxEntrySize on cache\");return 0};*#m({allowStale:e=this.allowStale}={}){if(this.#i)for(let r=this.#s;!(!this.#U(r)||((e||!this.#d(r))&&(yield r),r===this.#a));)r=this.#h[r]}*#v({allowStale:e=this.allowStale}={}){if(this.#i)for(let r=this.#a;!(!this.#U(r)||((e||!this.#d(r))&&(yield r),r===this.#s));)r=this.#u[r]}#U(e){return e!==void 0&&this.#n.get(this.#r[e])===e}*entries(){for(let e of this.#m())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*rentries(){for(let e of this.#v())this.#e[e]!==void 0&&this.#r[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#r[e],this.#e[e]])}*keys(){for(let e of this.#m()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r)}}*rkeys(){for(let e of this.#v()){let r=this.#r[e];r!==void 0&&!this.#t(this.#e[e])&&(yield r)}}*values(){for(let e of this.#m())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}*rvalues(){for(let e of this.#v())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}[Symbol.iterator](){return this.entries()}find(e,r={}){for(let i of this.#m()){let n=this.#e[i],o=this.#t(n)?n.__staleWhileFetching:n;if(o!==void 0&&e(o,this.#r[i],this))return this.get(this.#r[i],r)}}forEach(e,r=this){for(let i of this.#m()){let n=this.#e[i],o=this.#t(n)?n.__staleWhileFetching:n;o!==void 0&&e.call(r,o,this.#r[i],this)}}rforEach(e,r=this){for(let i of this.#v()){let n=this.#e[i],o=this.#t(n)?n.__staleWhileFetching:n;o!==void 0&&e.call(r,o,this.#r[i],this)}}purgeStale(){let e=!1;for(let r of this.#v({allowStale:!0}))this.#d(r)&&(this.delete(this.#r[r]),e=!0);return e}dump(){let e=[];for(let r of this.#m({allowStale:!0})){let i=this.#r[r],n=this.#e[r],o=this.#t(n)?n.__staleWhileFetching:n;if(o===void 0||i===void 0)continue;let s={value:o};if(this.#w&&this.#S){s.ttl=this.#w[r];let a=Ri.now()-this.#S[r];s.start=Math.floor(Date.now()-a)}this.#E&&(s.size=this.#E[r]),e.unshift([i,s])}return e}load(e){this.clear();for(let[r,i]of e){if(i.start){let n=Date.now()-i.start;i.start=Ri.now()-n}this.set(r,i.value,i)}}set(e,r,i={}){if(r===void 0)return this.delete(e),this;let{ttl:n=this.ttl,start:o,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:l}=i,{noUpdateTTL:c=this.noUpdateTTL}=i,h=this.#L(e,r,i.size||0,a);if(this.maxEntrySize&&h>this.maxEntrySize)return l&&(l.set=\"miss\",l.maxEntrySizeExceeded=!0),this.delete(e),this;let d=this.#i===0?void 0:this.#n.get(e);if(d===void 0)d=this.#i===0?this.#s:this.#b.length!==0?this.#b.pop():this.#i===this.#l?this.#k(!1):this.#i,this.#r[d]=e,this.#e[d]=r,this.#n.set(e,d),this.#u[this.#s]=d,this.#h[d]=this.#s,this.#s=d,this.#i++,this.#P(d,h,l),l&&(l.set=\"add\"),c=!1;else{this.#C(d);let g=this.#e[d];if(r!==g){if(this.#I&&this.#t(g)){g.__abortController.abort(new Error(\"replaced\"));let{__staleWhileFetching:y}=g;y!==void 0&&!s&&(this.#_&&this.#p?.(y,e,\"set\"),this.#f&&this.#o?.push([y,e,\"set\"]))}else s||(this.#_&&this.#p?.(g,e,\"set\"),this.#f&&this.#o?.push([g,e,\"set\"]));if(this.#R(d),this.#P(d,h,l),this.#e[d]=r,l){l.set=\"replace\";let y=g&&this.#t(g)?g.__staleWhileFetching:g;y!==void 0&&(l.oldValue=y)}}else l&&(l.set=\"update\")}if(n!==0&&!this.#w&&this.#x(),this.#w&&(c||this.#M(d,n,o),l&&this.#A(l,d)),!s&&this.#f&&this.#o){let g=this.#o,y;for(;y=g?.shift();)this.#g?.(...y)}return this}pop(){try{for(;this.#i;){let e=this.#e[this.#a];if(this.#k(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#f&&this.#o){let e=this.#o,r;for(;r=e?.shift();)this.#g?.(...r)}}}#k(e){let r=this.#a,i=this.#r[r],n=this.#e[r];return this.#I&&this.#t(n)?n.__abortController.abort(new Error(\"evicted\")):(this.#_||this.#f)&&(this.#_&&this.#p?.(n,i,\"evict\"),this.#f&&this.#o?.push([n,i,\"evict\"])),this.#R(r),e&&(this.#r[r]=void 0,this.#e[r]=void 0,this.#b.push(r)),this.#i===1?(this.#a=this.#s=0,this.#b.length=0):this.#a=this.#u[r],this.#n.delete(i),this.#i--,r}has(e,r={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:n}=r,o=this.#n.get(e);if(o!==void 0){let s=this.#e[o];if(this.#t(s)&&s.__staleWhileFetching===void 0)return!1;if(this.#d(o))n&&(n.has=\"stale\",this.#A(n,o));else return i&&this.#T(o),n&&(n.has=\"hit\",this.#A(n,o)),!0}else n&&(n.has=\"miss\");return!1}peek(e,r={}){let{allowStale:i=this.allowStale}=r,n=this.#n.get(e);if(n!==void 0&&(i||!this.#d(n))){let o=this.#e[n];return this.#t(o)?o.__staleWhileFetching:o}}#O(e,r,i,n){let o=r===void 0?void 0:this.#e[r];if(this.#t(o))return o;let s=new xn,{signal:a}=i;a?.addEventListener(\"abort\",()=>s.abort(a.reason),{signal:s.signal});let l={signal:s.signal,options:i,context:n},c=(S,E=!1)=>{let{aborted:I}=s.signal,C=i.ignoreFetchAbort&&S!==void 0;if(i.status&&(I&&!E?(i.status.fetchAborted=!0,i.status.fetchError=s.signal.reason,C&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),I&&!C&&!E)return d(s.signal.reason);let R=y;return this.#e[r]===y&&(S===void 0?R.__staleWhileFetching?this.#e[r]=R.__staleWhileFetching:this.delete(e):(i.status&&(i.status.fetchUpdated=!0),this.set(e,S,l.options))),S},h=S=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=S),d(S)),d=S=>{let{aborted:E}=s.signal,I=E&&i.allowStaleOnFetchAbort,C=I||i.allowStaleOnFetchRejection,R=C||i.noDeleteOnFetchRejection,U=y;if(this.#e[r]===y&&(!R||U.__staleWhileFetching===void 0?this.delete(e):I||(this.#e[r]=U.__staleWhileFetching)),C)return i.status&&U.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),U.__staleWhileFetching;if(U.__returned===U)throw S},g=(S,E)=>{let I=this.#B?.(e,o,l);I&&I instanceof Promise&&I.then(C=>S(C===void 0?void 0:C),E),s.signal.addEventListener(\"abort\",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(S(void 0),i.allowStaleOnFetchAbort&&(S=C=>c(C,!0)))})};i.status&&(i.status.fetchDispatched=!0);let y=new Promise(g).then(c,h),w=Object.assign(y,{__abortController:s,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(e,w,{...l.options,status:void 0}),r=this.#n.get(e)):this.#e[r]=w,w}#t(e){if(!this.#I)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty(\"__staleWhileFetching\")&&r.__abortController instanceof xn}async fetch(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:l=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:h=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:g=this.allowStaleOnFetchRejection,ignoreFetchAbort:y=this.ignoreFetchAbort,allowStaleOnFetchAbort:w=this.allowStaleOnFetchAbort,context:S,forceRefresh:E=!1,status:I,signal:C}=r;if(!this.#I)return I&&(I.fetch=\"get\"),this.get(e,{allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:o,status:I});let R={allowStale:i,updateAgeOnGet:n,noDeleteOnStaleGet:o,ttl:s,noDisposeOnSet:a,size:l,sizeCalculation:c,noUpdateTTL:h,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:w,ignoreFetchAbort:y,status:I,signal:C},U=this.#n.get(e);if(U===void 0){I&&(I.fetch=\"miss\");let N=this.#O(e,U,R,S);return N.__returned=N}else{let N=this.#e[U];if(this.#t(N)){let pe=i&&N.__staleWhileFetching!==void 0;return I&&(I.fetch=\"inflight\",pe&&(I.returnedStale=!0)),pe?N.__staleWhileFetching:N.__returned=N}let W=this.#d(U);if(!E&&!W)return I&&(I.fetch=\"hit\"),this.#C(U),n&&this.#T(U),I&&this.#A(I,U),N;let K=this.#O(e,U,R,S),Q=K.__staleWhileFetching!==void 0&&i;return I&&(I.fetch=W?\"stale\":\"refresh\",Q&&W&&(I.returnedStale=!0)),Q?K.__staleWhileFetching:K.__returned=K}}get(e,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:s}=r,a=this.#n.get(e);if(a!==void 0){let l=this.#e[a],c=this.#t(l);return s&&this.#A(s,a),this.#d(a)?(s&&(s.get=\"stale\"),c?(s&&i&&l.__staleWhileFetching!==void 0&&(s.returnedStale=!0),i?l.__staleWhileFetching:void 0):(o||this.delete(e),s&&i&&(s.returnedStale=!0),i?l:void 0)):(s&&(s.get=\"hit\"),c?l.__staleWhileFetching:(this.#C(a),n&&this.#T(a),l))}else s&&(s.get=\"miss\")}#N(e,r){this.#h[r]=e,this.#u[e]=r}#C(e){e!==this.#s&&(e===this.#a?this.#a=this.#u[e]:this.#N(this.#h[e],this.#u[e]),this.#N(this.#s,e),this.#s=e)}delete(e){let r=!1;if(this.#i!==0){let i=this.#n.get(e);if(i!==void 0)if(r=!0,this.#i===1)this.clear();else{this.#R(i);let n=this.#e[i];this.#t(n)?n.__abortController.abort(new Error(\"deleted\")):(this.#_||this.#f)&&(this.#_&&this.#p?.(n,e,\"delete\"),this.#f&&this.#o?.push([n,e,\"delete\"])),this.#n.delete(e),this.#r[i]=void 0,this.#e[i]=void 0,i===this.#s?this.#s=this.#h[i]:i===this.#a?this.#a=this.#u[i]:(this.#u[this.#h[i]]=this.#u[i],this.#h[this.#u[i]]=this.#h[i]),this.#i--,this.#b.push(i)}}if(this.#f&&this.#o?.length){let i=this.#o,n;for(;n=i?.shift();)this.#g?.(...n)}return r}clear(){for(let e of this.#v({allowStale:!0})){let r=this.#e[e];if(this.#t(r))r.__abortController.abort(new Error(\"deleted\"));else{let i=this.#r[e];this.#_&&this.#p?.(r,i,\"delete\"),this.#f&&this.#o?.push([r,i,\"delete\"])}}if(this.#n.clear(),this.#e.fill(void 0),this.#r.fill(void 0),this.#w&&this.#S&&(this.#w.fill(0),this.#S.fill(0)),this.#E&&this.#E.fill(0),this.#a=0,this.#s=0,this.#b.length=0,this.#y=0,this.#i=0,this.#f&&this.#o){let e=this.#o,r;for(;r=e?.shift();)this.#g?.(...r)}}};Mn.LRUCache=la});var lt=M(Vt=>{\"use strict\";_();v();m();Object.defineProperty(Vt,\"t\",{value:!0});Vt.ContainerIterator=Vt.Container=Vt.Base=void 0;var ua=class{constructor(e=0){this.iteratorType=e}equals(e){return this.o===e.o}};Vt.ContainerIterator=ua;var Ln=class{constructor(){this.i=0}get length(){return this.i}size(){return this.i}empty(){return this.i===0}};Vt.Base=Ln;var fa=class extends Ln{};Vt.Container=fa});var tp=M(Un=>{\"use strict\";_();v();m();Object.defineProperty(Un,\"t\",{value:!0});Un.default=void 0;var m1=lt(),ca=class extends m1.Base{constructor(e=[]){super(),this.S=[];let r=this;e.forEach(function(i){r.push(i)})}clear(){this.i=0,this.S=[]}push(e){return this.S.push(e),this.i+=1,this.i}pop(){if(this.i!==0)return this.i-=1,this.S.pop()}top(){return this.S[this.i-1]}},v1=ca;Un.default=v1});var rp=M(Nn=>{\"use strict\";_();v();m();Object.defineProperty(Nn,\"t\",{value:!0});Nn.default=void 0;var E1=lt(),ha=class extends E1.Base{constructor(e=[]){super(),this.j=0,this.q=[];let r=this;e.forEach(function(i){r.push(i)})}clear(){this.q=[],this.i=this.j=0}push(e){let r=this.q.length;if(this.j/r>.5&&this.j+this.i>=r&&r>4096){let i=this.i;for(let n=0;n{\"use strict\";_();v();m();Object.defineProperty(qn,\"t\",{value:!0});qn.default=void 0;var A1=lt(),da=class extends A1.Base{constructor(e=[],r=function(n,o){return n>o?-1:n>1;for(let o=this.i-1>>1;o>=0;--o)this.k(o,n)}m(e){let r=this.C[e];for(;e>0;){let i=e-1>>1,n=this.C[i];if(this.v(n,r)<=0)break;this.C[e]=n,e=i}this.C[e]=r}k(e,r){let i=this.C[e];for(;e0&&(n=o,s=this.C[o]),this.v(s,i)>=0)break;this.C[e]=s,e=n}this.C[e]=i}clear(){this.i=0,this.C.length=0}push(e){this.C.push(e),this.m(this.i),this.i+=1}pop(){if(this.i===0)return;let e=this.C[0],r=this.C.pop();return this.i-=1,this.i&&(this.C[0]=r,this.k(0,this.i>>1)),e}top(){return this.C[0]}find(e){return this.C.indexOf(e)>=0}remove(e){let r=this.C.indexOf(e);return r<0?!1:(r===0?this.pop():r===this.i-1?(this.C.pop(),this.i-=1):(this.C.splice(r,1,this.C.pop()),this.i-=1,this.m(r),this.k(r,this.i>>1)),!0)}updateItem(e){let r=this.C.indexOf(e);return r<0?!1:(this.m(r),this.k(r,this.i>>1),!0)}toArray(){return[...this.C]}},I1=da;qn.default=I1});var jn=M(Dn=>{\"use strict\";_();v();m();Object.defineProperty(Dn,\"t\",{value:!0});Dn.default=void 0;var T1=lt(),pa=class extends T1.Container{},R1=pa;Dn.default=R1});var ut=M(ga=>{\"use strict\";_();v();m();Object.defineProperty(ga,\"t\",{value:!0});ga.throwIteratorAccessError=C1;function C1(){throw new RangeError(\"Iterator access denied!\")}});var ba=M(Wn=>{\"use strict\";_();v();m();Object.defineProperty(Wn,\"t\",{value:!0});Wn.RandomIterator=void 0;var B1=lt(),Fn=ut(),ya=class extends B1.ContainerIterator{constructor(e,r){super(r),this.o=e,this.iteratorType===0?(this.pre=function(){return this.o===0&&(0,Fn.throwIteratorAccessError)(),this.o-=1,this},this.next=function(){return this.o===this.container.size()&&(0,Fn.throwIteratorAccessError)(),this.o+=1,this}):(this.pre=function(){return this.o===this.container.size()-1&&(0,Fn.throwIteratorAccessError)(),this.o+=1,this},this.next=function(){return this.o===-1&&(0,Fn.throwIteratorAccessError)(),this.o-=1,this})}get pointer(){return this.container.getElementByPos(this.o)}set pointer(e){this.container.setElementByPos(this.o,e)}};Wn.RandomIterator=ya});var np=M($n=>{\"use strict\";_();v();m();Object.defineProperty($n,\"t\",{value:!0});$n.default=void 0;var P1=O1(jn()),k1=ba();function O1(t){return t&&t.t?t:{default:t}}var mr=class t extends k1.RandomIterator{constructor(e,r,i){super(e,i),this.container=r}copy(){return new t(this.o,this.container,this.iteratorType)}},wa=class extends P1.default{constructor(e=[],r=!0){if(super(),Array.isArray(e))this.J=r?[...e]:e,this.i=e.length;else{this.J=[];let i=this;e.forEach(function(n){i.pushBack(n)})}}clear(){this.i=0,this.J.length=0}begin(){return new mr(0,this)}end(){return new mr(this.i,this)}rBegin(){return new mr(this.i-1,this,1)}rEnd(){return new mr(-1,this,1)}front(){return this.J[0]}back(){return this.J[this.i-1]}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;return this.J[e]}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;return this.J.splice(e,1),this.i-=1,this.i}eraseElementByValue(e){let r=0;for(let i=0;ithis.i-1)throw new RangeError;this.J[e]=r}insert(e,r,i=1){if(e<0||e>this.i)throw new RangeError;return this.J.splice(e,0,...new Array(i).fill(r)),this.i+=i,this.i}find(e){for(let r=0;r{\"use strict\";_();v();m();Object.defineProperty(Hn,\"t\",{value:!0});Hn.default=void 0;var M1=U1(jn()),L1=lt(),vr=ut();function U1(t){return t&&t.t?t:{default:t}}var Er=class t extends L1.ContainerIterator{constructor(e,r,i,n){super(n),this.o=e,this.h=r,this.container=i,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,vr.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,vr.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,vr.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,vr.throwIteratorAccessError)(),this.o=this.o.L,this})}get pointer(){return this.o===this.h&&(0,vr.throwIteratorAccessError)(),this.o.l}set pointer(e){this.o===this.h&&(0,vr.throwIteratorAccessError)(),this.o.l=e}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},_a=class extends M1.default{constructor(e=[]){super(),this.h={},this.p=this._=this.h.L=this.h.B=this.h;let r=this;e.forEach(function(i){r.pushBack(i)})}V(e){let{L:r,B:i}=e;r.B=i,i.L=r,e===this.p&&(this.p=i),e===this._&&(this._=r),this.i-=1}G(e,r){let i=r.B,n={l:e,L:r,B:i};r.B=n,i.L=n,r===this.h&&(this.p=n),i===this.h&&(this._=n),this.i+=1}clear(){this.i=0,this.p=this._=this.h.L=this.h.B=this.h}begin(){return new Er(this.p,this.h,this)}end(){return new Er(this.h,this.h,this)}rBegin(){return new Er(this._,this.h,this,1)}rEnd(){return new Er(this.h,this.h,this,1)}front(){return this.p.l}back(){return this._.l}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return r.l}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return this.V(r),this.i}eraseElementByValue(e){let r=this.p;for(;r!==this.h;)r.l===e&&this.V(r),r=r.B;return this.i}eraseElementByIterator(e){let r=e.o;return r===this.h&&(0,vr.throwIteratorAccessError)(),e=e.next(),this.V(r),e}pushBack(e){return this.G(e,this._),this.i}popBack(){if(this.i===0)return;let e=this._.l;return this.V(this._),e}pushFront(e){return this.G(e,this.h),this.i}popFront(){if(this.i===0)return;let e=this.p.l;return this.V(this.p),e}setElementByPos(e,r){if(e<0||e>this.i-1)throw new RangeError;let i=this.p;for(;e--;)i=i.B;i.l=r}insert(e,r,i=1){if(e<0||e>this.i)throw new RangeError;if(i<=0)return this.i;if(e===0)for(;i--;)this.pushFront(r);else if(e===this.i)for(;i--;)this.pushBack(r);else{let n=this.p;for(let s=1;s{\"use strict\";_();v();m();Object.defineProperty(Vn,\"t\",{value:!0});Vn.default=void 0;var q1=j1(jn()),D1=ba();function j1(t){return t&&t.t?t:{default:t}}var Sr=class t extends D1.RandomIterator{constructor(e,r,i){super(e,i),this.container=r}copy(){return new t(this.o,this.container,this.iteratorType)}},ma=class extends q1.default{constructor(e=[],r=4096){super(),this.j=0,this.D=0,this.R=0,this.N=0,this.P=0,this.A=[];let i=(()=>{if(typeof e.length==\"number\")return e.length;if(typeof e.size==\"number\")return e.size;if(typeof e.size==\"function\")return e.size();throw new TypeError(\"Cannot get the length or size of the container\")})();this.F=r,this.P=Math.max(Math.ceil(i/this.F),1);for(let s=0;s>1)-(n>>1),this.D=this.N=this.F-i%this.F>>1;let o=this;e.forEach(function(s){o.pushBack(s)})}T(){let e=[],r=Math.max(this.P>>1,1);for(let i=0;i>1}begin(){return new Sr(0,this)}end(){return new Sr(this.i,this)}rBegin(){return new Sr(this.i-1,this,1)}rEnd(){return new Sr(-1,this,1)}front(){if(this.i!==0)return this.A[this.j][this.D]}back(){if(this.i!==0)return this.A[this.R][this.N]}pushBack(e){return this.i&&(this.N0?this.N-=1:this.R>0?(this.R-=1,this.N=this.F-1):(this.R=this.P-1,this.N=this.F-1)),this.i-=1,e}pushFront(e){return this.i&&(this.D>0?this.D-=1:this.j>0?(this.j-=1,this.D=this.F-1):(this.j=this.P-1,this.D=this.F-1),this.j===this.R&&this.D===this.N&&this.T()),this.i+=1,this.A[this.j][this.D]=e,this.i}popFront(){if(this.i===0)return;let e=this.A[this.j][this.D];return this.i!==1&&(this.Dthis.i-1)throw new RangeError;let{curNodeBucketIndex:r,curNodePointerIndex:i}=this.O(e);return this.A[r][i]}setElementByPos(e,r){if(e<0||e>this.i-1)throw new RangeError;let{curNodeBucketIndex:i,curNodePointerIndex:n}=this.O(e);this.A[i][n]=r}insert(e,r,i=1){if(e<0||e>this.i)throw new RangeError;if(e===0)for(;i--;)this.pushFront(r);else if(e===this.i)for(;i--;)this.pushBack(r);else{let n=[];for(let o=e;othis.i-1)throw new RangeError;if(e===0)this.popFront();else if(e===this.i-1)this.popBack();else{let r=[];for(let n=e+1;ne;)this.popBack();return this.i}sort(e){let r=[];for(let i=0;i{\"use strict\";_();v();m();Object.defineProperty(ei,\"t\",{value:!0});ei.TreeNodeEnableIndex=ei.TreeNode=void 0;var zn=class{constructor(e,r){this.ee=1,this.u=void 0,this.l=void 0,this.U=void 0,this.W=void 0,this.tt=void 0,this.u=e,this.l=r}L(){let e=this;if(e.ee===1&&e.tt.tt===e)e=e.W;else if(e.U)for(e=e.U;e.W;)e=e.W;else{let r=e.tt;for(;r.U===e;)e=r,r=e.tt;e=r}return e}B(){let e=this;if(e.W){for(e=e.W;e.U;)e=e.U;return e}else{let r=e.tt;for(;r.W===e;)e=r,r=e.tt;return e.W!==r?r:e}}te(){let e=this.tt,r=this.W,i=r.U;return e.tt===this?e.tt=r:e.U===this?e.U=r:e.W=r,r.tt=e,r.U=this,this.tt=r,this.W=i,i&&(i.tt=this),r}se(){let e=this.tt,r=this.U,i=r.W;return e.tt===this?e.tt=r:e.U===this?e.U=r:e.W=r,r.tt=e,r.W=this,this.tt=r,this.U=i,i&&(i.tt=this),r}};ei.TreeNode=zn;var va=class extends zn{constructor(){super(...arguments),this.rt=1}te(){let e=super.te();return this.ie(),e.ie(),e}se(){let e=super.se();return this.ie(),e.ie(),e}ie(){this.rt=1,this.U&&(this.rt+=this.U.rt),this.W&&(this.rt+=this.W.rt)}};ei.TreeNodeEnableIndex=va});var Sa=M(Kn=>{\"use strict\";_();v();m();Object.defineProperty(Kn,\"t\",{value:!0});Kn.default=void 0;var lp=ap(),W1=lt(),up=ut(),Ea=class extends W1.Container{constructor(e=function(i,n){return in?1:0},r=!1){super(),this.Y=void 0,this.v=e,r?(this.re=lp.TreeNodeEnableIndex,this.M=function(i,n,o){let s=this.ne(i,n,o);if(s){let a=s.tt;for(;a!==this.h;)a.rt+=1,a=a.tt;let l=this.he(s);if(l){let{parentNode:c,grandParent:h,curNode:d}=l;c.ie(),h.ie(),d.ie()}}return this.i},this.V=function(i){let n=this.fe(i);for(;n!==this.h;)n.rt-=1,n=n.tt}):(this.re=lp.TreeNode,this.M=function(i,n,o){let s=this.ne(i,n,o);return s&&this.he(s),this.i},this.V=this.fe),this.h=new this.re}X(e,r){let i=this.h;for(;e;){let n=this.v(e.u,r);if(n<0)e=e.W;else if(n>0)i=e,e=e.U;else return e}return i}Z(e,r){let i=this.h;for(;e;)this.v(e.u,r)<=0?e=e.W:(i=e,e=e.U);return i}$(e,r){let i=this.h;for(;e;){let n=this.v(e.u,r);if(n<0)i=e,e=e.W;else if(n>0)e=e.U;else return e}return i}rr(e,r){let i=this.h;for(;e;)this.v(e.u,r)<0?(i=e,e=e.W):e=e.U;return i}ue(e){for(;;){let r=e.tt;if(r===this.h)return;if(e.ee===1){e.ee=0;return}if(e===r.U){let i=r.W;if(i.ee===1)i.ee=0,r.ee=1,r===this.Y?this.Y=r.te():r.te();else if(i.W&&i.W.ee===1){i.ee=r.ee,r.ee=0,i.W.ee=0,r===this.Y?this.Y=r.te():r.te();return}else i.U&&i.U.ee===1?(i.ee=1,i.U.ee=0,i.se()):(i.ee=1,e=r)}else{let i=r.U;if(i.ee===1)i.ee=0,r.ee=1,r===this.Y?this.Y=r.se():r.se();else if(i.U&&i.U.ee===1){i.ee=r.ee,r.ee=0,i.U.ee=0,r===this.Y?this.Y=r.se():r.se();return}else i.W&&i.W.ee===1?(i.ee=1,i.W.ee=0,i.te()):(i.ee=1,e=r)}}}fe(e){if(this.i===1)return this.clear(),this.h;let r=e;for(;r.U||r.W;){if(r.W)for(r=r.W;r.U;)r=r.U;else r=r.U;[e.u,r.u]=[r.u,e.u],[e.l,r.l]=[r.l,e.l],e=r}this.h.U===r?this.h.U=r.tt:this.h.W===r&&(this.h.W=r.tt),this.ue(r);let i=r.tt;return r===i.U?i.U=void 0:i.W=void 0,this.i-=1,this.Y.ee=0,i}oe(e,r){return e===void 0?!1:this.oe(e.U,r)||r(e)?!0:this.oe(e.W,r)}he(e){for(;;){let r=e.tt;if(r.ee===0)return;let i=r.tt;if(r===i.U){let n=i.W;if(n&&n.ee===1){if(n.ee=r.ee=0,i===this.Y)return;i.ee=1,e=i;continue}else if(e===r.W){if(e.ee=0,e.U&&(e.U.tt=r),e.W&&(e.W.tt=i),r.W=e.U,i.U=e.W,e.U=r,e.W=i,i===this.Y)this.Y=e,this.h.tt=e;else{let o=i.tt;o.U===i?o.U=e:o.W=e}return e.tt=i.tt,r.tt=e,i.tt=e,i.ee=1,{parentNode:r,grandParent:i,curNode:e}}else r.ee=0,i===this.Y?this.Y=i.se():i.se(),i.ee=1}else{let n=i.U;if(n&&n.ee===1){if(n.ee=r.ee=0,i===this.Y)return;i.ee=1,e=i;continue}else if(e===r.U){if(e.ee=0,e.U&&(e.U.tt=i),e.W&&(e.W.tt=r),i.W=e.U,r.U=e.W,e.U=i,e.W=r,i===this.Y)this.Y=e,this.h.tt=e;else{let o=i.tt;o.U===i?o.U=e:o.W=e}return e.tt=i.tt,r.tt=e,i.tt=e,i.ee=1,{parentNode:r,grandParent:i,curNode:e}}else r.ee=0,i===this.Y?this.Y=i.te():i.te(),i.ee=1}return}}ne(e,r,i){if(this.Y===void 0){this.i+=1,this.Y=new this.re(e,r),this.Y.ee=0,this.Y.tt=this.h,this.h.tt=this.Y,this.h.U=this.Y,this.h.W=this.Y;return}let n,o=this.h.U,s=this.v(o.u,e);if(s===0){o.l=r;return}else if(s>0)o.U=new this.re(e,r),o.U.tt=o,n=o.U,this.h.U=n;else{let a=this.h.W,l=this.v(a.u,e);if(l===0){a.l=r;return}else if(l<0)a.W=new this.re(e,r),a.W.tt=a,n=a.W,this.h.W=n;else{if(i!==void 0){let c=i.o;if(c!==this.h){let h=this.v(c.u,e);if(h===0){c.l=r;return}else if(h>0){let d=c.L(),g=this.v(d.u,e);if(g===0){d.l=r;return}else g<0&&(n=new this.re(e,r),d.W===void 0?(d.W=n,n.tt=d):(c.U=n,n.tt=c))}}}if(n===void 0)for(n=this.Y;;){let c=this.v(n.u,e);if(c>0){if(n.U===void 0){n.U=new this.re(e,r),n.U.tt=n,n=n.U;break}n=n.U}else if(c<0){if(n.W===void 0){n.W=new this.re(e,r),n.W.tt=n,n=n.W;break}n=n.W}else{n.l=r;return}}}}return this.i+=1,n}I(e,r){for(;e;){let i=this.v(e.u,r);if(i<0)e=e.W;else if(i>0)e=e.U;else return e}return e||this.h}clear(){this.i=0,this.Y=void 0,this.h.tt=void 0,this.h.U=this.h.W=void 0}updateKeyByIterator(e,r){let i=e.o;if(i===this.h&&(0,up.throwIteratorAccessError)(),this.i===1)return i.u=r,!0;if(i===this.h.U)return this.v(i.B().u,r)>0?(i.u=r,!0):!1;if(i===this.h.W)return this.v(i.L().u,r)<0?(i.u=r,!0):!1;let n=i.L().u;if(this.v(n,r)>=0)return!1;let o=i.B().u;return this.v(o,r)<=0?!1:(i.u=r,!0)}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=0,i=this;return this.oe(this.Y,function(n){return e===r?(i.V(n),!0):(r+=1,!1)}),this.i}eraseElementByKey(e){if(this.i===0)return!1;let r=this.I(this.Y,e);return r===this.h?!1:(this.V(r),!0)}eraseElementByIterator(e){let r=e.o;r===this.h&&(0,up.throwIteratorAccessError)();let i=r.W===void 0;return e.iteratorType===0?i&&e.next():(!i||r.U===void 0)&&e.next(),this.V(r),e}forEach(e){let r=0;for(let i of this)e(i,r++,this)}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r,i=0;for(let n of this){if(i===e){r=n;break}i+=1}return r}getHeight(){if(this.i===0)return 0;let e=function(r){return r?Math.max(e(r.U),e(r.W))+1:0};return e(this.Y)}},$1=Ea;Kn.default=$1});var Ia=M(Qn=>{\"use strict\";_();v();m();Object.defineProperty(Qn,\"t\",{value:!0});Qn.default=void 0;var H1=lt(),Gn=ut(),Aa=class extends H1.ContainerIterator{constructor(e,r,i){super(i),this.o=e,this.h=r,this.iteratorType===0?(this.pre=function(){return this.o===this.h.U&&(0,Gn.throwIteratorAccessError)(),this.o=this.o.L(),this},this.next=function(){return this.o===this.h&&(0,Gn.throwIteratorAccessError)(),this.o=this.o.B(),this}):(this.pre=function(){return this.o===this.h.W&&(0,Gn.throwIteratorAccessError)(),this.o=this.o.B(),this},this.next=function(){return this.o===this.h&&(0,Gn.throwIteratorAccessError)(),this.o=this.o.L(),this})}get index(){let e=this.o,r=this.h.tt;if(e===this.h)return r?r.rt-1:0;let i=0;for(e.U&&(i+=e.U.rt);e!==r;){let n=e.tt;e===n.W&&(i+=1,n.U&&(i+=n.U.rt)),e=n}return i}},V1=Aa;Qn.default=V1});var cp=M(Yn=>{\"use strict\";_();v();m();Object.defineProperty(Yn,\"t\",{value:!0});Yn.default=void 0;var z1=fp(Sa()),K1=fp(Ia()),G1=ut();function fp(t){return t&&t.t?t:{default:t}}var Ke=class t extends K1.default{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){return this.o===this.h&&(0,G1.throwIteratorAccessError)(),this.o.u}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},Ta=class extends z1.default{constructor(e=[],r,i){super(r,i);let n=this;e.forEach(function(o){n.insert(o)})}*K(e){e!==void 0&&(yield*this.K(e.U),yield e.u,yield*this.K(e.W))}begin(){return new Ke(this.h.U||this.h,this.h,this)}end(){return new Ke(this.h,this.h,this)}rBegin(){return new Ke(this.h.W||this.h,this.h,this,1)}rEnd(){return new Ke(this.h,this.h,this,1)}front(){return this.h.U?this.h.U.u:void 0}back(){return this.h.W?this.h.W.u:void 0}insert(e,r){return this.M(e,void 0,r)}find(e){let r=this.I(this.Y,e);return new Ke(r,this.h,this)}lowerBound(e){let r=this.X(this.Y,e);return new Ke(r,this.h,this)}upperBound(e){let r=this.Z(this.Y,e);return new Ke(r,this.h,this)}reverseLowerBound(e){let r=this.$(this.Y,e);return new Ke(r,this.h,this)}reverseUpperBound(e){let r=this.rr(this.Y,e);return new Ke(r,this.h,this)}union(e){let r=this;return e.forEach(function(i){r.insert(i)}),this.i}[Symbol.iterator](){return this.K(this.Y)}},Q1=Ta;Yn.default=Q1});var dp=M(Jn=>{\"use strict\";_();v();m();Object.defineProperty(Jn,\"t\",{value:!0});Jn.default=void 0;var Y1=hp(Sa()),J1=hp(Ia()),X1=ut();function hp(t){return t&&t.t?t:{default:t}}var Ge=class t extends J1.default{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){this.o===this.h&&(0,X1.throwIteratorAccessError)();let e=this;return new Proxy([],{get(r,i){if(i===\"0\")return e.o.u;if(i===\"1\")return e.o.l},set(r,i,n){if(i!==\"1\")throw new TypeError(\"props must be 1\");return e.o.l=n,!0}})}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},Ra=class extends Y1.default{constructor(e=[],r,i){super(r,i);let n=this;e.forEach(function(o){n.setElement(o[0],o[1])})}*K(e){e!==void 0&&(yield*this.K(e.U),yield[e.u,e.l],yield*this.K(e.W))}begin(){return new Ge(this.h.U||this.h,this.h,this)}end(){return new Ge(this.h,this.h,this)}rBegin(){return new Ge(this.h.W||this.h,this.h,this,1)}rEnd(){return new Ge(this.h,this.h,this,1)}front(){if(this.i===0)return;let e=this.h.U;return[e.u,e.l]}back(){if(this.i===0)return;let e=this.h.W;return[e.u,e.l]}lowerBound(e){let r=this.X(this.Y,e);return new Ge(r,this.h,this)}upperBound(e){let r=this.Z(this.Y,e);return new Ge(r,this.h,this)}reverseLowerBound(e){let r=this.$(this.Y,e);return new Ge(r,this.h,this)}reverseUpperBound(e){let r=this.rr(this.Y,e);return new Ge(r,this.h,this)}setElement(e,r,i){return this.M(e,r,i)}find(e){let r=this.I(this.Y,e);return new Ge(r,this.h,this)}getElementByKey(e){return this.I(this.Y,e).l}union(e){let r=this;return e.forEach(function(i){r.setElement(i[0],i[1])}),this.i}[Symbol.iterator](){return this.K(this.Y)}},Z1=Ra;Jn.default=Z1});var Ba=M(Ca=>{\"use strict\";_();v();m();Object.defineProperty(Ca,\"t\",{value:!0});Ca.default=ev;function ev(t){let e=typeof t;return e===\"object\"&&t!==null||e===\"function\"}});var xa=M(ti=>{\"use strict\";_();v();m();Object.defineProperty(ti,\"t\",{value:!0});ti.HashContainerIterator=ti.HashContainer=void 0;var pp=lt(),Pa=tv(Ba()),Ci=ut();function tv(t){return t&&t.t?t:{default:t}}var ka=class extends pp.ContainerIterator{constructor(e,r,i){super(i),this.o=e,this.h=r,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,Ci.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,Ci.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,Ci.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,Ci.throwIteratorAccessError)(),this.o=this.o.L,this})}};ti.HashContainerIterator=ka;var Oa=class extends pp.Container{constructor(){super(),this.H=[],this.g={},this.HASH_TAG=Symbol(\"@@HASH_TAG\"),Object.setPrototypeOf(this.g,null),this.h={},this.h.L=this.h.B=this.p=this._=this.h}V(e){let{L:r,B:i}=e;r.B=i,i.L=r,e===this.p&&(this.p=i),e===this._&&(this._=r),this.i-=1}M(e,r,i){i===void 0&&(i=(0,Pa.default)(e));let n;if(i){let o=e[this.HASH_TAG];if(o!==void 0)return this.H[o].l=r,this.i;Object.defineProperty(e,this.HASH_TAG,{value:this.H.length,configurable:!0}),n={u:e,l:r,L:this._,B:this.h},this.H.push(n)}else{let o=this.g[e];if(o)return o.l=r,this.i;n={u:e,l:r,L:this._,B:this.h},this.g[e]=n}return this.i===0?(this.p=n,this.h.B=n):this._.B=n,this._=n,this.h.L=n,++this.i}I(e,r){if(r===void 0&&(r=(0,Pa.default)(e)),r){let i=e[this.HASH_TAG];return i===void 0?this.h:this.H[i]}else return this.g[e]||this.h}clear(){let e=this.HASH_TAG;this.H.forEach(function(r){delete r.u[e]}),this.H=[],this.g={},Object.setPrototypeOf(this.g,null),this.i=0,this.p=this._=this.h.L=this.h.B=this.h}eraseElementByKey(e,r){let i;if(r===void 0&&(r=(0,Pa.default)(e)),r){let n=e[this.HASH_TAG];if(n===void 0)return!1;delete e[this.HASH_TAG],i=this.H[n],delete this.H[n]}else{if(i=this.g[e],i===void 0)return!1;delete this.g[e]}return this.V(i),!0}eraseElementByIterator(e){let r=e.o;return r===this.h&&(0,Ci.throwIteratorAccessError)(),this.V(r),e.next()}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return this.V(r),this.i}};ti.HashContainer=Oa});var yp=M(Xn=>{\"use strict\";_();v();m();Object.defineProperty(Xn,\"t\",{value:!0});Xn.default=void 0;var gp=xa(),rv=ut(),Ar=class t extends gp.HashContainerIterator{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){return this.o===this.h&&(0,rv.throwIteratorAccessError)(),this.o.u}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},Ma=class extends gp.HashContainer{constructor(e=[]){super();let r=this;e.forEach(function(i){r.insert(i)})}begin(){return new Ar(this.p,this.h,this)}end(){return new Ar(this.h,this.h,this)}rBegin(){return new Ar(this._,this.h,this,1)}rEnd(){return new Ar(this.h,this.h,this,1)}front(){return this.p.u}back(){return this._.u}insert(e,r){return this.M(e,void 0,r)}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return r.u}find(e,r){let i=this.I(e,r);return new Ar(i,this.h,this)}forEach(e){let r=0,i=this.p;for(;i!==this.h;)e(i.u,r++,this),i=i.B}[Symbol.iterator](){return function*(){let e=this.p;for(;e!==this.h;)yield e.u,e=e.B}.bind(this)()}},iv=Ma;Xn.default=iv});var wp=M(Zn=>{\"use strict\";_();v();m();Object.defineProperty(Zn,\"t\",{value:!0});Zn.default=void 0;var bp=xa(),nv=ov(Ba()),sv=ut();function ov(t){return t&&t.t?t:{default:t}}var Ir=class t extends bp.HashContainerIterator{constructor(e,r,i,n){super(e,r,n),this.container=i}get pointer(){this.o===this.h&&(0,sv.throwIteratorAccessError)();let e=this;return new Proxy([],{get(r,i){if(i===\"0\")return e.o.u;if(i===\"1\")return e.o.l},set(r,i,n){if(i!==\"1\")throw new TypeError(\"props must be 1\");return e.o.l=n,!0}})}copy(){return new t(this.o,this.h,this.container,this.iteratorType)}},La=class extends bp.HashContainer{constructor(e=[]){super();let r=this;e.forEach(function(i){r.setElement(i[0],i[1])})}begin(){return new Ir(this.p,this.h,this)}end(){return new Ir(this.h,this.h,this)}rBegin(){return new Ir(this._,this.h,this,1)}rEnd(){return new Ir(this.h,this.h,this,1)}front(){if(this.i!==0)return[this.p.u,this.p.l]}back(){if(this.i!==0)return[this._.u,this._.l]}setElement(e,r,i){return this.M(e,r,i)}getElementByKey(e,r){if(r===void 0&&(r=(0,nv.default)(e)),r){let n=e[this.HASH_TAG];return n!==void 0?this.H[n].l:void 0}let i=this.g[e];return i?i.l:void 0}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let r=this.p;for(;e--;)r=r.B;return[r.u,r.l]}find(e,r){let i=this.I(e,r);return new Ir(i,this.h,this)}forEach(e){let r=0,i=this.p;for(;i!==this.h;)e([i.u,i.l],r++,this),i=i.B}[Symbol.iterator](){return function*(){let e=this.p;for(;e!==this.h;)yield[e.u,e.l],e=e.B}.bind(this)()}},av=La;Zn.default=av});var _p=M(je=>{\"use strict\";_();v();m();Object.defineProperty(je,\"t\",{value:!0});Object.defineProperty(je,\"Deque\",{enumerable:!0,get:function(){return dv.default}});Object.defineProperty(je,\"HashMap\",{enumerable:!0,get:function(){return bv.default}});Object.defineProperty(je,\"HashSet\",{enumerable:!0,get:function(){return yv.default}});Object.defineProperty(je,\"LinkList\",{enumerable:!0,get:function(){return hv.default}});Object.defineProperty(je,\"OrderedMap\",{enumerable:!0,get:function(){return gv.default}});Object.defineProperty(je,\"OrderedSet\",{enumerable:!0,get:function(){return pv.default}});Object.defineProperty(je,\"PriorityQueue\",{enumerable:!0,get:function(){return fv.default}});Object.defineProperty(je,\"Queue\",{enumerable:!0,get:function(){return uv.default}});Object.defineProperty(je,\"Stack\",{enumerable:!0,get:function(){return lv.default}});Object.defineProperty(je,\"Vector\",{enumerable:!0,get:function(){return cv.default}});var lv=ft(tp()),uv=ft(rp()),fv=ft(ip()),cv=ft(np()),hv=ft(sp()),dv=ft(op()),pv=ft(cp()),gv=ft(dp()),yv=ft(yp()),bv=ft(wp());function ft(t){return t&&t.t?t:{default:t}}});var vp=M((lx,mp)=>{\"use strict\";_();v();m();var wv=_p().OrderedSet,ct=ot()(\"number-allocator:trace\"),_v=ot()(\"number-allocator:error\");function Re(t,e){this.low=t,this.high=e}Re.prototype.equals=function(t){return this.low===t.low&&this.high===t.high};Re.prototype.compare=function(t){return this.lowr.compare(i)),ct(\"Create\"),this.clear()}ht.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low};ht.prototype.alloc=function(){if(this.ss.size()===0)return ct(\"alloc():empty\"),null;let t=this.ss.begin(),e=t.pointer.low,r=t.pointer.high,i=e;return i+1<=r?this.ss.updateKeyByIterator(t,new Re(e+1,r)):this.ss.eraseElementByPos(0),ct(\"alloc():\"+i),i};ht.prototype.use=function(t){let e=new Re(t,t),r=this.ss.lowerBound(e);if(!r.equals(this.ss.end())){let i=r.pointer.low,n=r.pointer.high;return r.pointer.equals(e)?(this.ss.eraseElementByIterator(r),ct(\"use():\"+t),!0):i>t?!1:i===t?(this.ss.updateKeyByIterator(r,new Re(i+1,n)),ct(\"use():\"+t),!0):n===t?(this.ss.updateKeyByIterator(r,new Re(i,n-1)),ct(\"use():\"+t),!0):(this.ss.updateKeyByIterator(r,new Re(t+1,n)),this.ss.insert(new Re(i,t-1)),ct(\"use():\"+t),!0)}return ct(\"use():failed\"),!1};ht.prototype.free=function(t){if(tthis.max){_v(\"free():\"+t+\" is out of range\");return}let e=new Re(t,t),r=this.ss.upperBound(e);if(r.equals(this.ss.end())){if(r.equals(this.ss.begin())){this.ss.insert(e);return}r.pre();let i=r.pointer.high;r.pointer.high+1===t?this.ss.updateKeyByIterator(r,new Re(i,t)):this.ss.insert(e)}else if(r.equals(this.ss.begin()))if(t+1===r.pointer.low){let i=r.pointer.high;this.ss.updateKeyByIterator(r,new Re(t,i))}else this.ss.insert(e);else{let i=r.pointer.low,n=r.pointer.high;r.pre();let o=r.pointer.low;r.pointer.high+1===t?t+1===i?(this.ss.eraseElementByIterator(r),this.ss.updateKeyByIterator(r,new Re(o,n))):this.ss.updateKeyByIterator(r,new Re(o,t)):t+1===i?(this.ss.eraseElementByIterator(r.next()),this.ss.insert(new Re(t,n))):this.ss.insert(e)}ct(\"free():\"+t)};ht.prototype.clear=function(){ct(\"clear()\"),this.ss.clear(),this.ss.insert(new Re(this.min,this.max))};ht.prototype.intervalCount=function(){return this.ss.size()};ht.prototype.dump=function(){console.log(\"length:\"+this.ss.size());for(let t of this.ss)console.log(t)};mp.exports=ht});var Ua=M((gx,Ep)=>{_();v();m();var mv=vp();Ep.exports.NumberAllocator=mv});var Sp=M(qa=>{\"use strict\";_();v();m();Object.defineProperty(qa,\"__esModule\",{value:!0});var vv=ep(),Ev=Ua(),Na=class{constructor(e){e>0&&(this.aliasToTopic=new vv.LRUCache({max:e}),this.topicToAlias={},this.numberAllocator=new Ev.NumberAllocator(1,e),this.max=e,this.length=0)}put(e,r){if(r===0||r>this.max)return!1;let i=this.aliasToTopic.get(r);return i&&delete this.topicToAlias[i],this.aliasToTopic.set(r,e),this.topicToAlias[e]=r,this.numberAllocator.use(r),this.length=this.aliasToTopic.size,!0}getTopicByAlias(e){return this.aliasToTopic.get(e)}getAliasByTopic(e){let r=this.topicToAlias[e];return typeof r<\"u\"&&this.aliasToTopic.get(r),r}clear(){this.aliasToTopic.clear(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0}getLruAlias(){let e=this.numberAllocator.firstVacant();return e||[...this.aliasToTopic.keys()][this.aliasToTopic.size-1]}};qa.default=Na});var Ap=M(Bi=>{\"use strict\";_();v();m();var Sv=Bi&&Bi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Bi,\"__esModule\",{value:!0});var Av=Ti(),Iv=Sv(Sp()),Tv=_r(),Rv=(t,e)=>{t.log(\"_handleConnack\");let{options:r}=t,n=r.protocolVersion===5?e.reasonCode:e.returnCode;if(clearTimeout(t.connackTimer),delete t.topicAliasSend,e.properties){if(e.properties.topicAliasMaximum){if(e.properties.topicAliasMaximum>65535){t.emit(\"error\",new Error(\"topicAliasMaximum from broker is out of range\"));return}e.properties.topicAliasMaximum>0&&(t.topicAliasSend=new Iv.default(e.properties.topicAliasMaximum))}e.properties.serverKeepAlive&&r.keepalive&&(r.keepalive=e.properties.serverKeepAlive),e.properties.maximumPacketSize&&(r.properties||(r.properties={}),r.properties.maximumPacketSize=e.properties.maximumPacketSize)}if(n===0)t.reconnecting=!1,t._onConnect(e);else if(n>0){let o=new Tv.ErrorWithReasonCode(`Connection refused: ${Av.ReasonCodes[n]}`,n);t.emit(\"error\",o),t.options.reconnectOnConnackError&&t._cleanUp(!0)}};Bi.default=Rv});var Ip=M(Da=>{\"use strict\";_();v();m();Object.defineProperty(Da,\"__esModule\",{value:!0});var Cv=(t,e,r)=>{t.log(\"handling pubrel packet\");let i=typeof r<\"u\"?r:t.noop,{messageId:n}=e,o={cmd:\"pubcomp\",messageId:n};t.incomingStore.get(e,(s,a)=>{s?t._sendPacket(o,i):(t.emit(\"message\",a.topic,a.payload,a),t.handleMessage(a,l=>{if(l)return i(l);t.incomingStore.del(a,t.noop),t._sendPacket(o,i)}))})};Da.default=Cv});var Tp=M(Pi=>{\"use strict\";_();v();m();var ki=Pi&&Pi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Pi,\"__esModule\",{value:!0});var Bv=ki(Vd()),Pv=ki(Qd()),kv=ki(Ap()),Ov=ki(Ti()),xv=ki(Ip()),Mv=(t,e,r)=>{let{options:i}=t;if(i.protocolVersion===5&&i.properties&&i.properties.maximumPacketSize&&i.properties.maximumPacketSize{\"use strict\";_();v();m();var Lv=ri&&ri.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ri,\"__esModule\",{value:!0});ri.TypedEventEmitter=void 0;var Uv=Lv((sr(),X(nr))),Nv=_r(),es=class{};ri.TypedEventEmitter=es;(0,Nv.applyMixin)(es,Uv.default)});var Oi=M(Tr=>{\"use strict\";_();v();m();Object.defineProperty(Tr,\"__esModule\",{value:!0});Tr.isReactNativeBrowser=Tr.isWebWorker=void 0;var qv=()=>{var t;return typeof window<\"u\"?typeof navigator<\"u\"&&((t=navigator.userAgent)===null||t===void 0?void 0:t.toLowerCase().indexOf(\" electron/\"))>-1&&(!(B===null||B===void 0)&&B.versions)?!Object.prototype.hasOwnProperty.call(B.versions,\"electron\"):typeof window.document<\"u\":!1},Cp=()=>{var t,e;return!!(typeof self==\"object\"&&(!((e=(t=self?.constructor)===null||t===void 0?void 0:t.name)===null||e===void 0)&&e.includes(\"WorkerGlobalScope\")))},Bp=()=>typeof navigator<\"u\"&&navigator.product===\"ReactNative\",Dv=qv()||Cp()||Bp();Tr.isWebWorker=Cp();Tr.isReactNativeBrowser=Bp();Tr.default=Dv});var kp=M((ts,Pp)=>{_();v();m();(function(t,e){typeof ts==\"object\"&&typeof Pp<\"u\"?e(ts):typeof define==\"function\"&&define.amd?define([\"exports\"],e):(t=typeof globalThis<\"u\"?globalThis:t||self,e(t.fastUniqueNumbers={}))})(ts,function(t){\"use strict\";var e=function(g){return function(y){var w=g(y);return y.add(w),w}},r=function(g){return function(y,w){return g.set(y,w),w}},i=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,n=536870912,o=n*2,s=function(g,y){return function(w){var S=y.get(w),E=S===void 0?w.size:Si)throw new Error(\"Congratulations, you created a collection of unique numbers which uses all available integers!\");for(;w.has(E);)E=Math.floor(Math.random()*i);return g(w,E)}},a=new WeakMap,l=r(a),c=s(l,a),h=e(c);t.addUniqueNumber=h,t.generateUniqueNumber=c})});var xp=M((rs,Op)=>{_();v();m();(function(t,e){typeof rs==\"object\"&&typeof Op<\"u\"?e(rs,kp()):typeof define==\"function\"&&define.amd?define([\"exports\",\"fast-unique-numbers\"],e):(t=typeof globalThis<\"u\"?globalThis:t||self,e(t.workerTimersBroker={},t.fastUniqueNumbers))})(rs,function(t,e){\"use strict\";var r=function(s){return s.method!==void 0&&s.method===\"call\"},i=function(s){return s.error===null&&typeof s.id==\"number\"},n=function(s){var a=new Map([[0,function(){}]]),l=new Map([[0,function(){}]]),c=new Map,h=new Worker(s);h.addEventListener(\"message\",function(S){var E=S.data;if(r(E)){var I=E.params,C=I.timerId,R=I.timerType;if(R===\"interval\"){var U=a.get(C);if(typeof U==\"number\"){var N=c.get(U);if(N===void 0||N.timerId!==C||N.timerType!==R)throw new Error(\"The timer is in an undefined state.\")}else if(typeof U<\"u\")U();else throw new Error(\"The timer is in an undefined state.\")}else if(R===\"timeout\"){var W=l.get(C);if(typeof W==\"number\"){var K=c.get(W);if(K===void 0||K.timerId!==C||K.timerType!==R)throw new Error(\"The timer is in an undefined state.\")}else if(typeof W<\"u\")W(),l.delete(C);else throw new Error(\"The timer is in an undefined state.\")}}else if(i(E)){var z=E.id,Q=c.get(z);if(Q===void 0)throw new Error(\"The timer is in an undefined state.\");var pe=Q.timerId,Yt=Q.timerType;c.delete(z),Yt===\"interval\"?a.delete(pe):l.delete(pe)}else{var ge=E.error.message;throw new Error(ge)}});var d=function(E){var I=e.generateUniqueNumber(c);c.set(I,{timerId:E,timerType:\"interval\"}),a.set(E,I),h.postMessage({id:I,method:\"clear\",params:{timerId:E,timerType:\"interval\"}})},g=function(E){var I=e.generateUniqueNumber(c);c.set(I,{timerId:E,timerType:\"timeout\"}),l.set(E,I),h.postMessage({id:I,method:\"clear\",params:{timerId:E,timerType:\"timeout\"}})},y=function(E){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,C=e.generateUniqueNumber(a);return a.set(C,function(){E(),typeof a.get(C)==\"function\"&&h.postMessage({id:null,method:\"set\",params:{delay:I,now:performance.now(),timerId:C,timerType:\"interval\"}})}),h.postMessage({id:null,method:\"set\",params:{delay:I,now:performance.now(),timerId:C,timerType:\"interval\"}}),C},w=function(E){var I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,C=e.generateUniqueNumber(l);return l.set(C,E),h.postMessage({id:null,method:\"set\",params:{delay:I,now:performance.now(),timerId:C,timerType:\"timeout\"}}),C};return{clearInterval:d,clearTimeout:g,setInterval:y,setTimeout:w}};t.load=n})});var Lp=M((is,Mp)=>{_();v();m();(function(t,e){typeof is==\"object\"&&typeof Mp<\"u\"?e(is,xp()):typeof define==\"function\"&&define.amd?define([\"exports\",\"worker-timers-broker\"],e):(t=typeof globalThis<\"u\"?globalThis:t||self,e(t.workerTimers={},t.workerTimersBroker))})(is,function(t,e){\"use strict\";var r=function(h,d){var g=null;return function(){if(g!==null)return g;var y=new Blob([d],{type:\"application/javascript; charset=utf-8\"}),w=URL.createObjectURL(y);return g=h(w),setTimeout(function(){return URL.revokeObjectURL(w)}),g}},i=`(()=>{var e={472:(e,t,r)=>{var o,i;void 0===(i=\"function\"==typeof(o=function(){\"use strict\";var e=new Map,t=new Map,r=function(t){var r=e.get(t);if(void 0===r)throw new Error('There is no interval scheduled with the given id \"'.concat(t,'\".'));clearTimeout(r),e.delete(t)},o=function(e){var r=t.get(e);if(void 0===r)throw new Error('There is no timeout scheduled with the given id \"'.concat(e,'\".'));clearTimeout(r),t.delete(e)},i=function(e,t){var r,o=performance.now();return{expected:o+(r=e-Math.max(0,o-t)),remainingDelay:r}},n=function e(t,r,o,i){var n=performance.now();n>o?postMessage({id:null,method:\"call\",params:{timerId:r,timerType:i}}):t.set(r,setTimeout(e,o-n,t,r,o,i))},a=function(t,r,o){var a=i(t,o),s=a.expected,d=a.remainingDelay;e.set(r,setTimeout(n,d,e,r,s,\"interval\"))},s=function(e,r,o){var a=i(e,o),s=a.expected,d=a.remainingDelay;t.set(r,setTimeout(n,d,t,r,s,\"timeout\"))};addEventListener(\"message\",(function(e){var t=e.data;try{if(\"clear\"===t.method){var i=t.id,n=t.params,d=n.timerId,c=n.timerType;if(\"interval\"===c)r(d),postMessage({error:null,id:i});else{if(\"timeout\"!==c)throw new Error('The given type \"'.concat(c,'\" is not supported'));o(d),postMessage({error:null,id:i})}}else{if(\"set\"!==t.method)throw new Error('The given method \"'.concat(t.method,'\" is not supported'));var u=t.params,l=u.delay,p=u.now,m=u.timerId,v=u.timerType;if(\"interval\"===v)a(l,m,p);else{if(\"timeout\"!==v)throw new Error('The given type \"'.concat(v,'\" is not supported'));s(l,m,p)}}}catch(e){postMessage({error:{message:e.message},id:t.id,result:null})}}))})?o.call(t,r,t,e):o)||(e.exports=i)}},t={};function r(o){var i=t[o];if(void 0!==i)return i.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{\"use strict\";r(472)})()})();`,n=r(e.load,i),o=function(h){return n().clearInterval(h)},s=function(h){return n().clearTimeout(h)},a=function(){var h;return(h=n()).setInterval.apply(h,arguments)},l=function(){var h;return(h=n()).setTimeout.apply(h,arguments)};t.clearInterval=o,t.clearTimeout=s,t.setInterval=a,t.setTimeout=l})});var Dp=M(Ct=>{\"use strict\";_();v();m();var jv=Ct&&Ct.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||(\"get\"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),Fv=Ct&&Ct.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,\"default\",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Wv=Ct&&Ct.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!==\"default\"&&Object.prototype.hasOwnProperty.call(t,r)&&jv(e,t,r);return Fv(e,t),e};Object.defineProperty(Ct,\"__esModule\",{value:!0});var ja=Wv(Oi()),Up=Lp(),Np={set:Up.setInterval,clear:Up.clearInterval},qp={set:(t,e)=>setInterval(t,e),clear:t=>clearInterval(t)},$v=t=>{switch(t){case\"native\":return qp;case\"worker\":return Np;case\"auto\":default:return ja.default&&!ja.isWebWorker&&!ja.isReactNativeBrowser?Np:qp}};Ct.default=$v});var Wa=M(xi=>{\"use strict\";_();v();m();var Hv=xi&&xi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xi,\"__esModule\",{value:!0});var Vv=Hv(Dp()),Fa=class{get keepaliveTimeoutTimestamp(){return this._keepaliveTimeoutTimestamp}get intervalEvery(){return this._intervalEvery}get keepalive(){return this._keepalive}constructor(e,r){this.destroyed=!1,this.client=e,this.timer=typeof r==\"object\"&&\"set\"in r&&\"clear\"in r?r:(0,Vv.default)(r),this.setKeepalive(e.options.keepalive)}clear(){this.timerId&&(this.timer.clear(this.timerId),this.timerId=null)}setKeepalive(e){if(e*=1e3,isNaN(e)||e<=0||e>2147483647)throw new Error(`Keepalive value must be an integer between 0 and 2147483647. Provided value is ${e}`);this._keepalive=e,this.reschedule(),this.client.log(`KeepaliveManager: set keepalive to ${e}ms`)}destroy(){this.clear(),this.destroyed=!0}reschedule(){if(this.destroyed)return;this.clear(),this.counter=0;let e=Math.ceil(this._keepalive*1.5);this._keepaliveTimeoutTimestamp=Date.now()+e,this._intervalEvery=Math.ceil(this._keepalive/2),this.timerId=this.timer.set(()=>{this.destroyed||(this.counter+=1,this.counter===2?this.client.sendPing():this.counter>2&&this.client.onKeepaliveTimeout())},this._intervalEvery)}};xi.default=Fa});var os=M(Qe=>{\"use strict\";_();v();m();var zv=Qe&&Qe.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||(\"get\"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),Kv=Qe&&Qe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,\"default\",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Hp=Qe&&Qe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!==\"default\"&&Object.prototype.hasOwnProperty.call(t,r)&&zv(e,t,r);return Kv(e,t),e},zt=Qe&&Qe.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qe,\"__esModule\",{value:!0});var Gv=zt(Gu()),$a=zt(Nd()),Qv=zt(Zo()),Yv=jt(),jp=zt(Fd()),Fp=Hp($d()),Jv=zt(ot()),ii=zt(ra()),Xv=zt(Tp()),ns=_r(),Zv=Rp(),eE=zt(Wa()),Wp=Hp(Oi()),Ha=globalThis.setImmediate||((...t)=>{let e=t.shift();(0,ns.nextTick)(()=>{e(...t)})}),$p={keepalive:60,reschedulePings:!0,protocolId:\"MQTT\",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0,writeCache:!0,timerVariant:\"auto\"},ss=class t extends Zv.TypedEventEmitter{static defaultId(){return`mqttjs_${Math.random().toString(16).substr(2,8)}`}constructor(e,r){super(),this.options=r||{};for(let i in $p)typeof this.options[i]>\"u\"?this.options[i]=$p[i]:this.options[i]=r[i];this.log=this.options.log||(0,Jv.default)(\"mqttjs:client\"),this.noop=this._noop.bind(this),this.log(\"MqttClient :: version:\",t.VERSION),Wp.isWebWorker?this.log(\"MqttClient :: environment\",\"webworker\"):this.log(\"MqttClient :: environment\",Wp.default?\"browser\":\"node\"),this.log(\"MqttClient :: options.protocol\",r.protocol),this.log(\"MqttClient :: options.protocolVersion\",r.protocolVersion),this.log(\"MqttClient :: options.username\",r.username),this.log(\"MqttClient :: options.keepalive\",r.keepalive),this.log(\"MqttClient :: options.reconnectPeriod\",r.reconnectPeriod),this.log(\"MqttClient :: options.rejectUnauthorized\",r.rejectUnauthorized),this.log(\"MqttClient :: options.properties.topicAliasMaximum\",r.properties?r.properties.topicAliasMaximum:void 0),this.options.clientId=typeof r.clientId==\"string\"?r.clientId:t.defaultId(),this.log(\"MqttClient :: clientId\",this.options.clientId),this.options.customHandleAcks=r.protocolVersion===5&&r.customHandleAcks?r.customHandleAcks:(...i)=>{i[3](null,0)},this.options.writeCache||($a.default.writeToStream.cacheNumbers=!1),this.streamBuilder=e,this.messageIdProvider=typeof this.options.messageIdProvider>\"u\"?new Qv.default:this.options.messageIdProvider,this.outgoingStore=r.outgoingStore||new ii.default,this.incomingStore=r.incomingStore||new ii.default,this.queueQoSZero=r.queueQoSZero===void 0?!0:r.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.keepaliveManager=null,this.connected=!1,this.disconnecting=!1,this.reconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,r.properties&&r.properties.topicAliasMaximum>0&&(r.properties.topicAliasMaximum>65535?this.log(\"MqttClient :: options.properties.topicAliasMaximum is out of range\"):this.topicAliasRecv=new Gv.default(r.properties.topicAliasMaximum)),this.on(\"connect\",()=>{let{queue:i}=this,n=()=>{let o=i.shift();this.log(\"deliver :: entry %o\",o);let s=null;if(!o){this._resubscribe();return}s=o.packet,this.log(\"deliver :: call _sendPacket for %o\",s);let a=!0;s.messageId&&s.messageId!==0&&(this.messageIdProvider.register(s.messageId)||(a=!1)),a?this._sendPacket(s,l=>{o.cb&&o.cb(l),n()}):(this.log(\"messageId: %d has already used. The message is skipped and removed.\",s.messageId),n())};this.log(\"connect :: sending queued packets\"),n()}),this.on(\"close\",()=>{this.log(\"close :: connected set to `false`\"),this.connected=!1,this.log(\"close :: clearing connackTimer\"),clearTimeout(this.connackTimer),this._destroyKeepaliveManager(),this.topicAliasRecv&&this.topicAliasRecv.clear(),this.log(\"close :: calling _setupReconnect\"),this._setupReconnect()}),this.options.manualConnect||(this.log(\"MqttClient :: setting up stream\"),this.connect())}handleAuth(e,r){r()}handleMessage(e,r){r()}_nextId(){return this.messageIdProvider.allocate()}getLastMessageId(){return this.messageIdProvider.getLastAllocated()}connect(){var e;let r=new Yv.Writable,i=$a.default.parser(this.options),n=null,o=[];this.log(\"connect :: calling method to clear reconnect\"),this._clearReconnect(),this.disconnected&&!this.reconnecting&&(this.incomingStore=this.options.incomingStore||new ii.default,this.outgoingStore=this.options.outgoingStore||new ii.default,this.disconnecting=!1,this.disconnected=!1),this.log(\"connect :: using streamBuilder provided to client to create stream\"),this.stream=this.streamBuilder(this),i.on(\"packet\",h=>{this.log(\"parser :: on packet push to packets array.\"),o.push(h)});let s=()=>{this.log(\"work :: getting next packet in queue\");let h=o.shift();if(h)this.log(\"work :: packet pulled from queue\"),(0,Xv.default)(this,h,a);else{this.log(\"work :: no packets in queue\");let d=n;n=null,this.log(\"work :: done flag is %s\",!!d),d&&d()}},a=()=>{if(o.length)(0,ns.nextTick)(s);else{let h=n;n=null,h()}};r._write=(h,d,g)=>{n=g,this.log(\"writable stream :: parsing buffer\"),i.parse(h),s()};let l=h=>{this.log(\"streamErrorHandler :: error\",h.message),h.code?(this.log(\"streamErrorHandler :: emitting error\"),this.emit(\"error\",h)):this.noop(h)};this.log(\"connect :: pipe stream to writable stream\"),this.stream.pipe(r),this.stream.on(\"error\",l),this.stream.on(\"close\",()=>{this.log(\"(%s)stream :: on close\",this.options.clientId),this._flushVolatile(),this.log(\"stream: emit close to MqttClient\"),this.emit(\"close\")}),this.log(\"connect: sending packet `connect`\");let c={cmd:\"connect\",protocolId:this.options.protocolId,protocolVersion:this.options.protocolVersion,clean:this.options.clean,clientId:this.options.clientId,keepalive:this.options.keepalive,username:this.options.username,password:this.options.password,properties:this.options.properties};if(this.options.will&&(c.will=Object.assign(Object.assign({},this.options.will),{payload:(e=this.options.will)===null||e===void 0?void 0:e.payload})),this.topicAliasRecv&&(c.properties||(c.properties={}),this.topicAliasRecv&&(c.properties.topicAliasMaximum=this.topicAliasRecv.max)),this._writePacket(c),i.on(\"error\",this.emit.bind(this,\"error\")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return this.end(()=>this.emit(\"error\",new Error(\"Packet has no Authentication Method\"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket==\"object\"){let h=Object.assign({cmd:\"auth\",reasonCode:0},this.options.authPacket);this._writePacket(h)}}return this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(()=>{this.log(\"!!connectTimeout hit!! Calling _cleanUp with force `true`\"),this.emit(\"error\",new Error(\"connack timeout\")),this._cleanUp(!0)},this.options.connectTimeout),this}publish(e,r,i,n){this.log(\"publish :: message `%s` to topic `%s`\",r,e);let{options:o}=this;typeof i==\"function\"&&(n=i,i=null),i=i||{},i=Object.assign(Object.assign({},{qos:0,retain:!1,dup:!1}),i);let{qos:a,retain:l,dup:c,properties:h,cbStorePut:d}=i;if(this._checkDisconnecting(n))return this;let g=()=>{let y=0;if((a===1||a===2)&&(y=this._nextId(),y===null))return this.log(\"No messageId left\"),!1;let w={cmd:\"publish\",topic:e,payload:r,qos:a,retain:l,messageId:y,dup:c};switch(o.protocolVersion===5&&(w.properties=h),this.log(\"publish :: qos\",a),a){case 1:case 2:this.outgoing[w.messageId]={volatile:!1,cb:n||this.noop},this.log(\"MqttClient:publish: packet cmd: %s\",w.cmd),this._sendPacket(w,void 0,d);break;default:this.log(\"MqttClient:publish: packet cmd: %s\",w.cmd),this._sendPacket(w,n,d);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!g())&&this._storeProcessingQueue.push({invoke:g,cbStorePut:i.cbStorePut,callback:n}),this}publishAsync(e,r,i){return new Promise((n,o)=>{this.publish(e,r,i,(s,a)=>{s?o(s):n(a)})})}subscribe(e,r,i){let n=this.options.protocolVersion;typeof r==\"function\"&&(i=r),i=i||this.noop;let o=!1,s=[];typeof e==\"string\"?(e=[e],s=e):Array.isArray(e)?s=e:typeof e==\"object\"&&(o=e.resubscribe,delete e.resubscribe,s=Object.keys(e));let a=Fp.validateTopics(s);if(a!==null)return Ha(i,new Error(`Invalid topic ${a}`)),this;if(this._checkDisconnecting(i))return this.log(\"subscribe: discconecting true\"),this;let l={qos:0};n===5&&(l.nl=!1,l.rap=!1,l.rh=0),r=Object.assign(Object.assign({},l),r);let c=r.properties,h=[],d=(y,w)=>{if(w=w||r,!Object.prototype.hasOwnProperty.call(this._resubscribeTopics,y)||this._resubscribeTopics[y].qos{this.log(\"subscribe: array topic %s\",y),d(y)}):Object.keys(e).forEach(y=>{this.log(\"subscribe: object topic %s, %o\",y,e[y]),d(y,e[y])}),!h.length)return i(null,[]),this;let g=()=>{let y=this._nextId();if(y===null)return this.log(\"No messageId left\"),!1;let w={cmd:\"subscribe\",subscriptions:h,messageId:y};if(c&&(w.properties=c),this.options.resubscribe){this.log(\"subscribe :: resubscribe true\");let S=[];h.forEach(E=>{if(this.options.reconnectPeriod>0){let I={qos:E.qos};n===5&&(I.nl=E.nl||!1,I.rap=E.rap||!1,I.rh=E.rh||0,I.properties=E.properties),this._resubscribeTopics[E.topic]=I,S.push(E.topic)}}),this.messageIdToTopic[w.messageId]=S}return this.outgoing[w.messageId]={volatile:!0,cb(S,E){if(!S){let{granted:I}=E;for(let C=0;C0||!g())&&this._storeProcessingQueue.push({invoke:g,callback:i}),this}subscribeAsync(e,r){return new Promise((i,n)=>{this.subscribe(e,r,(o,s)=>{o?n(o):i(s)})})}unsubscribe(e,r,i){typeof e==\"string\"&&(e=[e]),typeof r==\"function\"&&(i=r),i=i||this.noop;let n=Fp.validateTopics(e);if(n!==null)return Ha(i,new Error(`Invalid topic ${n}`)),this;if(this._checkDisconnecting(i))return this;let o=()=>{let s=this._nextId();if(s===null)return this.log(\"No messageId left\"),!1;let a={cmd:\"unsubscribe\",messageId:s,unsubscriptions:[]};return typeof e==\"string\"?a.unsubscriptions=[e]:Array.isArray(e)&&(a.unsubscriptions=e),this.options.resubscribe&&a.unsubscriptions.forEach(l=>{delete this._resubscribeTopics[l]}),typeof r==\"object\"&&r.properties&&(a.properties=r.properties),this.outgoing[a.messageId]={volatile:!0,cb:i},this.log(\"unsubscribe: call _sendPacket\"),this._sendPacket(a),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!o())&&this._storeProcessingQueue.push({invoke:o,callback:i}),this}unsubscribeAsync(e,r){return new Promise((i,n)=>{this.unsubscribe(e,r,(o,s)=>{o?n(o):i(s)})})}end(e,r,i){this.log(\"end :: (%s)\",this.options.clientId),(e==null||typeof e!=\"boolean\")&&(i=i||r,r=e,e=!1),typeof r!=\"object\"&&(i=i||r,r=null),this.log(\"end :: cb? %s\",!!i),(!i||typeof i!=\"function\")&&(i=this.noop);let n=()=>{this.log(\"end :: closeStores: closing incoming and outgoing stores\"),this.disconnected=!0,this.incomingStore.close(s=>{this.outgoingStore.close(a=>{if(this.log(\"end :: closeStores: emitting end\"),this.emit(\"end\"),i){let l=s||a;this.log(\"end :: closeStores: invoking callback with args\"),i(l)}})}),this._deferredReconnect?this._deferredReconnect():(this.options.reconnectPeriod===0||this.options.manualConnect)&&(this.disconnecting=!1)},o=()=>{this.log(\"end :: (%s) :: finish :: calling _cleanUp with force %s\",this.options.clientId,e),this._cleanUp(e,()=>{this.log(\"end :: finish :: calling process.nextTick on closeStores\"),(0,ns.nextTick)(n)},r)};return this.disconnecting?(i(),this):(this._clearReconnect(),this.disconnecting=!0,!e&&Object.keys(this.outgoing).length>0?(this.log(\"end :: (%s) :: calling finish in 10ms once outgoing is empty\",this.options.clientId),this.once(\"outgoingEmpty\",setTimeout.bind(null,o,10))):(this.log(\"end :: (%s) :: immediately calling finish\",this.options.clientId),o()),this)}endAsync(e,r){return new Promise((i,n)=>{this.end(e,r,o=>{o?n(o):i()})})}removeOutgoingMessage(e){if(this.outgoing[e]){let{cb:r}=this.outgoing[e];this._removeOutgoingAndStoreMessage(e,()=>{r(new Error(\"Message removed\"))})}return this}reconnect(e){this.log(\"client reconnect\");let r=()=>{e?(this.options.incomingStore=e.incomingStore,this.options.outgoingStore=e.outgoingStore):(this.options.incomingStore=null,this.options.outgoingStore=null),this.incomingStore=this.options.incomingStore||new ii.default,this.outgoingStore=this.options.outgoingStore||new ii.default,this.disconnecting=!1,this.disconnected=!1,this._deferredReconnect=null,this._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),this}_flushVolatile(){this.outgoing&&(this.log(\"_flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function\"),Object.keys(this.outgoing).forEach(e=>{this.outgoing[e].volatile&&typeof this.outgoing[e].cb==\"function\"&&(this.outgoing[e].cb(new Error(\"Connection closed\")),delete this.outgoing[e])}))}_flush(){this.outgoing&&(this.log(\"_flush: queue exists? %b\",!!this.outgoing),Object.keys(this.outgoing).forEach(e=>{typeof this.outgoing[e].cb==\"function\"&&(this.outgoing[e].cb(new Error(\"Connection closed\")),delete this.outgoing[e])}))}_removeTopicAliasAndRecoverTopicName(e){let r;e.properties&&(r=e.properties.topicAlias);let i=e.topic.toString();if(this.log(\"_removeTopicAliasAndRecoverTopicName :: alias %d, topic %o\",r,i),i.length===0){if(typeof r>\"u\")return new Error(\"Unregistered Topic Alias\");if(i=this.topicAliasSend.getTopicByAlias(r),typeof i>\"u\")return new Error(\"Unregistered Topic Alias\");e.topic=i}r&&delete e.properties.topicAlias}_checkDisconnecting(e){return this.disconnecting&&(e&&e!==this.noop?e(new Error(\"client disconnecting\")):this.emit(\"error\",new Error(\"client disconnecting\"))),this.disconnecting}_reconnect(){this.log(\"_reconnect: emitting reconnect to client\"),this.emit(\"reconnect\"),this.connected?(this.end(()=>{this.connect()}),this.log(\"client already connected. disconnecting first.\")):(this.log(\"_reconnect: calling connect\"),this.connect())}_setupReconnect(){!this.disconnecting&&!this.reconnectTimer&&this.options.reconnectPeriod>0?(this.reconnecting||(this.log(\"_setupReconnect :: emit `offline` state\"),this.emit(\"offline\"),this.log(\"_setupReconnect :: set `reconnecting` to `true`\"),this.reconnecting=!0),this.log(\"_setupReconnect :: setting reconnectTimer for %d ms\",this.options.reconnectPeriod),this.reconnectTimer=setInterval(()=>{this.log(\"reconnectTimer :: reconnect triggered!\"),this._reconnect()},this.options.reconnectPeriod)):this.log(\"_setupReconnect :: doing nothing...\")}_clearReconnect(){this.log(\"_clearReconnect : clearing reconnect timer\"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)}_cleanUp(e,r,i={}){if(r&&(this.log(\"_cleanUp :: done callback provided for on stream close\"),this.stream.on(\"close\",r)),this.log(\"_cleanUp :: forced? %s\",e),e)this.options.reconnectPeriod===0&&this.options.clean&&this._flush(),this.log(\"_cleanUp :: (%s) :: destroying stream\",this.options.clientId),this.stream.destroy();else{let n=Object.assign({cmd:\"disconnect\"},i);this.log(\"_cleanUp :: (%s) :: call _sendPacket with disconnect packet\",this.options.clientId),this._sendPacket(n,()=>{this.log(\"_cleanUp :: (%s) :: destroying stream\",this.options.clientId),Ha(()=>{this.stream.end(()=>{this.log(\"_cleanUp :: (%s) :: stream destroyed\",this.options.clientId)})})})}!this.disconnecting&&!this.reconnecting&&(this.log(\"_cleanUp :: client not disconnecting/reconnecting. Clearing and resetting reconnect.\"),this._clearReconnect(),this._setupReconnect()),this._destroyKeepaliveManager(),r&&!this.connected&&(this.log(\"_cleanUp :: (%s) :: removing stream `done` callback `close` listener\",this.options.clientId),this.stream.removeListener(\"close\",r),r())}_storeAndSend(e,r,i){this.log(\"storeAndSend :: store packet with cmd %s to outgoingStore\",e.cmd);let n=e,o;if(n.cmd===\"publish\"&&(n=(0,jp.default)(e),o=this._removeTopicAliasAndRecoverTopicName(n),o))return r&&r(o);this.outgoingStore.put(n,s=>{if(s)return r&&r(s);i(),this._writePacket(e,r)})}_applyTopicAlias(e){if(this.options.protocolVersion===5&&e.cmd===\"publish\"){let r;e.properties&&(r=e.properties.topicAlias);let i=e.topic.toString();if(this.topicAliasSend)if(r){if(i.length!==0&&(this.log(\"applyTopicAlias :: register topic: %s - alias: %d\",i,r),!this.topicAliasSend.put(i,r)))return this.log(\"applyTopicAlias :: error out of range. topic: %s - alias: %d\",i,r),new Error(\"Sending Topic Alias out of range\")}else i.length!==0&&(this.options.autoAssignTopicAlias?(r=this.topicAliasSend.getAliasByTopic(i),r?(e.topic=\"\",e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log(\"applyTopicAlias :: auto assign(use) topic: %s - alias: %d\",i,r)):(r=this.topicAliasSend.getLruAlias(),this.topicAliasSend.put(i,r),e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log(\"applyTopicAlias :: auto assign topic: %s - alias: %d\",i,r))):this.options.autoUseTopicAlias&&(r=this.topicAliasSend.getAliasByTopic(i),r&&(e.topic=\"\",e.properties=Object.assign(Object.assign({},e.properties),{topicAlias:r}),this.log(\"applyTopicAlias :: auto use topic: %s - alias: %d\",i,r))));else if(r)return this.log(\"applyTopicAlias :: error out of range. topic: %s - alias: %d\",i,r),new Error(\"Sending Topic Alias out of range\")}}_noop(e){this.log(\"noop ::\",e)}_writePacket(e,r){this.log(\"_writePacket :: packet: %O\",e),this.log(\"_writePacket :: emitting `packetsend`\"),this.emit(\"packetsend\",e),this.log(\"_writePacket :: writing to stream\");let i=$a.default.writeToStream(e,this.stream,this.options);this.log(\"_writePacket :: writeToStream result %s\",i),!i&&r&&r!==this.noop?(this.log(\"_writePacket :: handle events on `drain` once through callback.\"),this.stream.once(\"drain\",r)):r&&(this.log(\"_writePacket :: invoking cb\"),r())}_sendPacket(e,r,i,n){this.log(\"_sendPacket :: (%s) :: start\",this.options.clientId),i=i||this.noop,r=r||this.noop;let o=this._applyTopicAlias(e);if(o){r(o);return}if(!this.connected){if(e.cmd===\"auth\"){this._writePacket(e,r);return}this.log(\"_sendPacket :: client not connected. Storing packet offline.\"),this._storePacket(e,r,i);return}if(n){this._writePacket(e,r);return}switch(e.cmd){case\"publish\":break;case\"pubrel\":this._storeAndSend(e,r,i);return;default:this._writePacket(e,r);return}switch(e.qos){case 2:case 1:this._storeAndSend(e,r,i);break;case 0:default:this._writePacket(e,r);break}this.log(\"_sendPacket :: (%s) :: end\",this.options.clientId)}_storePacket(e,r,i){this.log(\"_storePacket :: packet: %o\",e),this.log(\"_storePacket :: cb? %s\",!!r),i=i||this.noop;let n=e;if(n.cmd===\"publish\"){n=(0,jp.default)(e);let s=this._removeTopicAliasAndRecoverTopicName(n);if(s)return r&&r(s)}let o=n.qos||0;o===0&&this.queueQoSZero||n.cmd!==\"publish\"?this.queue.push({packet:n,cb:r}):o>0?(r=this.outgoing[n.messageId]?this.outgoing[n.messageId].cb:null,this.outgoingStore.put(n,s=>{if(s)return r&&r(s);i()})):r&&r(new Error(\"No connection to broker\"))}_setupKeepaliveManager(){this.log(\"_setupKeepaliveManager :: keepalive %d (seconds)\",this.options.keepalive),!this.keepaliveManager&&this.options.keepalive&&(this.keepaliveManager=new eE.default(this,this.options.timerVariant))}_destroyKeepaliveManager(){this.keepaliveManager&&(this.log(\"_destroyKeepaliveManager :: destroying keepalive manager\"),this.keepaliveManager.destroy(),this.keepaliveManager=null)}reschedulePing(e=!1){this.keepaliveManager&&this.options.keepalive&&(e||this.options.reschedulePings)&&this._reschedulePing()}_reschedulePing(){this.log(\"_reschedulePing :: rescheduling ping\"),this.keepaliveManager.reschedule()}sendPing(){this.log(\"_sendPing :: sending pingreq\"),this._sendPacket({cmd:\"pingreq\"})}onKeepaliveTimeout(){this.emit(\"error\",new Error(\"Keepalive timeout\")),this.log(\"onKeepaliveTimeout :: calling _cleanUp with force true\"),this._cleanUp(!0)}_resubscribe(){this.log(\"_resubscribe\");let e=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion>=4&&!this.connackPacket.sessionPresent)&&e.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){this.log(\"_resubscribe: protocolVersion 5\");for(let r=0;r{let i=this.outgoingStore.createStream(),n=()=>{i.destroy(),i=null,this._flushStoreProcessingQueue(),o()},o=()=>{this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={}};this.once(\"close\",n),i.on(\"error\",a=>{o(),this._flushStoreProcessingQueue(),this.removeListener(\"close\",n),this.emit(\"error\",a)});let s=()=>{if(!i)return;let a=i.read(1),l;if(!a){i.once(\"readable\",s);return}if(this._storeProcessing=!0,this._packetIdsDuringStoreProcessing[a.messageId]){s();return}!this.disconnecting&&!this.reconnectTimer?(l=this.outgoing[a.messageId]?this.outgoing[a.messageId].cb:null,this.outgoing[a.messageId]={volatile:!1,cb(c,h){l&&l(c,h),s()}},this._packetIdsDuringStoreProcessing[a.messageId]=!0,this.messageIdProvider.register(a.messageId)?this._sendPacket(a,void 0,void 0,!0):this.log(\"messageId: %d has already used.\",a.messageId)):i.destroy&&i.destroy()};i.on(\"end\",()=>{let a=!0;for(let l in this._packetIdsDuringStoreProcessing)if(!this._packetIdsDuringStoreProcessing[l]){a=!1;break}this.removeListener(\"close\",n),a?(o(),this._invokeAllStoreProcessingQueue(),this.emit(\"connect\",e)):r()}),s()};r()}_invokeStoreProcessingQueue(){if(!this._storeProcessing&&this._storeProcessingQueue.length>0){let e=this._storeProcessingQueue[0];if(e&&e.invoke())return this._storeProcessingQueue.shift(),!0}return!1}_invokeAllStoreProcessingQueue(){for(;this._invokeStoreProcessingQueue(););}_flushStoreProcessingQueue(){for(let e of this._storeProcessingQueue)e.cbStorePut&&e.cbStorePut(new Error(\"Connection closed\")),e.callback&&e.callback(new Error(\"Connection closed\"));this._storeProcessingQueue.splice(0)}_removeOutgoingAndStoreMessage(e,r){delete this.outgoing[e],this.outgoingStore.del({messageId:e},(i,n)=>{r(i,n),this.messageIdProvider.deallocate(e),this._invokeStoreProcessingQueue()})}};ss.VERSION=ns.MQTTJS_VERSION;Qe.default=ss});var Vp=M(za=>{\"use strict\";_();v();m();Object.defineProperty(za,\"__esModule\",{value:!0});var tE=Ua(),Va=class{constructor(){this.numberAllocator=new tE.NumberAllocator(1,65535)}allocate(){return this.lastId=this.numberAllocator.alloc(),this.lastId}getLastAllocated(){return this.lastId}register(e){return this.numberAllocator.use(e)}deallocate(e){this.numberAllocator.free(e)}clear(){this.numberAllocator.clear()}};za.default=Va});function Rr(t){throw new RangeError(sE[t])}function zp(t,e){let r=t.split(\"@\"),i=\"\";r.length>1&&(i=r[0]+\"@\",t=r[1]);let n=function(o,s){let a=[],l=o.length;for(;l--;)a[l]=s(o[l]);return a}((t=t.replace(nE,\".\")).split(\".\"),e).join(\".\");return i+n}function Yp(t){let e=[],r=0,i=t.length;for(;r=55296&&n<=56319&&r{_();v();m();rE=/^xn--/,iE=/[^\\0-\\x7E]/,nE=/[\\x2E\\u3002\\uFF0E\\uFF61]/g,sE={overflow:\"Overflow: input needs wider integers to process\",\"not-basic\":\"Illegal input >= 0x80 (not a basic code point)\",\"invalid-input\":\"Invalid input\"},dt=Math.floor,Ka=String.fromCharCode;Kp=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Jp=function(t,e,r){let i=0;for(t=r?dt(t/700):t>>1,t+=dt(t/e);t>455;i+=36)t=dt(t/35);return dt(i+36*t/(t+38))},Gp=function(t){let e=[],r=t.length,i=0,n=128,o=72,s=t.lastIndexOf(\"-\");s<0&&(s=0);for(let l=0;l=128&&Rr(\"not-basic\"),e.push(t.charCodeAt(l));for(let l=s>0?s+1:0;l=r&&Rr(\"invalid-input\");let y=(a=t.charCodeAt(l++))-48<10?a-22:a-65<26?a-65:a-97<26?a-97:36;(y>=36||y>dt((2147483647-i)/d))&&Rr(\"overflow\"),i+=y*d;let w=g<=o?1:g>=o+26?26:g-o;if(ydt(2147483647/S)&&Rr(\"overflow\"),d*=S}let h=e.length+1;o=Jp(i-c,h,c==0),dt(i/h)>2147483647-n&&Rr(\"overflow\"),n+=dt(i/h),i%=h,e.splice(i++,0,n)}var a;return String.fromCodePoint(...e)},Qp=function(t){let e=[],r=(t=Yp(t)).length,i=128,n=0,o=72;for(let l of t)l<128&&e.push(Ka(l));let s=e.length,a=s;for(s&&e.push(\"-\");a=i&&hdt((2147483647-n)/c)&&Rr(\"overflow\"),n+=(l-i)*c,i=l;for(let h of t)if(h2147483647&&Rr(\"overflow\"),h==i){let d=n;for(let g=36;;g+=36){let y=g<=o?1:g>=o+26?26:g-o;if(dString.fromCodePoint(...t)},decode:Gp,encode:Qp,toASCII:function(t){return zp(t,function(e){return iE.test(e)?\"xn--\"+Qp(e):e})},toUnicode:function(t){return zp(t,function(e){return rE.test(e)?Gp(e.slice(4).toLowerCase()):e})}};Kt.decode;Kt.encode;Kt.toASCII;Kt.toUnicode;Kt.ucs2;Kt.version});function oE(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var aE,Mi,lE,pt,Zp=_e(()=>{_();v();m();aE=function(t,e,r,i){e=e||\"&\",r=r||\"=\";var n={};if(typeof t!=\"string\"||t.length===0)return n;var o=/\\+/g;t=t.split(e);var s=1e3;i&&typeof i.maxKeys==\"number\"&&(s=i.maxKeys);var a=t.length;s>0&&a>s&&(a=s);for(var l=0;l=0?(c=y.substr(0,w),h=y.substr(w+1)):(c=y,h=\"\"),d=decodeURIComponent(c),g=decodeURIComponent(h),oE(n,d)?Array.isArray(n[d])?n[d].push(g):n[d]=[n[d],g]:n[d]=g}return n},Mi=function(t){switch(typeof t){case\"string\":return t;case\"boolean\":return t?\"true\":\"false\";case\"number\":return isFinite(t)?t:\"\";default:return\"\"}},lE=function(t,e,r,i){return e=e||\"&\",r=r||\"=\",t===null&&(t=void 0),typeof t==\"object\"?Object.keys(t).map(function(n){var o=encodeURIComponent(Mi(n))+r;return Array.isArray(t[n])?t[n].map(function(s){return o+encodeURIComponent(Mi(s))}).join(e):o+encodeURIComponent(Mi(t[n]))}).join(e):i?encodeURIComponent(Mi(i))+r+encodeURIComponent(Mi(t)):\"\"},pt={};pt.decode=pt.parse=aE,pt.encode=pt.stringify=lE;pt.decode;pt.encode;pt.parse;pt.stringify});function Ga(){throw new Error(\"setTimeout has not been defined\")}function Qa(){throw new Error(\"clearTimeout has not been defined\")}function rg(t){if(Pt===setTimeout)return setTimeout(t,0);if((Pt===Ga||!Pt)&&setTimeout)return Pt=setTimeout,setTimeout(t,0);try{return Pt(t,0)}catch{try{return Pt.call(null,t,0)}catch{return Pt.call(this||si,t,0)}}}function uE(){ni&&Cr&&(ni=!1,Cr.length?Ot=Cr.concat(Ot):as=-1,Ot.length&&ig())}function ig(){if(!ni){var t=rg(uE);ni=!0;for(var e=Ot.length;e;){for(Cr=Ot,Ot=[];++as{_();v();m();si=typeof globalThis<\"u\"?globalThis:typeof self<\"u\"?self:global,fe=tg={};(function(){try{Pt=typeof setTimeout==\"function\"?setTimeout:Ga}catch{Pt=Ga}try{kt=typeof clearTimeout==\"function\"?clearTimeout:Qa}catch{kt=Qa}})();Ot=[],ni=!1,as=-1;fe.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r1)for(var I=1;I{_();v();m();Ya={},sg=!1,oi=typeof globalThis<\"u\"?globalThis:typeof self<\"u\"?self:global;re=fE();re.platform=\"browser\";re.addListener;re.argv;re.binding;re.browser;re.chdir;re.cwd;re.emit;re.env;re.listeners;re.nextTick;re.off;re.on;re.once;re.prependListener;re.prependOnceListener;re.removeAllListeners;re.removeListener;re.title;re.umask;re.version;re.versions});function cE(){if(og)return Xa;og=!0;var t=re;function e(o){if(typeof o!=\"string\")throw new TypeError(\"Path must be a string. Received \"+JSON.stringify(o))}function r(o,s){for(var a=\"\",l=0,c=-1,h=0,d,g=0;g<=o.length;++g){if(g2){var y=a.lastIndexOf(\"/\");if(y!==a.length-1){y===-1?(a=\"\",l=0):(a=a.slice(0,y),l=a.length-1-a.lastIndexOf(\"/\")),c=g,h=0;continue}}else if(a.length===2||a.length===1){a=\"\",l=0,c=g,h=0;continue}}s&&(a.length>0?a+=\"/..\":a=\"..\",l=2)}else a.length>0?a+=\"/\"+o.slice(c+1,g):a=o.slice(c+1,g),l=g-c-1;c=g,h=0}else d===46&&h!==-1?++h:h=-1}return a}function i(o,s){var a=s.dir||s.root,l=s.base||(s.name||\"\")+(s.ext||\"\");return a?a===s.root?a+l:a+o+l:l}var n={resolve:function(){for(var s=\"\",a=!1,l,c=arguments.length-1;c>=-1&&!a;c--){var h;c>=0?h=arguments[c]:(l===void 0&&(l=t.cwd()),h=l),e(h),h.length!==0&&(s=h+\"/\"+s,a=h.charCodeAt(0)===47)}return s=r(s,!a),a?s.length>0?\"/\"+s:\"/\":s.length>0?s:\".\"},normalize:function(s){if(e(s),s.length===0)return\".\";var a=s.charCodeAt(0)===47,l=s.charCodeAt(s.length-1)===47;return s=r(s,!a),s.length===0&&!a&&(s=\".\"),s.length>0&&l&&(s+=\"/\"),a?\"/\"+s:s},isAbsolute:function(s){return e(s),s.length>0&&s.charCodeAt(0)===47},join:function(){if(arguments.length===0)return\".\";for(var s,a=0;a0&&(s===void 0?s=l:s+=\"/\"+l)}return s===void 0?\".\":n.normalize(s)},relative:function(s,a){if(e(s),e(a),s===a||(s=n.resolve(s),a=n.resolve(a),s===a))return\"\";for(var l=1;lw){if(a.charCodeAt(d+E)===47)return a.slice(d+E+1);if(E===0)return a.slice(d+E)}else h>w&&(s.charCodeAt(l+E)===47?S=E:E===0&&(S=0));break}var I=s.charCodeAt(l+E),C=a.charCodeAt(d+E);if(I!==C)break;I===47&&(S=E)}var R=\"\";for(E=l+S+1;E<=c;++E)(E===c||s.charCodeAt(E)===47)&&(R.length===0?R+=\"..\":R+=\"/..\");return R.length>0?R+a.slice(d+S):(d+=S,a.charCodeAt(d)===47&&++d,a.slice(d))},_makeLong:function(s){return s},dirname:function(s){if(e(s),s.length===0)return\".\";for(var a=s.charCodeAt(0),l=a===47,c=-1,h=!0,d=s.length-1;d>=1;--d)if(a=s.charCodeAt(d),a===47){if(!h){c=d;break}}else h=!1;return c===-1?l?\"/\":\".\":l&&c===1?\"//\":s.slice(0,c)},basename:function(s,a){if(a!==void 0&&typeof a!=\"string\")throw new TypeError('\"ext\" argument must be a string');e(s);var l=0,c=-1,h=!0,d;if(a!==void 0&&a.length>0&&a.length<=s.length){if(a.length===s.length&&a===s)return\"\";var g=a.length-1,y=-1;for(d=s.length-1;d>=0;--d){var w=s.charCodeAt(d);if(w===47){if(!h){l=d+1;break}}else y===-1&&(h=!1,y=d+1),g>=0&&(w===a.charCodeAt(g)?--g===-1&&(c=d):(g=-1,c=y))}return l===c?c=y:c===-1&&(c=s.length),s.slice(l,c)}else{for(d=s.length-1;d>=0;--d)if(s.charCodeAt(d)===47){if(!h){l=d+1;break}}else c===-1&&(h=!1,c=d+1);return c===-1?\"\":s.slice(l,c)}},extname:function(s){e(s);for(var a=-1,l=0,c=-1,h=!0,d=0,g=s.length-1;g>=0;--g){var y=s.charCodeAt(g);if(y===47){if(!h){l=g+1;break}continue}c===-1&&(h=!1,c=g+1),y===46?a===-1?a=g:d!==1&&(d=1):a!==-1&&(d=-1)}return a===-1||c===-1||d===0||d===1&&a===c-1&&a===l+1?\"\":s.slice(a,c)},format:function(s){if(s===null||typeof s!=\"object\")throw new TypeError('The \"pathObject\" argument must be of type Object. Received type '+typeof s);return i(\"/\",s)},parse:function(s){e(s);var a={root:\"\",dir:\"\",base:\"\",ext:\"\",name:\"\"};if(s.length===0)return a;var l=s.charCodeAt(0),c=l===47,h;c?(a.root=\"/\",h=1):h=0;for(var d=-1,g=0,y=-1,w=!0,S=s.length-1,E=0;S>=h;--S){if(l=s.charCodeAt(S),l===47){if(!w){g=S+1;break}continue}y===-1&&(w=!1,y=S+1),l===46?d===-1?d=S:E!==1&&(E=1):d!==-1&&(E=-1)}return d===-1||y===-1||E===0||E===1&&d===y-1&&d===g+1?y!==-1&&(g===0&&c?a.base=a.name=s.slice(1,y):a.base=a.name=s.slice(g,y)):(g===0&&c?(a.name=s.slice(1,d),a.base=s.slice(1,y)):(a.name=s.slice(g,d),a.base=s.slice(g,y)),a.ext=s.slice(d,y)),g>0?a.dir=s.slice(0,g-1):c&&(a.dir=\"/\"),a},sep:\"/\",delimiter:\":\",win32:null,posix:null};return n.posix=n,Xa=n,Xa}var Xa,og,Za,ag=_e(()=>{_();v();m();Ja();Xa={},og=!1;Za=cE()});var gg={};Jt(gg,{URL:()=>FE,Url:()=>UE,default:()=>Z,fileURLToPath:()=>dg,format:()=>NE,parse:()=>jE,pathToFileURL:()=>pg,resolve:()=>qE,resolveObject:()=>DE});function Fe(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function Li(t,e,r){if(t&>.isObject(t)&&t instanceof Fe)return t;var i=new Fe;return i.parse(t,e,r),i}function _E(){if(cg)return rl;cg=!0;var t=ne;function e(o){if(typeof o!=\"string\")throw new TypeError(\"Path must be a string. Received \"+JSON.stringify(o))}function r(o,s){for(var a=\"\",l=0,c=-1,h=0,d,g=0;g<=o.length;++g){if(g2){var y=a.lastIndexOf(\"/\");if(y!==a.length-1){y===-1?(a=\"\",l=0):(a=a.slice(0,y),l=a.length-1-a.lastIndexOf(\"/\")),c=g,h=0;continue}}else if(a.length===2||a.length===1){a=\"\",l=0,c=g,h=0;continue}}s&&(a.length>0?a+=\"/..\":a=\"..\",l=2)}else a.length>0?a+=\"/\"+o.slice(c+1,g):a=o.slice(c+1,g),l=g-c-1;c=g,h=0}else d===46&&h!==-1?++h:h=-1}return a}function i(o,s){var a=s.dir||s.root,l=s.base||(s.name||\"\")+(s.ext||\"\");return a?a===s.root?a+l:a+o+l:l}var n={resolve:function(){for(var s=\"\",a=!1,l,c=arguments.length-1;c>=-1&&!a;c--){var h;c>=0?h=arguments[c]:(l===void 0&&(l=t.cwd()),h=l),e(h),h.length!==0&&(s=h+\"/\"+s,a=h.charCodeAt(0)===47)}return s=r(s,!a),a?s.length>0?\"/\"+s:\"/\":s.length>0?s:\".\"},normalize:function(s){if(e(s),s.length===0)return\".\";var a=s.charCodeAt(0)===47,l=s.charCodeAt(s.length-1)===47;return s=r(s,!a),s.length===0&&!a&&(s=\".\"),s.length>0&&l&&(s+=\"/\"),a?\"/\"+s:s},isAbsolute:function(s){return e(s),s.length>0&&s.charCodeAt(0)===47},join:function(){if(arguments.length===0)return\".\";for(var s,a=0;a0&&(s===void 0?s=l:s+=\"/\"+l)}return s===void 0?\".\":n.normalize(s)},relative:function(s,a){if(e(s),e(a),s===a||(s=n.resolve(s),a=n.resolve(a),s===a))return\"\";for(var l=1;lw){if(a.charCodeAt(d+E)===47)return a.slice(d+E+1);if(E===0)return a.slice(d+E)}else h>w&&(s.charCodeAt(l+E)===47?S=E:E===0&&(S=0));break}var I=s.charCodeAt(l+E),C=a.charCodeAt(d+E);if(I!==C)break;I===47&&(S=E)}var R=\"\";for(E=l+S+1;E<=c;++E)(E===c||s.charCodeAt(E)===47)&&(R.length===0?R+=\"..\":R+=\"/..\");return R.length>0?R+a.slice(d+S):(d+=S,a.charCodeAt(d)===47&&++d,a.slice(d))},_makeLong:function(s){return s},dirname:function(s){if(e(s),s.length===0)return\".\";for(var a=s.charCodeAt(0),l=a===47,c=-1,h=!0,d=s.length-1;d>=1;--d)if(a=s.charCodeAt(d),a===47){if(!h){c=d;break}}else h=!1;return c===-1?l?\"/\":\".\":l&&c===1?\"//\":s.slice(0,c)},basename:function(s,a){if(a!==void 0&&typeof a!=\"string\")throw new TypeError('\"ext\" argument must be a string');e(s);var l=0,c=-1,h=!0,d;if(a!==void 0&&a.length>0&&a.length<=s.length){if(a.length===s.length&&a===s)return\"\";var g=a.length-1,y=-1;for(d=s.length-1;d>=0;--d){var w=s.charCodeAt(d);if(w===47){if(!h){l=d+1;break}}else y===-1&&(h=!1,y=d+1),g>=0&&(w===a.charCodeAt(g)?--g===-1&&(c=d):(g=-1,c=y))}return l===c?c=y:c===-1&&(c=s.length),s.slice(l,c)}else{for(d=s.length-1;d>=0;--d)if(s.charCodeAt(d)===47){if(!h){l=d+1;break}}else c===-1&&(h=!1,c=d+1);return c===-1?\"\":s.slice(l,c)}},extname:function(s){e(s);for(var a=-1,l=0,c=-1,h=!0,d=0,g=s.length-1;g>=0;--g){var y=s.charCodeAt(g);if(y===47){if(!h){l=g+1;break}continue}c===-1&&(h=!1,c=g+1),y===46?a===-1?a=g:d!==1&&(d=1):a!==-1&&(d=-1)}return a===-1||c===-1||d===0||d===1&&a===c-1&&a===l+1?\"\":s.slice(a,c)},format:function(s){if(s===null||typeof s!=\"object\")throw new TypeError('The \"pathObject\" argument must be of type Object. Received type '+typeof s);return i(\"/\",s)},parse:function(s){e(s);var a={root:\"\",dir:\"\",base:\"\",ext:\"\",name:\"\"};if(s.length===0)return a;var l=s.charCodeAt(0),c=l===47,h;c?(a.root=\"/\",h=1):h=0;for(var d=-1,g=0,y=-1,w=!0,S=s.length-1,E=0;S>=h;--S){if(l=s.charCodeAt(S),l===47){if(!w){g=S+1;break}continue}y===-1&&(w=!1,y=S+1),l===46?d===-1?d=S:E!==1&&(E=1):d!==-1&&(E=-1)}return d===-1||y===-1||E===0||E===1&&d===y-1&&d===g+1?y!==-1&&(g===0&&c?a.base=a.name=s.slice(1,y):a.base=a.name=s.slice(g,y)):(g===0&&c?(a.name=s.slice(1,d),a.base=s.slice(1,y)):(a.name=s.slice(g,d),a.base=s.slice(g,y)),a.ext=s.slice(d,y)),g>0?a.dir=s.slice(0,g-1):c&&(a.dir=\"/\"),a},sep:\"/\",delimiter:\":\",win32:null,posix:null};return n.posix=n,rl=n,rl}function kE(t){if(typeof t==\"string\")t=new URL(t);else if(!(t instanceof URL))throw new Deno.errors.InvalidData(\"invalid argument path , must be a string or URL\");if(t.protocol!==\"file:\")throw new Deno.errors.InvalidData(\"invalid url scheme\");return nl?OE(t):xE(t)}function OE(t){let e=t.hostname,r=t.pathname;for(let i=0;iAE||n!==\":\")throw new Deno.errors.InvalidData(\"file url path must be absolute\");return r.slice(1)}}function xE(t){if(t.hostname!==\"\")throw new Deno.errors.InvalidData(\"invalid file url hostname\");let e=t.pathname;for(let r=0;rVE||n!==\":\")throw new Deno.errors.InvalidData(\"file url path must be absolute\");return r.slice(1)}}function ZE(t){if(t.hostname!==\"\")throw new Deno.errors.InvalidData(\"invalid file url hostname\");let e=t.pathname;for(let r=0;r{_();v();m();Xp();Zp();ng();ag();Ja();Z={},hE=Kt,gt={isString:function(t){return typeof t==\"string\"},isObject:function(t){return typeof t==\"object\"&&t!==null},isNull:function(t){return t===null},isNullOrUndefined:function(t){return t==null}};Z.parse=Li,Z.resolve=function(t,e){return Li(t,!1,!0).resolve(e)},Z.resolveObject=function(t,e){return t?Li(t,!1,!0).resolveObject(e):e},Z.format=function(t){return gt.isString(t)&&(t=Li(t)),t instanceof Fe?t.format():Fe.prototype.format.call(t)},Z.Url=Fe;dE=/^([a-z0-9.+-]+:)/i,pE=/:[0-9]*$/,gE=/^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,yE=[\"{\",\"}\",\"|\",\"\\\\\",\"^\",\"`\"].concat([\"<\",\">\",'\"',\"`\",\" \",\"\\r\",`","`,\"\t\"]),il=[\"'\"].concat(yE),lg=[\"%\",\"/\",\"?\",\";\",\"#\"].concat(il),ug=[\"/\",\"?\",\"#\"],fg=/^[+a-z0-9A-Z_-]{0,63}$/,bE=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,wE={javascript:!0,\"javascript:\":!0},el={javascript:!0,\"javascript:\":!0},ai={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,\"http:\":!0,\"https:\":!0,\"ftp:\":!0,\"gopher:\":!0,\"file:\":!0},tl=pt;Fe.prototype.parse=function(t,e,r){if(!gt.isString(t))throw new TypeError(\"Parameter 'url' must be a string, not \"+typeof t);var i=t.indexOf(\"?\"),n=i!==-1&&i127?U+=\"x\":U+=R[N];if(!U.match(fg)){var K=I.slice(0,w),z=I.slice(w+1),Q=R.match(bE);Q&&(K.push(Q[1]),z.unshift(Q[2])),z.length&&(s=\"/\"+z.join(\".\")+s),this.hostname=K.join(\".\");break}}}this.hostname.length>255?this.hostname=\"\":this.hostname=this.hostname.toLowerCase(),E||(this.hostname=hE.toASCII(this.hostname));var pe=this.port?\":\"+this.port:\"\",Yt=this.hostname||\"\";this.host=Yt+pe,this.href+=this.host,E&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),s[0]!==\"/\"&&(s=\"/\"+s))}if(!wE[c])for(w=0,C=il.length;w0)&&r.host.split(\"@\"))&&(r.auth=Q.shift(),r.host=r.hostname=Q.shift())),r.search=t.search,r.query=t.query,gt.isNull(r.pathname)&>.isNull(r.search)||(r.path=(r.pathname?r.pathname:\"\")+(r.search?r.search:\"\")),r.href=r.format(),r;if(!R.length)return r.pathname=null,r.search?r.path=\"/\"+r.search:r.path=null,r.href=r.format(),r;for(var N=R.slice(-1)[0],W=(r.host||t.host||R.length>1)&&(N===\".\"||N===\"..\")||N===\"\",K=0,z=R.length;z>=0;z--)(N=R[z])===\".\"?R.splice(z,1):N===\"..\"?(R.splice(z,1),K++):K&&(R.splice(z,1),K--);if(!I&&!C)for(;K--;K)R.unshift(\"..\");!I||R[0]===\"\"||R[0]&&R[0].charAt(0)===\"/\"||R.unshift(\"\"),W&&R.join(\"/\").substr(-1)!==\"/\"&&R.push(\"\");var Q,pe=R[0]===\"\"||R[0]&&R[0].charAt(0)===\"/\";return U&&(r.hostname=r.host=pe?\"\":R.length?R.shift():\"\",(Q=!!(r.host&&r.host.indexOf(\"@\")>0)&&r.host.split(\"@\"))&&(r.auth=Q.shift(),r.host=r.hostname=Q.shift())),(I=I||r.host&&R.length)&&!pe&&R.unshift(\"\"),R.length?r.pathname=R.join(\"/\"):(r.pathname=null,r.path=null),gt.isNull(r.pathname)&>.isNull(r.search)||(r.path=(r.pathname?r.pathname:\"\")+(r.search?r.search:\"\")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},Fe.prototype.parseHost=function(){var t=this.host,e=pE.exec(t);e&&((e=e[0])!==\":\"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};Z.Url;Z.format;Z.resolve;Z.resolveObject;rl={},cg=!1;hg=_E(),mE=typeof Deno<\"u\"?Deno.build.os===\"windows\"?\"win32\":Deno.build.os:void 0;Z.URL=typeof URL<\"u\"?URL:null;Z.pathToFileURL=ME;Z.fileURLToPath=kE;Z.Url;Z.format;Z.resolve;Z.resolveObject;Z.URL;vE=92,EE=47,SE=97,AE=122,nl=mE===\"win32\",IE=/\\//g,TE=/%/g,RE=/\\\\/g,CE=/\\n/g,BE=/\\r/g,PE=/\\t/g;LE=typeof Deno<\"u\"?Deno.build.os===\"windows\"?\"win32\":Deno.build.os:void 0;Z.URL=typeof URL<\"u\"?URL:null;Z.pathToFileURL=pg;Z.fileURLToPath=dg;UE=Z.Url,NE=Z.format,qE=Z.resolve,DE=Z.resolveObject,jE=Z.parse,FE=Z.URL,WE=92,$E=47,HE=97,VE=122,sl=LE===\"win32\",zE=/\\//g,KE=/%/g,GE=/\\\\/g,QE=/\\n/g,YE=/\\r/g,JE=/\\t/g});var wg=M((YL,bg)=>{\"use strict\";_();v();m();bg.exports=function(){throw new Error(\"ws does not work in the browser. Browser clients must use the native WebSocket object\")}});var ls=M(li=>{\"use strict\";_();v();m();Object.defineProperty(li,\"__esModule\",{value:!0});li.BufferedDuplex=li.writev=void 0;var eS=jt(),_g=(be(),X(me));function mg(t,e){let r=new Array(t.length);for(let i=0;i{this.destroyed||this.push(n)})}_read(e){this.proxy.read(e)}_write(e,r,i){this.isSocketOpen?this.writeToProxy(e,r,i):this.writeQueue.push({chunk:e,encoding:r,cb:i})}_final(e){this.writeQueue=[],this.proxy.end(e)}_destroy(e,r){this.writeQueue=[],this.proxy.destroy(),r(e)}socketReady(){this.emit(\"connect\"),this.isSocketOpen=!0,this.processWriteQueue()}writeToProxy(e,r,i){this.proxy.write(e,r)===!1?this.proxy.once(\"drain\",i):i()}processWriteQueue(){for(;this.writeQueue.length>0;){let{chunk:e,encoding:r,cb:i}=this.writeQueue.shift();this.writeToProxy(e,r,i)}}};li.BufferedDuplex=ol});var Ui=M(Qt=>{\"use strict\";_();v();m();var ll=Qt&&Qt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qt,\"__esModule\",{value:!0});Qt.streamBuilder=Qt.browserStreamBuilder=void 0;var us=(be(),X(me)),vg=ll(wg()),tS=ll(ot()),rS=jt(),iS=ll(Oi()),al=ls(),Gt=(0,tS.default)(\"mqttjs:ws\"),nS=[\"rejectUnauthorized\",\"ca\",\"cert\",\"key\",\"pfx\",\"passphrase\"];function Eg(t,e){let r=`${t.protocol}://${t.hostname}:${t.port}${t.path}`;return typeof t.transformWsUrl==\"function\"&&(r=t.transformWsUrl(r,t,e)),r}function Sg(t){let e=t;return t.port||(t.protocol===\"wss\"?e.port=443:e.port=80),t.path||(e.path=\"/\"),t.wsOptions||(e.wsOptions={}),!iS.default&&!t.forceNativeWebSocket&&t.protocol===\"wss\"&&nS.forEach(r=>{Object.prototype.hasOwnProperty.call(t,r)&&!Object.prototype.hasOwnProperty.call(t.wsOptions,r)&&(e.wsOptions[r]=t[r])}),e}function sS(t){let e=Sg(t);if(e.hostname||(e.hostname=e.host),!e.hostname){if(typeof document>\"u\")throw new Error(\"Could not determine host. Specify host manually.\");let r=new URL(document.URL);e.hostname=r.hostname,e.port||(e.port=Number(r.port))}return e.objectMode===void 0&&(e.objectMode=!(e.binary===!0||e.binary===void 0)),e}function oS(t,e,r){Gt(\"createWebSocket\"),Gt(`protocol: ${r.protocolId} ${r.protocolVersion}`);let i=r.protocolId===\"MQIsdp\"&&r.protocolVersion===3?\"mqttv3.1\":\"mqtt\";Gt(`creating new Websocket for url: ${e} and protocol: ${i}`);let n;return r.createWebsocket?n=r.createWebsocket(e,[i],r):n=new vg.default(e,[i],r.wsOptions),n}function aS(t,e){let r=e.protocolId===\"MQIsdp\"&&e.protocolVersion===3?\"mqttv3.1\":\"mqtt\",i=Eg(e,t),n;return e.createWebsocket?n=e.createWebsocket(i,[r],e):n=new WebSocket(i,[r]),n.binaryType=\"arraybuffer\",n}var lS=(t,e)=>{Gt(\"streamBuilder\");let r=Sg(e);r.hostname=r.hostname||r.host||\"localhost\";let i=Eg(r,t),n=oS(t,i,r),o=vg.default.createWebSocketStream(n,r.wsOptions);return o.url=i,n.on(\"close\",()=>{o.destroy()}),o};Qt.streamBuilder=lS;var uS=(t,e)=>{Gt(\"browserStreamBuilder\");let r,n=sS(e).browserBufferSize||1024*512,o=e.browserBufferTimeout||1e3,s=!e.objectMode,a=aS(t,e),l=h(e,S,E);e.objectMode||(l._writev=al.writev.bind(l)),l.on(\"close\",()=>{a.close()});let c=typeof a.addEventListener<\"u\";a.readyState===a.OPEN?(r=l,r.socket=a):(r=new al.BufferedDuplex(e,l,a),c?a.addEventListener(\"open\",d):a.onopen=d),c?(a.addEventListener(\"close\",g),a.addEventListener(\"error\",y),a.addEventListener(\"message\",w)):(a.onclose=g,a.onerror=y,a.onmessage=w);function h(I,C,R){let U=new rS.Transform({objectMode:I.objectMode});return U._write=C,U._flush=R,U}function d(){Gt(\"WebSocket onOpen\"),r instanceof al.BufferedDuplex&&r.socketReady()}function g(I){Gt(\"WebSocket onClose\",I),r.end(),r.destroy()}function y(I){Gt(\"WebSocket onError\",I);let C=new Error(\"WebSocket error\");C.event=I,r.destroy(C)}async function w(I){let{data:C}=I;C instanceof ArrayBuffer?C=us.Buffer.from(C):C instanceof Blob?C=us.Buffer.from(await new Response(C).arrayBuffer()):C=us.Buffer.from(C,\"utf8\"),l&&!l.destroyed&&l.push(C)}function S(I,C,R){if(a.bufferedAmount>n){setTimeout(S,o,I,C,R);return}s&&typeof I==\"string\"&&(I=us.Buffer.from(I,\"utf8\"));try{a.send(I)}catch(U){return R(U)}R()}function E(I){a.close(),I()}return r};Qt.browserStreamBuilder=uS});var ul={};Jt(ul,{Server:()=>Me,Socket:()=>Me,Stream:()=>Me,_createServerHandle:()=>Me,_normalizeArgs:()=>Me,_setSimultaneousAccepts:()=>Me,connect:()=>Me,createConnection:()=>Me,createServer:()=>Me,default:()=>fS,isIP:()=>Me,isIPv4:()=>Me,isIPv6:()=>Me});function Me(){throw new Error(\"Node.js net module is not supported by JSPM core outside of Node.js\")}var fS,fl=_e(()=>{_();v();m();fS={_createServerHandle:Me,_normalizeArgs:Me,_setSimultaneousAccepts:Me,connect:Me,createConnection:Me,createServer:Me,isIP:Me,isIPv4:Me,isIPv6:Me,Server:Me,Socket:Me,Stream:Me}});var cl=M(Ni=>{\"use strict\";_();v();m();var Ag=Ni&&Ni.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ni,\"__esModule\",{value:!0});var cS=Ag((fl(),X(ul))),hS=Ag(ot()),dS=(0,hS.default)(\"mqttjs:tcp\"),pS=(t,e)=>{e.port=e.port||1883,e.hostname=e.hostname||e.host||\"localhost\";let{port:r,path:i}=e,n=e.hostname;return dS(\"port %d and host %s\",r,n),cS.default.createConnection({port:r,host:n,path:i})};Ni.default=pS});var Ig={};Jt(Ig,{default:()=>gS});var gS,Tg=_e(()=>{_();v();m();gS={}});var dl=M(qi=>{\"use strict\";_();v();m();var hl=qi&&qi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(qi,\"__esModule\",{value:!0});var yS=hl((Tg(),X(Ig))),bS=hl((fl(),X(ul))),wS=hl(ot()),_S=(0,wS.default)(\"mqttjs:tls\"),mS=(t,e)=>{e.port=e.port||8883,e.host=e.hostname||e.host||\"localhost\",bS.default.isIP(e.host)===0&&(e.servername=e.host),e.rejectUnauthorized=e.rejectUnauthorized!==!1,delete e.path,_S(\"port %d host %s rejectUnauthorized %b\",e.port,e.host,e.rejectUnauthorized);let r=yS.default.connect(e);r.on(\"secureConnect\",()=>{e.rejectUnauthorized&&!r.authorized?r.emit(\"error\",new Error(\"TLS not authorized\")):r.removeListener(\"error\",i)});function i(n){e.rejectUnauthorized&&t.emit(\"error\",n),r.end()}return r.on(\"error\",i),r};qi.default=mS});var yl=M(gl=>{\"use strict\";_();v();m();Object.defineProperty(gl,\"__esModule\",{value:!0});var Rg=(be(),X(me)),vS=jt(),ES=ls(),yt,pl,Le;function SS(){let t=new vS.Transform;return t._write=(e,r,i)=>{yt.send({data:e.buffer,success(){i()},fail(n){i(new Error(n))}})},t._flush=e=>{yt.close({success(){e()}})},t}function AS(t){t.hostname||(t.hostname=\"localhost\"),t.path||(t.path=\"/\"),t.wsOptions||(t.wsOptions={})}function IS(t,e){let r=t.protocol===\"wxs\"?\"wss\":\"ws\",i=`${r}://${t.hostname}${t.path}`;return t.port&&t.port!==80&&t.port!==443&&(i=`${r}://${t.hostname}:${t.port}${t.path}`),typeof t.transformWsUrl==\"function\"&&(i=t.transformWsUrl(i,t,e)),i}function TS(){yt.onOpen(()=>{Le.socketReady()}),yt.onMessage(t=>{let{data:e}=t;e instanceof ArrayBuffer?e=Rg.Buffer.from(e):e=Rg.Buffer.from(e,\"utf8\"),pl.push(e)}),yt.onClose(()=>{Le.emit(\"close\"),Le.end(),Le.destroy()}),yt.onError(t=>{let e=new Error(t.errMsg);Le.destroy(e)})}var RS=(t,e)=>{if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error(\"Could not determine host. Specify host manually.\");let r=e.protocolId===\"MQIsdp\"&&e.protocolVersion===3?\"mqttv3.1\":\"mqtt\";AS(e);let i=IS(e,t);yt=wx.connectSocket({url:i,protocols:[r]}),pl=SS(),Le=new ES.BufferedDuplex(e,pl,yt),Le._destroy=(o,s)=>{yt.close({success(){s&&s(o)}})};let n=Le.destroy;return Le.destroy=(o,s)=>(Le.destroy=n,setTimeout(()=>{yt.close({fail(){Le._destroy(o,s)}})},0),Le),TS(),Le};gl.default=RS});var _l=M(wl=>{\"use strict\";_();v();m();Object.defineProperty(wl,\"__esModule\",{value:!0});var bl=(be(),X(me)),CS=jt(),BS=ls(),xt,fs,ui,Cg=!1;function PS(){let t=new CS.Transform;return t._write=(e,r,i)=>{xt.sendSocketMessage({data:e.buffer,success(){i()},fail(){i(new Error)}})},t._flush=e=>{xt.closeSocket({success(){e()}})},t}function kS(t){t.hostname||(t.hostname=\"localhost\"),t.path||(t.path=\"/\"),t.wsOptions||(t.wsOptions={})}function OS(t,e){let r=t.protocol===\"alis\"?\"wss\":\"ws\",i=`${r}://${t.hostname}${t.path}`;return t.port&&t.port!==80&&t.port!==443&&(i=`${r}://${t.hostname}:${t.port}${t.path}`),typeof t.transformWsUrl==\"function\"&&(i=t.transformWsUrl(i,t,e)),i}function xS(){Cg||(Cg=!0,xt.onSocketOpen(()=>{ui.socketReady()}),xt.onSocketMessage(t=>{if(typeof t.data==\"string\"){let e=bl.Buffer.from(t.data,\"base64\");fs.push(e)}else{let e=new FileReader;e.addEventListener(\"load\",()=>{let r=e.result;r instanceof ArrayBuffer?r=bl.Buffer.from(r):r=bl.Buffer.from(r,\"utf8\"),fs.push(r)}),e.readAsArrayBuffer(t.data)}}),xt.onSocketClose(()=>{ui.end(),ui.destroy()}),xt.onSocketError(t=>{ui.destroy(t)}))}var MS=(t,e)=>{if(e.hostname=e.hostname||e.host,!e.hostname)throw new Error(\"Could not determine host. Specify host manually.\");let r=e.protocolId===\"MQIsdp\"&&e.protocolVersion===3?\"mqttv3.1\":\"mqtt\";kS(e);let i=OS(e,t);return xt=e.my,xt.connectSocket({url:i,protocols:r}),fs=PS(),ui=new BS.BufferedDuplex(e,fs,xt),xS(),ui};wl.default=MS});var kg=M(Br=>{\"use strict\";_();v();m();var cs=Br&&Br.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Br,\"__esModule\",{value:!0});Br.connectAsync=void 0;var LS=cs(ot()),US=cs((yg(),X(gg))),NS=cs(os()),qS=cs(Oi());typeof(B===null||B===void 0?void 0:B.nextTick)!=\"function\"&&(B.nextTick=setImmediate);var Bg=(0,LS.default)(\"mqttjs\"),de=null;function DS(t){let e;t.auth&&(e=t.auth.match(/^(.+):(.+)$/),e?(t.username=e[1],t.password=e[2]):t.username=t.auth)}function Pg(t,e){var r,i,n,o;if(Bg(\"connecting to an MQTT broker...\"),typeof t==\"object\"&&!e&&(e=t,t=\"\"),e=e||{},t&&typeof t==\"string\"){let l=US.default.parse(t,!0),c={};if(l.port!=null&&(c.port=Number(l.port)),c.host=l.hostname,c.query=l.query,c.auth=l.auth,c.protocol=l.protocol,c.path=l.path,c.protocol=(r=c.protocol)===null||r===void 0?void 0:r.replace(/:$/,\"\"),e=Object.assign(Object.assign({},c),e),!e.protocol)throw new Error(\"Missing protocol\")}if(e.unixSocket=e.unixSocket||((i=e.protocol)===null||i===void 0?void 0:i.includes(\"+unix\")),e.unixSocket?e.protocol=e.protocol.replace(\"+unix\",\"\"):!(!((n=e.protocol)===null||n===void 0)&&n.startsWith(\"ws\"))&&!(!((o=e.protocol)===null||o===void 0)&&o.startsWith(\"wx\"))&&delete e.path,DS(e),e.query&&typeof e.query.clientId==\"string\"&&(e.clientId=e.query.clientId),e.cert&&e.key)if(e.protocol){if([\"mqtts\",\"wss\",\"wxs\",\"alis\"].indexOf(e.protocol)===-1)switch(e.protocol){case\"mqtt\":e.protocol=\"mqtts\";break;case\"ws\":e.protocol=\"wss\";break;case\"wx\":e.protocol=\"wxs\";break;case\"ali\":e.protocol=\"alis\";break;default:throw new Error(`Unknown protocol for secure connection: \"${e.protocol}\"!`)}}else throw new Error(\"Missing secure protocol key\");if(de||(de={},!qS.default&&!e.forceNativeWebSocket?(de.ws=Ui().streamBuilder,de.wss=Ui().streamBuilder,de.mqtt=cl().default,de.tcp=cl().default,de.ssl=dl().default,de.tls=de.ssl,de.mqtts=dl().default):(de.ws=Ui().browserStreamBuilder,de.wss=Ui().browserStreamBuilder,de.wx=yl().default,de.wxs=yl().default,de.ali=_l().default,de.alis=_l().default)),!de[e.protocol]){let l=[\"mqtts\",\"wss\"].indexOf(e.protocol)!==-1;e.protocol=[\"mqtt\",\"mqtts\",\"ws\",\"wss\",\"wx\",\"wxs\",\"ali\",\"alis\"].filter((c,h)=>l&&h%2===0?!1:typeof de[c]==\"function\")[0]}if(e.clean===!1&&!e.clientId)throw new Error(\"Missing clientId for unclean clients\");e.protocol&&(e.defaultProtocol=e.protocol);function s(l){return e.servers&&((!l._reconnectCount||l._reconnectCount===e.servers.length)&&(l._reconnectCount=0),e.host=e.servers[l._reconnectCount].host,e.port=e.servers[l._reconnectCount].port,e.protocol=e.servers[l._reconnectCount].protocol?e.servers[l._reconnectCount].protocol:e.defaultProtocol,e.hostname=e.host,l._reconnectCount++),Bg(\"calling streambuilder for\",e.protocol),de[e.protocol](l,e)}let a=new NS.default(s,e);return a.on(\"error\",()=>{}),a}function jS(t,e,r=!0){return new Promise((i,n)=>{let o=Pg(t,e),s={connect:l=>{a(),i(o)},end:()=>{a(),i(o)},error:l=>{a(),o.end(),n(l)}};r===!1&&(s.close=()=>{s.error(new Error(\"Couldn't connect to server\"))});function a(){Object.keys(s).forEach(l=>{o.off(l,s[l])})}Object.keys(s).forEach(l=>{o.on(l,s[l])})})}Br.connectAsync=jS;Br.default=Pg});var ml=M(G=>{\"use strict\";_();v();m();var Og=G&&G.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||(\"get\"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),FS=G&&G.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,\"default\",{enumerable:!0,value:e})}:function(t,e){t.default=e}),WS=G&&G.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!==\"default\"&&Object.prototype.hasOwnProperty.call(t,r)&&Og(e,t,r);return FS(e,t),e},xg=G&&G.__exportStar||function(t,e){for(var r in t)r!==\"default\"&&!Object.prototype.hasOwnProperty.call(e,r)&&Og(e,t,r)},Di=G&&G.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(G,\"__esModule\",{value:!0});G.ReasonCodes=G.KeepaliveManager=G.UniqueMessageIdProvider=G.DefaultMessageIdProvider=G.Store=G.MqttClient=G.connectAsync=G.connect=G.Client=void 0;var Mg=Di(os());G.MqttClient=Mg.default;var $S=Di(Zo());G.DefaultMessageIdProvider=$S.default;var HS=Di(Vp());G.UniqueMessageIdProvider=HS.default;var VS=Di(ra());G.Store=VS.default;var Lg=WS(kg());G.connect=Lg.default;Object.defineProperty(G,\"connectAsync\",{enumerable:!0,get:function(){return Lg.connectAsync}});var zS=Di(Wa());G.KeepaliveManager=zS.default;G.Client=Mg.default;xg(os(),G);xg(_r(),G);var KS=Ti();Object.defineProperty(G,\"ReasonCodes\",{enumerable:!0,get:function(){return KS.ReasonCodes}})});var XS=M(We=>{_();v();m();var Ug=We&&We.__createBinding||(Object.create?function(t,e,r,i){i===void 0&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||(\"get\"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}),GS=We&&We.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,\"default\",{enumerable:!0,value:e})}:function(t,e){t.default=e}),QS=We&&We.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!==\"default\"&&Object.prototype.hasOwnProperty.call(t,r)&&Ug(e,t,r);return GS(e,t),e},YS=We&&We.__exportStar||function(t,e){for(var r in t)r!==\"default\"&&!Object.prototype.hasOwnProperty.call(e,r)&&Ug(e,t,r)};Object.defineProperty(We,\"__esModule\",{value:!0});var JS=QS(ml());We.default=JS;YS(ml(),We)});return XS();})();",""],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"parameters":[],"objectGroups":[]},{"fullName":"","functionType":"Action","name":"onScenePostEvents","sentence":"","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["// Remove the messages of the last frame for no dataloss mode","Object"," .values(gdjs.evtTools.mqtt.events)"," .forEach((event, index) => {"," if (Array.isArray(event.data))"," event.data.shift();"," else event.data = gdjs.evtTools.mqtt.empty;"," });",""],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"parameters":[],"objectGroups":[]},{"description":"Triggers if the client is connected to an MQTT broker server.","fullName":"Is connected to a broker?","functionType":"Condition","name":"isConnected","sentence":"Client connected to a broker","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["eventsFunctionContext.returnValue ="," gdjs.evtTools.mqtt.connection && gdjs.evtTools.mqtt.connection.connected;",""],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"parameters":[],"objectGroups":[]},{"description":"Connects to an MQTT broker. ","fullName":"Connect to a broker","functionType":"Action","name":"connect","sentence":"Connect to MQTT broker _PARAM1_ with parameters _PARAM2_ (secure connection: _PARAM3_)","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["// Parse settings","const settings = eventsFunctionContext.getArgument(\"settings\");","let settingsParsed;","if (settings.length > 2)"," try {"," settingsParsed = JSON.parse(settings);"," } catch (e) {"," settingsParsed = {}"," console.error(\"Invalid settings: \", settings, \", Error:\", e);"," };","","// Connect to broker","gdjs.evtTools.mqtt.connection = mqtt.connect("," (eventsFunctionContext.getArgument(\"secure\")"," ? \"wss://\""," : \"ws://\")"," + eventsFunctionContext.getArgument(\"host\"),"," settingsParsed",");","","// Set up listeners","gdjs.evtTools.mqtt.connection.on(\"message\", (channel, message) => {"," if (typeof gdjs.evtTools.mqtt.events[channel] === undefined) {"," gdjs.evtTools.mqtt.events[channel] = {"," loss: false,"," data: [message],"," };"," return;"," }",""," const mqttEvent = gdjs.evtTools.mqtt.events[channel];"," if (mqttEvent.loss) {"," mqttEvent.data = message;"," } else {"," if (!Array.isArray(mqttEvent.data)) mqttEvent.data = [];"," mqttEvent.data.push(message);"," }","});","","gdjs.evtTools.mqtt.connection.on(\"error\", function (e) {"," gdjs.evtTools.mqtt.lastError = e;","});",""],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":true}],"parameters":[{"description":"Host port","name":"host","type":"string"},{"description":"Settings as JSON","longDescription":"You can find the list of settings at [the MQTT.js docs](https://github.com/mqttjs/MQTT.js/#client). \nAn example of valid configuration would be `\"{\\\"clientId\\\": \\\"myUserName\\\"}\"`.","name":"settings","type":"string"},{"description":"Use secure WebSockets?","name":"secure","type":"yesorno"}],"objectGroups":[]},{"description":"Disconnects from the current MQTT broker.","fullName":"Disconnect from broker","functionType":"Action","name":"disconnect","sentence":"Disconnect from MQTT broker (force: _PARAM1_)","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["if (gdjs.evtTools.mqtt.connection === null) return;","gdjs.evtTools.mqtt.connection.end(eventsFunctionContext.getArgument(\"force\"));","gdjs.evtTools.mqtt.connection = null;",""],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"parameters":[{"description":"Force end the connection?","longDescription":"By default, MQTT waits for pending messages or messages in the process of being sent to finish being sent before ending the connection. Use this to cancel any request and immediately shutdown the connection.","name":"force","type":"yesorno"}],"objectGroups":[]},{"description":"Publishes a message on a topic.","fullName":"Publish message","functionType":"Action","name":"publish","sentence":"Publish variable _PARAM1_ on topic _PARAM2_ (QoS: _PARAM3_)","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["if (gdjs.evtTools.mqtt.connection === null) return;","gdjs.evtTools.mqtt.connection.publish("," eventsFunctionContext.getArgument(\"topic\"),"," eventsFunctionContext.getArgument(\"content\"),"," { qos: eventsFunctionContext.getArgument(\"QoS\"), retain: eventsFunctionContext.getArgument(\"retain\") }",");",""],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"parameters":[{"description":"Text to publish","name":"content","type":"string"},{"description":"Topic to publish to","name":"topic","type":"string"},{"description":"The QoS","longDescription":"See [this](https://github.com/mqttjs/MQTT.js#qos) for more details.","name":"QoS","type":"expression"},{"description":"Should the message be retained?","longDescription":"When a message is retained, it will be sent to every client that subscribe to the topic. Only one message can be retained per topic, if another retained message is sent it will overwrite the previous one. \nRead more [here](https://www.hivemq.com/blog/mqtt-essentials-part-8-retained-messages/#retained-messages).","name":"retain","type":"yesorno"}],"objectGroups":[]},{"description":"Subcribe to a topic. All messages published on that topic will be received.","fullName":"Subscribe to a topic","functionType":"Action","name":"subscribe","sentence":"Subscribe to topic _PARAM1_ with QoS at _PARAM2_ and dataloss _PARAM3_","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["if (gdjs.evtTools.mqtt.connection === null) return;","","const topic = eventsFunctionContext.getArgument(\"topic\");","if (typeof gdjs.evtTools.mqtt.events[topic] === \"undefined\") gdjs.evtTools.mqtt.events[topic] = { data: eventsFunctionContext.getArgument(\"dataloss\") ? \"\" : [] };","gdjs.evtTools.mqtt.events[topic].loss = eventsFunctionContext.getArgument(\"dataloss\");","","gdjs.evtTools.mqtt.connection.subscribe("," topic,"," { qos: eventsFunctionContext.getArgument(\"QoS\") }",");",""],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"parameters":[{"description":"The topic to subscribe to","name":"topic","type":"string"},{"description":"The QoS","longDescription":"See https://github.com/mqttjs/MQTT.js#qos for more details","name":"QoS","type":"expression"},{"description":"Is dataloss allowed?","longDescription":"See https://wiki.gdevelop.io/gdevelop5/all-features/p2p#choosing_if_you_want_to_activate_data_loss_mode for more details","name":"dataloss","type":"yesorno"}],"objectGroups":[]},{"description":"Unsubcribe from a topic. No more messages from this topic will be received.","fullName":"Unsubscribe from a topic","functionType":"Action","name":"unsubscribe","sentence":"Unsubscribe from topic _PARAM1_","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["if (gdjs.evtTools.mqtt.connection !== null)"," gdjs.evtTools.mqtt.connection.unsubscribe("," eventsFunctionContext.getArgument(\"topic\")"," );",""],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"parameters":[{"description":"The topic to subscribe to","name":"topic","type":"string"}],"objectGroups":[]},{"description":"Triggers whenever a message was received. Note that you first need to subcribe to a topic in order to get messages from it.","fullName":"On message","functionType":"Condition","name":"onMessage","sentence":"Message received from topic _PARAM1_","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["const mqttEvent = gdjs.evtTools.mqtt.events[eventsFunctionContext.getArgument(\"topic\")];\r","if (typeof mqttEvent === \"undefined\" || typeof mqttEvent.data === \"undefined\") return;\r","eventsFunctionContext.returnValue =\r"," Array.isArray(mqttEvent.data)\r"," ? mqttEvent.data.length !== 0\r"," : mqttEvent.data !== gdjs.evtTools.mqtt.empty;\r",""],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"parameters":[{"description":"The topic to listen to","name":"topic","type":"string"}],"objectGroups":[]},{"description":"Get the last received message of a topic.","fullName":"Get last message","functionType":"StringExpression","name":"GetLastMessage","sentence":"","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["const mqttEvent = gdjs.evtTools.mqtt.events[eventsFunctionContext.getArgument(\"topic\")];","if (typeof mqttEvent === \"undefined\") return;","eventsFunctionContext.returnValue = Array.isArray(mqttEvent.data)"," ? mqttEvent.data[0]"," : mqttEvent.data;",""],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"expressionType":{"type":"string"},"parameters":[{"description":"The topic to get the message from","name":"topic","type":"string"}],"objectGroups":[]},{"description":"Gets the last error. Returns an empty string if there was no errors.","fullName":"Get the last error","functionType":"StringExpression","name":"getCurrentError","sentence":"","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":"eventsFunctionContext.returnValue = gdjs.evtTools.mqtt.lastError","parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"expressionType":{"type":"string"},"parameters":[],"objectGroups":[]}],"eventsFunctionsFolderStructure":{"folderName":"__ROOT","children":[{"functionName":"onFirstSceneLoaded"},{"functionName":"onScenePostEvents"},{"functionName":"isConnected"},{"functionName":"connect"},{"functionName":"disconnect"},{"functionName":"publish"},{"functionName":"subscribe"},{"functionName":"unsubscribe"},{"functionName":"onMessage"},{"functionName":"GetLastMessage"},{"functionName":"getCurrentError"}]},"eventsBasedBehaviors":[],"eventsBasedObjects":[]},{"author":"","category":"Network","dimension":"","extensionNamespace":"","fullName":"Advanced HTTP","gdevelopVersion":">=5.5.222","helpPath":"","iconUrl":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQoJLnN0MXtmaWxsOm5vbmU7c3Ryb2tlOiMwMDAwMDA7c3Ryb2tlLXdpZHRoOjI7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO3N0cm9rZS1taXRlcmxpbWl0OjEwO30NCjwvc3R5bGU+DQo8cG9seWxpbmUgY2xhc3M9InN0MCIgcG9pbnRzPSIxMSwxMiAyMSwxOCAzMSwxMiAiLz4NCjxsaW5lIGNsYXNzPSJzdDAiIHgxPSI0IiB5MT0iMTIiIHgyPSIxMSIgeTI9IjEyIi8+DQo8bGluZSBjbGFzcz0ic3QwIiB4MT0iMSIgeTE9IjE2IiB4Mj0iMTIiIHkyPSIxNiIvPg0KPGxpbmUgY2xhc3M9InN0MCIgeDE9IjQiIHkxPSIyMCIgeDI9IjExIiB5Mj0iMjAiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMSwxMnYtMWMwLTIuMiwxLjgtNCw0LTRoMTJjMi4yLDAsNCwxLjgsNCw0djEwYzAsMi4yLTEuOCw0LTQsNEgxNWMtMi4yLDAtNC0xLjgtNC00di0xIi8+DQo8L3N2Zz4NCg==","name":"AdvancedHTTP","previewIconUrl":"https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/Email/04e28ac117741933d15ac1cadb34e0d799c7a561352b1525a1b75c5bd1dbeabc_Email_email_envelope_letter_message_fast.svg","shortDescription":"HTTP requests with custom headers, methods, caching, CORS bypass, and JSON/FormData body.","version":"1.1.0","description":"An extension to create HTTP requests with more advanced settings than the built-in \"Network request\" action, like specifying headers or bypassing CORS.","origin":{"identifier":"AdvancedHTTP","name":"gdevelop-extension-store"},"tags":["header","beacon","http","request","get","post","delete","patch","head","method","body","html","request","web","curl","url"],"authorIds":["ZgrsWuRTAkXgeuPV9bo0zuEcA2w1"],"dependencies":[],"globalVariables":[],"sceneVariables":[],"eventsFunctions":[{"description":"Creates a template for your request. All requests must be made from a request template.","fullName":"Create a new request template","functionType":"Action","group":"Request creation","name":"CreateRequest","sentence":"Create request template _PARAM1_ with URL _PARAM2_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"GlobalVariableClearChildren"},"parameters":["__AdvancedHTTP.Requests[Request]"]},{"type":{"value":"ModVarGlobalTxt"},"parameters":["__AdvancedHTTP.Requests[Request].URL","=","URL"]}]}],"parameters":[{"description":"New request template name","name":"Request","supplementaryInformation":"sceneRequest","type":"identifier"},{"description":"URL the request will be sent to","name":"URL","supplementaryInformation":"sceneURL","type":"identifier"}],"objectGroups":[]},{"description":"Creates a new request template with all the attributes from an existing one.","fullName":"Copy a request template","functionType":"Action","group":"Request creation","name":"CopyRequest","sentence":"Create request _PARAM1_ from template _PARAM2_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"JSONToGlobalVariableStructure"},"parameters":["GlobalVarToJSON(__AdvancedHTTP.Requests[OriginRequest])","__AdvancedHTTP.Requests[Request]"]}]}],"parameters":[{"description":"New request template name","name":"Request","supplementaryInformation":"sceneRequest","type":"identifier"},{"description":"Request to copy","name":"OriginRequest","supplementaryInformation":"sceneRequest","type":"identifier"}],"objectGroups":[]},{"description":"The HTTP method of the request. GET is the default and what you should use if you are unsure which to pick. A request to a REST API endpoint may have a different effect depending on the method - refer to the documentation of the API you are calling to learn about the appropriate method to use.","fullName":"HTTP Method (Verb)","functionType":"Action","group":"Request settings","name":"SetRequestMethod","sentence":"Set HTTP method of request _PARAM1_ to _PARAM2_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"ModVarGlobalTxt"},"parameters":["__AdvancedHTTP.Requests[Request].Options.method","=","Method"]}]}],"parameters":[{"description":"Request template name","name":"Request","supplementaryInformation":"sceneRequest","type":"identifier"},{"description":"HTTP Method","name":"Method","supplementaryInformation":"[\"GET\",\"POST\",\"PUT\",\"PATCH\",\"DELETE\",\"HEAD\",\"TRACE\",\"CONNECT\",\"OPTIONS\"]","type":"stringWithSelector"}],"objectGroups":[]},{"description":"the HTTP method of the request. GET is the default and what you should use if you are unsure which to pick. A request to a REST API endpoint may have a different effect depending on the method - refer to the documentation of the API you are calling to learn about the appropriate method to use.","fullName":"HTTP Method (Verb)","functionType":"ExpressionAndCondition","group":"Request settings","name":"RequestMethod","sentence":"HTTP method of request _PARAM1_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"GlobalVariableChildExists"},"parameters":["__AdvancedHTTP.Requests[Request].Options","\"method\""]}],"actions":[{"type":{"value":"SetReturnString"},"parameters":["GlobalVariableString(__AdvancedHTTP.Requests[Request].Options.method)"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"GlobalVariableChildExists"},"parameters":["__AdvancedHTTP.Requests[Request].Options","\"method\""]}],"actions":[{"type":{"value":"SetReturnString"},"parameters":["\"GET\""]}]}],"expressionType":{"supplementaryInformation":"[\"GET\",\"HEAD\",\"POST\",\"PUT\",\"OPTIONS\",\"CONNECT\",\"TRACE\"]","type":"stringWithSelector"},"parameters":[{"description":"Request template name","name":"Request","supplementaryInformation":"sceneRequest","type":"identifier"}],"objectGroups":[]},{"description":"Defines to what extent the results of the request is can/must be cached. When cached, instead of sending a request to the server, the browser will avoid making a real request to the server and will use a previous response given by the server for the same request.\n\nThe server also has a say in this via the Cache-Control header.","fullName":"HTTP Caching strategy","functionType":"Action","group":"Request settings","name":"SetRequestCache","sentence":"Set HTTP caching strategy of request _PARAM1_ to _PARAM2_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"ModVarGlobalTxt"},"parameters":["__AdvancedHTTP.Requests[Request].Options.cache","=","Cache"]}]}],"parameters":[{"description":"Request template name","name":"Request","supplementaryInformation":"sceneRequest","type":"identifier"},{"description":"HTTP Caching strategy","longDescription":"Learn more about what each caching strategy does [on the MDN page for cache](https://developer.mozilla.org/en-US/docs/Web/API/Request/cache).","name":"Cache","supplementaryInformation":"[\"default\",\"no-store\",\"reload\",\"no-cache\",\"force-cache\",\"only-if-cached\"]","type":"stringWithSelector"}],"objectGroups":[]},{"description":"the HTTP method of the request. GET is the default and what you should use if you are unsure which to pick. A request to a REST API endpoint may have a different effect depending on the method - refer to the documentation of the API you are calling to learn about the appropriate method to use.","fullName":"HTTP Caching","functionType":"ExpressionAndCondition","group":"Request settings","name":"RequestCache","sentence":"HTTP caching strategy of request _PARAM1_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"GlobalVariableChildExists"},"parameters":["__AdvancedHTTP.Requests[Request].Options","\"cache\""]}],"actions":[{"type":{"value":"SetReturnString"},"parameters":["GlobalVariableString(__AdvancedHTTP.Requests[Request].Options.cache)"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"GlobalVariableChildExists"},"parameters":["__AdvancedHTTP.Requests[Request].Options","\"cache\""]}],"actions":[{"type":{"value":"SetReturnString"},"parameters":["\"default\""]}]}],"expressionType":{"supplementaryInformation":"[\"default\",\"reload\",\"no-cache\",\"force-cache\",\"only-if-cached\"]","type":"stringWithSelector"},"parameters":[{"description":"Request template name","name":"Request","supplementaryInformation":"sceneRequest","type":"identifier"}],"objectGroups":[]},{"description":"The HTTP method of the request. GET is the default and what you should use if you are unsure which to pick. A request to a REST API endpoint may have a different effect depending on the method - refer to the documentation of the API you are calling to learn about the appropriate method to use.","fullName":"HTTP Method (Verb)","functionType":"ActionWithOperator","getterName":"RequestBody","group":"Request settings","name":"SetRequestBody","sentence":"Set HTTP method of request _PARAM1_ to _PARAM2_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"ModVarGlobalTxt"},"parameters":["__AdvancedHTTP.Requests[Request].Options.body","=","Value"]}]}],"parameters":[{"description":"Request template name","name":"Request","supplementaryInformation":"sceneRequest","type":"identifier"},{"description":"HTTP Method","name":"Method","supplementaryInformation":"[\"GET\",\"POST\",\"PUT\",\"PATCH\",\"DELETE\",\"HEAD\",\"TRACE\",\"CONNECT\",\"OPTIONS\"]","type":"stringWithSelector"}],"objectGroups":[]},{"description":"Sets the body of an HTTP request to a JSON representation of a structure variable.","fullName":"Body as JSON","functionType":"Action","getterName":"RequestBody","group":"Request settings","name":"SetJSONRequestBody","sentence":"Set body of request _PARAM1_ to contents of _PARAM2_ as JSON","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"CopyArgumentToVariable"},"parameters":["\"Body\"","__AdvancedHTTP.Body"]},{"type":{"value":"ModVarGlobalTxt"},"parameters":["__AdvancedHTTP.Requests[Request].Options.body","=","ToJSON(__AdvancedHTTP.Body)"]}]}],"parameters":[{"description":"Request template name","name":"Request","supplementaryInformation":"sceneRequest","type":"identifier"},{"description":"Variable with body contents","name":"Body","supplementaryInformation":"[\"GET\",\"POST\",\"PUT\",\"PATCH\",\"DELETE\",\"HEAD\",\"TRACE\",\"CONNECT\",\"OPTIONS\"]","type":"scenevar"}],"objectGroups":[]},{"description":"Sets the body of an HTTP request to a form data representation of a structure variable.","fullName":"Body as form data","functionType":"Action","getterName":"RequestBody","group":"Request settings","name":"SetFormDataRequestBody","sentence":"Set body of request _PARAM1_ to contents of _PARAM2_ as form data","events":[{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"Merge form data with the form data of the request"},{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["gdjs.Variable.copy("," eventsFunctionContext.getArgument(\"Body\"),"," runtimeScene.getGame().getVariables().get(\"__AdvancedHTTP\")"," .getChild(\"Requests\")"," .getChild(eventsFunctionContext.getArgument(\"Request\"))"," .getChild(\"FormData\"),"," /* mergeVariables = */true",");",""],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"parameters":[{"description":"Request template name","name":"Request","supplementaryInformation":"sceneRequest","type":"identifier"},{"description":"Variable with body contents","name":"Body","supplementaryInformation":"[\"GET\",\"POST\",\"PUT\",\"PATCH\",\"DELETE\",\"HEAD\",\"TRACE\",\"CONNECT\",\"OPTIONS\"]","type":"scenevar"}],"objectGroups":[]},{"description":"the body of the HTTP request. Contains data to send to the server, ususally in plain text, JSON or FormData format. This cannot be set for GET requests.","fullName":"Body","functionType":"ExpressionAndCondition","group":"Request settings","name":"RequestBody","sentence":"body of request _PARAM1_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"GlobalVariableChildExists"},"parameters":["__AdvancedHTTP.Requests[Request].Options","\"body\""]}],"actions":[{"type":{"value":"SetReturnString"},"parameters":["GlobalVariableString(__AdvancedHTTP.Requests[Request].Options.body)"]}]}],"expressionType":{"supplementaryInformation":"[\"GET\",\"HEAD\",\"POST\",\"PUT\",\"OPTIONS\",\"CONNECT\",\"TRACE\"]","type":"string"},"parameters":[{"description":"Request template name","name":"Request","supplementaryInformation":"sceneRequest","type":"identifier"}],"objectGroups":[]},{"description":"The HTTP method of the request. GET is the default and what you should use if you are unsure which to pick. A request to a REST API endpoint may have a different effect depending on the method - refer to the documentation of the API you are calling to learn about the appropriate method to use.","fullName":"HTTP Method (Verb)","functionType":"ActionWithOperator","getterName":"RequestHeader","group":"Request settings","name":"SetRequestHeader","sentence":"Set HTTP method of request _PARAM1_ to _PARAM2_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"ModVarGlobalTxt"},"parameters":["__AdvancedHTTP.Requests[Request].Options.headers[Header]","=","Value"]}]}],"parameters":[{"description":"Request template name","name":"Request","supplementaryInformation":"sceneRequest","type":"identifier"},{"description":"HTTP Method","name":"Method","supplementaryInformation":"[\"GET\",\"POST\",\"PUT\",\"PATCH\",\"DELETE\",\"HEAD\",\"TRACE\",\"CONNECT\",\"OPTIONS\"]","type":"stringWithSelector"}],"objectGroups":[]},{"description":"an HTTP header to be sent with the request.","fullName":"Header","functionType":"ExpressionAndCondition","group":"Request settings","name":"RequestHeader","sentence":"HTTP header _PARAM2_ of request _PARAM1_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"GlobalVariableChildExists"},"parameters":["__AdvancedHTTP.Requests[Request].Options","\"headers\""]},{"type":{"value":"GlobalVariableChildExists"},"parameters":["__AdvancedHTTP.Requests[Request].Options.headers","Header"]}],"actions":[{"type":{"value":"SetReturnString"},"parameters":["GlobalVariableString(__AdvancedHTTP.Requests[Request].Options.headers[Header])"]}]}],"expressionType":{"supplementaryInformation":"sceneHeader","type":"string"},"parameters":[{"description":"Request template name","name":"Request","supplementaryInformation":"sceneRequest","type":"identifier"},{"description":"HTTP header name","name":"Header","supplementaryInformation":"sceneHeader","type":"identifier"}],"objectGroups":[]},{"description":"The HTTP method of the request. GET is the default and what you should use if you are unsure which to pick. A request to a REST API endpoint may have a different effect depending on the method - refer to the documentation of the API you are calling to learn about the appropriate method to use.","fullName":"HTTP Method (Verb)","functionType":"ActionWithOperator","getterName":"RequestURL","group":"Request settings","name":"SetRequestURL","sentence":"Set HTTP method of request _PARAM1_ to _PARAM2_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"ModVarGlobalTxt"},"parameters":["__AdvancedHTTP.Requests[Request].URL","=","Value"]}]}],"parameters":[{"description":"Request template name","name":"Request","supplementaryInformation":"sceneRequest","type":"identifier"}],"objectGroups":[]},{"description":"the request template's target URL.","fullName":"URL","functionType":"ExpressionAndCondition","group":"Request settings","name":"RequestURL","sentence":"the URL of request template _PARAM1_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"SetReturnString"},"parameters":["GlobalVariableString(__AdvancedHTTP.Requests[Request].URL)"]}]}],"expressionType":{"supplementaryInformation":"sceneURL","type":"identifier"},"parameters":[{"description":"Request template name","name":"Request","supplementaryInformation":"sceneRequest","type":"identifier"}],"objectGroups":[]},{"description":"CORS prevents most external websites from being queried with the browser's HTTP client, since the browser may be authenticated on that website and as such another website would be able to impersonate the player on that other website.\n\nWhen the CORS Bypass is enabled, the request will be made from a server that is not authenticated anywhere and as such is not blocked by CORS, and it will share the response with your game. Note that as such, authentication cookies are ignored! If you own the REST API you are requesting, add CORS headers to your server instead of using this CORS Bypass.","fullName":"Enable CORS Bypass","functionType":"Action","group":"Request settings","name":"UseCORSBypass","sentence":"Enable CORS Bypass for request _PARAM1_: _PARAM2_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BooleanVariable"},"parameters":["UseBypass","True",""]}],"actions":[{"type":{"value":"SetGlobalVariableAsBoolean"},"parameters":["__AdvancedHTTP.Requests[Request].CORS","True"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"BooleanVariable"},"parameters":["UseBypass","True",""]}],"actions":[{"type":{"value":"SetGlobalVariableAsBoolean"},"parameters":["__AdvancedHTTP.Requests[Request].CORS","False"]}]}],"parameters":[{"description":"Request template name","name":"Request","supplementaryInformation":"sceneRequest","type":"identifier"},{"defaultValue":"yes","description":"Enable the CORS Bypass?","longDescription":"The CORS Bypass server is offered for free by [arthuro555](https://twitter.com/arthuro555). Consider making a [donation](https://ko-fi.com/arthuro555) to help keep the CORS Bypass server running.","name":"UseBypass","optional":true,"type":"yesorno"}],"objectGroups":[]},{"description":"Checks whether or not CORS Bypass has been enabled for the request template.","fullName":"CORS Bypass enabled","functionType":"Condition","group":"Request settings","name":"IsUsingCORSBypass","sentence":"CORS Bypass is enabled for request _PARAM1_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"GlobalVariableAsBoolean"},"parameters":["__AdvancedHTTP.Requests[Request].CORS","True"]}],"actions":[{"type":{"value":"SetReturnBoolean"},"parameters":["True"]}]}],"parameters":[{"description":"Request template name","name":"Request","supplementaryInformation":"sceneRequest","type":"identifier"}],"objectGroups":[]},{"async":true,"description":"Executes the request defined by a request template.","fullName":"Execute the request","functionType":"Action","group":"Request execution","name":"ExecuteRequest","sentence":"Execute request _PARAM1_ and store results in _PARAM2_","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["const logger = (this.logger || (this.logger = new gdjs.Logger(\"Advanced HTTP\")));","const advancedHTTP = (gdjs._advancedHTTP || (gdjs._advancedHTTP = { responses: new Map(), id: 1 }));","","/** @type {gdjs.Variable} */","const result = eventsFunctionContext.getArgument(\"Response\");","const requestName = eventsFunctionContext.getArgument(\"Request\");","const request = runtimeScene"," .getGame()"," .getVariables()"," .get(\"__AdvancedHTTP\")"," .getChild(\"Requests\")"," .getChild(requestName)"," .toJSObject();","if (!request.Options) request.Options = {}","if (request.Options.method === 'GET' || request.Options.method === 'HEAD') delete request.Options.body;","","if (typeof request.URL !== \"string\") {"," eventsFunctionContext.task.resolve();"," logger.error(`Couldn't execute request '${requestName}' - has it been properly initialized?`);"," return;","}","","function isContentful(obj) {"," for (var x in obj) { return true; }"," return false;","}","const hasFormData = request.FormData && isContentful(request.FormData)","console.log(isContentful(request.FormData), request.FormData)","","if (hasFormData) {"," if (request.Options.body && request.Options.body !== \"\") {"," console.warn(`The request ${requestName} has both form data and a separate body - the body will be ignored and replaced by the form data.`);"," }",""," delete request.Options.body;","}","","if (request.CORS) {"," // Cache makes sense only on the client. CF Workers does not support cache property on fetch anyways."," const cache = request.Options.cache;"," delete request.Options.cache;"," eventsFunctionContext.task = new gdjs.PromiseTask("," fetch(`https://cors.arthuro555.com?${JSON.stringify({"," url: request.URL,"," options: request.Options,"," formData: isContentful(request.FormData) ? request.FormData : undefined"," })}`, { keepalive: true, cache })"," .then(async (response) => {"," const { ok, status, headers, body } = await response.json();"," result.fromJSObject({"," ok,"," status,"," headers,"," body,"," });"," })"," .catch((e) => {"," logger.error(`Couldn't execute request '${requestName}': ${e}`);"," })"," );","} else {"," if (hasFormData && request.Options.method !== 'GET' && request.Options.method !== 'HEAD') {"," const fd = request.Options.body = new FormData();"," for (const key of Object.keys(request.FormData)) {"," fd.append(key, request.FormData[key])"," }"," }",""," eventsFunctionContext.task = new gdjs.PromiseTask("," fetch(request.URL, { keepalive: true, ...request.Options })"," .then((response) => {"," const id = advancedHTTP.id++;"," const { ok, status, headers } = response;"," result.fromJSObject({"," id,"," ok,"," status,"," headers: Object.fromEntries(headers.entries()),"," });"," result.getChild(\"id\").setNumber(id);"," advancedHTTP.responses.set(id, response);"," setTimeout(() => advancedHTTP.responses.delete(id), 10_000);"," })"," .catch((e) => {"," logger.error(`Couldn't execute request '${requestName}': ${e}`);"," })"," );","}"],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"parameters":[{"description":"Request to execute","name":"Request","supplementaryInformation":"sceneRequest","type":"identifier"},{"description":"Variable where to store the response to the request","name":"Response","type":"scenevar"}],"objectGroups":[]},{"description":"Checks whether the server marked the response as a success (status code 1XX/2XX), not as a failure (status code 4XX/5XX).","fullName":"Success","functionType":"Condition","group":"Response","name":"ResponseSuccess","sentence":"Response _PARAM1_ indicates a success","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"CopyArgumentToVariable"},"parameters":["\"Response\"","__AdvancedHTTP.Response"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"SceneVariableAsBoolean"},"parameters":["__AdvancedHTTP.Response.ok","True"]}],"actions":[{"type":{"value":"SetReturnBoolean"},"parameters":["True"]}]}],"parameters":[{"description":"Variable containing the response","name":"Response","type":"scenevar"}],"objectGroups":[]},{"description":"the status code of the HTTP request (e.g. 200 if succeeded, 404 if not found, etc).","fullName":"Status code","functionType":"ExpressionAndCondition","group":"Response","name":"ResponseStatusCode","sentence":"Status code of response _PARAM1_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"CopyArgumentToVariable"},"parameters":["\"Response\"","__AdvancedHTTP.Response"]},{"type":{"value":"SetReturnNumber"},"parameters":["Variable(__AdvancedHTTP.Response.status)"]}]}],"expressionType":{"type":"expression"},"parameters":[{"description":"Variable containing the response","name":"Response","type":"scenevar"}],"objectGroups":[]},{"description":"Gets the status text for a response. For example, for a response with the status code 404, the status text will be \"Not Found\".","fullName":"Status text","functionType":"StringExpression","group":"Response","name":"ResponseStatusText","sentence":"","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"GlobalVariableChildExists"},"parameters":["__AdvancedHTTP","\"StatusTexts\""]}],"actions":[{"type":{"value":"JSONToGlobalVariableStructure"},"parameters":["\"{\\\"100\\\":\\\"Continue\\\",\\\"101\\\":\\\"Switching Protocols\\\",\\\"102\\\":\\\"Processing\\\",\\\"200\\\":\\\"OK\\\",\\\"201\\\":\\\"Created\\\",\\\"202\\\":\\\"Accepted\\\",\\\"203\\\":\\\"Non-Authoritative Information\\\",\\\"204\\\":\\\"No Content\\\",\\\"205\\\":\\\"Reset Content\\\",\\\"206\\\":\\\"Partial Content\\\",\\\"207\\\":\\\"Multi-Status\\\",\\\"226\\\":\\\"IM Used\\\",\\\"300\\\":\\\"Multiple Choices\\\",\\\"301\\\":\\\"Moved Permanently\\\",\\\"302\\\":\\\"Found\\\",\\\"303\\\":\\\"See Other\\\",\\\"304\\\":\\\"Not Modified\\\",\\\"305\\\":\\\"Use Proxy\\\",\\\"307\\\":\\\"Temporary Redirect\\\",\\\"308\\\":\\\"Permanent Redirect\\\",\\\"400\\\":\\\"Bad Request\\\",\\\"401\\\":\\\"Unauthorized\\\",\\\"402\\\":\\\"Payment Required\\\",\\\"403\\\":\\\"Forbidden\\\",\\\"404\\\":\\\"Not Found\\\",\\\"405\\\":\\\"Method Not Allowed\\\",\\\"406\\\":\\\"Not Acceptable\\\",\\\"407\\\":\\\"Proxy Authentication Required\\\",\\\"408\\\":\\\"Request Timeout\\\",\\\"409\\\":\\\"Conflict\\\",\\\"410\\\":\\\"Gone\\\",\\\"411\\\":\\\"Length Required\\\",\\\"412\\\":\\\"Precondition Failed\\\",\\\"413\\\":\\\"Payload Too Large\\\",\\\"414\\\":\\\"URI Too Long\\\",\\\"415\\\":\\\"Unsupported Media Type\\\",\\\"416\\\":\\\"Range Not Satisfiable\\\",\\\"417\\\":\\\"Expectation Failed\\\",\\\"418\\\":\\\"I'm a teapot\\\",\\\"422\\\":\\\"Unprocessable Entity\\\",\\\"423\\\":\\\"Locked\\\",\\\"424\\\":\\\"Failed Dependency\\\",\\\"426\\\":\\\"Upgrade Required\\\",\\\"428\\\":\\\"Precondition Required\\\",\\\"429\\\":\\\"Too Many Requests\\\",\\\"431\\\":\\\"Request Header Fields Too Large\\\",\\\"451\\\":\\\"Unavailable For Legal Reasons\\\",\\\"500\\\":\\\"Internal Server Error\\\",\\\"501\\\":\\\"Not Implemented\\\",\\\"502\\\":\\\"Bad Gateway\\\",\\\"503\\\":\\\"Service Unavailable\\\",\\\"504\\\":\\\"Gateway Time-out\\\",\\\"505\\\":\\\"HTTP Version Not Supported\\\",\\\"506\\\":\\\"Variant Also Negotiates\\\",\\\"507\\\":\\\"Insufficient Storage\\\",\\\"511\\\":\\\"Network Authentication Required\\\",\\\"1xx\\\":\\\"**Informational**\\\",\\\"2xx\\\":\\\"**Successful**\\\",\\\"3xx\\\":\\\"**Redirection**\\\",\\\"4xx\\\":\\\"**Client Error**\\\",\\\"5xx\\\":\\\"**Server Error**\\\",\\\"7xx\\\":\\\"**Developer Error**\\\"}\"","__AdvancedHTTP.StatusTexts"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"CopyArgumentToVariable"},"parameters":["\"Response\"","__AdvancedHTTP.Response"]},{"type":{"value":"SetReturnString"},"parameters":["GlobalVariableString(__AdvancedHTTP.StatusTexts[Variable(__AdvancedHTTP.Response.status)])"]}]}],"expressionType":{"type":"string"},"parameters":[{"description":"Variable containing the response","name":"Response","type":"scenevar"}],"objectGroups":[]},{"description":"one of the HTTP headers included in the server's response.","fullName":"Header","functionType":"ExpressionAndCondition","group":"Response","name":"ResponseHeader","sentence":"Header _PARAM2_ of response _PARAM1_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"CopyArgumentToVariable"},"parameters":["\"Response\"","__AdvancedHTTP.Response"]},{"type":{"value":"SetReturnString"},"parameters":["VariableString(__AdvancedHTTP.Response.headers[Header])"]}]}],"expressionType":{"type":"string"},"parameters":[{"description":"Variable containing the response","name":"Response","type":"scenevar"},{"description":"Header","name":"Header","supplementaryInformation":"sceneHeader","type":"identifier"}],"objectGroups":[]},{"async":true,"description":"Reads the body sent by the server, and store it as a string in a variable.","fullName":"Get response body (text)","functionType":"Action","group":"Response","name":"ReadResponseText","sentence":"Read body of response _PARAM1_ into _PARAM2_ as text","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["const logger = (this.logger || (this.logger = new gdjs.Logger(\"Advanced HTTP\")));\r","const advancedHTTP = (gdjs._advancedHTTP || (gdjs._advancedHTTP = { responses: new Map(), id: 1 }));\r","\r","/** @type {gdjs.Variable} */\r","const response = eventsFunctionContext.getArgument(\"Response\");\r","/** @type {gdjs.Variable} */\r","const body = eventsFunctionContext.getArgument(\"Body\");\r","\r","const id = response.getChild(\"id\").getAsNumber();\r","const responseBody = response.getChild(\"body\").getAsString();\r","\r","if (responseBody !== \"0\") {\r"," body.setString(responseBody);\r"," eventsFunctionContext.task.resolve();\r"," return;\r","}\r","\r","if (!advancedHTTP.responses.has(id)) {\r"," eventsFunctionContext.task.resolve();\r"," logger.error(`Couldn't read the body of a request. Either an invalid request has passed, or the body has already been disposed of. The body must be read within 10 seconds of the request succeeding, as it will then be disposed of.`);\r"," return;\r","}\r","\r","const fetchResponse = advancedHTTP.responses.get(id);\r","\r","eventsFunctionContext.task = new gdjs.PromiseTask(\r"," fetchResponse\r"," .text()\r"," .then((text) => {\r"," body.setString(text);\r"," })\r"," .catch((e) => {\r"," logger.error(`An error occured while reading the body of a request: ${e}`)\r"," })\r",")\r",""],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"parameters":[{"description":"Variable containing the response","name":"Response","type":"scenevar"},{"description":"Variable where to write the body contents into","name":"Body","type":"scenevar"}],"objectGroups":[]},{"async":true,"description":"Reads the body sent by the server, parses it as JSON and stores the resulting structure in a variable.","fullName":"Get response body (JSON)","functionType":"Action","group":"Response","name":"ReadResponseJSON","sentence":"Read body of response _PARAM1_ into _PARAM2_ as JSON","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["const logger = (this.logger || (this.logger = new gdjs.Logger(\"Advanced HTTP\")));\r","const advancedHTTP = (gdjs._advancedHTTP || (gdjs._advancedHTTP = { responses: new Map(), id: 1 }));\r","\r","/** @type {gdjs.Variable} */\r","const response = eventsFunctionContext.getArgument(\"Response\");\r","/** @type {gdjs.Variable} */\r","const body = eventsFunctionContext.getArgument(\"Body\");\r","\r","const id = response.getChild(\"id\").getAsNumber();\r","const responseBody = response.getChild(\"body\").getAsString();\r","\r","if (responseBody !== \"0\") {\r"," try {\r"," const parsedBody = JSON.parse(responseBody)\r"," body.fromJSObject(parsedBody);\r"," } catch (e) {\r"," logger.error(`An error occured while reading the body of a request: ${e}`)\r"," }\r"," eventsFunctionContext.task.resolve();\r"," return;\r","}\r","\r","if (!advancedHTTP.responses.has(id)) {\r"," eventsFunctionContext.task.resolve();\r"," logger.error(`Couldn't read the body of a request. Either an invalid request has passed, or the body has already been disposed of. The body must be read within 10 seconds of the request succeeding, as it will then be disposed of.`);\r"," return;\r","}\r","\r","const fetchResponse = advancedHTTP.responses.get(id);\r","\r","eventsFunctionContext.task = new gdjs.PromiseTask(\r"," fetchResponse\r"," .json()\r"," .then((json) => {\r"," body.fromJSObject(json);\r"," })\r"," .catch((e) => {\r"," logger.error(`An error occured while reading the body of a request: ${e}`)\r"," })\r",")\r",""],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"parameters":[{"description":"Variable containing the response","name":"Response","type":"scenevar"},{"description":"Variable where to write the body contents into","name":"Body","type":"scenevar"}],"objectGroups":[]}],"eventsFunctionsFolderStructure":{"folderName":"__ROOT","children":[{"folderName":"Request creation","children":[{"functionName":"CreateRequest"},{"functionName":"CopyRequest"}]},{"folderName":"Request settings","children":[{"functionName":"SetRequestMethod"},{"functionName":"RequestMethod"},{"functionName":"SetRequestCache"},{"functionName":"RequestCache"},{"functionName":"SetRequestBody"},{"functionName":"SetJSONRequestBody"},{"functionName":"SetFormDataRequestBody"},{"functionName":"RequestBody"},{"functionName":"SetRequestHeader"},{"functionName":"RequestHeader"},{"functionName":"SetRequestURL"},{"functionName":"RequestURL"},{"functionName":"UseCORSBypass"},{"functionName":"IsUsingCORSBypass"}]},{"folderName":"Request execution","children":[{"functionName":"ExecuteRequest"}]},{"folderName":"Response","children":[{"functionName":"ResponseSuccess"},{"functionName":"ResponseStatusCode"},{"functionName":"ResponseStatusText"},{"functionName":"ResponseHeader"},{"functionName":"ReadResponseText"},{"functionName":"ReadResponseJSON"}]}]},"eventsBasedBehaviors":[],"eventsBasedObjects":[]},{"author":"","category":"Movement","dimension":"2D","extensionNamespace":"","fullName":"Pixel perfect movement","gdevelopVersion":">=5.5.222","helpPath":"","iconUrl":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQoJLnN0MXtmaWxsOm5vbmU7c3Ryb2tlOiMwMDAwMDA7c3Ryb2tlLXdpZHRoOjI7c3Ryb2tlLWxpbmVjYXA6cm91bmQ7c3Ryb2tlLWxpbmVqb2luOnJvdW5kO30NCgkuc3Qye2ZpbGw6bm9uZTtzdHJva2U6IzAwMDAwMDtzdHJva2Utd2lkdGg6MjtzdHJva2UtbGluZWNhcDpyb3VuZDtzdHJva2UtbGluZWpvaW46cm91bmQ7c3Ryb2tlLWRhc2hhcnJheTo2LDY7fQ0KCS5zdDN7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtZGFzaGFycmF5OjQsNDt9DQoJLnN0NHtmaWxsOm5vbmU7c3Ryb2tlOiMwMDAwMDA7c3Ryb2tlLXdpZHRoOjI7c3Ryb2tlLWxpbmVjYXA6cm91bmQ7fQ0KCS5zdDV7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1kYXNoYXJyYXk6My4xMDgxLDMuMTA4MTt9DQoJDQoJCS5zdDZ7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDtzdHJva2UtZGFzaGFycmF5OjQsMzt9DQo8L3N0eWxlPg0KPHJlY3QgeD0iNCIgeT0iNCIgY2xhc3M9InN0MCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ii8+DQo8bGluZSBjbGFzcz0ic3QwIiB4MT0iMTIiIHkxPSIyOCIgeDI9IjEyIiB5Mj0iNCIvPg0KPGxpbmUgY2xhc3M9InN0MCIgeDE9IjIwIiB5MT0iMjgiIHgyPSIyMCIgeTI9IjQiLz4NCjxsaW5lIGNsYXNzPSJzdDAiIHgxPSIyOCIgeTE9IjIwIiB4Mj0iNCIgeTI9IjIwIi8+DQo8bGluZSBjbGFzcz0ic3QwIiB4MT0iMjgiIHkxPSIxMiIgeDI9IjQiIHkyPSIxMiIvPg0KPC9zdmc+DQo=","name":"PixelPerfectMovement","previewIconUrl":"https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Graphic Design/Graphic Design_grid.svg","shortDescription":"Grid-based pixel-perfect movement for platformer and top-down characters.","version":"0.3.2","description":["Games with pixel art usually use pixels bigger than actual pixels of the screen. This can lead to big pixels partially overlapping each other which doesn't look good.","","This extension allows to seamlessly keep big pixels aligned when the object is stopped and still beneficiate from the high resolution of the screen to have smooth movements.","","It can be used for:","* Pixel-perfect platformers ([open the project online](https://editor.gdevelop.io/?project=example://platformer-with-tilemap))","* Align top-down characters on a grid ([open the project online](https://editor.gdevelop.io/?project=example://top-down-grid-movement))"],"origin":{"identifier":"PixelPerfectMovement","name":"gdevelop-extension-store"},"tags":["pixel perfect","platformer","platform","top-down","movement","grid"],"authorIds":["IWykYNRvhCZBN3vEgKEbBPOR3Oc2","mkJFlZEo4aXeAZxt8CsXjEkW4Oq1","mMR36hCjO5dlcYmhNSuVtcREM473"],"dependencies":[],"globalVariables":[],"sceneVariables":[],"eventsFunctions":[{"description":"Return the speed necessary to cover a distance according to the deceleration.","fullName":"Speed to reach","functionType":"Expression","name":"SpeedToReach","private":true,"sentence":"Braking distance from an initial speed: _PARAM2_ and a deceleration: _PARAM3_ is less than _PARAM1_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BuiltinCommonInstructions::CompareNumbers"},"parameters":["Distance",">=","0"]}],"actions":[{"type":{"value":"SetReturnNumber"},"parameters":["sqrt(2 * Distance * Deceleration)"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BuiltinCommonInstructions::CompareNumbers"},"parameters":["Distance","<","0"]}],"actions":[{"type":{"value":"SetReturnNumber"},"parameters":["-sqrt(-2 * Distance * Deceleration)"]}]}],"expressionType":{"type":"expression"},"parameters":[{"description":"Distance","name":"Distance","type":"expression"},{"description":"Deceleration","name":"Deceleration","type":"expression"}],"objectGroups":[]},{"description":"Return the braking distance according to an initial speed and a deceleration.","fullName":"Braking distance","functionType":"Expression","name":"BrakingDistance","private":true,"sentence":"Braking distance from an initial speed: _PARAM2_ and a deceleration: _PARAM3_ is less than _PARAM1_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"SetReturnNumber"},"parameters":["Speed * Speed / (2 * Deceleration)"]}]}],"expressionType":{"type":"expression"},"parameters":[{"description":"Speed","name":"Speed","type":"expression"},{"description":"Deceleration","name":"Deceleration","type":"expression"}],"objectGroups":[]},{"description":"Define JavaScript classes for top-down.","fullName":"Define JavaScript classes for top-down","functionType":"Action","name":"DefineJavaScriptForTopDown","private":true,"sentence":"Define JavaScript classes for top-down","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["if (gdjs.__pixelPerfectExtension) {"," return;","}","","const epsilon = 1 / (1 << 20);","","class PixelPerfectTopDownMovement {",""," /**"," * @param {gdjs.RuntimeBehavior} pixelPerfectBehavior"," * @param {gdjs.TopDownMovementRuntimeBehavior} topDownBehavior"," */"," constructor(pixelPerfectBehavior, topDownBehavior) {"," /** @type {gdjs.RuntimeBehavior} */"," this.pixelPerfectBehavior = pixelPerfectBehavior;"," /** @type {gdjs.TopDownMovementRuntimeBehavior} */"," this.topDownBehavior = topDownBehavior;",""," topDownBehavior.registerHook(this);",""," /** @type {number | null} */"," this.targetX = null;"," /** @type {number | null} */"," this.targetY = null;"," this.targetDirectionX = 0;"," this.targetDirectionY = 0;"," this.lastDirection = -1;"," this.isVelocityAdjusted = false;"," this.isVelocityAdjustedOnX = false;"," this.isVelocityAdjustedOnY = false;"," }",""," /**"," * Return the direction to use instead of the direction given in"," * parameter."," * @param {gdjs.TopDownMovementRuntimeBehavior.TopDownMovementHookContext} context"," * @return {number}"," */"," overrideDirection(context) {"," let direction = context.getDirection();"," if (!this.pixelPerfectBehavior.activated()) {"," return direction;"," }",""," /** @type {number} */"," const cellSize = this.pixelPerfectBehavior._getPixelSize();"," const that = this.topDownBehavior;"," const object = that.owner;",""," if (cellSize <= 0 || that._allowDiagonals) {"," return direction;"," }",""," // Forbid to turn before being aligned on the grid.",""," const timeDelta = object.getElapsedTime() / 1000;"," const deltaX = Math.abs(that._xVelocity * timeDelta);"," const deltaY = Math.abs(that._yVelocity * timeDelta);",""," const isTryingToMoveOnX = direction === 4 || direction === 0;"," const isTryingToMoveOnY = direction === 6 || direction === 2;"," if (isTryingToMoveOnX) {"," if (that._yVelocity < 0) {"," if (Math.abs(this.ceilToCellY(object.y) - object.y) > deltaY) {"," direction = 6;"," } else {"," object.y = this.ceilToCellY(object.y);"," }"," }"," if (that._yVelocity > 0) {"," if (Math.abs(this.floorToCellY(object.y) - object.y) > deltaY) {"," direction = 2;"," } else {"," object.y = this.floorToCellY(object.y);"," }"," }"," } else if (isTryingToMoveOnY) {"," if (that._xVelocity < 0) {"," if (Math.abs(this.ceilToCellX(object.x) - object.x) > deltaX) {"," direction = 4;"," } else {"," object.x = this.ceilToCellX(object.x);"," }"," }"," if (that._xVelocity > 0) {"," if (Math.abs(this.floorToCellX(object.x) - object.x) > deltaX) {"," direction = 0;"," } else {"," object.x = this.floorToCellX(object.x);"," }"," }"," }",""," // Ensure sharp turn even with Verlet integrations."," const speed = Math.abs(that._xVelocity + that._yVelocity);"," if (direction === 0) {"," that._xVelocity = speed;"," that._yVelocity = 0;"," } else if (direction === 4) {"," that._xVelocity = -speed;"," that._yVelocity = 0;"," } else if (direction === 2) {"," that._yVelocity = speed;"," that._xVelocity = 0;"," } else if (direction === 6) {"," that._yVelocity = -speed;"," that._xVelocity = 0;"," }",""," this.lastDirection = direction;"," return direction;"," }",""," /**"," * Called before the acceleration and new direction is applied to the"," * velocity."," * @param {gdjs.TopDownMovementRuntimeBehavior.TopDownMovementHookContext} context"," */"," beforeSpeedUpdate(context) {"," if (!this.pixelPerfectBehavior.activated()) {"," return;"," }",""," const direction = context.getDirection();"," /** @type {number} */"," const cellSize = this.pixelPerfectBehavior._getPixelSize();"," const that = this.topDownBehavior;"," const object = that.owner;",""," if (cellSize <= 0) {"," return;"," }",""," const isMovingOnX ="," direction !== -1 && direction !== 2 && direction !== 6;"," if (isMovingOnX) {"," this.targetX = null;"," } else if (this.targetX === null) {"," // Find where the deceleration should stop the object."," if (that._xVelocity > 0) {"," this.targetX = this.ceilToCellX("," object.x + this.getBreakingDistanceX()"," );"," this.targetDirectionX = 1;"," }"," if (that._xVelocity < 0) {"," this.targetX = this.floorToCellX("," object.x - this.getBreakingDistanceX()"," );"," this.targetDirectionX = -1;"," }"," }",""," const isMovingOnY ="," direction !== -1 && direction !== 0 && direction !== 4;"," if (isMovingOnY) {"," this.targetY = null;"," } else if (this.targetY === null) {"," // Find where the deceleration should stop the object."," if (that._yVelocity > 0) {"," this.targetY = this.ceilToCellY("," object.y + this.getBreakingDistanceY()"," );"," this.targetDirectionY = 1;"," }"," if (that._yVelocity < 0) {"," this.targetY = this.floorToCellY("," object.y - this.getBreakingDistanceY()"," );"," this.targetDirectionY = -1;"," }"," }",""," // Make as if the player had press button a bit longer to reach exactly"," // the next cell.",""," this.isVelocityAdjustedOnX = this.targetX !== null;"," if (this.isVelocityAdjustedOnX) {"," if (this.targetDirectionX > 0) {"," if (this.targetX > object.getX()) {"," that._xVelocity = Math.min("," that._xVelocity + that._acceleration,"," that._maxSpeed,"," this.getSpeedToReach(this.targetX - object.getX())"," );"," }"," const nextFrameX = object.getX() + that._xVelocity * object.getElapsedTime() / 1000;"," if (this.targetX <= nextFrameX) {"," that._xVelocity = 0;"," object.setX(this.roundToCellX(object.getX()));"," this.targetX = null;"," }"," }"," if (this.targetDirectionX < 0) {"," if (this.targetX < object.getX()) {"," that._xVelocity = Math.max("," that._xVelocity - that._acceleration,"," -that._maxSpeed,"," this.getSpeedToReach(this.targetX - object.getX())"," );"," }"," const nextFrameX = object.getX() + that._xVelocity * object.getElapsedTime() / 1000;"," if (this.targetX >= nextFrameX) {"," that._xVelocity = 0;"," object.setX(this.roundToCellX(object.getX()));"," this.targetX = null;"," }"," }"," // The velocity is exact. There no need for Verlet integration."," this.previousVelocityX = that._xVelocity;"," }",""," this.isVelocityAdjustedOnY = this.targetY !== null;"," if (this.isVelocityAdjustedOnY) {"," if (this.targetDirectionY > 0) {"," if (this.targetY > object.getY()) {"," that._yVelocity = Math.min("," that._yVelocity + that._acceleration,"," that._maxSpeed,"," this.getSpeedToReach(this.targetY - object.getY())"," );"," }"," const nextFrameY = object.getY() + that._yVelocity * object.getElapsedTime() / 1000;"," if (this.targetY <= nextFrameY) {"," that._yVelocity = 0;"," object.setY(this.roundToCellY(object.getY()));"," this.targetY = null;"," }"," }"," if (this.targetDirectionY < 0) {"," if (this.targetY < object.getY()) {"," that._yVelocity = Math.max("," that._yVelocity - that._acceleration,"," -that._maxSpeed,"," this.getSpeedToReach(this.targetY - object.getY())"," );"," }"," const nextFrameY = object.getY() + that._yVelocity * object.getElapsedTime() / 1000;"," if (this.targetY >= nextFrameY) {"," that._yVelocity = 0;"," object.setY(this.roundToCellY(object.getY()));"," this.targetY = null;"," }"," }"," // The velocity is exact. There no need for Verlet integration."," this.previousVelocityY = that._yVelocity;"," }"," }",""," /**"," * Called before the velocity is applied to the object position and"," * angle."," */"," beforePositionUpdate() {"," if (!this.pixelPerfectBehavior.activated()) {"," return;"," }",""," /** @type {number} */"," const cellSize = this.pixelPerfectBehavior._getPixelSize();"," if (cellSize <= 0) {"," return;"," }",""," const that = this.topDownBehavior;",""," if (this.isVelocityAdjustedOnX) {"," // The velocity is exact. There no need for Verlet integration."," that._xVelocity = this.previousVelocityX;"," }"," if (this.isVelocityAdjustedOnY) {"," // The velocity is exact. There no need for Verlet integration."," that._yVelocity = this.previousVelocityY;"," }"," }",""," doStepPostEvents(instanceContainer) {"," /** @type {number} */"," const cellSize = this.pixelPerfectBehavior._getPixelSize();"," if (cellSize <= 0) {"," return;"," }",""," const that = this.topDownBehavior;"," const object = that.owner;",""," const isMovingOnX ="," this.lastDirection !== -1 &&"," this.lastDirection !== 2 &&"," this.lastDirection !== 6;"," const isMovingOnY ="," this.lastDirection !== -1 &&"," this.lastDirection !== 0 &&"," this.lastDirection !== 4;",""," // Avoid rounding errors after a call to \"separate\" to make characters"," // move indefinitely in front of a wall because they can't reach the cell."," if (!isMovingOnX && that._xVelocity !== 0) {"," const x = object.getX();"," const roundedX = this.roundToCellX(x);"," if (Math.abs(roundedX - x) < epsilon) {"," object.setX(roundedX);"," this.targetDirectionX = 0;"," that._xVelocity = 0;"," }"," }"," if (!isMovingOnY && that._yVelocity !== 0) {"," const y = object.getY();"," const roundedY = this.roundToCellY(y);"," if (Math.abs(roundedY - y) < epsilon) {"," object.setY(roundedY);"," this.targetDirectionY = 0;"," that._yVelocity = 0;"," }"," }"," }",""," /**"," * @returns {number} the braking distance according to an initial speed and a deceleration."," */"," getBreakingDistanceX() {"," const that = this.topDownBehavior;"," return (that._xVelocity * that._xVelocity) / (2 * that._deceleration);"," }",""," /**"," * @returns {number} the braking distance according to an initial speed and a deceleration."," */"," getBreakingDistanceY() {"," const that = this.topDownBehavior;"," return (that._yVelocity * that._yVelocity) / (2 * that._deceleration);"," }",""," /**"," * @param {number} displacement"," * @returns {number} the speed necessary to cover a distance according to the deceleration."," */"," getSpeedToReach(displacement) {"," const that = this.topDownBehavior;"," return ("," Math.sign(displacement) *"," Math.sqrt(2 * Math.abs(displacement) * that._deceleration)"," );"," }",""," /**"," * @param {number} x"," * @return {number}"," */"," ceilToCellX(x) {"," /** @type {number} */"," const cellSize = this.pixelPerfectBehavior._getPixelSize();"," /** @type {number} */"," const gridOffsetX = this.pixelPerfectBehavior._getOffsetX();",""," return ("," gridOffsetX +"," cellSize * Math.ceil((x - gridOffsetX) / cellSize)"," );"," }",""," /**"," * @param {number} x"," * @return {number}"," */"," roundToCellX(x) {"," /** @type {number} */"," const cellSize = this.pixelPerfectBehavior._getPixelSize();"," /** @type {number} */"," const gridOffsetX = this.pixelPerfectBehavior._getOffsetX();",""," return ("," gridOffsetX +"," cellSize * Math.round((x - gridOffsetX) / cellSize)"," );"," }",""," /**"," * @param {number} x"," * @return {number}"," */"," floorToCellX(x) {"," /** @type {number} */"," const cellSize = this.pixelPerfectBehavior._getPixelSize();"," /** @type {number} */"," const gridOffsetX = this.pixelPerfectBehavior._getOffsetX();",""," return ("," gridOffsetX +"," cellSize * Math.floor((x - gridOffsetX) / cellSize)"," );"," }",""," /**"," * @param {number} y"," * @return {number}"," */"," ceilToCellY(y) {"," /** @type {number} */"," const cellSize = this.pixelPerfectBehavior._getPixelSize();"," /** @type {number} */"," const gridOffsetY = this.pixelPerfectBehavior._getOffsetY();",""," return ("," gridOffsetY +"," cellSize * Math.ceil((y - gridOffsetY) / cellSize)"," );"," }",""," /**"," * @param {number} y"," * @return {number}"," */"," roundToCellY(y) {"," /** @type {number} */"," const cellSize = this.pixelPerfectBehavior._getPixelSize();"," /** @type {number} */"," const gridOffsetY = this.pixelPerfectBehavior._getOffsetY();",""," return ("," gridOffsetY +"," cellSize * Math.round((y - gridOffsetY) / cellSize)"," );"," }",""," /**"," * @param {number} y"," * @return {number}"," */"," floorToCellY(y) {"," /** @type {number} */"," const cellSize = this.pixelPerfectBehavior._getPixelSize();"," /** @type {number} */"," const gridOffsetY = this.pixelPerfectBehavior._getOffsetY();",""," return ("," gridOffsetY +"," cellSize * Math.floor((y - gridOffsetY) / cellSize)"," );"," }","}","","gdjs.__pixelPerfectExtension = {"," PixelPerfectTopDownMovement","}"],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":true}],"parameters":[],"objectGroups":[]}],"eventsFunctionsFolderStructure":{"folderName":"__ROOT","children":[{"functionName":"SpeedToReach"},{"functionName":"BrakingDistance"},{"functionName":"DefineJavaScriptForTopDown"}]},"eventsBasedBehaviors":[{"description":"Seamlessly align big pixels using a top-down movement.","fullName":"Pixel perfect top-down movement","helpPath":"","iconUrl":"","name":"PixelPerfectTopDownMovement","objectType":"","previewIconUrl":"","eventsFunctions":[{"fullName":"","functionType":"Action","name":"onCreated","sentence":"","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"PixelPerfectMovement::DefineJavaScriptForTopDown"},"parameters":["",""]}]},{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["\r","const object = objects[0];\r","const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");\r","const behavior = object.getBehavior(behaviorName);\r","\r","/** @type {gdjs.TopDownMovementRuntimeBehavior} */\r","const topDownBehavior = object.getBehavior(behavior._getTopDownMovement());\r","\r","const pixelPerfect = new gdjs.__pixelPerfectExtension.PixelPerfectTopDownMovement(behavior, topDownBehavior);\r","topDownBehavior.__pixelPerfect = pixelPerfect;\r","behavior.__pixelPerfect = pixelPerfect;\r",""],"parameterObjects":"Object","useStrict":true,"eventsSheetExpanded":true}],"parameters":[{"description":"Object","name":"Object","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PixelPerfectMovement::PixelPerfectTopDownMovement","type":"behavior"}],"objectGroups":[]},{"fullName":"","functionType":"Action","name":"doStepPostEvents","sentence":"","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["const object = objects[0];","const behaviorName = eventsFunctionContext.getBehaviorName(\"Behavior\");","const behavior = object.getBehavior(behaviorName);","","behavior.__pixelPerfect.doStepPostEvents(runtimeScene);"],"parameterObjects":"Object","useStrict":true,"eventsSheetExpanded":true}],"parameters":[{"description":"Object","name":"Object","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PixelPerfectMovement::PixelPerfectTopDownMovement","type":"behavior"}],"objectGroups":[]}],"eventsFunctionsFolderStructure":{"folderName":"__ROOT","children":[{"functionName":"onCreated"},{"functionName":"doStepPostEvents"}]},"propertyDescriptors":[{"value":"","type":"Behavior","label":"Top-down movement behavior","extraInformation":["TopDownMovementBehavior::TopDownMovementBehavior"],"choices":[],"name":"TopDownMovement"},{"value":"1","type":"Number","label":"Pixel size","name":"PixelSize"},{"value":"0","type":"Number","label":"Pixel grid offset X","name":"OffsetX"},{"value":"0","type":"Number","label":"Pixel grid offset Y","name":"OffsetY"}],"propertiesFolderStructure":{"folderName":"__ROOT","children":[{"propertyName":"TopDownMovement"},{"propertyName":"PixelSize"},{"propertyName":"OffsetX"},{"propertyName":"OffsetY"}]}},{"description":"Seamlessly align big pixels using a 2D platformer character movement.","fullName":"Pixel perfect platformer character","helpPath":"","iconUrl":"","name":"PixelPerfectPlatformerCharacter","objectType":"","previewIconUrl":"","eventsFunctions":[{"fullName":"","functionType":"Action","name":"doStepPreEvents","sentence":"","events":[{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"X axis","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"We don't know if the deceleration was already applied or not this step, but if the speed drifted from more than 1%, another extension is probably modifying the speed and it must not be overridden."},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BooleanVariable"},"parameters":["IsDecelerating","True",""]},{"type":{"value":"BuiltinCommonInstructions::CompareNumbers"},"parameters":["abs(Object.PlatformerCharacter::CurrentSpeed() - PreviousSpeedX)","<","Object.PlatformerCharacter::CurrentSpeed() * 0.01 + Object.PlatformerCharacter::Deceleration() * TimeDelta()"]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"Find how far to go to reach a pixel."},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlatformBehavior::CurrentSpeed"},"parameters":["Object","PlatformerCharacter",">","0"]}],"actions":[{"type":{"value":"SetNumberVariable"},"parameters":["TargetX","=","OffsetX + PixelSize * ceil((Object.X() + PixelPerfectMovement::BrakingDistance(Object.PlatformerCharacter::CurrentSpeed(), Object.PlatformerCharacter::Deceleration()) - OffsetX) / PixelSize)"]},{"type":{"value":"SetNumberVariable"},"parameters":["TargetDirectionX","=","1"]}],"events":[{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"Target: \" + ToString(Object.X()) + \"-->\" + TargetX","",""]}]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlatformBehavior::CurrentSpeed"},"parameters":["Object","PlatformerCharacter","<","0"]}],"actions":[{"type":{"value":"SetNumberVariable"},"parameters":["TargetX","=","OffsetX + PixelSize * floor((Object.X() - PixelPerfectMovement::BrakingDistance(Object.PlatformerCharacter::CurrentSpeed(), Object.PlatformerCharacter::Deceleration()) - OffsetX) / PixelSize)"]},{"type":{"value":"SetNumberVariable"},"parameters":["TargetDirectionX","=","-1"]}],"events":[{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"Target: \" + ToString(Object.X()) + \"-->\" + TargetX","",""]}]}]}]},{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"Move to the target as the movement behavior would do."},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PosX"},"parameters":["Object","<","TargetX"]},{"type":{"value":"NumberVariable"},"parameters":["TargetDirectionX","=","1"]}],"actions":[{"type":{"value":"PlatformBehavior::PlatformerObjectBehavior::SetCurrentSpeed"},"parameters":["Object","PlatformerCharacter","=","min(Object.PlatformerCharacter::CurrentSpeed() + Object.PlatformerCharacter::Acceleration(), min(Object.PlatformerCharacter::MaxSpeed(), PixelPerfectMovement::SpeedToReach(TargetX - Object.X(), Object.PlatformerCharacter::Deceleration())))"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PosX"},"parameters":["Object",">","TargetX"]},{"type":{"value":"NumberVariable"},"parameters":["TargetDirectionX","=","-1"]}],"actions":[{"type":{"value":"PlatformBehavior::PlatformerObjectBehavior::SetCurrentSpeed"},"parameters":["Object","PlatformerCharacter","=","max(Object.PlatformerCharacter::CurrentSpeed() - Object.PlatformerCharacter::Acceleration(), max(-Object.PlatformerCharacter::MaxSpeed(), PixelPerfectMovement::SpeedToReach(TargetX - Object.X(), Object.PlatformerCharacter::Deceleration())))"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BuiltinCommonInstructions::Or"},"parameters":[],"subInstructions":[{"type":{"value":"BuiltinCommonInstructions::And"},"parameters":[],"subInstructions":[{"type":{"value":"PosX"},"parameters":["Object",">=","TargetX"]},{"type":{"value":"NumberVariable"},"parameters":["TargetDirectionX","=","1"]}]},{"type":{"value":"BuiltinCommonInstructions::And"},"parameters":[],"subInstructions":[{"type":{"value":"PosX"},"parameters":["Object","<=","TargetX"]},{"type":{"value":"NumberVariable"},"parameters":["TargetDirectionX","=","-1"]}]}]}],"actions":[{"type":{"value":"SetX"},"parameters":["Object","=","OffsetX + PixelSize * round((Object.X() - OffsetX) / PixelSize)"]},{"type":{"value":"SetNumberVariable"},"parameters":["TargetDirectionX","=","0"]},{"type":{"value":"PlatformBehavior::PlatformerObjectBehavior::SetCurrentSpeed"},"parameters":["Object","PlatformerCharacter","=","0"]}],"events":[{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"X: \" + ToString(Object.X()) + \" Speed: \" + ToString(Object.PlatformerCharacter::CurrentSpeed())","",""]}]}]}]}],"parameters":[]},{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Ladder","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PlatformBehavior::IsOnLadder"},"parameters":["Object","PlatformerCharacter"]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"Find how far to go to reach a pixel."},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"PlatformBehavior::PlatformerObjectBehavior::IsUsingControl"},"parameters":["Object","PlatformerCharacter","\"Down\""]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"PlatformBehavior::PlatformerObjectBehavior::IsUsingControl"},"parameters":["Object","PlatformerCharacter","\"Up\""]}],"actions":[{"type":{"value":"SetNumberVariable"},"parameters":["TargetY","=","OffsetY + PixelSize * ceil((Object.Y() - OffsetY) / PixelSize)"]},{"type":{"value":"SetNumberVariable"},"parameters":["TargetDirectionY","=","1"]}],"events":[{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"Target: \" + ToString(Object.Y()) + \"-->\" + TargetY","",""]}]}]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"PlatformBehavior::PlatformerObjectBehavior::IsUsingControl"},"parameters":["Object","PlatformerCharacter","\"Up\""]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"PlatformBehavior::PlatformerObjectBehavior::IsUsingControl"},"parameters":["Object","PlatformerCharacter","\"Down\""]}],"actions":[{"type":{"value":"SetNumberVariable"},"parameters":["TargetY","=","OffsetY + PixelSize * floor((Object.Y() - OffsetY) / PixelSize)"]},{"type":{"value":"SetNumberVariable"},"parameters":["TargetDirectionY","=","-1"]}],"events":[{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"Target: \" + ToString(Object.Y()) + \"-->\" + TargetY","",""]}]}]}]},{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"Move to the target as the movement behavior would do."},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"PlatformBehavior::PlatformerObjectBehavior::IsUsingControl"},"parameters":["Object","PlatformerCharacter","\"Up\""]},{"type":{"inverted":true,"value":"PlatformBehavior::PlatformerObjectBehavior::IsUsingControl"},"parameters":["Object","PlatformerCharacter","\"Down\""]}],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PosY"},"parameters":["Object","<","TargetY"]},{"type":{"value":"NumberVariable"},"parameters":["TargetDirectionY","=","1"]}],"actions":[{"type":{"value":"SetY"},"parameters":["Object","+","Object.PlatformerCharacter::MaxSpeed() * TimeDelta()"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PosY"},"parameters":["Object",">","TargetY"]},{"type":{"value":"NumberVariable"},"parameters":["TargetDirectionY","=","-1"]}],"actions":[{"type":{"value":"SetY"},"parameters":["Object","-","Object.PlatformerCharacter::MaxSpeed() * TimeDelta()"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BuiltinCommonInstructions::Or"},"parameters":[],"subInstructions":[{"type":{"value":"BuiltinCommonInstructions::And"},"parameters":[],"subInstructions":[{"type":{"value":"PosY"},"parameters":["Object",">=","TargetY"]},{"type":{"value":"NumberVariable"},"parameters":["TargetDirectionY","=","1"]}]},{"type":{"value":"BuiltinCommonInstructions::And"},"parameters":[],"subInstructions":[{"type":{"value":"PosY"},"parameters":["Object","<=","TargetY"]},{"type":{"value":"NumberVariable"},"parameters":["TargetDirectionY","=","-1"]}]}]}],"actions":[{"type":{"value":"SetY"},"parameters":["Object","=","OffsetY + PixelSize * round((Object.Y() - OffsetY) / PixelSize)"]},{"type":{"value":"SetNumberVariable"},"parameters":["TargetDirectionY","=","0"]}]},{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["\"X: \" + ToString(Object.X()) + \" Speed: \" + ToString(Object.PlatformerCharacter::CurrentSpeed())","",""]}]}]}]}],"parameters":[]}],"parameters":[{"description":"Object","name":"Object","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PixelPerfectMovement::PixelPerfectPlatformerCharacter","type":"behavior"}],"objectGroups":[]},{"fullName":"","functionType":"Action","name":"doStepPostEvents","sentence":"","events":[{"disabled":true,"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BuiltinCommonInstructions::CompareNumbers"},"parameters":["abs(Object.PlatformerCharacter::CurrentSpeed())","!=","0"]},{"type":{"value":"BuiltinCommonInstructions::CompareNumbers"},"parameters":["abs(Object.PlatformerCharacter::CurrentSpeed())","!=","Object.PlatformerCharacter::MaxSpeed()"]}],"actions":[{"type":{"value":"DebuggerTools::ConsoleLog"},"parameters":["ToString(abs(PreviousSpeedX) - Object.PlatformerCharacter::Deceleration() * TimeDelta() - abs(Object.PlatformerCharacter::CurrentSpeed()))","",""]}]},{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"Check if the character is decelerating.\nIt's done in doStepPostEvent because there is no way to know if the doStepPreEvents of this behavior is executed before or after the one of PlatformerCharcter.\nAs TimeDelta is used, we have to be sure the last PlatformerCharcter.doStepPreEvents call used the same TimeDelta. Which means this must be done after PlatformerCharcter.doStepPreEvents."},{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"SetBooleanVariable"},"parameters":["IsDecelerating","False",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BuiltinCommonInstructions::Or"},"parameters":[],"subInstructions":[{"type":{"value":"PlatformBehavior::CurrentSpeed"},"parameters":["Object","PlatformerCharacter","=","0"]},{"type":{"value":"BuiltinCommonInstructions::CompareNumbers"},"parameters":["abs(Object.PlatformerCharacter::CurrentSpeed())","=","abs(PreviousSpeedX) - Object.PlatformerCharacter::Deceleration() * TimeDelta()"]}]}],"actions":[{"type":{"value":"SetBooleanVariable"},"parameters":["IsDecelerating","True",""]}]},{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"Save the speed to detect speed changes from outside."},{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"SetNumberVariable"},"parameters":["PreviousSpeedX","=","Object.PlatformerCharacter::CurrentSpeed()"]}]}],"parameters":[{"description":"Object","name":"Object","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PixelPerfectMovement::PixelPerfectPlatformerCharacter","type":"behavior"}],"objectGroups":[]}],"eventsFunctionsFolderStructure":{"folderName":"__ROOT","children":[{"functionName":"doStepPreEvents"},{"functionName":"doStepPostEvents"}]},"propertyDescriptors":[{"value":"","type":"Behavior","label":"Platformer character behavior","extraInformation":["PlatformBehavior::PlatformerObjectBehavior"],"choices":[],"name":"PlatformerCharacter"},{"value":"1","type":"Number","label":"Pixel size","name":"PixelSize"},{"value":"0","type":"Number","label":"Pixel grid offset X","name":"OffsetX"},{"value":"0","type":"Number","label":"Pixel grid offset Y","name":"OffsetY"},{"value":"0","type":"Number","label":"","hidden":true,"name":"TargetX"},{"value":"0","type":"Number","label":"","hidden":true,"name":"TargetDirectionX"},{"value":"0","type":"Number","label":"","hidden":true,"name":"TargetY"},{"value":"0","type":"Number","label":"","hidden":true,"name":"TargetDirectionY"},{"value":"","type":"Number","label":"","hidden":true,"name":"PreviousSpeedX"},{"value":"","type":"Boolean","label":"","hidden":true,"name":"IsDecelerating"}],"propertiesFolderStructure":{"folderName":"__ROOT","children":[{"propertyName":"PlatformerCharacter"},{"propertyName":"PixelSize"},{"propertyName":"OffsetX"},{"propertyName":"OffsetY"},{"propertyName":"TargetX"},{"propertyName":"TargetDirectionX"},{"propertyName":"TargetY"},{"propertyName":"TargetDirectionY"},{"propertyName":"PreviousSpeedX"},{"propertyName":"IsDecelerating"}]}}],"eventsBasedObjects":[]},{"author":"Arthur Pacaud (arthuro555)","category":"Advanced","dimension":"","extensionNamespace":"","fullName":"Unique Identifiers","gdevelopVersion":">=5.5.222","helpPath":"","iconUrl":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWlkZW50aWZpZXIiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNiwxOFY4SDhWMThINk02LDQuNUg4VjYuNUg2VjQuNU0xNyw0SDE5VjE4SDE3VjE3Ljc1QzE3LDE3Ljc1IDE1LjY3LDE4IDE1LDE4QTUsNSAwIDAsMSAxMCwxM0E1LDUgMCAwLDEgMTUsOEMxNS42Nyw4IDE3LDguMjUgMTcsOC4yNVY0TTE3LDEwLjI1QzE3LDEwLjI1IDE1LjY3LDEwIDE1LDEwQTMsMyAwIDAsMCAxMiwxM0EzLDMgMCAwLDAgMTUsMTZDMTUuNjcsMTYgMTcsMTUuNzUgMTcsMTUuNzVWMTAuMjVaIiAvPjwvc3ZnPg==","name":"UUID","previewIconUrl":"https://resources.gdevelop-app.com/assets/Icons/identifier.svg","shortDescription":"Generate unique identifiers: UUIDv4 random strings and incremented integer UIDs.","version":"1.0.0","description":["Adds UUID (Universally Unique Identifiers) generation expressions via multiple patterns:","- UUIDv4: Creates a long random string of characters following the UUIDv4 standard. If available on the system/browser, will use a cryptographic random number generator, otherwise uses the same pseudorandom number generator as the `Random()` expression. Chances of collisions are extremely low, but not non-existent. As the return value is a string, it may not be the most performant pattern. It can not be predicted in most cases.","- Incremented integer: Returns use an integer that will be incremented after each call. Very performant and no risk of collisions. The UID will be predictable, so it may be vulnerable to some cryptographic attacks if used for private unique tokens, like password reset verification UID. Note that if you store IDs and then restart the game, there may be duplicates, since it'll reset the counter."],"origin":{"identifier":"UUID","name":"gdevelop-extension-store"},"tags":["random","generation","uid","uuid","guid","v4","unique","id","identifier"],"authorIds":["ZgrsWuRTAkXgeuPV9bo0zuEcA2w1"],"dependencies":[],"globalVariables":[],"sceneVariables":[],"eventsFunctions":[{"description":"Generates a unique identifier with the UUIDv4 pattern.","fullName":"Generate a UUIDv4","functionType":"StringExpression","name":"GenerateUUIDv4","sentence":"","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["// Use the engine implementation of UUIDv4.","eventsFunctionContext.returnValue = gdjs.makeUuid();",""],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"expressionType":{"type":"string"},"parameters":[],"objectGroups":[]},{"description":"Generates a unique identifier with the incremented integer pattern.","fullName":"Generate an incremented integer UID","functionType":"Expression","name":"GenerateIncrementedIntegerUID","sentence":"","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"SetReturnNumber"},"parameters":["GlobalVariable(__UUID_IncrementedInteger)"]},{"type":{"value":"ModVarGlobal"},"parameters":["__UUID_IncrementedInteger","+","1"]}]}],"expressionType":{"type":"expression"},"parameters":[],"objectGroups":[]}],"eventsFunctionsFolderStructure":{"folderName":"__ROOT","children":[{"functionName":"GenerateUUIDv4"},{"functionName":"GenerateIncrementedIntegerUID"}]},"eventsBasedBehaviors":[],"eventsBasedObjects":[]},{"author":"Silver-Streak, @Bouh, Tristan Rhodes","category":"Game mechanic","dimension":"2D","extensionNamespace":"","fullName":"Object \"Is On Screen\" Detection","gdevelopVersion":"","helpPath":"","iconUrl":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLW1vbml0b3Itc2NyZWVuc2hvdCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik05LDZINVYxMEg3VjhIOU0xOSwxMEgxN1YxMkgxNVYxNEgxOU0yMSwxNkgzVjRIMjFNMjEsMkgzQzEuODksMiAxLDIuODkgMSw0VjE2QTIsMiAwIDAsMCAzLDE4SDEwVjIwSDhWMjJIMTZWMjBIMTRWMThIMjFBMiwyIDAgMCwwIDIzLDE2VjRDMjMsMi44OSAyMi4xLDIgMjEsMiIgLz48L3N2Zz4=","name":"IsOnScreen","previewIconUrl":"https://resources.gdevelop-app.com/assets/Icons/monitor-screenshot.svg","shortDescription":"Condition to check if an object is visible in its layer's camera viewport.","version":"1.2.2","description":["This extension adds conditions to check if an object is located within the visible portion of its layer's camera. The condition also allows for specifying padding to the virtual screen border.","","Note that this does not take into account any object visibility, such as being hidden or 0 opacity, but can be combined with those existing conditions."],"origin":{"identifier":"IsOnScreen","name":"gdevelop-extension-store"},"tags":["is on screen","condition","visible","hide","screen"],"authorIds":["2OwwM8ToR9dx9RJ2sAKTcrLmCB92","8Ih1aa8f5gWUp4UB2BdhQ2iXWxJ3","gqDaZjCfevOOxBYkK6zlhtZnXCg1"],"dependencies":[],"globalVariables":[],"sceneVariables":[],"eventsFunctions":[],"eventsFunctionsFolderStructure":{"folderName":"__ROOT"},"eventsBasedBehaviors":[{"description":"This behavior provides a condition to check if the object is located within the visible portion of its layer's camera. The condition also allows for specifying padding to the virtual screen border.\nNote that object visibility, such as being hidden or 0 opacity, is not considered (but you can use those existing conditions in addition to this behavior).","fullName":"Is on screen","helpPath":"","iconUrl":"","name":"InOnScreen","objectType":"","previewIconUrl":"","quickCustomizationVisibility":"hidden","eventsFunctions":[{"description":"Checks if an object position is within the viewport of its layer.","fullName":"Is on screen","functionType":"Condition","name":"IsOnScreen","sentence":"_PARAM0_ is on screen (padded by _PARAM2_ pixels)","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["/*","Get the object layer, convert the position from this layer to the screen coordinates.","Get the point on each side on the object on screen, and compare with the screen area.","","This way even if the camera has a rotation or custom scale the object is always compared to the screen area.","*/","","","// Get the layer of the object.","const object = objects[0];","const layer = runtimeScene.getLayer(object.getLayer());","","// Get the aabb of the object on his layer.","const aabb = object.getVisibilityAABB();","","// Get the layer to convert the coordinates of the AABB to the screen coordinates","const topLeft = layer.convertInverseCoords(aabb.min[0], aabb.min[1]);","const topRight = layer.convertInverseCoords(aabb.max[0], aabb.min[1]);","const bottomRight = layer.convertInverseCoords(aabb.max[0], aabb.max[1]);","const bottomLeft = layer.convertInverseCoords(aabb.min[0], aabb.max[1]);","","// Get the points on each side of the object on screen.","const posLeftObjectOnScreen = Math.min(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]);","const posRightObjectOnScreen = Math.max(topLeft[0], topRight[0], bottomLeft[0], bottomRight[0]);","const posUpObjectOnScreen = Math.min(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]);","const posDownObjectOnScreen = Math.max(topLeft[1], topRight[1], bottomLeft[1], bottomRight[1]);","","const padding = eventsFunctionContext.getArgument(\"Padding\");","","if ("," !(posLeftObjectOnScreen - padding > runtimeScene.getGame().getGameResolutionWidth() ||"," posUpObjectOnScreen - padding > runtimeScene.getGame().getGameResolutionHeight() ||"," posRightObjectOnScreen + padding < 0 ||"," posDownObjectOnScreen + padding < 0"," )",") {"," eventsFunctionContext.returnValue = true;","}",""],"parameterObjects":"Object","useStrict":true,"eventsSheetExpanded":true}],"parameters":[{"description":"Object","name":"Object","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"IsOnScreen::InOnScreen","type":"behavior"},{"description":"Padding (in pixels)","longDescription":"Number of pixels to pad the screen border. Zero by default. A negative value goes inside the screen, a positive value go outside.","name":"Padding","type":"expression"}],"objectGroups":[{"name":"Group","objects":[]}]}],"eventsFunctionsFolderStructure":{"folderName":"__ROOT","children":[{"functionName":"IsOnScreen"}]},"propertyDescriptors":[],"propertiesFolderStructure":{"folderName":"__ROOT"}}],"eventsBasedObjects":[]},{"author":"","category":"User interface","dimension":"2D","extensionNamespace":"","fullName":"Labeled button","gdevelopVersion":">=5.5.230","helpPath":"/objects/button","iconUrl":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI5LDIzSDNjLTEuMSwwLTItMC45LTItMlYxMWMwLTEuMSwwLjktMiwyLTJoMjZjMS4xLDAsMiwwLjksMiwydjEwQzMxLDIyLjEsMzAuMSwyMywyOSwyM3oiLz4NCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik0xMywxOUwxMywxOWMtMS4xLDAtMi0wLjktMi0ydi0yYzAtMS4xLDAuOS0yLDItMmgwYzEuMSwwLDIsMC45LDIsMnYyQzE1LDE4LjEsMTQuMSwxOSwxMywxOXoiLz4NCjxsaW5lIGNsYXNzPSJzdDAiIHgxPSIxOCIgeTE9IjEzIiB4Mj0iMTgiIHkyPSIxOSIvPg0KPGxpbmUgY2xhc3M9InN0MCIgeDE9IjIxIiB5MT0iMTMiIHgyPSIxOCIgeTI9IjE3Ii8+DQo8bGluZSBjbGFzcz0ic3QwIiB4MT0iMjEiIHkxPSIxOSIgeDI9IjE5IiB5Mj0iMTYiLz4NCjwvc3ZnPg0K","name":"PanelSpriteButton","previewIconUrl":"https://resources.gdevelop-app.com/assets/Icons/Line Hero Pack/Master/SVG/Interface Elements/Interface Elements_interface_ui_button_ok_cta_clock_tap.svg","shortDescription":"Resizeable button with a label.","version":"2.2.1","description":["A button that can be used for menus and most labelled buttons of a game. The button can be customized with a background for each state and a label. It handles user interactions and a simple condition can be used to check if it is clicked.","","There are ready-to-use buttons in the asset-store [menu buttons pack](https://editor.gdevelop.io/?initial-dialog=asset-store&asset-pack=menu-buttons-menu-buttons)."],"origin":{"identifier":"PanelSpriteButton","name":"gdevelop-extension-store"},"tags":["button","ui"],"authorIds":["IWykYNRvhCZBN3vEgKEbBPOR3Oc2"],"changelog":[{"version":"2.0.0","breaking":"- Buttons now use \"variants\", allowing easy swapping of their visual aspect. You will have to make some adjustments to existing buttons in your project. Follow this [migration documentation](https://wiki.gdevelop.io/gdevelop5/objects/custom-objects-prefab-template/migrate-to-variants/) to do these changes."}],"dependencies":[],"globalVariables":[],"sceneVariables":[],"eventsFunctions":[{"description":"Check if the events are running for the editor.","fullName":"Editor is running","functionType":"Condition","name":"IsInGameEdition","private":true,"sentence":"Events are running for the editor","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["const game = runtimeScene.getGame();\r","eventsFunctionContext.returnValue = game.isInGameEdition && game.isInGameEdition();"],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"parameters":[],"objectGroups":[]}],"eventsFunctionsFolderStructure":{"folderName":"__ROOT","children":[{"functionName":"IsInGameEdition"}]},"eventsBasedBehaviors":[{"description":"The finite state machine used internally by the button object.","fullName":"Button finite state machine","helpPath":"","iconUrl":"","name":"ButtonFSM","objectType":"","previewIconUrl":"","private":true,"eventsFunctions":[{"fullName":"","functionType":"Action","name":"doStepPostEvents","sentence":"","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"PanelSpriteButton::IsInGameEdition"},"parameters":["",""]}],"actions":[],"events":[{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Finite state machine","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"The \"Validated\" state only last one frame."},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["State","=","\"Validated\""]}],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["State","=","\"Idle\""]}]},{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Check position","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"Make sure the cursor position is only checked once per frame."},{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"SetBooleanVariable"},"parameters":["MouseIsInside","False",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BooleanVariable"},"parameters":["ShouldCheckHovering","True",""]},{"type":{"value":"CollisionPoint"},"parameters":["Object","MouseOnlyCursorX(Object.Layer(), 0)","MouseOnlyCursorY(Object.Layer(), 0)"]}],"actions":[{"type":{"value":"SetBooleanVariable"},"parameters":["MouseIsInside","True",""]}]},{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"Touches are always pressed, so ShouldCheckHovering doesn't matter."},{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"SetBooleanVariable"},"parameters":["TouchIsInside","False",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"NumberVariable"},"parameters":["TouchId","!=","0"]},{"type":{"value":"CollisionPoint"},"parameters":["Object","TouchX(TouchId, Object.Layer(), 0)","TouchY(TouchId, Object.Layer(), 0)"]}],"actions":[{"type":{"value":"SetBooleanVariable"},"parameters":["TouchIsInside","True",""]}]}],"parameters":[]},{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Handle touch start","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"HasAnyTouchOrMouseStarted"},"parameters":[""]}],"actions":[{"type":{"value":"SetNumberVariable"},"parameters":["Index","=","0"]}],"events":[{"type":"BuiltinCommonInstructions::Repeat","repeatExpression":"StartedTouchOrMouseCount()","conditions":[],"actions":[],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"CollisionPoint"},"parameters":["Object","TouchX(StartedTouchOrMouseId(Index), Object.Layer(), 0)","TouchY(StartedTouchOrMouseId(Index), Object.Layer(), 0)"]}],"actions":[{"type":{"value":"SetNumberVariable"},"parameters":["TouchId","=","StartedTouchOrMouseId(Index)"]},{"type":{"value":"SetBooleanVariable"},"parameters":["TouchIsInside","True",""]}],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BuiltinCommonInstructions::Or"},"parameters":[],"subInstructions":[{"type":{"value":"PanelSpriteButton::ButtonFSM::PropertyState"},"parameters":["Object","Behavior","=","\"Hovered\""]},{"type":{"value":"PanelSpriteButton::ButtonFSM::PropertyState"},"parameters":["Object","Behavior","=","\"Idle\""]}]}],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["State","=","\"PressedInside\""]}]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"SetNumberVariable"},"parameters":["Index","+","1"]}]}]}]}],"parameters":[]},{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Apply position changes","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"BooleanVariable"},"parameters":["MouseIsInside","True",""]},{"type":{"value":"StringVariable"},"parameters":["State","=","\"Hovered\""]}],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["State","=","\"Idle\""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BooleanVariable"},"parameters":["MouseIsInside","True",""]},{"type":{"value":"StringVariable"},"parameters":["State","=","\"Idle\""]}],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["State","=","\"Hovered\""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"BooleanVariable"},"parameters":["TouchIsInside","True",""]},{"type":{"value":"StringVariable"},"parameters":["State","=","\"PressedInside\""]}],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["State","=","\"PressedOutside\""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BooleanVariable"},"parameters":["TouchIsInside","True",""]},{"type":{"value":"StringVariable"},"parameters":["State","=","\"PressedOutside\""]}],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["State","=","\"PressedInside\""]}]}],"parameters":[]},{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Handle touch end","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"HasTouchEnded"},"parameters":["","TouchId"]}],"actions":[{"type":{"value":"SetNumberVariable"},"parameters":["TouchId","=","0"]}],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["State","=","\"PressedInside\""]}],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["State","=","\"Validated\""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"StringVariable"},"parameters":["State","=","\"PressedInside\""]},{"type":{"inverted":true,"value":"StringVariable"},"parameters":["State","=","\"Validated\""]}],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["State","=","\"Idle\""]}]}]}],"parameters":[]}],"parameters":[]}]}],"parameters":[{"description":"Object","name":"Object","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PanelSpriteButton::ButtonFSM","type":"behavior"}],"objectGroups":[]},{"fullName":"","functionType":"Action","name":"onDeActivate","sentence":"","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"PanelSpriteButton::ButtonFSM::ResetState"},"parameters":["Object","Behavior",""]}]}],"parameters":[{"description":"Object","name":"Object","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PanelSpriteButton::ButtonFSM","type":"behavior"}],"objectGroups":[]},{"description":"Reset the state of the button.","fullName":"Reset state","functionType":"Action","name":"ResetState","private":true,"sentence":"Reset the button state of _PARAM0_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["State","=","\"Idle\""]},{"type":{"value":"SetNumberVariable"},"parameters":["TouchId","=","0"]}]}],"parameters":[{"description":"Object","name":"Object","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PanelSpriteButton::ButtonFSM","type":"behavior"}],"objectGroups":[]},{"description":"Check if the button is not used.","fullName":"Is idle","functionType":"Condition","name":"IsIdle","sentence":"_PARAM0_ is idle","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["State","=","\"Idle\""]}],"actions":[{"type":{"value":"SetReturnBoolean"},"parameters":["True"]}]}],"parameters":[{"description":"Object","name":"Object","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PanelSpriteButton::ButtonFSM","type":"behavior"}],"objectGroups":[]},{"description":"Check if the button was just clicked.","fullName":"Is clicked","functionType":"Condition","name":"IsClicked","sentence":"_PARAM0_ is clicked","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["State","=","\"Validated\""]}],"actions":[{"type":{"value":"SetReturnBoolean"},"parameters":["True"]}]}],"parameters":[{"description":"Object","name":"Object","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PanelSpriteButton::ButtonFSM","type":"behavior"}],"objectGroups":[]},{"description":"Check if the cursor is hovered over the button.","fullName":"Is hovered","functionType":"Condition","name":"IsHovered","sentence":"_PARAM0_ is hovered","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["State","=","\"Hovered\""]}],"actions":[{"type":{"value":"SetReturnBoolean"},"parameters":["True"]}]}],"parameters":[{"description":"Object","name":"Object","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PanelSpriteButton::ButtonFSM","type":"behavior"}],"objectGroups":[]},{"description":"Check if the button is either hovered or pressed but not hovered.","fullName":"Is focused","functionType":"Condition","name":"IsFocused","sentence":"_PARAM0_ is focused","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["State","=","\"Hovered\""]}],"actions":[{"type":{"value":"SetReturnBoolean"},"parameters":["True"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["State","=","\"PressedOutside\""]}],"actions":[{"type":{"value":"SetReturnBoolean"},"parameters":["True"]}]}],"parameters":[{"description":"Object","name":"Object","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PanelSpriteButton::ButtonFSM","type":"behavior"}],"objectGroups":[]},{"description":"Check if the button is currently being pressed with mouse or touch.","fullName":"Is pressed","functionType":"Condition","name":"IsPressed","sentence":"_PARAM0_ is pressed","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["State","=","\"PressedInside\""]}],"actions":[{"type":{"value":"SetReturnBoolean"},"parameters":["True"]}]}],"parameters":[{"description":"Object","name":"Object","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PanelSpriteButton::ButtonFSM","type":"behavior"}],"objectGroups":[]},{"description":"Check if the button is currently being pressed outside with mouse or touch.","fullName":"Is held outside","functionType":"Condition","name":"IsPressedOutside","sentence":"_PARAM0_ is held outside","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["State","=","\"PressedOutside\""]}],"actions":[{"type":{"value":"SetReturnBoolean"},"parameters":["True"]}]}],"parameters":[{"description":"Object","name":"Object","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PanelSpriteButton::ButtonFSM","type":"behavior"}],"objectGroups":[]},{"description":"the touch id that is using the button or 0 if none.","fullName":"Touch id","functionType":"ExpressionAndCondition","name":"TouchId","sentence":"the touch id","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"SetReturnNumber"},"parameters":["TouchId"]}]}],"expressionType":{"type":"expression"},"parameters":[{"description":"Object","name":"Object","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PanelSpriteButton::ButtonFSM","type":"behavior"}],"objectGroups":[]}],"eventsFunctionsFolderStructure":{"folderName":"__ROOT","children":[{"functionName":"doStepPostEvents"},{"functionName":"onDeActivate"},{"functionName":"ResetState"},{"functionName":"IsIdle"},{"functionName":"IsClicked"},{"functionName":"IsHovered"},{"functionName":"IsFocused"},{"functionName":"IsPressed"},{"functionName":"IsPressedOutside"},{"functionName":"TouchId"}]},"propertyDescriptors":[{"value":"true","type":"Boolean","label":"","description":"Should check hovering","hidden":true,"name":"ShouldCheckHovering"},{"value":"Idle","type":"Choice","label":"State","choices":[{"label":"Idle","value":"Idle"},{"label":"Hovered","value":"Hovered"},{"label":"PressedInside","value":"PressedInside"},{"label":"PressedOutside","value":"PressedOutside"},{"label":"Validated","value":"Validated"}],"hidden":true,"name":"State"},{"value":"0","type":"Number","label":"Touch id","hidden":true,"name":"TouchId"},{"value":"","type":"Boolean","label":"Touch is inside","hidden":true,"name":"TouchIsInside"},{"value":"","type":"Boolean","label":"Mouse is inside","hidden":true,"name":"MouseIsInside"},{"value":"","type":"Number","label":"","hidden":true,"name":"Index"}],"propertiesFolderStructure":{"folderName":"__ROOT","children":[{"propertyName":"ShouldCheckHovering"},{"propertyName":"State"},{"propertyName":"TouchId"},{"propertyName":"TouchIsInside"},{"propertyName":"MouseIsInside"},{"propertyName":"Index"}]}},{"description":"Change the text style when the button is hovered.","fullName":"Hover text style","helpPath":"","iconUrl":"","name":"TextStyleState","objectType":"TextObject::Text","previewIconUrl":"","private":true,"eventsFunctions":[{"description":"Check if isHovered.","fullName":"IsHovered","functionType":"Condition","name":"IsHovered","sentence":"_PARAM0_ isHovered","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BooleanVariable"},"parameters":["IsHovered","True",""]}],"actions":[{"type":{"value":"SetReturnBoolean"},"parameters":["True"]}]}],"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"TextObject::Text","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PanelSpriteButton::TextStyleState","type":"behavior"}],"objectGroups":[]},{"description":"Change if isHovered.","fullName":"IsHovered","functionType":"Action","name":"SetIsHovered","sentence":"_PARAM0_ isHovered: _PARAM2_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BooleanVariable"},"parameters":["IsHovered","False",""]},{"type":{"value":"BooleanVariable"},"parameters":["Value","True",""]}],"actions":[{"type":{"value":"SetBooleanVariable"},"parameters":["IsHovered","True",""]}],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"NumberVariable"},"parameters":["HoverFontSize",">","0"]}],"actions":[{"type":{"value":"SetNumberVariable"},"parameters":["IdleFontSize","=","Object.FontSize()"]},{"type":{"value":"TextObject::Text::SetFontSize"},"parameters":["Object","=","HoverFontSize"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["HoverColor","!=","\"\""]}],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["IdleColor","=","Object.Behavior::Color()"]},{"type":{"value":"TextObject::ChangeColor"},"parameters":["Object","HoverColor"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BooleanVariable"},"parameters":["ShouldEnableShadowOnHover","True",""]}],"actions":[{"type":{"value":"TextObject::ShowShadow"},"parameters":["Object",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BooleanVariable"},"parameters":["ShouldEnableOutlineOnHover","True",""]}],"actions":[{"type":{"value":"TextObject::Text::SetOutlineEnabled"},"parameters":["Object","yes"]}]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BooleanVariable"},"parameters":["IsHovered","True",""]},{"type":{"value":"BooleanVariable"},"parameters":["Value","False",""]}],"actions":[{"type":{"value":"SetBooleanVariable"},"parameters":["IsHovered","False",""]}],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"NumberVariable"},"parameters":["HoverFontSize",">","0"]}],"actions":[{"type":{"value":"TextObject::Text::SetFontSize"},"parameters":["Object","=","IdleFontSize"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["HoverColor","!=","\"\""]}],"actions":[{"type":{"value":"TextObject::ChangeColor"},"parameters":["Object","IdleColor"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BooleanVariable"},"parameters":["ShouldEnableShadowOnHover","True",""]}],"actions":[{"type":{"value":"TextObject::ShowShadow"},"parameters":["Object","no"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BooleanVariable"},"parameters":["ShouldEnableOutlineOnHover","True",""]}],"actions":[{"type":{"value":"TextObject::Text::SetOutlineEnabled"},"parameters":["Object","no"]}]}]}],"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"TextObject::Text","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PanelSpriteButton::TextStyleState","type":"behavior"},{"defaultValue":"yes","description":"IsHovered","name":"Value","optional":true,"type":"yesorno"}],"objectGroups":[]},{"description":"Return the text color","fullName":"Text color","functionType":"StringExpression","name":"Color","private":true,"sentence":"","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["/** @type {gdjs.TextRuntimeObject} */","const object = eventsFunctionContext.getObjects(\"Object\")[0];","","eventsFunctionContext.returnValue = object._color.join(\";\");"],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":true}],"expressionType":{"type":"color"},"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"TextObject::Text","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PanelSpriteButton::TextStyleState","type":"behavior"}],"objectGroups":[]}],"eventsFunctionsFolderStructure":{"folderName":"__ROOT","children":[{"functionName":"IsHovered"},{"functionName":"SetIsHovered"},{"functionName":"Color"}]},"propertyDescriptors":[{"value":"","type":"Boolean","label":"Outline on hover","name":"ShouldEnableOutlineOnHover"},{"value":"","type":"Color","label":"Hover color","name":"HoverColor"},{"value":"","type":"Boolean","label":"Enable shadow on hover","name":"ShouldEnableShadowOnHover"},{"value":"0","type":"Number","unit":"Pixel","label":"Hover font size","name":"HoverFontSize"},{"value":"","type":"Boolean","label":"","hidden":true,"name":"IsHovered"},{"value":"0","type":"Number","unit":"Pixel","label":"Idle font size","hidden":true,"name":"IdleFontSize"},{"value":"","type":"Color","label":"Idle color","hidden":true,"name":"IdleColor"}],"propertiesFolderStructure":{"folderName":"__ROOT","children":[{"propertyName":"IsHovered"},{"propertyName":"HoverFontSize"},{"propertyName":"IdleFontSize"},{"propertyName":"HoverColor"},{"propertyName":"IdleColor"},{"propertyName":"ShouldEnableOutlineOnHover"},{"propertyName":"ShouldEnableShadowOnHover"}]}},{"description":"Change the text style when the button is hovered.","fullName":"Hover bitmap text style","helpPath":"","iconUrl":"","name":"BitmapTextStyleState","objectType":"BitmapText::BitmapTextObject","previewIconUrl":"","private":true,"eventsFunctions":[{"description":"Check if isHovered.","fullName":"IsHovered","functionType":"Condition","name":"IsHovered","sentence":"_PARAM0_ isHovered","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BooleanVariable"},"parameters":["IsHovered","True",""]}],"actions":[{"type":{"value":"SetReturnBoolean"},"parameters":["True"]}]}],"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"BitmapText::BitmapTextObject","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PanelSpriteButton::BitmapTextStyleState","type":"behavior"}],"objectGroups":[]},{"description":"Change if isHovered.","fullName":"IsHovered","functionType":"Action","name":"SetIsHovered","sentence":"_PARAM0_ isHovered: _PARAM2_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BooleanVariable"},"parameters":["IsHovered","False",""]},{"type":{"value":"BooleanVariable"},"parameters":["Value","True",""]}],"actions":[{"type":{"value":"SetBooleanVariable"},"parameters":["IsHovered","True",""]}],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["HoverColor","!=","\"\""]}],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["IdleColor","=","Object.Behavior::Color()"]},{"type":{"value":"BitmapText::SetTint"},"parameters":["Object","HoverColor"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BuiltinCommonInstructions::Or"},"parameters":[],"subInstructions":[{"type":{"value":"StringVariable"},"parameters":["HoverPrefix","!=","\"\""]},{"type":{"value":"StringVariable"},"parameters":["HoverSuffix","!=","\"\""]}]}],"actions":[{"type":{"value":"SetStringVariable"},"parameters":["IdleText","=","Object.Text::Value()"]},{"type":{"value":"TextContainerCapability::TextContainerBehavior::SetValue"},"parameters":["Object","Text","=","HoverPrefix + Object.Text::Value() + HoverSuffix"]}]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BooleanVariable"},"parameters":["IsHovered","True",""]},{"type":{"value":"BooleanVariable"},"parameters":["Value","False",""]}],"actions":[{"type":{"value":"SetBooleanVariable"},"parameters":["IsHovered","False",""]}],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"StringVariable"},"parameters":["HoverColor","!=","\"\""]}],"actions":[{"type":{"value":"BitmapText::SetTint"},"parameters":["Object","IdleColor"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BuiltinCommonInstructions::Or"},"parameters":[],"subInstructions":[{"type":{"value":"StringVariable"},"parameters":["HoverPrefix","!=","\"\""]},{"type":{"value":"StringVariable"},"parameters":["HoverSuffix","!=","\"\""]}]}],"actions":[{"type":{"value":"TextContainerCapability::TextContainerBehavior::SetValue"},"parameters":["Object","Text","=","IdleText"]}]}]}],"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"BitmapText::BitmapTextObject","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PanelSpriteButton::BitmapTextStyleState","type":"behavior"},{"defaultValue":"yes","description":"IsHovered","name":"Value","optional":true,"type":"yesorno"}],"objectGroups":[]},{"description":"Return the text color","fullName":"Text color","functionType":"StringExpression","name":"Color","private":true,"sentence":"","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["/** @type {gdjs.BitmapTextRuntimeObject} */","const object = eventsFunctionContext.getObjects(\"Object\")[0];","","eventsFunctionContext.returnValue = object._tint.join(\";\");"],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":true}],"expressionType":{"type":"color"},"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"BitmapText::BitmapTextObject","type":"object"},{"description":"Behavior","name":"Behavior","supplementaryInformation":"PanelSpriteButton::BitmapTextStyleState","type":"behavior"}],"objectGroups":[]}],"eventsFunctionsFolderStructure":{"folderName":"__ROOT","children":[{"functionName":"IsHovered"},{"functionName":"SetIsHovered"},{"functionName":"Color"}]},"propertyDescriptors":[{"value":"","type":"Color","label":"Hover color","name":"HoverColor"},{"value":"","type":"String","label":"Hover prefix","name":"HoverPrefix"},{"value":"","type":"String","label":"Hover suffix","name":"HoverSuffix"},{"value":"","type":"Boolean","label":"","hidden":true,"name":"IsHovered"},{"value":"","type":"String","label":"Idle text","hidden":true,"name":"IdleText"},{"value":"","type":"Color","label":"Idle color","hidden":true,"name":"IdleColor"}],"propertiesFolderStructure":{"folderName":"__ROOT","children":[{"propertyName":"IsHovered"},{"propertyName":"HoverPrefix"},{"propertyName":"HoverSuffix"},{"propertyName":"IdleText"},{"propertyName":"HoverColor"},{"propertyName":"IdleColor"}]}}],"eventsBasedObjects":[{"areaMaxX":256,"areaMaxY":64,"areaMaxZ":64,"areaMinX":0,"areaMinY":0,"areaMinZ":0,"assetStoreTag":"menu buttons","defaultName":"Button","description":"Button with a label.","fullName":"Labeled button","helpPath":"","iconUrl":"","isInnerAreaFollowingParentSize":true,"isUsingLegacyInstancesRenderer":false,"name":"PanelSpriteButton","previewIconUrl":"","objects":[{"assetStoreId":"","bold":false,"italic":false,"name":"Label","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":4.0,"topEdgeAnchor":4.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"useLegacyBottomAndRightAnchors":false},{"name":"TextStyleState","type":"PanelSpriteButton::TextStyleState","ShouldEnableOutlineOnHover":false,"HoverColor":"","ShouldEnableShadowOnHover":false,"HoverFontSize":0.0,"IsHovered":false,"IdleFontSize":0.0,"IdleColor":""}],"string":"Text","font":"","textAlignment":"center","characterSize":20.0,"color":{"b":0,"g":0,"r":0},"content":{"bold":false,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"Text","font":"","textAlignment":"center","verticalTextAlignment":"center","characterSize":20.0,"lineHeight":0.0,"color":"0;0;0"}},{"assetStoreId":"","bottomMargin":0.0,"height":32.0,"leftMargin":0.0,"name":"Idle","rightMargin":0.0,"texture":"","tiled":false,"topMargin":0.0,"type":"PanelSpriteObject::PanelSprite","width":32.0,"variables":[{"folded":true,"name":"State","type":"string","value":"Idle"}],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":2.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"topEdgeAnchor":1.0,"useLegacyBottomAndRightAnchors":false},{"name":"ButtonFSM","type":"PanelSpriteButton::ButtonFSM","ShouldCheckHovering":true}]},{"assetStoreId":"","bottomMargin":0.0,"height":32.0,"leftMargin":0.0,"name":"Hovered","rightMargin":0.0,"texture":"","tiled":false,"topMargin":0.0,"type":"PanelSpriteObject::PanelSprite","width":32.0,"variables":[],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":2.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"topEdgeAnchor":1.0,"useLegacyBottomAndRightAnchors":false},{"name":"Tween","type":"Tween::TweenBehavior"}]},{"assetStoreId":"","bottomMargin":0.0,"height":32.0,"leftMargin":0.0,"name":"Pressed","rightMargin":0.0,"texture":"","tiled":false,"topMargin":0.0,"type":"PanelSpriteObject::PanelSprite","width":32.0,"variables":[],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":2.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"topEdgeAnchor":1.0,"useLegacyBottomAndRightAnchors":false}]},{"assetStoreId":"","name":"BitmapLabel","type":"BitmapText::BitmapTextObject","variables":[],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":4.0,"topEdgeAnchor":4.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"useLegacyBottomAndRightAnchors":false},{"name":"BitmapTextStyleState","type":"PanelSpriteButton::BitmapTextStyleState","HoverColor":"","HoverPrefix":"","HoverSuffix":"","IsHovered":false,"IdleText":"","IdleColor":""}],"content":{"text":"Text","opacity":255.0,"scale":1.0,"fontSize":20.0,"tint":"255;255;255","bitmapFontResourceName":"","textureAtlasResourceName":"","align":"center","verticalTextAlignment":"center"}}],"objectsFolderStructure":{"folderName":"__ROOT","children":[{"objectName":"Label"},{"objectName":"BitmapLabel"},{"objectName":"Idle"},{"objectName":"Hovered"},{"objectName":"Pressed"}]},"objectsGroups":[{"name":"Background","objects":[{"name":"Idle"},{"name":"Hovered"},{"name":"Pressed"}]},{"name":"Labels","objects":[{"name":"Label"},{"name":"BitmapLabel"}]}],"layers":[{"ambientLightColorB":200,"ambientLightColorG":200,"ambientLightColorR":200,"camera2DPlaneMaxDrawingDistance":5000.0,"camera3DFarPlaneDistance":10000.0,"camera3DFieldOfView":45.0,"camera3DNearPlaneDistance":3.0,"cameraType":"","followBaseLayerCamera":false,"isLightingLayer":false,"isLocked":false,"name":"","renderingType":"","visibility":true,"cameras":[{"defaultSize":true,"defaultViewport":true,"height":0.0,"viewportBottom":1.0,"viewportLeft":0.0,"viewportRight":1.0,"viewportTop":0.0,"width":0.0}],"effects":[]}],"instances":[{"angle":0.0,"customSize":true,"depth":1.0,"height":64.0,"layer":"","name":"Idle","persistentUuid":"24882334-eec8-403e-8bf1-70fc928a46e6","width":256.0,"x":0.0,"y":0.0,"zOrder":1,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":true,"depth":1.0,"height":64.0,"layer":"","name":"Label","persistentUuid":"3b29c95c-5363-4e25-bf47-eecf13e8a226","width":256.0,"x":0.0,"y":32.0,"zOrder":2,"numberProperties":[],"stringProperties":[],"initialVariables":[]}],"editionSettings":{"grid":false,"gridType":"rectangular","gridWidth":32.0,"gridHeight":32.0,"gridDepth":32.0,"gridOffsetX":0.0,"gridOffsetY":0.0,"gridOffsetZ":0.0,"gridColor":10401023.0,"gridAlpha":0.8,"snap":false,"zoomFactor":2.734375,"windowMask":false,"selectedLayer":"","gameEditorMode":"instances-editor"},"eventsFunctions":[{"fullName":"","functionType":"Action","name":"onCreated","sentence":"","events":[{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"Create one background instance for of each state.\nOnly the instance for the current state is shown."},{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"Create"},"parameters":["","Hovered","0","0",""]},{"type":{"value":"Create"},"parameters":["","Pressed","0","0",""]},{"type":{"value":"ResizableCapability::ResizableBehavior::SetSize"},"parameters":["Hovered","Resizable","Idle.Width()","Idle.Height()"]},{"type":{"value":"ResizableCapability::ResizableBehavior::SetSize"},"parameters":["Pressed","Resizable","Idle.Width()","Idle.Height()"]},{"type":{"value":"Hide"},"parameters":["Hovered"]},{"type":{"value":"Hide"},"parameters":["Pressed"]},{"type":{"value":"SetZOrder"},"parameters":["Hovered","=","1"]},{"type":{"value":"SetZOrder"},"parameters":["Pressed","=","1"]},{"type":{"value":"TextContainerCapability::TextContainerBehavior::SetValue"},"parameters":["Labels","Text","=","LabelText"]}]}],"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"PanelSpriteButton::PanelSpriteButton","type":"object"}],"objectGroups":[{"name":"Background","objects":[{"name":"Idle"},{"name":"Hovered"},{"name":"Pressed"}]}]},{"fullName":"","functionType":"Action","name":"onHotReloading","sentence":"","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsPressed"},"parameters":["Object",""]}],"actions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::SetLabelOffset"},"parameters":["Object","=","PressedLabelOffsetY",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"TextContainerCapability::TextContainerBehavior::SetValue"},"parameters":["Labels","Text","=","LabelText"]}]}],"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"PanelSpriteButton::PanelSpriteButton","type":"object"}],"objectGroups":[]},{"fullName":"","functionType":"Action","name":"doStepPostEvents","sentence":"","events":[{"colorB":228,"colorG":176,"colorR":74,"creationTime":0,"name":"Apply states","source":"","type":"BuiltinCommonInstructions::Group","events":[{"type":"BuiltinCommonInstructions::Comment","color":{"b":109,"g":230,"r":255,"textB":0,"textG":0,"textR":0},"comment":"Show the right background accordingly to the new state."},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsIdle"},"parameters":["Object","ButtonFSM"]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"PanelSpriteButton::TextStyleState::SetIsHovered"},"parameters":["Label","TextStyleState","no",""]},{"type":{"value":"PanelSpriteButton::BitmapTextStyleState::SetIsHovered"},"parameters":["BitmapLabel","BitmapTextStyleState","no",""]},{"type":{"value":"PanelSpriteButton::PanelSpriteButton::SetLabelOffset"},"parameters":["Object","=","0",""]},{"type":{"value":"Show"},"parameters":["Idle",""]},{"type":{"value":"Hide"},"parameters":["Pressed"]}],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"Visible"},"parameters":["Hovered"]},{"type":{"value":"NumberVariable"},"parameters":["HoveredFadeOutDuration",">","0"]}],"actions":[{"type":{"value":"Tween::TweenBehavior::AddObjectOpacityTween2"},"parameters":["Hovered","Tween","\"Fadeout\"","0","\"linear\"","HoveredFadeOutDuration",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"NumberVariable"},"parameters":["HoveredFadeOutDuration","=","0"]}],"actions":[{"type":{"value":"Hide"},"parameters":["Hovered"]}]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"OpacityCapability::OpacityBehavior::Value"},"parameters":["Hovered","Opacity","=","0"]}],"actions":[{"type":{"value":"Hide"},"parameters":["Hovered"]},{"type":{"value":"OpacityCapability::OpacityBehavior::SetValue"},"parameters":["Hovered","Opacity","=","255"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsHovered"},"parameters":["Object","ButtonFSM"]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"PanelSpriteButton::TextStyleState::SetIsHovered"},"parameters":["Label","TextStyleState","",""]},{"type":{"value":"PanelSpriteButton::BitmapTextStyleState::SetIsHovered"},"parameters":["BitmapLabel","BitmapTextStyleState","yes",""]},{"type":{"value":"PanelSpriteButton::PanelSpriteButton::SetLabelOffset"},"parameters":["Object","=","0",""]},{"type":{"value":"Hide"},"parameters":["Idle"]},{"type":{"value":"Show"},"parameters":["Hovered",""]},{"type":{"value":"Hide"},"parameters":["Pressed"]}],"events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"NumberVariable"},"parameters":["HoveredFadeOutDuration",">","0"]}],"actions":[{"type":{"value":"Tween::RemoveTween"},"parameters":["Hovered","Tween","\"Fadeout\""]},{"type":{"value":"OpacityCapability::OpacityBehavior::SetValue"},"parameters":["Hovered","Opacity","=","255"]}]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsPressed"},"parameters":["Object","ButtonFSM"]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"PanelSpriteButton::TextStyleState::SetIsHovered"},"parameters":["Label","TextStyleState","no",""]},{"type":{"value":"PanelSpriteButton::BitmapTextStyleState::SetIsHovered"},"parameters":["BitmapLabel","BitmapTextStyleState","no",""]},{"type":{"value":"PanelSpriteButton::PanelSpriteButton::SetLabelOffset"},"parameters":["Object","=","PressedLabelOffsetY",""]},{"type":{"value":"Hide"},"parameters":["Idle"]},{"type":{"value":"Hide"},"parameters":["Hovered"]},{"type":{"value":"Show"},"parameters":["Pressed",""]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::PanelSpriteButton::IsFocused"},"parameters":["Object","ButtonFSM"]},{"type":{"value":"BuiltinCommonInstructions::Once"},"parameters":[]}],"actions":[{"type":{"value":"PanelSpriteButton::TextStyleState::SetIsHovered"},"parameters":["Label","TextStyleState","yes",""]},{"type":{"value":"PanelSpriteButton::BitmapTextStyleState::SetIsHovered"},"parameters":["BitmapLabel","BitmapTextStyleState","yes",""]},{"type":{"value":"PanelSpriteButton::PanelSpriteButton::SetLabelOffset"},"parameters":["Object","=","0",""]},{"type":{"value":"Hide"},"parameters":["Idle"]},{"type":{"value":"Show"},"parameters":["Hovered",""]},{"type":{"value":"Hide"},"parameters":["Pressed"]}]}],"parameters":[]}],"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"PanelSpriteButton::PanelSpriteButton","type":"object"}],"objectGroups":[]},{"description":"Check if the button is not used.","fullName":"Is idle","functionType":"Condition","name":"IsIdle","sentence":"_PARAM0_ is idle","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::ButtonFSM::IsIdle"},"parameters":["Idle","ButtonFSM",""]}],"actions":[{"type":{"value":"SetReturnBoolean"},"parameters":["True"]}]}],"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"PanelSpriteButton::PanelSpriteButton","type":"object"}],"objectGroups":[]},{"description":"Check if the button was just clicked.","fullName":"Is clicked","functionType":"Condition","name":"IsClicked","sentence":"_PARAM0_ is clicked","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::ButtonFSM::IsClicked"},"parameters":["Idle","ButtonFSM",""]}],"actions":[{"type":{"value":"SetReturnBoolean"},"parameters":["True"]}]}],"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"PanelSpriteButton::PanelSpriteButton","type":"object"}],"objectGroups":[]},{"description":"Check if the cursor is hovered over the button.","fullName":"Is hovered","functionType":"Condition","name":"IsHovered","sentence":"_PARAM0_ is hovered","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::ButtonFSM::IsHovered"},"parameters":["Idle","ButtonFSM",""]}],"actions":[{"type":{"value":"SetReturnBoolean"},"parameters":["True"]}]}],"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"PanelSpriteButton::PanelSpriteButton","type":"object"}],"objectGroups":[]},{"description":"Check if the button is either hovered or pressed but not hovered.","fullName":"Is focused","functionType":"Condition","name":"IsFocused","sentence":"_PARAM0_ is focused","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::ButtonFSM::IsFocused"},"parameters":["Idle","ButtonFSM",""]}],"actions":[{"type":{"value":"SetReturnBoolean"},"parameters":["True"]}]}],"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"PanelSpriteButton::PanelSpriteButton","type":"object"}],"objectGroups":[]},{"description":"Check if the button is currently being pressed with mouse or touch.","fullName":"Is pressed","functionType":"Condition","name":"IsPressed","sentence":"_PARAM0_ is pressed","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"PanelSpriteButton::ButtonFSM::IsPressed"},"parameters":["Idle","ButtonFSM",""]}],"actions":[{"type":{"value":"SetReturnBoolean"},"parameters":["True"]}]}],"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"PanelSpriteButton::PanelSpriteButton","type":"object"}],"objectGroups":[]},{"description":"Change the text of the button label.","fullName":"Label text","functionType":"Action","name":"SetLabelText","private":true,"sentence":"Change the text of _PARAM0_ to _PARAM1_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"TextContainerCapability::TextContainerBehavior::SetValue"},"parameters":["Labels","Text","=","Value"]}]}],"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"PanelSpriteButton::PanelSpriteButton","type":"object"},{"description":"Text","name":"Value","type":"string"}],"objectGroups":[]},{"fullName":"","functionType":"ActionWithOperator","getterName":"LabelText","name":"SetLabelTextOp","sentence":"","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"TextContainerCapability::TextContainerBehavior::SetValue"},"parameters":["Labels","Text","=","Value"]}]}],"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"PanelSpriteButton::PanelSpriteButton","type":"object"}],"objectGroups":[]},{"description":"the label text.","fullName":"Label text","functionType":"ExpressionAndCondition","name":"LabelText","sentence":"the label text","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"SetReturnString"},"parameters":["Labels.Text::Value()"]}]}],"expressionType":{"type":"string"},"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"PanelSpriteButton::PanelSpriteButton","type":"object"}],"objectGroups":[]},{"description":"De/activate interactions with the button.","fullName":"De/activate interactions","functionType":"Action","name":"Activate","sentence":"Activate interactions with _PARAM0_: _PARAM1_","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BooleanVariable"},"parameters":["ShouldActivate","True",""]}],"actions":[{"type":{"value":"ActivateBehavior"},"parameters":["Idle","ButtonFSM","yes"]}]},{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"inverted":true,"value":"BooleanVariable"},"parameters":["ShouldActivate","True",""]}],"actions":[{"type":{"value":"ActivateBehavior"},"parameters":["Idle","ButtonFSM","no"]}]}],"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"PanelSpriteButton::PanelSpriteButton","type":"object"},{"description":"Activate","name":"ShouldActivate","type":"yesorno"}],"objectGroups":[]},{"description":"Check if interactions are activated on the button.","fullName":"Interactions activated","functionType":"Condition","name":"IsActivated","sentence":"Interactions on _PARAM0_ are activated","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[{"type":{"value":"BehaviorActivated"},"parameters":["Idle","ButtonFSM"]}],"actions":[{"type":{"value":"SetReturnBoolean"},"parameters":["True"]}]}],"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"PanelSpriteButton::PanelSpriteButton","type":"object"}],"objectGroups":[]},{"description":"the labelOffset of the object.","fullName":"LabelOffset","functionType":"ExpressionAndCondition","name":"LabelOffset","private":true,"sentence":"the labelOffset","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"SetReturnNumber"},"parameters":["LabelOffset"]}]}],"expressionType":{"type":"expression"},"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"PanelSpriteButton::PanelSpriteButton","type":"object"}],"objectGroups":[]},{"fullName":"","functionType":"ActionWithOperator","getterName":"LabelOffset","name":"SetLabelOffset","private":true,"sentence":"","events":[{"type":"BuiltinCommonInstructions::Standard","conditions":[],"actions":[{"type":{"value":"SetCenterY"},"parameters":["Labels","+","Value - LabelOffset"]},{"type":{"value":"SetNumberVariable"},"parameters":["LabelOffset","=","Value"]}]}],"parameters":[{"description":"Object","name":"Object","supplementaryInformation":"PanelSpriteButton::PanelSpriteButton","type":"object"}],"objectGroups":[]}],"eventsFunctionsFolderStructure":{"folderName":"__ROOT","children":[{"functionName":"onCreated"},{"functionName":"onHotReloading"},{"functionName":"doStepPostEvents"},{"functionName":"IsIdle"},{"functionName":"IsClicked"},{"functionName":"IsHovered"},{"functionName":"IsFocused"},{"functionName":"IsPressed"},{"functionName":"SetLabelText"},{"functionName":"SetLabelTextOp"},{"functionName":"LabelText"},{"functionName":"Activate"},{"functionName":"IsActivated"},{"functionName":"LabelOffset"},{"functionName":"SetLabelOffset"}]},"propertyDescriptors":[{"value":"","type":"MultilineString","label":"Label","name":"LabelText"},{"value":"0.25","type":"Number","unit":"Second","label":"Hovered fade out duration","group":"States","name":"HoveredFadeOutDuration"},{"value":"0","type":"Number","unit":"Pixel","label":"Label offset on Y axis when pressed","group":"States","name":"PressedLabelOffsetY"},{"value":"0","type":"Number","unit":"Pixel","label":"","group":"States","hidden":true,"name":"LabelOffset"},{"value":"","type":"Choice","label":"","choices":[{"label":"Label.Text=LabelText","value":"Label.Text=LabelText"},{"label":"BitmapLabel.Text=LabelText","value":"BitmapLabel.Text=LabelText"}],"hidden":true,"name":"_PropertyMapping"}],"propertiesFolderStructure":{"folderName":"__ROOT","children":[{"propertyName":"LabelText"},{"propertyName":"_PropertyMapping"},{"folderName":"States","children":[{"propertyName":"HoveredFadeOutDuration"},{"propertyName":"PressedLabelOffsetY"},{"propertyName":"LabelOffset"}]}]},"variants":[{"areaMaxX":128,"areaMaxY":48,"areaMaxZ":64,"areaMinX":0,"areaMinY":0,"areaMinZ":0,"assetStoreAssetId":"80b9ddd78c8727888bb53c7524f443682746667b1ba493c223114c04e7661bbf","assetStoreOriginalName":"Small Blue Button","name":"Small Blue Button","objects":[{"assetStoreId":"","bold":false,"italic":false,"name":"Label","smoothed":true,"type":"TextObject::Text","underlined":false,"variables":[],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":4.0,"topEdgeAnchor":4.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"useLegacyBottomAndRightAnchors":false},{"name":"TextStyleState","type":"PanelSpriteButton::TextStyleState","ShouldEnableOutlineOnHover":false,"HoverColor":"","ShouldEnableShadowOnHover":false,"HoverFontSize":0.0,"IsHovered":false,"IdleFontSize":0.0,"IdleColor":""}],"string":"Text","font":"","textAlignment":"center","characterSize":20.0,"color":{"b":0,"g":0,"r":0},"content":{"bold":false,"isOutlineEnabled":false,"isShadowEnabled":false,"italic":false,"outlineColor":"255;255;255","outlineThickness":2.0,"shadowAngle":90.0,"shadowBlurRadius":2.0,"shadowColor":"0;0;0","shadowDistance":4.0,"shadowOpacity":127.0,"smoothed":true,"underlined":false,"text":"Text","font":"","textAlignment":"center","verticalTextAlignment":"center","characterSize":20.0,"lineHeight":0.0,"color":"0;0;0"}},{"assetStoreId":"","bottomMargin":5.0,"height":32.0,"leftMargin":3.0,"name":"Idle","rightMargin":3.0,"texture":"assets\\Small Blue Button_Idle.png","tiled":false,"topMargin":3.0,"type":"PanelSpriteObject::PanelSprite","width":32.0,"variables":[{"folded":true,"name":"State","type":"string","value":"Idle"}],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":2.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"topEdgeAnchor":1.0,"useLegacyBottomAndRightAnchors":false},{"name":"ButtonFSM","type":"PanelSpriteButton::ButtonFSM","ShouldCheckHovering":true}]},{"assetStoreId":"","bottomMargin":5.0,"height":32.0,"leftMargin":3.0,"name":"Hovered","rightMargin":3.0,"texture":"assets\\Small Blue Button_Hovered.png","tiled":false,"topMargin":3.0,"type":"PanelSpriteObject::PanelSprite","width":32.0,"variables":[],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":2.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"topEdgeAnchor":1.0,"useLegacyBottomAndRightAnchors":false},{"name":"Tween","type":"Tween::TweenBehavior"}]},{"assetStoreId":"","bottomMargin":3.0,"height":32.0,"leftMargin":3.0,"name":"Pressed","rightMargin":3.0,"texture":"assets\\Small Blue Button_Pressed.png","tiled":false,"topMargin":3.0,"type":"PanelSpriteObject::PanelSprite","width":32.0,"variables":[],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":2.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"topEdgeAnchor":1.0,"useLegacyBottomAndRightAnchors":false}]},{"assetStoreId":"","name":"BitmapLabel","type":"BitmapText::BitmapTextObject","variables":[],"effects":[],"behaviors":[{"name":"Anchor","type":"AnchorBehavior::AnchorBehavior","bottomEdgeAnchor":4.0,"topEdgeAnchor":4.0,"leftEdgeAnchor":1.0,"relativeToOriginalWindowSize":true,"rightEdgeAnchor":2.0,"useLegacyBottomAndRightAnchors":false},{"name":"BitmapTextStyleState","type":"PanelSpriteButton::BitmapTextStyleState","HoverColor":"","HoverPrefix":"","HoverSuffix":"","IsHovered":false,"IdleText":"","IdleColor":""}],"content":{"text":"Button","opacity":255.0,"scale":1.0,"fontSize":20.0,"tint":"255;255;255","bitmapFontResourceName":"assets\\8BitOperatorPlus8Regular_Edited.fnt","textureAtlasResourceName":"assets\\8BitOperatorPlus8Regular_Edited.png","align":"center","verticalTextAlignment":"center"}}],"objectsFolderStructure":{"folderName":"__ROOT","children":[{"objectName":"Label"},{"objectName":"BitmapLabel"},{"objectName":"Idle"},{"objectName":"Hovered"},{"objectName":"Pressed"}]},"objectsGroups":[{"name":"Background","objects":[{"name":"Idle"},{"name":"Hovered"},{"name":"Pressed"}]},{"name":"Labels","objects":[{"name":"Label"},{"name":"BitmapLabel"}]}],"layers":[{"ambientLightColorB":200,"ambientLightColorG":200,"ambientLightColorR":200,"camera2DPlaneMaxDrawingDistance":5000.0,"camera3DFarPlaneDistance":10000.0,"camera3DFieldOfView":45.0,"camera3DNearPlaneDistance":3.0,"cameraType":"","followBaseLayerCamera":false,"isLightingLayer":false,"isLocked":false,"name":"","renderingType":"","visibility":true,"cameras":[{"defaultSize":true,"defaultViewport":true,"height":0.0,"viewportBottom":1.0,"viewportLeft":0.0,"viewportRight":1.0,"viewportTop":0.0,"width":0.0}],"effects":[]}],"instances":[{"angle":0.0,"customSize":true,"depth":1.0,"height":48.0,"layer":"","name":"Idle","persistentUuid":"24882334-eec8-403e-8bf1-70fc928a46e6","width":128.0,"x":0.0,"y":0.0,"zOrder":1,"numberProperties":[],"stringProperties":[],"initialVariables":[]},{"angle":0.0,"customSize":true,"depth":1.0,"height":48.0,"keepRatio":true,"layer":"","name":"BitmapLabel","persistentUuid":"c3c3200d-dec4-4ac4-9dc5-4715d8989830","width":128.0,"x":5.0,"y":26.0,"zOrder":2,"numberProperties":[],"stringProperties":[],"initialVariables":[]}],"editionSettings":[]}]}]},{"author":"","category":"General","dimension":"","extensionNamespace":"","fullName":"JSON Resource Loading","gdevelopVersion":">=5.5.222","helpPath":"","iconUrl":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWZpbGUtY29kZS1vdXRsaW5lIiB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTE0IDJINkM0Ljg5IDIgNCAyLjkgNCA0VjIwQzQgMjEuMTEgNC44OSAyMiA2IDIySDE4QzE5LjExIDIyIDIwIDIxLjExIDIwIDIwVjhMMTQgMk0xOCAyMEg2VjRIMTNWOUgxOFYyME05LjU0IDE1LjY1TDExLjYzIDE3Ljc0TDEwLjM1IDE5TDcgMTUuNjVMMTAuMzUgMTIuM0wxMS42MyAxMy41Nkw5LjU0IDE1LjY1TTE3IDE1LjY1TDEzLjY1IDE5TDEyLjM4IDE3Ljc0TDE0LjQ3IDE1LjY1TDEyLjM4IDEzLjU2TDEzLjY1IDEyLjNMMTcgMTUuNjVaIiAvPjwvc3ZnPg==","name":"JSONResourceLoader","previewIconUrl":"https://resources.gdevelop-app.com/assets/Icons/file-code-outline.svg","shortDescription":"Loads a JSON resource into a variable.","version":"1.1.0","description":["Loads a (static) JSON resource from your project files into a global, scene, or object variable.","","NEVER use this to load your game.json into a variable - this would increase your game size by a lot and make your whole project file available for anyone to open!"],"origin":{"identifier":"JSONResourceLoader","name":"gdevelop-extension-store"},"tags":["json","resource","load","open","file","data","static","file"],"authorIds":["ZgrsWuRTAkXgeuPV9bo0zuEcA2w1"],"dependencies":[],"globalVariables":[],"sceneVariables":[],"eventsFunctions":[{"description":"Loads a JSON resource into a scene structure variable.","fullName":"Load a JSON resource in a scene variable","functionType":"Action","name":"LoadJSONToScene","private":true,"sentence":"Load _PARAM1_ into scene variable _PARAM2_","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["eventsFunctionContext"," .getArgument(\"Variable\")"," .fromJSObject("," runtimeScene"," .getGame()"," .getJsonManager()"," .getLoadedJson(eventsFunctionContext.getArgument(\"Resource\"))"," );",""],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"parameters":[{"description":"The resource to load the JSON from","name":"Resource","type":"jsonResource"},{"description":"The scene variable to load the JSON to","name":"Variable","type":"scenevar"}],"objectGroups":[]},{"description":"Loads a JSON resource into a global structure variable.","fullName":"Load a JSON resource in a global variable","functionType":"Action","name":"LoadJSONToGlobal","private":true,"sentence":"Load _PARAM1_ into global variable _PARAM2_","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["eventsFunctionContext"," .getArgument(\"Variable\")"," .fromJSObject("," runtimeScene"," .getGame()"," .getJsonManager()"," .getLoadedJson(eventsFunctionContext.getArgument(\"Resource\"))"," );",""],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"parameters":[{"description":"The resource to load the JSON from","name":"Resource","type":"jsonResource"},{"description":"The global variable to load the JSON to","name":"Variable","type":"globalvar"}],"objectGroups":[]},{"description":"Loads a JSON resource into an object structure variable.","fullName":"Load a JSON resource in an object variable","functionType":"Action","name":"LoadJSONToObject","sentence":"Load _PARAM1_ into object variable _PARAM3_ of object _PARAM2_","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["eventsFunctionContext"," .getArgument(\"Variable\")"," .fromJSObject("," runtimeScene"," .getGame()"," .getJsonManager()"," .getLoadedJson(eventsFunctionContext.getArgument(\"Resource\"))"," );",""],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":false}],"parameters":[{"description":"The resource to load the JSON from","name":"Resource","type":"jsonResource"},{"description":"The object where to find the variable","name":"Object","type":"objectList"},{"description":"The object variable to load the JSON to","name":"Variable","type":"objectvar"}],"objectGroups":[]},{"description":"Loads a JSON resource into a structure variable.","fullName":"Load a JSON resource in a variable","functionType":"Action","name":"LoadJSONToVariable","sentence":"Load _PARAM1_ into variable _PARAM2_","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["/** @type {gdjs.Variable} */","//@ts-ignore","const variable = eventsFunctionContext.getArgument(\"Variable\");","variable.fromJSObject("," runtimeScene"," .getGame()"," .getJsonManager()"," .getLoadedJson(eventsFunctionContext.getArgument(\"Resource\"))",");",""],"parameterObjects":"","useStrict":true,"eventsSheetExpanded":true}],"parameters":[{"description":"The resource to load the JSON from","name":"Resource","type":"jsonResource"},{"description":"The variable to load the JSON to","name":"Variable","type":"variable"}],"objectGroups":[]}],"eventsFunctionsFolderStructure":{"folderName":"__ROOT","children":[{"functionName":"LoadJSONToVariable"},{"functionName":"LoadJSONToScene"},{"functionName":"LoadJSONToGlobal"},{"functionName":"LoadJSONToObject"}]},"eventsBasedBehaviors":[],"eventsBasedObjects":[]},{"author":"@Bouh","category":"User interface","dimension":"","extensionNamespace":"","fullName":"Time formatting","gdevelopVersion":">=5.5.222","helpPath":"","iconUrl":"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWNsb2NrLWRpZ2l0YWwiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMiw2QTIsMiAwIDAsMCAwLDhWMTZBMiwyIDAgMCwwIDIsMThIMjJBMiwyIDAgMCwwIDI0LDE2VjhBMiwyIDAgMCwwIDIyLDZNMiw4SDIyVjE2SDJNMyw5VjEwLjVINi4yNUwzLDE1SDQuNzVMOCwxMC41VjlNOS4yNSw5VjEwLjVIMTAuNzVWOU0xMiw5VjEwLjVIMTMuNVYxNUgxNVY5TTE3LDlBMSwxIDAgMCwwIDE2LDEwVjE0QTEsMSAwIDAsMCAxNywxNUgyMEExLDEgMCAwLDAgMjEsMTRWMTBBMSwxIDAgMCwwIDIwLDlNMTcuNSwxMC41SDE5LjVWMTMuNUgxNy41TTkuMjUsMTMuNVYxNUgxMC43NVYxMy41IiAvPjwvc3ZnPg==","name":"TimeFormatter","previewIconUrl":"https://resources.gdevelop-app.com/assets/Icons/clock-digital.svg","shortDescription":"Format seconds into HH:MM:SS or HH:MM:SS.000 time display strings.","version":"0.0.2","description":["Ideal for displaying timers on screen.","","Formats included:","* HH:MM:SS","* HH:MM:SS.000 (displays milliseconds)"],"origin":{"identifier":"TimeFormatter","name":"gdevelop-extension-store"},"tags":["time","timer","format","hours","minutes","seconds","milliseconds"],"authorIds":["2OwwM8ToR9dx9RJ2sAKTcrLmCB92"],"dependencies":[],"globalVariables":[],"sceneVariables":[],"eventsFunctions":[{"description":"Format time in seconds to HH:MM:SS.","fullName":"Format time in seconds to HH:MM:SS","functionType":"StringExpression","name":"SecondsToHHMMSS","sentence":"Format time _PARAM1_ to HH:MM:SS in _PARAM2_","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["var format_time = function (time_second) {\r"," date = new Date(null);\r"," date.setSeconds(time_second);\r"," if (time_second >= 3600) {\r"," return date.toISOString().substr(11, 8); // MM:SS\r"," } else {\r"," return date.toISOString().substr(14, 5); // HH:MM:SS\r"," }\r","}\r","\r","eventsFunctionContext.returnValue = format_time(eventsFunctionContext.getArgument(\"TimeInSeconds\"));"],"parameterObjects":"","useStrict":false,"eventsSheetExpanded":false}],"expressionType":{"type":"string"},"parameters":[{"description":"Time, in seconds","name":"TimeInSeconds","type":"expression"}],"objectGroups":[]},{"description":"Format time in seconds to HH:MM:SS.000, including milliseconds.","fullName":"Format time in seconds to HH:MM:SS.000","functionType":"StringExpression","name":"SecondsToHHMMSS000","sentence":"Format time _PARAM1_ to HH:MM:SS in _PARAM2_","events":[{"type":"BuiltinCommonInstructions::JsCode","inlineCode":["var format_time = function (time_second) {\r"," date = new Date(null);\r"," date.setMilliseconds(1000*time_second);\r"," if (time_second >= 3600) {\r"," return date.toISOString().substr(11, 12); // MM:SS.000\r"," } else {\r"," return date.toISOString().substr(14, 9); // HH:MM:SS.000\r"," }\r","}\r","\r","eventsFunctionContext.returnValue = format_time(eventsFunctionContext.getArgument(\"TimeInSeconds\"));"],"parameterObjects":"","useStrict":false,"eventsSheetExpanded":false}],"expressionType":{"type":"string"},"parameters":[{"description":"Time, in seconds","name":"TimeInSeconds","type":"expression"}],"objectGroups":[]}],"eventsFunctionsFolderStructure":{"folderName":"__ROOT","children":[{"functionName":"SecondsToHHMMSS"},{"functionName":"SecondsToHHMMSS000"}]},"eventsBasedBehaviors":[],"eventsBasedObjects":[]}],"externalLayouts":[]} \ No newline at end of file diff --git a/assets/8BitOperatorPlus8Regular_Edited.fnt b/assets/8BitOperatorPlus8Regular_Edited.fnt new file mode 100644 index 0000000..def784a --- /dev/null +++ b/assets/8BitOperatorPlus8Regular_Edited.fnt @@ -0,0 +1,95 @@ +info face="8-bitOperatorPlus8-Regular" size=23 bold=0 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=10,10,10,10 spacing=5,5 +common lineHeight=23 base=14 scaleW=392 scaleH=387 pages=1 packed=0 +page id=0 file="8BitOperatorPlus8Regular_Edited.png" +chars count=91 +char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=0 xadvance=8 page=0 chnl=15 +char id=33 x=364 y=111 width=26 height=38 xoffset=-10 yoffset=-11.98 xadvance=6 page=0 chnl=15 +char id=34 x=288 y=152 width=34 height=30 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=35 x=52 y=0 width=36 height=36 xoffset=-10 yoffset=-9.98 xadvance=16 page=0 chnl=15 +char id=36 x=210 y=86 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=37 x=0 y=339 width=36 height=36 xoffset=-10 yoffset=-9.98 xadvance=16 page=0 chnl=15 +char id=38 x=210 y=129 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=39 x=364 y=76 width=28 height=30 xoffset=-10 yoffset=-11.98 xadvance=8 page=0 chnl=15 +char id=40 x=327 y=203 width=30 height=38 xoffset=-10 yoffset=-11.98 xadvance=10 page=0 chnl=15 +char id=41 x=327 y=246 width=30 height=38 xoffset=-10 yoffset=-11.98 xadvance=10 page=0 chnl=15 +char id=42 x=0 y=210 width=38 height=34 xoffset=-10 yoffset=-9.98 xadvance=18 page=0 chnl=15 +char id=43 x=288 y=78 width=34 height=34 xoffset=-10 yoffset=-9.98 xadvance=14 page=0 chnl=15 +char id=44 x=364 y=41 width=28 height=30 xoffset=-10 yoffset=-1.99 xadvance=8 page=0 chnl=15 +char id=45 x=327 y=0 width=32 height=26 xoffset=-10 yoffset=-5.99 xadvance=12 page=0 chnl=15 +char id=46 x=364 y=236 width=26 height=26 xoffset=-10 yoffset=0 xadvance=6 page=0 chnl=15 +char id=47 x=288 y=222 width=32 height=40 xoffset=-10 yoffset=-11.98 xadvance=12 page=0 chnl=15 +char id=48 x=52 y=86 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=49 x=327 y=31 width=30 height=38 xoffset=-10 yoffset=-11.98 xadvance=10 page=0 chnl=15 +char id=50 x=52 y=129 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=51 x=52 y=172 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=52 x=52 y=215 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=53 x=52 y=258 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=54 x=52 y=301 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=55 x=52 y=344 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=56 x=93 y=0 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=57 x=93 y=43 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=58 x=364 y=197 width=26 height=34 xoffset=-10 yoffset=-7.98 xadvance=6 page=0 chnl=15 +char id=59 x=364 y=0 width=28 height=36 xoffset=-10 yoffset=-7.98 xadvance=8 page=0 chnl=15 +char id=61 x=288 y=117 width=34 height=30 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=63 x=210 y=43 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=64 x=0 y=294 width=36 height=40 xoffset=-10 yoffset=-11.98 xadvance=16 page=0 chnl=15 +char id=65 x=93 y=258 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=66 x=93 y=301 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=67 x=93 y=344 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=68 x=132 y=0 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=69 x=132 y=43 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=70 x=132 y=86 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=71 x=132 y=129 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=72 x=132 y=172 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=73 x=327 y=160 width=30 height=38 xoffset=-10 yoffset=-11.98 xadvance=10 page=0 chnl=15 +char id=74 x=132 y=215 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=75 x=132 y=258 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=76 x=132 y=301 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=77 x=0 y=46 width=38 height=38 xoffset=-10 yoffset=-11.98 xadvance=18 page=0 chnl=15 +char id=78 x=132 y=344 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=79 x=171 y=0 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=80 x=171 y=43 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=81 x=0 y=249 width=36 height=40 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=82 x=171 y=86 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=83 x=171 y=129 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=84 x=171 y=172 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=85 x=171 y=215 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=86 x=171 y=258 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=87 x=0 y=89 width=38 height=38 xoffset=-10 yoffset=-11.98 xadvance=18 page=0 chnl=15 +char id=88 x=171 y=301 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=89 x=171 y=344 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=90 x=210 y=0 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=91 x=327 y=289 width=30 height=38 xoffset=-10 yoffset=-11.98 xadvance=10 page=0 chnl=15 +char id=93 x=327 y=332 width=30 height=38 xoffset=-10 yoffset=-11.98 xadvance=10 page=0 chnl=15 +char id=94 x=288 y=187 width=34 height=30 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=95 x=288 y=353 width=32 height=26 xoffset=-12 yoffset=2 xadvance=8 page=0 chnl=15 +char id=97 x=249 y=41 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=98 x=93 y=86 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=99 x=249 y=80 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=100 x=93 y=129 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=101 x=249 y=119 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=102 x=288 y=267 width=32 height=38 xoffset=-10 yoffset=-11.98 xadvance=12 page=0 chnl=15 +char id=103 x=210 y=258 width=34 height=36 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=104 x=93 y=172 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=105 x=327 y=74 width=30 height=38 xoffset=-10 yoffset=-11.98 xadvance=10 page=0 chnl=15 +char id=106 x=52 y=41 width=34 height=40 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=107 x=93 y=215 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=108 x=327 y=117 width=30 height=38 xoffset=-10 yoffset=-11.98 xadvance=10 page=0 chnl=15 +char id=109 x=0 y=132 width=38 height=34 xoffset=-10 yoffset=-7.98 xadvance=18 page=0 chnl=15 +char id=110 x=249 y=158 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=111 x=249 y=197 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=112 x=210 y=299 width=34 height=36 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=113 x=210 y=340 width=34 height=36 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=114 x=249 y=236 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=115 x=249 y=275 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=116 x=288 y=310 width=32 height=38 xoffset=-10 yoffset=-11.98 xadvance=12 page=0 chnl=15 +char id=117 x=249 y=314 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=118 x=249 y=353 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=119 x=0 y=171 width=38 height=34 xoffset=-10 yoffset=-7.98 xadvance=18 page=0 chnl=15 +char id=120 x=288 y=0 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=121 x=249 y=0 width=34 height=36 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=122 x=288 y=39 width=34 height=34 xoffset=-10 yoffset=-7.98 xadvance=14 page=0 chnl=15 +char id=123 x=210 y=172 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=124 x=364 y=154 width=26 height=38 xoffset=-10 yoffset=-11.98 xadvance=6 page=0 chnl=15 +char id=125 x=210 y=215 width=34 height=38 xoffset=-10 yoffset=-11.98 xadvance=14 page=0 chnl=15 +char id=8470 x=0 y=0 width=47 height=41 xoffset=-13 yoffset=-8 xadvance=22 page=0 chnl=15 diff --git a/assets/8BitOperatorPlus8Regular_Edited.png b/assets/8BitOperatorPlus8Regular_Edited.png new file mode 100644 index 0000000000000000000000000000000000000000..1ebff0aa7ee38d39303be374db8a1e65955fe465 GIT binary patch literal 4317 zcmZWs2UJtp7QG2AQUf!L2th+YW<-$Ypo{^6^o|h_h!p990YRh+L_mpDBVABxq$mWC zGPD6jrAjm-H9`c02vVdgMgGJ8|623cKkH>B_vWpe^UgkdpPf6F<^}@1;=BL=0V6|Q zJOD5<^ol`nLp#c`ansNn>>A$SENrA(J_=fJdTN_#15lm9w{wXLTBBVJ@n!&o$pS!% z1z-!>B7Fkjx)K0$&H((81;D|pxlQM=03ZoQy4qGDqYGmuHOzVuU^zSJ5RIqGp*nrQu=co18jg>BiO+w^?_t2JT ze@SoM+Sq2Ela|4!hD>g9xMWQxf)6Q$hz-(osI2oJpu(oD7tD!mP+n_n2D_p>H#~x{ z?Z}+0s~D8sWV*HyEGCJq#BW-Utq~Y`lAMc8hKTaD&r*b*ZnbS18sq-FZd>7O+w`tz zwfOwRw+#mGb(i4MYdrNc16B*EtD^M zF65BIiyo=AO_R3ljJBbcHb$QGj=40;)1+17@g>=0u(h!!uQjTCbco7te zeBQpYhrg*IYHSi>jayFg6x>_r9Ays?5+wLZH;zI&`ds}ZA!R58}G6K##Bl5sCBy>ho)Hdzy|6=>!Rd~R*du&v1PVa&Cv|tBNWj3ue z+GfNB1Ara?)tmkIw6`D}fGi6xSo@bJF7T$Fe)djq=hSj(gB22#qDMXCRYcrAFFajs z+uLHZ%IIyoUsqB^#sKwnEDl z$|}BXD$u48MM822V1@Llxrwj~dy#m;g*u=k`@Z9Mv#BjgRGzS0Tvyx8(TMs`uIj*_ zx(svl!G@cEP|eAwv)56JH<~U+(F-wFNUEA{SFE%n>*2OS!1cdZPF*_k!j)caaQw-p zC+h=P>qhBn$11;;aSx!x_`paBtV=D$VW#X1!_#j&!GHmemIQ#bnNJlQpVP%H^o+vB^2vN$mMzHKUaf z)|@O}9Uzc8WfjPHB|)Z+gmhl`&+3=`?UkAlNI4z=bNQ`KR6-c;^igdiggaI3IoA9d zm$QW6XO7{xmpY~FAqf6I=&Fq4g1Ixi?Zx|GJs>Z&8;QPN4#AeAp>)Ca zx|hdJU%ia*Xl({B9Efs$3DL*mJ$CpnFHSI16!QulIt!5{$E^5!NfCOG>+d+JA*$`1F!2s(Q~mDp=grk8*4?kX7v@B&0k& zZB^zLRKzhak4r36<3?S&SUs50#ilpRx2**mMAEd&CJ*~#b0oRQcspMgK4*R*y7tGB zAqKsu=jl2EM(gzdZg}k+b$zF7CB8QP*qGmKk2~#}2vFa9@7f(?E^$Lme8%n9>lsu%?6aDB@e-;%6GL-}f3NmQ1(z0SWunD{ z;}W(Pg2`80xwCVdhG*JW!ap|>-?)=(oA#dlh4=@Gz?l}Ng{nOWu@pxF!vyM49H?r9 zIJlM}%#K54XnIOQzn0p9l+5a5BnTzlR-_x#IQlK_oQPPoANTdC%>2PerMBqblGr6f zEA>xg!pd9hH&P+4lvKqZ$a2F*Wn1}Ed3|CPub@d#z0h&|2+R96;m1 zeD~;`fX7)RJt0xHWEmQK%BA*zn~AkOpBF~wwpm zSrja;qabDIxW2Ee1+65pg~>AFEJefR%qrO|orLW-xtt0kJP;LJj4uah>}j42`u1rv zoJg=3a9+^l6y zhsMQ`-NO)EP$;@TI+A5IO7gg688!6ft&fKwq+J`@Al1%u_5&_lV5@rLi^2Y_t8!$= zagnZTP|=ZSP-x`>(Rr*U{=iqX)}gvJjp-gKV=XAf_Vc!#{HAgb;_r_?Yv1jWI;%zX z`RYZ0*aW`x@w(LRO8L>}_;W6UAaOJhV|MgjG*LW|Qu~6B#0`U!!Wb=&!MXbvy0rE- zrg}?Qd-Gn-K=g$r#*IV6Lnie3o5F>ddT9XA5zk!b0UM?I|eXKkc$H+j4k!N_;aa>B3S> z*O^PjE4(-^?XFa@%=+xe^zmoTx(l%KSZ>D$@&`)g$YVBwp+ScVUPopztFXCb z)F4lL@t9}CwaqiS!$uCH#bTkE!LegK!puh^e@AI383_a)5#xV-0BLcqxf-(&1Bodn z_Z!|mLbV}kbF`juLj-{Y7N!q}Z!b5+ug(S#BRB>}k!4B3QGW_EGa9-%d>xK@ENXMX zzDOyF-RJm_0{kH#37HZ5awKfnpY-M@x_c1{r1oh82W!E&m_{B5BQra3Zc~rhmvQ1J<8^jN|Gq!Ul2#2)kKPJ}THyL?SyQNM^5@_1s97^zorRu9mZCwH zn;_iw1ym-;?|gSnhCxRLXU70drOq!Q)7MWY*7Xv8_@aA`jwczY{tg{es^C@fFYRJb z7FW=cK9rfO`dO*AD73fY{8f}9bPnn4(P|UH6}au*llhzOm5?g{eV&4FXPvrR*dKyl zq`Q3|(HkV~YyL#R$G34_J%Bkg9+i=>Nl;I$x)0ef67S^0uBlrZzUHXQsCvD<8{5m% zsg852hg2AvX? z)1J5actv%RS!+zZQ)^HZxWGSv!GR~GC{8?Vl4|Gi(X=vdqS-KAw@iUzW1qgLs8a_$ zqmY&0ornu`s%q4}r6|q5=uIe7s9S=7?;>8x0n42nW~6<$lBQUq##0atzFKl+z+>ku zNx%`kay41{s$&OV%nvxS`udZWilPBD2j5K}zZLLm7xEtvRNv2^iN`Xu6QPe@?Y0;t zJE?ay!8wc{juiCpT#%L9ZwM&*AWWS(r~^(KOW0EoJ!Q_6!PHJNPWbJAjqP2?q%W(QS8a?8t8Sz7CpwC=8jYTa zN#W9FWQ-ND&Kk?Xyn6TsPo`8K7nz436;1nOy5d+VU7E>AByxZNa z)+t>r-f8HmMEnJfFG;L_iNbL`8#6tDw?Q*6X0{ab`Yd|TFW6Ltcj;TloZ&~7oqzuZ zz+c=A8~*g`{tX|~bz&1~feTg%frro;{pwk#xh%Bqo$4R-tht4am1D!tAy8uI_ee{Tm4})q%O{= zZF7ulSK`@y`mi99+H+}9^8j!O|2m-&Mk1dK9PF?(nhle9)u^ZiJ4w5E)Hcvs+qQxe zjeBDR5|uWxQ_2jwZkQ0`YqQTszqEuE+Ncj}3qUP_PcgWqD@HRvpi?}cPE}i1!pglZ z>;>nx&mGIYlqgdcrzhN|T0l4PZTIr|+lS~qGQ(g+{QEDNc$t<#NXO9l(y8bRNKlcM z!F5DXUy+mipgifb0gATa`Z8ibi-zLDaaGF@QnG$eA01SAT)uvx_E|G|cPUF#(&uAEDQ*KvQxNY7li@~m_8 FzW}Y0l4Jk? literal 0 HcmV?d00001 diff --git a/assets/NewSprite.png b/assets/NewSprite.png new file mode 100644 index 0000000000000000000000000000000000000000..05edc8477a881ae7e6ab4c5d55bf359fc652dbf4 GIT binary patch literal 198 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D$|8a!PbLn`9l zUT+j+P~c%Q-2MN8#fjsB7T$fgw~5!OGuR*Ce9=(AZl~(O$Q97QB*LNI;K-9C&@92D zoWPR^q>m`D8A|vuKpAcaq(A~4Ks5$)7@&-v22+p#NO6J%Ba|V*m@Uv;%4WaG^S@)v T0q1_8TNpfD{an^LB{Ts5V@NlW literal 0 HcmV?d00001 diff --git a/assets/NewSprite2.png b/assets/NewSprite2.png new file mode 100644 index 0000000000000000000000000000000000000000..05edc8477a881ae7e6ab4c5d55bf359fc652dbf4 GIT binary patch literal 198 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D$|8a!PbLn`9l zUT+j+P~c%Q-2MN8#fjsB7T$fgw~5!OGuR*Ce9=(AZl~(O$Q97QB*LNI;K-9C&@92D zoWPR^q>m`D8A|vuKpAcaq(A~4Ks5$)7@&-v22+p#NO6J%Ba|V*m@Uv;%4WaG^S@)v T0q1_8TNpfD{an^LB{Ts5V@NlW literal 0 HcmV?d00001 diff --git a/assets/NewSprite3.png b/assets/NewSprite3.png new file mode 100644 index 0000000000000000000000000000000000000000..ede2650d12dcf48717c107ff5885b285640fb2d6 GIT binary patch literal 533 zcmV+w0_y#VP)Px$&q+i(T0Y(eoH#|40=ASngq z?;hh014tsgqppFF+Ky-#0x&YL)}++ls>KArBYKh{%kLIlY5-Q!7DLu+G#XU^G#y*T zdtHZWB>Tv`Q`D;b`XtPdpuddJ3dv3;}p51j&5z1p{~*1jIZ6XcO?16ri)OPC&V% zlK%eo{|L7>bhWxvHQ>%W$eLL%eGCD(%aX8~H!lH?=y~h}CF9!2*W(T+pzP2?5CX#^?D>tp#ZLG1tM&8ZKGpM1%Qg0*^U5a(!S$Z+b7@` XYq?NR*(~9F00000NkvXXu0mjfS5W14 literal 0 HcmV?d00001 diff --git a/assets/Small Blue Button_Hovered.png b/assets/Small Blue Button_Hovered.png new file mode 100644 index 0000000000000000000000000000000000000000..16f208cb46228e46ae2256dae79d997a1d99b9d0 GIT binary patch literal 292 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC#^NA%C&rs6b?Si}mUKs7M+SzC z{oH>NS%G|oWRD45dI*UL`OvSj}Ky5HFasE6@fgvB=ZK zF(l*O+glrXn+*h7AC`AWYAC5_oaA^jk?{u0Mo#7wezgrAovKrmtRn&f9K;-~Ue-^& zdw2QscR7FS$kcwMxZ#i-{I0&#_@KvnX z*t+%2!)h=8cne3TX}aoH4I zswfr+D)NvP161g7u~?0^P)u!k=_&FM5Q+-OBO%GR^M!&f?Aa}Q_K$53^PT(U&b>Ex z?(fb$GxJTx>t1{&-G~kVU<$Uo`NH1~7*Waa9fVgL2Y{8j{|!NeKwt%^PzJ!CAklyZ z5CINy7y;Zgk9Bar;PE&DAV75rBm(3yTg)%{7rf!mJZ6W(Py0!SJpN~1r3*W-QMC`+ ziar7?PY;0y90(g6zR(9?8=#WO6f%iQp-^ZvDqY8bsl#CCEMKCpYw(H@XXPtK#>T76 zY|K}gTCX-Xws5qx-eAk+ayjNsn_sotWMj{@!<^t~G@1@WXBm^Z%+AEv#BRY2y#e&7 zSWE<*DZuOD2zog5E5Lzql5pBK4Fv;AAd<)wDvi#7230HoGey7?2_zDc2(`zc9uW0N zOH6EC$of9}D5h}+cJE~sP*=NFd}-(_e{Ny#+-S{Oa|=r=uER#hSDl=< zxw(7rw+lS|`~w1m-U!|q{^tIO$f)SI;u8`NB^^F;^!*Rg(vN?bAv$^L@7W)pK9h4+ zQh4FwrJ~ElC0C`DRn?zgtEsKO`PHr4vO9Ob{_g(wKQye#(VeaVB6>t$*8EX~4uOG6(xavq)-;dO@!Jaa8& z*_`Ejsyy%aeT0OEAj0(xC`jY9ws1O5jPg49<`*w9nQvb{OHoLV$`Dmpj{;#wD=K%sjm^XMv6Cp`9@_WdQom3&pUgXRbM%`E;RLkqS zhfy$?qY10DK|!;4A}YPUxMq*YqST&lAxT*%S?@%y@SZjcr6}NJpddsx>QE4^sYJmS z!OA9;&|DqQY53kd+%q{n6IzI&MboHZL6W8tfd-B$Ax|C8YY0s1P|7t!tX8X-Ac@GT zpk6$1$mgWt5PgUiWp+MG!wAiW|qvnUE-}>DrorQ?38wD-)s#{UJQE-I=qn{U> z+eZ4i?0$(zx=p%~0eZZ+J3qtO2p#IWIQ1ac;)pjQv z8RWz0=fx&xre1n{)Iw6$U?CBKg;K@bsc24{6PnNFOv|T6b0#9Pe{N)z+x9LN$=m{7 zERtWB?_!ZGt|b4DD@pMt=DKuW+rP%|iS5*753rS$6|XTr^TEYt?{a!rH{DbeO&Q9uc+%0#_OEd{u(?Q-;ME6vd zkgtl;v|ZEmgl3_@$mw44#{b}n8=pV^&OPlo@^QiDpi#Js4V@D|byskP3uj&Sx%|{t zpj8+Cbn@t@eZeT0IXAsLm4Ewwn{=C2&2KXs3;h;u%+)cx8g>tITRiLXJVhFDT&ose z6%5p!k3_-0IIKJCMl|Yb^_(|P{eU<(y~MKIB63@CMF^=8S_Z+ev} z!fVjBt@{t3hM$?ZcwfFNuI;Wh0z1S=mmMwuREQa>eI(dl6~5hf2LMOc!b^t_08m0v zN1!*;b>D@eG=ZCof7Fjd?G?0?tvYF)>^S_Ndv2^L+kGQ5w{v4Hsr(Sl z#X2EP>KydZBeXU_fiGT?@$QOK7g&D7t*Q!}2$M^8Uea%#Jlhqx>%?g7ZU^3r^Jc}v s|G=(5{%v~{nlj-Vy1wJbE=^lEuID0av@_ZX-p~LbaQAX6cio%%Po_hKg8%>k literal 0 HcmV?d00001 diff --git a/jsonServerGET.cartero b/jsonServerGET.cartero new file mode 100644 index 0000000..f1fd084 --- /dev/null +++ b/jsonServerGET.cartero @@ -0,0 +1,3 @@ +version = 1 +url = "http://192.168.100.225:3020/users" +method = "GET" diff --git a/jsonserver.cartero b/jsonserver.cartero new file mode 100644 index 0000000..a01f2d7 --- /dev/null +++ b/jsonserver.cartero @@ -0,0 +1,3 @@ +version = 1 +url = "http://192.168.100.225:3020/users?username=test" +method = "GET" diff --git a/jsonserverDELETE.cartero b/jsonserverDELETE.cartero new file mode 100644 index 0000000..a4a3860 --- /dev/null +++ b/jsonserverDELETE.cartero @@ -0,0 +1,3 @@ +version = 1 +url = "http://192.168.100.225:3020/users/5" +method = "DELETE" diff --git a/jsonserverPOST.cartero b/jsonserverPOST.cartero new file mode 100644 index 0000000..33e06ff --- /dev/null +++ b/jsonserverPOST.cartero @@ -0,0 +1,21 @@ +version = 1 +url = "http://192.168.100.225:3020/users" +method = "POST" + +[body] +type = "raw" +format = "json" +body = """ +{ + "username": "test2", + "password": "password", + "character_created": true, + "color": "#ff0000", + "online": false, + "room": "000000", + "x": 200, + "y": 200 +}""" + +[inactive-params] +"" = ""