@evitcastudio/kit 2.1.2 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +123 -59
  3. package/lib/bundle/cli/cli.js +1398 -53
  4. package/lib/bundle/cli/kit-game-templates/multi/README.md +5 -0
  5. package/lib/bundle/cli/kit-game-templates/multi/bun-build.ts +109 -0
  6. package/lib/bundle/cli/kit-game-templates/multi/favicon.ico +0 -0
  7. package/lib/bundle/cli/kit-game-templates/multi/package.json +24 -0
  8. package/lib/bundle/cli/kit-game-templates/multi/src/client/c-network.ts +22 -0
  9. package/lib/bundle/cli/kit-game-templates/multi/src/client/index.html +9 -0
  10. package/lib/bundle/cli/kit-game-templates/multi/src/client/index.ts +45 -0
  11. package/lib/bundle/cli/kit-game-templates/multi/src/client/packets/s-packets.ts +5 -0
  12. package/lib/bundle/cli/kit-game-templates/multi/src/client/vendor/vylocity-game-engine/vylo.client.js +19 -0
  13. package/lib/bundle/cli/kit-game-templates/multi/src/map-types.ts +9 -0
  14. package/lib/bundle/cli/kit-game-templates/multi/src/resources/default-atlas.vyi +0 -0
  15. package/lib/bundle/cli/kit-game-templates/multi/src/resources/default-macro.vymac +27 -0
  16. package/lib/bundle/cli/kit-game-templates/multi/src/resources/main-map.vym +1 -0
  17. package/lib/bundle/cli/kit-game-templates/multi/src/server/index.ts +58 -0
  18. package/lib/bundle/cli/kit-game-templates/multi/src/server/packets/c-packets.ts +5 -0
  19. package/lib/bundle/cli/kit-game-templates/multi/src/server/s-network.ts +16 -0
  20. package/lib/bundle/cli/kit-game-templates/multi/src/server/settings.json +4 -0
  21. package/lib/bundle/cli/kit-game-templates/multi/src/server/vendor/vylocity-game-engine/vylo.server.js +1 -0
  22. package/lib/bundle/cli/kit-game-templates/multi/src/types/shared-types.ts +13 -0
  23. package/lib/bundle/cli/kit-game-templates/multi/src/vylo.d.ts +3850 -0
  24. package/lib/bundle/cli/kit-game-templates/multi/tsconfig.json +28 -0
  25. package/lib/bundle/cli/kit-game-templates/single/README.md +5 -0
  26. package/lib/bundle/cli/kit-game-templates/single/bun-build.ts +33 -0
  27. package/lib/bundle/cli/kit-game-templates/single/bun-serve.ts +28 -0
  28. package/lib/bundle/cli/kit-game-templates/single/favicon.ico +0 -0
  29. package/lib/bundle/cli/kit-game-templates/single/package.json +23 -0
  30. package/lib/bundle/cli/kit-game-templates/single/src/index.html +12 -0
  31. package/lib/bundle/cli/kit-game-templates/single/src/index.ts +37 -0
  32. package/lib/bundle/cli/kit-game-templates/single/src/map-types.ts +9 -0
  33. package/lib/bundle/cli/kit-game-templates/single/src/resources/default-atlas.vyi +0 -0
  34. package/lib/bundle/cli/kit-game-templates/single/src/resources/default-macro.vymac +27 -0
  35. package/lib/bundle/cli/kit-game-templates/single/src/resources/main-map.vym +1 -0
  36. package/lib/bundle/cli/kit-game-templates/single/src/style.css +0 -0
  37. package/lib/bundle/cli/kit-game-templates/single/src/types/vylo.d.ts +3850 -0
  38. package/lib/bundle/cli/kit-game-templates/single/src/vendor/vylocity-game-engine/vylo.client.js +19 -0
  39. package/lib/bundle/cli/kit-game-templates/single/tsconfig.json +28 -0
  40. package/lib/cli/init.d.ts +15 -0
  41. package/lib/cli/init.d.ts.map +1 -0
  42. package/lib/cli/init.js +190 -0
  43. package/lib/cli/main.d.ts +13 -0
  44. package/lib/cli/main.d.ts.map +1 -0
  45. package/lib/cli/main.js +16 -0
  46. package/lib/cli/resource-builder.d.ts +6 -0
  47. package/lib/cli/resource-builder.d.ts.map +1 -0
  48. package/lib/cli/resource-builder.js +191 -0
  49. package/lib/cli/types.d.ts +11 -0
  50. package/lib/cli/types.d.ts.map +1 -0
  51. package/lib/cli/types.js +1 -0
  52. package/lib/index.d.ts +2 -1
  53. package/lib/index.d.ts.map +1 -1
  54. package/lib/plugins/network/index.d.ts +7 -0
  55. package/lib/plugins/network/index.d.ts.map +1 -1
  56. package/lib/plugins/network/index.js +18 -5
  57. package/lib/types/vylo.d.ts +3848 -3848
  58. package/package.json +13 -5
@@ -0,0 +1,19 @@
1
+ (()=>{var __webpack_modules__={352:(t,e,r)=>{(e=r(314)(!1)).push([t.id,"\r\nhtml, body, iframe, canvas, input, div {\r\n\tmargin: 0;\r\n\tpadding: 0;\r\n\tborder: 0;\r\n}\r\nhtml, body {\r\n\tbackground-color: #1f232e;\r\n\tfont-size: 12px;\r\n\tfont-family: Courier, monospace;\r\n\tuser-select: none;\r\n\tcursor: default;\r\n\theight: 100%;\r\n}\r\n#fps_label {\r\n\tposition: absolute;\r\n\tcolor: #FFF;\r\n\ttop: 6px;\r\n\tleft: 10px;\r\n\tz-index: 1000000;\r\n\tfont-size: 10px;\r\n\tdisplay: none;\r\n}\r\n#web_background {\r\n\tposition: absolute;\r\n\ttop: 0px;\r\n\tleft: 0px;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\tz-index: 0;\r\n}\r\n#game_body {\r\n\tposition: relative;\r\n\tbackground-color: #000000;\r\n\toverflow: hidden;\r\n\theight: 100%;\r\n}\r\n.web_box, .web_box_child {\r\n\tposition: absolute;\r\n\tbox-sizing: border-box;\r\n\tuser-select: initial;\r\n\toverflow: hidden;\r\n\toverflow-y: auto;\r\n\tword-wrap: break-word;\r\n}\r\n.web_box_child {\r\n\tposition: static;\r\n}\r\n.web_box div.web_box_div, .web_box_child div.web_box_div {\r\n\tdisplay: block;\r\n}\r\n.map_view {\r\n\toverflow: hidden;\r\n}\r\n.map_view canvas {\r\n\tdisplay: block;\r\n\tpointer-events: none;\r\n}\r\n#game_canvas, .game_canvas, #interface_canvas, .interface_canvas, #top_canvas, .top_canvas {\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n}\r\n#interface_canvas, .interface_canvas, #top_canvas, .top_canvas {\r\n\tz-index: 1;\r\n\tpointer-events: none;\r\n}\r\n#top_canvas, .top_canvas {\r\n\tz-index: 99999;\r\n}\r\n.text_input {\r\n\tbackground-color: transparent;\r\n}\r\n.text_input:focus {\r\n\toutline: none;\r\n}\r\n#error_message {\r\n\tposition: absolute;\r\n\tcolor: #ffffff;\r\n\ttop: 30%;\r\n\tleft: 0;\r\n\ttext-align: center;\r\n\tz-index: 1000000;\r\n\tpointer-events: none;\r\n}\r\n\r\n#load_screen {\r\n\tdisplay: none;\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\tbackground: #1f232e;\r\n\tz-index: 2000000;\r\n\tpointer-events: none;\r\n\t-webkit-transition: opacity 0.6s;\r\n\ttransition: opacity 0.6s;\r\n}\r\n#load_screen_login_box_1, #load_screen_login_box_2 {\r\n\tdisplay: none;\r\n\tposition: absolute;\r\n\twidth: 100%;\r\n\theight: 100%;\r\n\tbackground-color: #1f232e;\r\n\tz-index: 100000;\r\n\tpointer-events: all;\r\n}\r\n#load_screen_login_mes_1, #load_screen_login_mes_2 {\r\n\twidth: 55%;\r\n\tmargin: 20% auto 10px auto;\r\n\tpadding: 8px;\r\n\tcolor: #ffffff;\r\n\tbackground-color: #353d50;\r\n\tborder: 1px solid #8793b0;\r\n\tfont-size: 12px;\r\n\ttext-align: center;\r\n}\r\n#load_screen_login_mes_1 a, #load_screen_login_mes_2 a {\r\n\tcolor: #dabf70;\r\n\tfont-weight: bold;\r\n\tcursor: pointer;\r\n}\r\n#load_screen_login_mes_1 a:hover, #load_screen_login_mes_2 a:hover {\r\n\tcolor: #000000;\r\n\tbackground-color: #dabf70;\r\n}\r\n#load_screen_logo {\r\n\tposition: absolute;\r\n\ttop: 50%;\r\n\tleft: 50%;\r\n\tmargin-left: -105px;\r\n\tmargin-top: -62px;\r\n\twidth: 210px;\r\n\theight: 90px;\r\n\tcursor: pointer;\r\n\tz-index: 2;\r\n\tpointer-events: auto;\r\n\tbackground: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANIAAABaCAYAAADNegj3AAAF0klEQVR4Xu2dO3IUQRBEkcnFFMFFwFfoDjiEHCw4BR4RuhgmhH7EajWrrOyqnunpeXInp7oqK7N/q5Wuvn7/9fcDPzAAAykGrh6MdH//OxWEl2HgyAxcX3/6gJGOrABqL2EAI5XQSJCjM4CRjq4A6i9hACOV0EiQozOAkY6uAOovYQAjldBIkKMzgJGOrgDqL2EgbKQfNx+bB/xy92fx3d4xL417msxpDlvl6RI7cp4RziP17kUbL7VgpJMJYmSBnopv5DwxkvjNht4zRGSWcsUUaSor0hOrVeaMcB7pdW+9RfKMaCO1IlUl4ST6kHAEH8FktnaR2l2hRGJG6opgIrm5/GTwl/Jxa4ngI5jWWpq2dls1PkJEBOOS5caMiNWNGcFHMJHcXH4yeIwkOhJpagTjNql3TFeIVVsmd1vbI8+qCTSSW++tXSSHCOeprV1VEr1Ff9r4S2NFcthLU3vniZEuK79pa3dkI0XEFOEnYuDoufBlvGjMSH6tMatycOO4eHenozjDSOb1N0Z6X1IZQWfEnRk3825qa9dDTMrx58+PcvZwmtx7axfp0cjaqLrYWIrTtCKNTNYIYoocUqMGieLOt4ER0bt5RmKOrA2MtMAAK9JbUkaYRDASf7MhMuGCgYFFBsJbO/iDARgouP6GRBiAAYyEBmCgKwNs7brSS/CjMICRjtJp6uzKAEbqSi/Bj8IARjpKp6mzKwNhI/28u+2aCMFhYGQGPt98ezc9jDRy98htGAYw0jCtIJE9M4CR9tw9ch+GAYw0TCtIZM8MYKQ9d4/ch2GgzEjDVEQiUzKgboWVkLcmJXxrt3WijD83Axhp7v5S3UoMYKSViGaYuRk4jJHU15jdrxi78Vy8kp0bz220wqv83OfnZ4jRx3fzzeIVn4ovdUYLn5Fc4anE3Xguvnp8l2iFV/m5z12hufEV3h1/bbzKX/ULI11g0DWmS7TCq8a6z11huvEV3h1/bbzKX/ULI2EkpaGS52sbIyv886Kz8djaXZDR+ZnPJVrhS9R7EsQV8tbju/lm8ape1S9WJFYkpaGS51mhu0J28arIbDxWpI1WJDXDZbceWWFkx1fCzcYfrT6MhJFCmq8WLkYKCk91x701c/HV47tCcvEqXzeei68eX8XDSBhpkYHsGUEJzzWGi68eX8XDSBgJIy0wkJ1IXOO7eGXsbDzOSMGJwSXaxVc3em/ju/m6+Gp+z+NhJIykNPb43BXuaHhVpJsvRnpmwL28cIl28dWN3tv4br4uvppfjDSpkZRQzp+7n2O58V2h98ar/N3xMRJGemQAI722AkZ65qP396Fcol18dsZU77Mivc9Qtl9cNkxy2YCRXjPgrrgYiRVpcauWFca5Md14o+HVROPmyxlp0jNS9gPRaqG5wuyNr64PI2GkpsuG3kLvHR8jNQpfEcfnSO//mxK2dt6Zi8uGSS4b2Np5ws9OFGztGle4vW093HzVCu7GGw1fXV+zkVQivZ+7WzGVjxuvtzBUvrOPv7f6MBIrEpcNC7OWa+TuRnJnejUTvzxXcaNxojj+ilCUqSdc9ozmClnhvew1Wn3AG75s0EM9IZTg3V/lwUgx5l0hx6LGUe74vfHxzGNIjBTj6Q2KFckjrrcx3Phe9hqNkTRHiwiM5BHnCr033steozGS5ggjNXJ0+lpvY7jxC0p6FQIjNTLKiuQR5wq9N97LXqNXN5JOaQyEeymibokU0WNUTRaXGMj2t/zWbi+twkh76dQ6eWKkRp4xUiNxk76GkRobi5EaiZv0tdWMpIQ3G7/uZcPW9buH963z3dv46gwcPiNhpNuhe4+R+rYHIzXyy4rUSNykr2GkxsZipEbiJn0NIzU2FiM1EjfpaxipsbEYqZG4SV8rM9Kk/FAWDJQwEL61KxmNIDAwKQMYadLGUta6DGCkdflmtEkZwEiTNpay1mUAI63LN6NNygBGmrSxlLUuAxhpXb4ZbVIG/htp0vooCwZWY+AfBQdyfe9S49IAAAAASUVORK5CYII=);\r\n}\r\n#load_screen_loader_back {\r\n\tdisplay: none;\r\n\tposition: absolute;\r\n\ttop: 50%;\r\n\tleft: 50%;\r\n\tmargin-left: -105px;\r\n\tmargin-top: 27px;\r\n\twidth: 210px;\r\n\theight: 28px;\r\n\tz-index: 4;\r\n\tbackground-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANIAAAAcCAYAAAAUe+GGAAABCElEQVR4Xu3bsQ2CABQEUFiOxEUcwLiDjbGxcwo7E5bTztIQ4hVwj54c936uZLzcn+95fg0eAgTWCUzTYRiXDOlxO69L8BaBHQgcT9efLQxpB0dWIS9gSHljCQUChlRwZBXzAoaUN5ZQIGBIBUdWMS9gSHljCQUChlRwZBXzAoaUN5ZQIGBIBUdWMS9gSHljCQUChlRwZBXzAoaUN5ZQIGBIBUdWMS9gSHljCQUChlRwZBXzAoaUN5ZQIGBIBUdWMS/wtyHlP1UCge0KLP5DdrsVfTmBvIAh5Y0lFAgYUsGRVcwLGFLeWEKBgCEVHFnFvIAh5Y0lFAgYUsGRVcwLfIeUj5JAYN8CH0o31RkJeDwlAAAAAElFTkSuQmCC);\r\n}\r\n#load_screen_loader {\r\n\tdisplay: none;\r\n\tposition: absolute;\r\n\ttop: 50%;\r\n\tleft: 50%;\r\n\tmargin-left: -96px;\r\n\tmargin-top: 28px;\r\n\twidth: 200px;\r\n\theight: 18px;\r\n\tbackground-color: #dabf70;\r\n\tz-index: 4;\r\n\tbox-sizing: border-box;\r\n}\r\n#load_screen_loader_text {\r\n\tposition: absolute;\r\n\ttop: 50%;\r\n\tleft: 50%;\r\n\twidth: 80px;\r\n\tmargin-top: 30px;\r\n\tmargin-left: -40px;\r\n\ttext-align: center;\r\n\tz-index: 1010;\r\n\tfont-weight: bold;\r\n\tfont-size: 12px;\r\n\tcolor: #000000;\r\n\tdisplay: none;\r\n}\r\n",""]),t.exports=e},589:(t,e,r)=>{(e=r(314)(!1)).push([t.id,"\r\n#logo_box {\r\n\tdisplay: none;\r\n\tposition: absolute;\r\n\twidth: 106px;\r\n\theight: 45px;\r\n\tbackground-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGoAAAAtCAYAAABGfP5DAAACUklEQVR4Xu2aQU4rMQyG2yUXq8RFYF9xBzaoG1ZwCnZIvRhL0NAGDVYc/44zncnM/3a8l9jO/9mOJ4/98+vH945/Fq/AfgB1Pn8uPtAtB3g43O8IqoMMIKgOIA0hElTvoN6Od8UjPJ6+/v69tFauG/+cDAz7a+2VgmxpMxd3zrdXN0SPYkVJ8cZB5YRFHGo2UXtSmBYxojZLvkratNDNBOXJVi+o8cGXVlHIWTRtvBWl2ZExqHcUmkGDo5pKsUAhrSbnF42lJHQUlBa7pwPI+JqBQjLDc5eh9qQoJVCozdw6JHFS0qKdCG2ZnPo6mfgIiqA6UqCTUPnB2zuo99NTJ0dYZ5gPx5d/B1MriqDmTQCCmld/2DsMCrbIhb8KyA4khY7KxGEiquB1/2yg5CtC6VlkfNa0LrpfO3jt3ZkyvPV+za719zI/LNDFJ6QcAOlAA0JQl6nNApD0tNYRFNj6rApBO4B2d60elPfgliBohqOtq5W/7iuKoMR/xS91mLg1KG+LY0Vdew9BrayitJnB+2HKiroqmVqsVxDrcicopfJu9R3F1rey1md9B1kVae1v3QHgR9loRUT3T3Xw6BTmjSvqLyXQZI+yBHWjJ6Tc5YuKP+y1fhFRu9y9wwT4ArRbyqOsN96qiiIo/ZEVbYkEZSiwqYpCs8GzTqtS9BL2+FryWuu8kw0TqCgEdVGqGlTtMIAC8g4TUbvR1hf1791f/R3ldVS7Xpv6au2lfQQVVVDsJ6iLIHBFNdaf5oIKzD5MBOPfzHaC6gQ1QfUGqpN4Nx3mD2A9Fr+96ha+AAAAAElFTkSuQmCC);\r\n\tbottom: 16px;\r\n\tright: 16px;\r\n\tz-index: 2000002;\r\n\tcursor: pointer;\r\n\ttext-align: right;\r\n\tbox-sizing: border-box;\r\n\ttransition: opacity 0.4s;\r\n\t-webkit-transition: opacity 0.4s;\r\n}\r\n#games_list {\r\n\tposition: absolute;\r\n\twidth: 300px;\r\n\tmin-height: 300px;\r\n\tmax-height: 400px;\r\n\ttop: 50%;\r\n\tleft: 50%;\r\n\tmargin-top: -180px;\r\n\tmargin-left: -150px;\r\n\tz-index: 2000000;\r\n\tdisplay: none;\r\n\tborder-top: 0;\r\n\tbox-sizing: border-box;\r\n\ttransition: opacity 0.4s;\r\n\t-webkit-transition: opacity 0.4s;\r\n}\r\n#games_list .list_entry {\r\n\tfont-size: 12px;\r\n\tpadding: 5px;\r\n\tpadding-left: 0px;\r\n\tcursor: pointer;\r\n\tmin-height: 32px;\r\n\tcolor: #dabf70;\r\n\tbackground-color: #3f4b64;\r\n\tborder: 1px solid #000000;\r\n\ttransition: background 0.4s, border 0.4s;\r\n}\r\n#games_list .list_entry_div {\r\n\tborder-top: 1px solid #000000;\r\n}\r\n#games_list .list_entry_ser {\r\n\tborder-top: 0;\r\n}\r\n#games_list .list_entry span {\r\n\tpadding-top: 1px;\r\n\tmargin-left: 6px;\r\n}\r\n#games_list .list_entry:hover {\r\n\tcolor: #000000;\r\n\tbackground-color: #dabf70;\r\n}\r\n#games_list .list_entry_img {\r\n\twidth: 50px;\r\n\theight: 32px;\r\n\tmargin-bottom: 1px;\r\n\tfloat: left;\r\n}\r\n#games_list .solo_span {\r\n\tdisplay: inline-block;\r\n\tmargin-top: 8px;\r\n\tfont-weight: bold;\r\n}\r\n#games_list .server_name {\r\n\tdisplay: block;\r\n\tfont-weight: bold;\r\n}\r\n#games_list .player_count {\r\n\tdisplay: inline-block;\r\n\tmargin-right: 6px;\r\n}\r\n#games_list .server_list_mes {\r\n\tdisplay: inline-block;\r\n\twidth: 300px;\r\n\tcolor: #ffffff;\r\n\tmargin-top: 50px;\r\n\tfont-size: 12px;\r\n\tfont-weight: bold;\r\n\ttext-align: center;\r\n}\r\n#server_list {\r\n\toverflow-y: auto;\r\n\theight: 190px;\r\n}\r\n.box {\r\n\tborder: 1px solid #8793b0;\r\n\tbackground-color: #353d50;\r\n\tbox-shadow: 0px 1px 2px rgba(0, 0, 0, 0.2);\r\n}\r\n.box_title {\r\n\tpadding: 6px 8px 8px 14px;\r\n\tbackground-color: #252a37;\r\n\tletter-spacing: 0.3px;\r\n\tdisplay: block;\r\n\theight: 16px;\r\n\tborder-top: 1px solid #8793b0;\r\n\tborder-bottom: 1px solid #8793b0;\r\n\t-webkit-user-select: none;\r\n\tuser-select: none;\r\n}\r\n.box_title_inner {\r\n\tcolor: #ffffff;\r\n\tfont-weight: bold;\r\n\tfont-size: 14px;\r\n\tbox-sizing: border-box;\r\n}\r\n.load_screen_login_buttons_box {\r\n\ttext-align: center;\r\n}\r\n.load_screen_vy_login_button, .load_screen_twit_login_button {\r\n\tdisplay: inline-block;\r\n\twidth: 32px;\r\n\theight: 32px;\r\n\tbackground-repeat: no-repeat;\r\n\tbackground-position: center;\r\n\tcursor: pointer;\r\n\tbox-sizing: border-box;\r\n}\r\n.load_screen_vy_login_button {\r\n\tbackground-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAdElEQVRYR2Nsn7zhP8MAAkaQA3bt2j4gTnBz82QYdcBoCIyGAFEhMLOIEyWbpvd9x5ptiVUH00x0NiTWYGLVjTpgNARGQ2A0BEZDgOQQoFV7jei6AJsDSC33sZkx6gCKQoAa6WLUAaMhMBoC8BCgRpYi1wwAHEUEUE1Ol6oAAAAASUVORK5CYII=);\r\n}\r\n.load_screen_twit_login_button {\r\n\tbackground-color: #ffffff;\r\n\tborder: 1px solid #000000;\r\n\tbackground-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAACVklEQVQ4T62Uy08TURTGvzPT14ClPESxQKoGdVOMC0IsRI0hguEPcKkuDHHhBlK3NizcuGDhygXRpeJjYTQGcKvWB1GjNlFDRDoVY1HTlrZM77RzTG8TZKwEFr3JLO6dc3/nu+d89xIzM2owqKagR58SGD7QsaGuDz9SOH3/FfSsCYDR5/fh8vEggjsb8XQxKffRk8Ukn3nwGlcHuzG8z18Fi6dzGJiaw4qnAeTWAGZwYRVeM4cOTQUBCPfuAV1785Ujb5fBxirGe3bhfE+XDXbl+TwmvhhQGppAqlP+46IJLuQBU6CBShhqdYLimVXundFlgJX6iZCPcLF3L/oDO+Ta2ccfMZvTQJ46u1q2wKUixna7EQ5uB8XTeX72S2A0lpUZrGxafh1OC/2BVixZHkSFBnK6/gExQtss3D3SVqnRzViCI+9/Q/G1IMOqzAJRkHVgqySVKJ56QHXYQaUiBr0CN44GKqCUYfKJmQUklHpQOZhIFhRl6ZYFKs8VtbK+brApMNZJCB+qNEj6SM8KjL5LIZpmgJQt2ZONPF4MtKHT614HyhiYnE8hZjgQTVtV2avIzDhcJ3Dv2F/vrTn70ss4Jr9ZII+2qSouCsz2NSPYrK3lsF0RPSdwW8/jzncB3Sgf3F6XikdKiHS5MbK/ySbUDloxcGshhesJExlyVStjC+faHRg/2FJ1WrrwcI71FQPxrEBCkHSw4m0CuTw2RT4qYaLbi5P++v82Qyqa+pzE9FIO08umvE/kcFZazoxQo4pT7W4MtWnwudQNO1rbZ2RLxtkk6A8fkhLkaXRpRgAAAABJRU5ErkJggg==);\r\n}\r\n",""]),t.exports=e},314:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var r=function(t,e){var r=t[1]||"",n=t[3];if(!n)return r;if(e&&"function"==typeof btoa){var i=(o=n,a=btoa(unescape(encodeURIComponent(JSON.stringify(o)))),l="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a),"/*# ".concat(l," */")),s=n.sources.map((function(t){return"/*# sourceURL=".concat(n.sourceRoot||"").concat(t," */")}));return[r].concat(s).concat([i]).join("\n")}var o,a,l;return[r].join("\n")}(e,t);return e[2]?"@media ".concat(e[2]," {").concat(r,"}"):r})).join("")},e.i=function(t,r,n){"string"==typeof t&&(t=[[null,t,""]]);var i={};if(n)for(var s=0;s<this.length;s++){var o=this[s][0];null!=o&&(i[o]=!0)}for(var a=0;a<t.length;a++){var l=[].concat(t[a]);n&&i[l[0]]||(r&&(l[2]?l[2]="".concat(r," and ").concat(l[2]):l[2]=r),e.push(l))}},e}},865:(t,e,r)=>{var n=r(72),i=r(352);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[t.id,i,""]]);var s={insert:"head",singleton:!1};n(i,s);t.exports=i.locals||{}},256:(t,e,r)=>{var n=r(72),i=r(589);"string"==typeof(i=i.__esModule?i.default:i)&&(i=[[t.id,i,""]]);var s={insert:"head",singleton:!1};n(i,s);t.exports=i.locals||{}},72:(t,e,r)=>{"use strict";var n,i=function(){return void 0===n&&(n=Boolean(window&&document&&document.all&&!window.atob)),n},s=function(){var t={};return function(e){if(void 0===t[e]){var r=document.querySelector(e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}t[e]=r}return t[e]}}(),o=[];function a(t){for(var e=-1,r=0;r<o.length;r++)if(o[r].identifier===t){e=r;break}return e}function l(t,e){for(var r={},n=[],i=0;i<t.length;i++){var s=t[i],l=e.base?s[0]+e.base:s[0],_=r[l]||0,u="".concat(l," ").concat(_);r[l]=_+1;var c=a(u),h={css:s[1],media:s[2],sourceMap:s[3]};-1!==c?(o[c].references++,o[c].updater(h)):o.push({identifier:u,updater:v(h,e),references:1}),n.push(u)}return n}function _(t){var e=document.createElement("style"),n=t.attributes||{};if(void 0===n.nonce){var i=r.nc;i&&(n.nonce=i)}if(Object.keys(n).forEach((function(t){e.setAttribute(t,n[t])})),"function"==typeof t.insert)t.insert(e);else{var o=s(t.insert||"head");if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(e)}return e}var u,c=(u=[],function(t,e){return u[t]=e,u.filter(Boolean).join("\n")});function h(t,e,r,n){var i=r?"":n.media?"@media ".concat(n.media," {").concat(n.css,"}"):n.css;if(t.styleSheet)t.styleSheet.cssText=c(e,i);else{var s=document.createTextNode(i),o=t.childNodes;o[e]&&t.removeChild(o[e]),o.length?t.insertBefore(s,o[e]):t.appendChild(s)}}function d(t,e,r){var n=r.css,i=r.media,s=r.sourceMap;if(i?t.setAttribute("media",i):t.removeAttribute("media"),s&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}var p=null,y=0;function v(t,e){var r,n,i;if(e.singleton){var s=y++;r=p||(p=_(e)),n=h.bind(null,r,s,!1),i=h.bind(null,r,s,!0)}else r=_(e),n=d.bind(null,r,e),i=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(r)};return n(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;n(t=e)}else i()}}t.exports=function(t,e){(e=e||{}).singleton||"boolean"==typeof e.singleton||(e.singleton=i());var r=l(t=t||[],e);return function(t){if(t=t||[],"[object Array]"===Object.prototype.toString.call(t)){for(var n=0;n<r.length;n++){var i=a(r[n]);o[i].references--}for(var s=l(t,e),_=0;_<r.length;_++){var u=a(r[_]);0===o[u].references&&(o[u].updater(),o.splice(u,1))}r=s}}}},868:(t,e,r)=>{"use strict";r.d(e,{Q:()=>o});var n,i=function(t,e,r){return"symbol"==typeof e&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})};class s{constructor(t){this.name="",this.up="",this.upArgs=[],this.down="",this.downArgs=[],this.name=t}}const o=(i(n=class{},"ResourceManager"),n.macros={},n.loadedAtlases={},n.loadedSounds={},n.iconsO={},n.iconAtlasO={},n.iconCache={},n.vyrFiles={},n.loadingResources=[],n.fileText={},n.colorMatrix={},n.resources={},n.maps={},n.createMacro=function(t,e,r){const n=new s(e);return this.macros[t][r]=n,n},n.parseMacroFileKeyArgs=function(t){const e=t.split(",");for(const t in e){const r=e[t];"'"===r[0]||'"'===r[0]?e[t]=r.substring(1,r.length-1):"{"===r[0]||"["===r[0]?e[t]=JSON.parse(r):isNaN(r)||(e[t]=parseFloat(r))}return e},n)},181:(t,e,r)=>{"use strict";r.d(e,{c:()=>s});var n=r(518),i=r(428);class s extends i.jG{constructor(){super(),this._vy_preventAutoDisplay=!1,this.getDistFrom=function(t){if(t.isMapObject)return Math.sqrt(Math.pow(this._vy_x+this._vy_xOr-(t._vy_x+t._vy_xOr),2)+Math.pow(this._vy_y+this._vy_yOr-(t._vy_y+t._vy_yOr),2))},this.getDistCenterFrom=function(t){if(t.isMapObject)return Math.sqrt(Math.pow(this._vy_x+this._vy_xOr+this.width/2-(t._vy_x+t._vy_xOr+t.width/2),2)+Math.pow(this._vy_y+this._vy_yOr+this.height/2-(t._vy_y+t._vy_yOr+t.height/2),2))},this.getDistEdgeFrom=function(t){if(t.isMapObject){const e=n.j3.Map._getDistArr[n.j3.Map.dirs.indexOf(this.getDirFromCenter(t))],r=n.j3.Map._getDistArr[n.j3.Map.dirs.indexOf(t.getDirFromCenter(this))];return Math.sqrt(Math.pow(this._vy_x+this._vy_xOr+this.width*e[0]-(t._vy_x+t._vy_xOr+t.width*r[0]),2)+Math.pow(this._vy_y+this._vy_yOr+this.height*e[1]-(t._vy_y+t._vy_yOr+t.height*r[1]),2))}},this.getDirFrom=function(t,e){if(!t)return this._vy_dir;let r=180*this.getAngleFrom(t)/Math.PI;return r>=360?r=0:r<0&&(r=360+r),e?n.j3.Map._cDirs[Math.floor(r/22.5)]:n.j3.Map._dirs[Math.floor(r/22.5)]},this.getDirCenterFrom=function(t,e){if(!t)return this._vy_dir;let r=180*this.getAngleCenterFrom(t)/Math.PI;return r>=360?r=0:r<0&&(r=360+r),e?n.j3.Map._cDirs[Math.floor(r/22.5)]:n.j3.Map._dirs[Math.floor(r/22.5)]},this.getAngleFrom=function(t){if(t.isMapObject)return Math.atan2(t._vy_y+t._vy_yOr-(this._vy_y+this._vy_yOr),this._vy_x+this._vy_xOr-(t._vy_x+t._vy_xOr))+Math.PI},this.getAngleCenterFrom=function(t){if(t.isMapObject)return Math.atan2(t._vy_y+t._vy_yOr+t.height-(this._vy_y+this._vy_yOr+this.height),this._vy_x+this._vy_xOr+this.width-(t.width+t._vy_xOr+t.width))+Math.PI},this.checkIntersectWith=function(t){return!(!t||!t._vy_id||this._vy_x+this._vy_xOr+this.width<=t._vy_x+t._vy_xOr||this._vy_x+this._vy_xOr>=t._vy_x+t._vy_xOr+t.width||this._vy_y+this._vy_yOr+this.height<=t._vy_y+t._vy_yOr||this._vy_y+this._vy_yOr>=t._vy_y+t._vy_yOr+t.height)},this.checkCollideAt=function(t,e,r,n){if(!this._vy_map||!this._vy_density)return null;void 0===t&&(t=this._vy_x+this._vy_xOr),void 0===e&&(e=this._vy_y+this._vy_yOr),void 0===r&&(r=this._vy_w),void 0===n&&(n=this._vy_h);const i=Math.ceil(t/this._vy_map._vy_tileW),s=Math.ceil(e/this._vy_map._vy_tileH),o=i+(Math.floor(r/this._vy_map._vy_tileW)+1),a=s+(Math.floor(n/this._vy_map._vy_tileH)+1);for(let l=s;l<=a;l++)for(let s=i;s<=o;s++){const i=this._vy_map._vy_tiles[s+this._vy_map._vy_xMax*l];if(i){if(i._vy_density&&(i._vy_density>this._vy_density||i._vy_density==this._vy_density&&!i.allowDensityCross)&&!(i._vy_x+i._vy_w<=t||i._vy_x>=t+r||i._vy_y+i._vy_h<=e||i._vy_y>=e+n))return i;if(i._vy_conts)for(let s=i._vy_conts.length;s--;){const o=i._vy_conts[s];if(o!==this&&o._vy_density&&(o._vy_density>this._vy_density||o._vy_density==this._vy_density&&!o.allowDensityCross)){if(o._vy_x+o._vy_xOr+o._vy_w<=t||o._vy_x+o._vy_xOr>=t+r||o._vy_y+o._vy_yOr+o._vy_h<=e||o._vy_y+o._vy_yOr>=e+n)continue;return o}}}}return null}}get isMapObject(){return!0}set isMapObject(t){}get preventAutoDisplay(){return this._vy_preventAutoDisplay}set preventAutoDisplay(t){this._vy_preventAutoDisplay=t}}},602:(t,e,r)=>{"use strict";r.d(e,{B:()=>i});var n=r(758);class i extends n.T{constructor(){super(),this._vy_layer=4,this._vy_density=1,this._vy_clientC=null,this.onLogin=null,this.onLogout=null,this.getClient=function(){return this._vy_clientC}}get isMob(){return!0}set isMob(t){}get client(){return this._vy_clientC}set client(t){t?t.mob=this:this._vy_clientC&&this._vy_clientC._vy_setPlayerMob(null)}}},532:(t,e,r)=>{"use strict";r.d(e,{h:()=>i});var n=r(428);class i extends n.jG{constructor(){super(),this._vy_isOverlay=!0,this._vy_plane=1,this._vy_layer=5,this._vy_parent=null,this._vy_mouseOp=0,this.setOrigin=function(t,e){this._vy_xOr=t,this._vy_yOr=e},this.getOrigin=function(){return{x:null,y:null}},this.setLoc=function(t,e,r){},this.getLoc=function(){},this.getLocs=function(){},this.setCoords=function(t,e,r){}}get isOverlay(){return this._vy_isOverlay}set isOverlay(t){}get parent(){return this._vy_parent}set parent(t){}set xOrigin(t){}get xOrigin(){}set yOrigin(t){}get yOrigin(){}get loc(){return this._vy_loc}set loc(t){}set xCoord(t){}get xCoord(){return 0}set yCoord(t){}get yCoord(){return 0}}},960:(t,e,r)=>{"use strict";r.d(e,{J:()=>s});var n=r(758),i=r(868);class s extends n.T{constructor(){super(),this._vy_isParticle=!0,this._vy_layer=5,this._vy_plane=2,this._vy_preventScreenRelayer=!0,this._vy_mouseOp=0,this._vy_isCullable=!1,this._vy_setPos=function(t,e,r){if(r&&this._vy_setMap(r,t,e,!0),this.onRelocated){const n=this._vy_x,i=this._vy_y;this._vy_x=t,this._vy_y=e,this.onRelocated(n,i,r||this._vy_mapN)}else this._vy_x=t,this._vy_y=e;this._vy_onScr&&this._vy_pixS&&this._vy_pixS.position.set(this._vy_x+this._vy_xIcoOff+this._vy_icoW*this._vy_pixS.anchor.x,this._vy_y+this._vy_yIcoOff+this._vy_icoH*this._vy_pixS.anchor.y)},this._vy_setMap=function(t,e,r,n){var s,o,a;if(this._vy_mapN===t&&!n)return;const l=this._vy_mapN;if(this._vy_map){const t=this._vy_map._vy_particles.indexOf(this);-1!==t&&this._vy_map._vy_particles.splice(t,1)}if(null===(s=this._vy_onScr)||void 0===s||s._vy_removeFromScreen(this),t){i.Q.maps[t]||i.Q.loadMap(t);const s=i.Q.maps[t];s._vy_particles.includes(this)||s._vy_particles.push(this),this._vy_mapN=t,this._vy_map=s,null===(o=s._vy_mapView)||void 0===o||o._vy_addToScreen(this),n||this._vy_setPos(e,r,l)}else this._vy_mapN=null,this._vy_map=null,n||this._vy_setPos(-1e5,-1e5,l);null===(a=this.onMapChange)||void 0===a||a.call(this,l,!1)},this.setPos=function(t,e,r){r&&this._vy_mapN!==r?this._vy_setMap(r,t,e):this._vy_setPos(t,e)},this.setLoc=function(t,e,r){if(!t)return void this._vy_setMap(r,-1e5,-1e5);let n=t,s=e,o=this._vy_map;if(r){if("number"==typeof t){if(o=i.Q.maps[r],!e)return}else if(t._vy_isLoc)o=i.Q.maps[t._vy_mapN],n=Math.floor(t._vy_x/o._vy_tileW)+1,s=Math.floor(t._vy_y/o._vy_tileH)+1,r=t._vy_mapN;else{if(!t.loc)return;o=i.Q.maps[t._vy_mapN],n=Math.floor(t._vy_loc._vy_x/o._vy_tileW)+1,s=Math.floor(t._vy_loc._vy_y/o._vy_tileH)+1,r=t._vy_mapN}this._vy_setMap(r,(n-1)*o._vy_tileW,(s-1)*o._vy_tileH)}else this._vy_setPos((n-1)*o._vy_tileW,(s-1)*o._vy_tileH)},this.setCoords=null,this.setCoordOffsets=null,this.step=null,this.stepDir=null,this.stepPos=null,this.move=null,this.moveDir=null,this.movePos=null}get isParticle(){return!0}set isParticle(t){}get x(){return this._vy_x}set x(t){this._vy_setPos(t,this._vy_y)}get xPos(){return this._vy_x}set xPos(t){this._vy_setPos(t,this._vy_y)}get y(){return this._vy_y}set y(t){this._vy_setPos(this._vy_x,t)}get yPos(){return this._vy_y}set yPos(t){this._vy_setPos(this._vy_x,t)}}},585:(t,e,r)=>{"use strict";r.d(e,{T:()=>i});var n=r(428);class i extends n.jG{constructor(){super(),this._vy_isRegion=!0,this.onEntered=null,this.onExited=null,this.setOrigin=function(t,e){},this.setPos=function(t,e,r){},this.setLoc=function(t,e,r){},this.getLoc=function(){return this},this.getLocs=function(){return[this]},this.setCoords=function(t,e,r){},this.setCoordOffsets=null,this.setIconOffsets=function(t,e){},this.getRegion=function(){return this},this.setSize=function(t,e){},this.getSize=function(){return{width:0,height:0}}}get isRegion(){return!0}set isRegion(t){}set xOrigin(t){}get xOrigin(){return this._vy_xOr}set yOrigin(t){}get yOrigin(){return this._vy_yOr}get x(){return this._vy_x}set x(t){}get xPos(){return this._vy_x}set xPos(t){}get y(){return this._vy_y}set y(t){}get yPos(){return this._vy_y}get loc(){return this}set loc(t){}set xCoord(t){}get xCoord(){return 0}set yCoord(t){}get yCoord(){return 0}get width(){return 0}set width(t){}get height(){return 0}set height(t){}}},708:(t,e,r)=>{"use strict";r.d(e,{z:()=>s});var n=r(518),i=r(140);class s{constructor(){this._vy_type="",this._vy_parentT=null,this._vy_tickerOb=null,this.onNew=null,this.onDel=null,this.onTickerAdd=null,this.onTickerRemove=null,this.onTick=null,this.getType=function(){return this._vy_type},this.getBaseType=function(){var t,e;return null===(e=null===(t=this._vy_parentT)||void 0===t?void 0:t._vy_baseType)||void 0===e?void 0:e._vy_type},this.getParentType=function(){var t,e;return null===(e=null===(t=this._vy_parentT)||void 0===t?void 0:t._vy_parentType)||void 0===e?void 0:e._vy_type},this.setStaticVariable=function(t,e){n.j3.Type.setStaticVariable(this._vy_type,t,e)},this.getStaticVariable=function(t){return n.j3.Type.getStaticVariable(this._vy_type,t)},this.startTicker=function(t){var e,r;if(!(null===(e=this._vy_tickerOb)||void 0===e?void 0:e._vy_isActive)){if(t)if(t._vy_isTickerOb)this._vy_tickerOb=t;else{this._vy_tickerOb||(this._vy_tickerOb=i.P.createTickerObject(this));for(const e in t)this._vy_tickerOb[e]=t[e]}else this._vy_tickerOb||(this._vy_tickerOb=i.P.createTickerObject(this));this._vy_tickerOb._vy_currTick=0,this._vy_tickerOb._vy_delta=0,this._vy_tickerOb._vy_isActive=!0,i.P.tickers.push(this._vy_tickerOb),null===(r=this.onTickerAdd)||void 0===r||r.call(this)}},this.stopTicker=function(){var t;const e=i.P.tickers.indexOf(this._vy_tickerOb);-1!==e&&(i.P.tickers.splice(e,1),this._vy_tickerOb._vy_isActive=!1,null===(t=this.onTickerRemove)||void 0===t||t.call(this))}}get typeOb(){return this._vy_parentT}set typeOb(t){}get type(){return this._vy_type}set type(t){}get baseType(){var t,e;return null===(e=null===(t=this._vy_parentT)||void 0===t?void 0:t._vy_baseType)||void 0===e?void 0:e._vy_type}set baseType(t){}get parentType(){var t,e;return null===(e=null===(t=this._vy_parentT)||void 0===t?void 0:t._vy_parentType)||void 0===e?void 0:e._vy_type}set parentType(t){}get tickerOb(){return this._vy_tickerOb||(this._vy_tickerOb=i.P.createTickerObject(this)),this._vy_tickerOb}set tickerOb(t){if(t){if(t._vy_isTickerOb)this._vy_tickerOb=t;else{this._vy_tickerOb=i.P.createTickerObject(this);for(const e in t)this._vy_tickerOb[e]=t[e]}this._vy_tickerOb._vy_isActive&&this.startTicker()}else this._vy_tickerOb&&this.stopTicker()}get inTicker(){return this.tickerOb}set inTicker(t){this.tickerOb=t}}},917:(t,e,r)=>{"use strict";r.d(e,{M:()=>o});var n=r(708),i=r(518),s=r(140);class o extends n.z{constructor(){super(),this._vy_isIntPane=!0,this._vy_name="",this._vy_client=null,this._vy_conts=null,this._vy_aContents=null,this._vy_isShown=!1,this._vy_onScr=null,this._vy_alpha=1,this.onShow=null,this.onHide=null,this.onAddChild=null,this.onRemoveChild=null,this._vy_addChild=function(t){var e,r,n;if(!t._vy_gui)return t;let s=null;if(t._vy_pane&&(s=t._vy_pane,t._vy_pane._vy_removeChild(t,!0,!0)),!t._vy_dom||t._vy_dom.id||t._vy_domID||(t.isTextInput?t._vy_dom.id="ti_"+this._vy_name.replace(/ /g,"")+"_"+t._vy_name:t._vy_dom.id="wb_"+this._vy_name.replace(/ /g,"")+"_"+t._vy_name),this._vy_aContents[t._vy_name]=t,this._vy_conts.push(t),t._vy_pane=this,null===(e=this.onAddChild)||void 0===e||e.call(this,t),null===(r=t.onPaneChange)||void 0===r||r.call(t,s),this._vy_isShown&&!t.isHidden&&this._vy_onScr&&(i.up.addToInterface(t),null===(n=t.onShow)||void 0===n||n.call(t,this._vy_client)),t._vy_children)for(const e of t._vy_children)this._vy_addChild(e)},this._vy_removeChild=function(t,e,r){var n;t._vy_onScr&&i.up.removeFromInterface(t),null===(n=this.onRemoveChild)||void 0===n||n.call(this,t),this._vy_isShown&&!t.isHidden&&t.onHide&&t.onHide(this._vy_client),t.onPaneChange&&!r&&t.onPaneChange(this),t._vy_pane=null;const o=this._vy_conts.indexOf(t);if(-1!==o&&this._vy_conts.splice(o,1),delete this._vy_aContents[t._vy_name],t._vy_children)for(const n of t._vy_children)this._vy_removeChild(n,e,r);e||s.P.deleteDiob(t)},this.show=function(t,e){var r,n,s,o,a;if(t){const e=this._vy_aContents[t];e&&(e.isHidden=!1,e._vy_parent&&e._vy_parent._vy_dom.appendChild(e._vy_dom),this._vy_onScr&&i.up.addToInterface(e),null===(r=e.onShow)||void 0===r||r.call(e,this._vy_client))}if(!this._vy_isShown){this._vy_isShown=!0,this._vy_onScr="interface";for(let t=0,r=this._vy_conts.length;t<r;t++){const r=this._vy_conts[t];!r||r.isHidden&&!e||(i.up.addToInterface(r),r.isHidden=0,null===(n=r.onShow)||void 0===n||n.call(r,this._vy_client))}null===(s=this.onShow)||void 0===s||s.call(this,this._vy_client),null===(a=(o=this._vy_client).onInterfaceShow)||void 0===a||a.call(o,this._vy_name)}},this.hide=function(t){var e,r,n,s;if(t){const r=this._vy_aContents[t];r&&(r.isHidden=!0,r._vy_parent&&r._vy_dom.remove(),null===(e=r.onHide)||void 0===e||e.call(r,this._vy_client),r._vy_onScr&&i.up.removeFromInterface(r))}else{this._vy_isShown=!1,this._vy_onScr=null;for(let t=0,e=this._vy_conts.length;t<e;t++){const e=this._vy_conts[t];if(e._vy_appMask){if(e._vy_onScr=null,e._vy_onScrAnim){if(e._vy_appMask.ownAnim){const t=i.up.screenAnimations.indexOf(e);-1!==t&&i.up.screenAnimations.splice(t,1)}e._vy_onScrAnim=!1}}else i.up.removeFromInterface(e);!e.isHidden&&e.onHide&&e.onHide(this._vy_client)}null===(r=this.onHide)||void 0===r||r.call(this,this._vy_client),null===(s=(n=this._vy_client).onInterfaceHide)||void 0===s||s.call(n,this._vy_name)}},this.addChild=function(t){return this._vy_addChild(t)},this.removeChild=function(t,e){this._vy_removeChild(t,e)},this.getChild=function(t){return this._vy_aContents[t]},this.getChildren=function(t,e){const r=[];for(const n of this._vy_conts)n&&(t&&!s.P.isType(n._vy_type,t,e)||r.push(n));return r}}get isInterfacePane(){return!0}set isInterfacePane(t){}get name(){return this._vy_name}set name(t){}get isShown(){return this._vy_isShown}set isShown(t){t?this.show():this.hide()}get alpha(){return this._vy_alpha}set alpha(t){this._vy_alpha=t;for(const e of this._vy_conts)e&&(e.alpha=t)}}},145:(t,e,r)=>{"use strict";r.d(e,{k:()=>s});var n=r(518),i=r(725);class s extends i.U{constructor(){super(),this._vy_isTextInput=!0,this._vy_isMultiline=!1,this._vy_isPasswordInput=!1,this._vy_isCommandInput=!1,this._vy_maxLength=null,this._vy_placeholder="",this._vy_tabIndex=null,this._vy_initiate=function(){let t;this._vy_isMultiline?(t=document.createElement("textarea"),t.style.resize="none",t.autocomplete="off"):(t=document.createElement("input"),this._vy_isPasswordInput?(t.type="password",t.autocomplete="new-password"):t.autocomplete="off"),t.classList.add("web_box"),this._vy_maxLength&&(t.maxLength=this._vy_maxLength),this._vy_placeholder&&(t.placeholder=this._vy_placeholder),this._vy_tabIndex&&(t.tabIndex=this._vy_tabIndex),t.classList.add("text_input"),this._vy_pane&&!this._vy_domID&&(t.id="ti_"+this._vy_pane._vy_name.replace(/ /g,"")+"_"+this._vy_name),this._vy_text&&(t.value=this._vy_text),t.inputChange=function(t){this._vy_parent._vy_text=this.value},t.onkeydown=function(t){this.inputChange(t)},t.onkeyup=function(t){this.inputChange(t)},t.addEventListener("focus",(()=>{n.um.setFocus(this)})),t.addEventListener("blur",(()=>{n.um.setFocus()})),this._vy_atlas&&!t.style.backgroundRepeat&&(t.style.backgroundRepeat="no-repeat"),!this._vy_xIcoOff&&!this._vy_yIcoOff||t.style.backgroundPosition||(t.style.backgroundPosition=`${this._vy_xIcoOff}px ${this._vy_yIcoOff}px`),t.style.zIndex=this._vy_plane,this._vy_dom=t,t._vy_parent=this,this._vy_scaleWebBox()}}get isTextInput(){return!0}set isTextInput(t){}get isMultiline(){return this._vy_isMultiline}set isMultiline(t){this._vy_isMultiline=t}get isPasswordInput(){return this._vy_isPasswordInput}set isPasswordInput(t){this._vy_isPasswordInput=t}get isCommandInput(){return this._vy_isCommandInput}set isCommandInput(t){this._vy_isCommandInput=t}get maxLength(){return this._vy_maxLength}set maxLength(t){this._vy_maxLength=t,this._vy_dom&&(this._vy_dom.maxLength=t)}get placeholder(){return this._vy_placeholder}set placeholder(t){this._vy_placeholder=t,this._vy_dom&&(this._vy_dom.placeholder=t)}get tabIndex(){return this._vy_tabIndex}set tabIndex(t){this._vy_tabIndex=t,this._vy_dom&&(this._vy_dom.tabIndex=t)}}},518:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Bn:()=>defM,Me:()=>_vy_t_xTileSize,R5:()=>soundM,U3:()=>serM,Ze:()=>_vy_t_yTileSize,a$:()=>gameM,aK:()=>_vy_t_windowPar,j3:()=>VYLO,um:()=>_vy_cOb,up:()=>scrM,vC:()=>mainM,vX:()=>urlPar});var _object_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(140),_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(868);let _vy_t_windowPar=window.parent;try{window.parent.urlPar}catch(t){_vy_t_windowPar=window}const mainM=globalThis.mainM=class{};mainM.game={sound:!0};const soundM={};let urlPar=_vy_t_windowPar.urlPar||void 0,serM,localM;const VYLO=globalThis.VYLO=globalThis.VS=class{static Map=null;static Type=null;static Client=null;static Macro=null;static Event=null;static Resource=null},scrM=globalThis.scrM={};let gameM=globalThis.gameM={},_vy_cOb=globalThis._vy_cOb={},_vy_t_xTileSize=32,_vy_t_yTileSize=32;globalThis.vyM||(globalThis.vyM={});const vyM=globalThis.vyM;serM||(serM={}),serM.remSockets=[],serM.remConnections=[],serM.packetDelay=20,serM.serverPath=location.origin+(/(?:\.([^.]+))?$/.exec(location.pathname)[1]?location.pathname.substr(0,location.pathname.lastIndexOf("/")+1):location.pathname),"/"===serM.serverPath[serM.serverPath.length-1]&&(serM.serverPath=serM.serverPath.substr(0,serM.serverPath.length-1)),serM.resourceServer=serM.serverPath;const defM={imgPre:"data:image/png;base64,",gameMedBanner:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAgCAYAAABQISshAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAVxJREFUeNrs2M8rw3Ecx/F9GWllJX+AHJRSykk5ys2BE+WonDSH/RG2hfzYTXGRg1wkpYhdtFo7DDmstJbSHBUlUb57fup9Ukq274/3fN71aKe1vft+vp/36/NxXNeNtEK1RVqkbCO2EY8q2siXZ7PTm3y0Yxm1Zv6xg8SRr09kCIu4xRr6tC+tXiSloW0MaH9H4ljANfYxrP1lj2EORZjFPqp91+rEFPI4xzgczduv+Z0JXOAKk+jQPkfGcIICZtClfSCOmHGBEubRrX2yD2IHN1hCj/aI0g+TFCpY9TWieFCP2MWx1kaq2MAenn0PjU2oMlZwiNfA0m8DZXaqtCyh98Bj/B8qL5H/DJ+hOY/8sr5wiRRy8OS2w8tGPnAqDRRCfUL8od4k8WbkfBL+o+63epHIYXahe1VndkkGZs2vYwsPKi8fJB/dSaR4CnIgOfbK1DZiG/kfjdQFGAAn2kGLy2vQHQAAAABJRU5ErkJggg==",blankIcon:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",appMaskS:{ownState:!0}};window.oncontextmenu=function(){return!1},mainM.inputTypeButton=["button","checkbox","submit","reset","radio","file","range"],window.addEventListener("focus",(function(t){t.target===window?_vy_cOb&&_vy_cOb._vy_initiated&&_vy_cOb.onWindowFocus&&_vy_cOb.onWindowFocus():t.target?.tagName&&("textarea"===t.target.tagName.toLowerCase()||"input"===t.target.tagName.toLowerCase()&&!mainM.inputTypeButton.includes(t.target.type.toLowerCase()))&&_vy_cOb&&(_vy_cOb._vy_inInput=t.target)}),!0),window.addEventListener("blur",(function(t){_vy_cOb&&mainM.isInitialized&&(_vy_cOb._vy_clearKeyDownEvents(),t.target===window?_vy_cOb._vy_initiated&&(_vy_cOb._vy_focused&&(_vy_cOb._vy_focused._vy_gui&&mainM.serSocket?.sendPacket([5,2,_vy_cOb._vy_focused._vy_id,_vy_cOb._vy_focused.getText()]),_vy_cOb._vy_onUnfocus(_vy_cOb._vy_focused)),_vy_cOb.onWindowBlur?.()):t.target?.tagName&&("textarea"===t.target.tagName.toLowerCase()||"input"===t.target.tagName.toLowerCase()&&!mainM.inputTypeButton.includes(t.target.type.toLowerCase()))&&(_vy_cOb._vy_inInput=null))}),!0),window.onresize=function(){_vy_cOb&&mainM.isInitialized?(mainM.setWindowSize(),_vy_cOb.onWindowResize?.(window.innerWidth,window.innerHeight)):mainM.resizeWindow=!0},window.onunload=function(){_vy_cOb._vy_initiated&&_vy_cOb._vy_disconnected(),VYLO.World.onDel?.()},window.addEventListener("message",(function(t){t.data.type&&("playerAcc"===t.data.type?(mainM.playerAcc=t.data.obj,mainM.scaleWidth=t.data.scaleWidth,mainM.scaleHeight=t.data.scaleHeight,mainM.serSocket?.sendPacket([13,{result:!0,playerAcc:mainM.playerAcc,localStorage:t.data.localStorage,navigator:_vy_cOb._vy_navigator,urlPar}])):"changeServer"===t.data.type?(0!==t.data.address.indexOf("http")&&(t.data.address=location.protocol+"//"+t.data.address),location.href=t.data.address):"toggleSound"===t.data.type&&(mainM.game.sound=t.data.sound))}),!1),document.onvisibilitychange=function(){"visible"===document.visibilityState?scrM.resumeRender&&!mainM.disconnected&&(scrM.resumeRender(),_vy_cOb._vy_mapView?._vy_eye&&_vy_cOb._vy_mapView._vy_setViewFromPos(_vy_cOb._vy_mapView._vy_eye._vy_x,_vy_cOb._vy_mapView._vy_eye._vy_y,!0)):"hidden"===document.visibilityState&&scrM.pauseRender&&scrM.pauseRender(0,1)},globalThis.dE=function(t,e,r){if(!mainM.codeFiles)return void console.log(r);let n="Error:"+mainM.codeFiles[e]+":"+t+": "+r;n.indexOf("TypeError: ")&&(n=n.replace("TypeError: ","")),n.indexOf("not a function")&&n.indexOf("_vy_global.")&&(n=n.replace("_vy_global.","")),console.log(n),_vy_cOb?.outputText?.(n),VYLO.World.onError?.(n)},mainM.initiate=function(){if(_vy_cOb=VYLO.Client,serM&&globalThis._vy_ser){const t=serM.serverAddress?serM.serverAddress.split(":"):"";if(!t||t[0]&&"undefined"!==t[0]?serM.serverAddress=location.hostname+":"+location.port:serM.serverAddress=location.hostname+":"+t[1],!gameM.mainServer||serM.serverAddress&&":"!==serM.serverAddress||(serM.serverAddress=gameM.mainServer),mainM.playerAcc={name:"Guest",guest:!0},mainM.serSocketAdd=("https:"!==location.protocol?"ws://":"wss://")+serM.serverAddress,"file:"===location.protocol&&gameM.mainServer){const t=gameM.mainServer.split("://");mainM.serSocketAdd=("https"!==t[0]?"ws://":"wss://")+(t[1]?t[1]:t[0])}mainM.serSocketAdd.substring(4,mainM.serSocketAdd.length-1).includes(":")?mainM.createWebSocket():_vy_cOb._vy_clientID=1}else _vy_cOb._vy_clientID=1;if(!globalThis.vyM.disableVy){globalThis.vyM.disableLoad||mainM.showLoadScreen();const t=function(){window.open("https://www.vylocity.com/")};document.getElementById("load_screen_logo").onclick=t,globalThis.vyM.disableAPI||(mainM.gamesList=document.getElementById("games_list"),document.getElementById("logo_box").onclick=t)}localM&&mainM.parseLocalM()},mainM.initialized=function(){mainM.isInitialized||(mainM.isInitialized=!0,mainM.serSocket?globalThis.vyM.disableAPI?mainM.serSocket.sendPacket([13,{result:!0,playerAcc:mainM.playerAcc,localStorage:window.locStorage,navigator:_vy_cOb._vy_navigator,urlPar}]):window.parent.postMessage("getPlayerAcc","*"):globalThis.vyM.disableAPI?_vy_cOb._vy_initiate():_vy_t_windowPar.authenticateGameAccount((function(){_vy_cOb._vy_initiate()})))},mainM.finishInitialize=function(){mainM.inServerList&&mainM.hideServerList(),globalThis.vyM.disableLoad||(gameM.loadScreen?mainM.showCustomLoadScreen():mainM.showLoadScreen()),_vy_cOb._vy_clientID?_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_1__.Q.typesLoaded():_vy_cOb._vy_typesLoadedQueue=1},mainM.parseLocalM=function(){localM=JSON.parse(localM),localM.resourceServer&&(serM.resourceServer=localM.resourceServer)},mainM.setLocalM=function(){locSetLocalM(JSON.stringify(localM))},mainM.showServerList=function(){mainM.inServerList=!0,mainM.gamesList.style.display="block";document.getElementById("logo_box").style.display="block"},mainM.hideServerList=function(){mainM.inServerList=!1,mainM.gamesList.style.display="none",document.getElementById("logo_box").style.display="none"},mainM.joinNewServer=function(t,e){(!e||"player_list_toggle"!=e.target.className&&"player_list_toggle"!=e.target.parentNode.className)&&(mainM.gamesList.style.display="none",mainM.changeServer(t))},mainM.changeServer=function(t){if(localM&&mainM.setLocalM(),mainM.serSocket)0!==t.indexOf("http")&&(t=location.protocol+"//"+t),globalThis.vyM.disableAPI?location.href=t:window.parent.postMessage('{"type": "changeServer", "address": "'+t+'"}',"*");else{const e=urlPar?"?"+urlPar:"";0!==t.indexOf("http")&&(t="https://"+t),globalThis.vyM.disableAPI?location.href=t+e:_vy_t_windowPar.authenticateGameAccount((function(){location.href=t+e}))}},mainM.scriptLoader=function(t,e){for(i=0,len=t.length;i<len;i++){const r=document.createElement("script");r.setAttribute("type","text/javascript"),r.setAttribute("src",t[i]+"?v="+mainM.codeVersion),e&&(r.onload=e),document.getElementsByTagName("head")[0].appendChild(r)}},mainM.setGameSettings=async function(){gameM=VYLO.World,gameM.tileSize||(gameM.tileSize={width:32,height:32}),gameM.tileSize.width||gameM.tileSize.height?(gameM.tileSize.width||(gameM.tileSize={width:32,height:gameM.tileSize.height}),gameM.tileSize.height||(gameM.tileSize={width:gameM.tileSize.width,height:32})):gameM.tileSize={width:gameM.tileSize,height:gameM.tileSize},gameM.playerMode||(gameM.playerMode=1),gameM.gameHeight||(gameM.gameHeight=540),gameM.gameWidth||(gameM.gameWidth=960),gameM.resourceServer&&"file:"!==location.protocol&&(serM.resourceServer=gameM.resourceServer),gameM.packetDelay&&(serM.packetDelay=gameM.packetDelay),gameM.trial||(gameM.trial=0),gameM.origWidth=gameM.gameWidth,gameM.origHeight=gameM.gameHeight,scrM.intApp=new PIXI.Application,scrM.intApp.stageScale=new PIXI.Container,scrM.intApp.stageScale.scale.set(mainM.scaleWidth,mainM.scaleHeight),scrM.intApp.stage.addChild(scrM.intApp.stageScale);const t={width:gameM.gameWidth,height:gameM.gameHeight,backgroundAlpha:0,view:mainM.intCanvasControl,autoStart:!1,sharedTicker:!0};if(_vy_cOb._vy_renderOptions)for(const e in _vy_cOb._vy_renderOptions)"view"!==e&&"sharedTicker"!==e&&(t[e]=_vy_cOb._vy_renderOptions[e]);await scrM.intApp.init(t),scrM.pixiAppOp=new PIXI.Application;const e={width:gameM.gameWidth,height:gameM.gameHeight,backgroundAlpha:0,sharedTicker:!0};if(_vy_cOb._vy_renderOptions)for(const t in _vy_cOb._vy_renderOptions)"sharedTicker"!==t&&(e[t]=_vy_cOb._vy_renderOptions[t]);await scrM.pixiAppOp.init(e)},mainM.dE=function(t,e,r,n){let i="Error: ";"object"==typeof e?(e._vy_type?i+=e.name+" ("+e._vy_type+"."+t+")":i+="unknown",i+="\n\t "+n):i+=e,console.log(i),_vy_cOb.outputText(i),VYLO.World.onError?.(i)},mainM.getWindowSize=function(){let t=window.innerWidth,e=window.innerHeight;if(_vy_cOb.screenView.scaleTo)if("none"===_vy_cOb.screenView.scaleTo)_vy_cOb.screenView.preventAutoResize?(t=gameM.gameWidth,e=gameM.gameHeight):(gameM.gameWidth=t,gameM.gameHeight=e);else if("multiAspect"===_vy_cOb.screenView.scaleTo){if(t/e!==gameM.gameWidth/gameM.gameHeight)if(t>=2*gameM.gameWidth&&e>=2*gameM.gameHeight){const r=gameM.gameWidth>gameM.gameHeight?Math.floor(e/gameM.gameHeight):Math.floor(t/gameM.gameWidth);t=gameM.gameWidth*r,e=gameM.gameHeight*r}else t=gameM.gameWidth,e=gameM.gameHeight}else if("ratio"===_vy_cOb.screenView.scaleTo){const r=Math.min(t/gameM.gameWidth,e/gameM.gameHeight);t=gameM.gameWidth*r,e=gameM.gameHeight*r}else if("multiple"===_vy_cOb.screenView.scaleTo)if(t>=2*gameM.gameWidth&&e>=2*gameM.gameHeight){const r=gameM.gameWidth>gameM.gameHeight?Math.floor(e/gameM.gameHeight):Math.floor(t/gameM.gameWidth);t=gameM.gameWidth*r,e=gameM.gameHeight*r}else t=gameM.gameWidth,e=gameM.gameHeight;return{width:t,height:e}},mainM.setWindowSize=function(){if(!gameM)return;const t=mainM.getWindowSize();mainM.scaleWidth=t.width/gameM.gameWidth,mainM.scaleHeight=t.height/gameM.gameHeight;const e=_vy_cOb.screenView;let r,n,i=this._vy_xAutoScale,s=this._vy_yAutoScale;if(e.minView){if(e.minView.width&&e.minView.width>t.width)if(e.autoScaleMulti){const n=e.minView.width/e.autoScaleMulti;r=Math.floor(t.width/n)*n/e.minView.width,r||(r=1/e.autoScaleMulti)}else r=t.width/e.minView.width;if(e.minView.height&&e.minView.height>t.height)if(e.autoScaleMulti){const r=e.minView.height/e.autoScaleMulti;n=Math.floor(t.height/r)*r/e.minView.height,n||(n=1/e.autoScaleMulti)}else n=t.height/e.minView.height;e.autoScaleMulti&&(n=r=Math.min(r||1,n||1))}if(e.maxView){if(e.maxView.width&&e.maxView.width<t.width)if(e.autoScaleMulti){const n=e.maxView.width*e.autoScaleMulti;r=Math.ceil(t.width/n)*n/e.maxView.width}else r=t.width/e.maxView.width;if(e.maxView.height&&e.maxView.height<t.height)if(e.autoScaleMulti){const r=e.maxView.height*e.autoScaleMulti;n=Math.ceil(t.height/r)*r/e.maxView.height}else n=t.height/e.maxView.height;e.autoScaleMulti&&(n=r=Math.min(r||1,n||1))}r?mainM.scaleWidth=e._vy_xAutoScale=r:e._vy_xAutoScale=mainM.scaleWidth,n?mainM.scaleHeight=e._vy_yAutoScale=n:e._vy_yAutoScale=mainM.scaleHeight,e.xAutoScale=e._vy_xAutoScale,e.yAutoScale=e._vy_yAutoScale,!e.onAutoScale||i===e._vy_xAutoScale&&s===e._vy_yAutoScale||e.onAutoScale(i,s),e.width=t.width,e.height=t.height,mainM.gameBody.style.width=t.width+"px",mainM.gameBody.style.height=t.height+"px",t.width<window.innerWidth?mainM.xBodyPos=(window.innerWidth-t.width)/2:mainM.xBodyPos=0,t.height<window.innerHeight?mainM.yBodyPos=(window.innerHeight-t.height)/2:mainM.yBodyPos=0,mainM.gameBody.style.top=mainM.yBodyPos+"px",mainM.gameBody.style.left=mainM.xBodyPos+"px";for(let t=0,e=scrM.interfaceElements.length;t<e;t++){const e=scrM.interfaceElements[t];e._vy_isWebBox?e._vy_scaleWebBox():(e.preventAutoScale||e._vy_edgeLock)&&e._vy_setEdgeLock()}scrM.intApp?.renderer&&(scrM.intApp.view.style.width=window.innerWidth+"px",scrM.intApp.view.style.height=window.innerHeight+"px",scrM.intApp.renderer.resize(window.innerWidth,window.innerHeight),scrM.intApp.stageScale.scale.set(mainM.scaleWidth,mainM.scaleHeight),scrM.refreshInt=!0);for(const t in scrM.topScreenCanvas)scrM.topScreenBrush[t].topSet&&scrM.topScreenBrush[t].topSet.autoScale||(scrM.topScreenCanvas[t].width=window.innerWidth,scrM.topScreenCanvas[t].height=window.innerHeight);mainM.errorDisplay.style.width=window.innerWidth+"px"},mainM.showCustomLoadScreen=function(){if(mainM.showLoadScreen(),!mainM.origLoadScreen){if(gameM.loadScreen.css){const t=document.getElementsByTagName("head")[0],e=document.createElement("style");e.setAttribute("id","custom_load_css"),e.setAttribute("type","text/css"),e.appendChild(document.createTextNode(gameM.loadScreen.css)),t.appendChild(e)}gameM.loadScreen.onTick&&(eval("gameM.loadScreen.onTick = "+gameM.loadScreen.onTick),"[object Function]"!=={}.toString.call(gameM.loadScreen.onTick)&&delete gameM.loadScreen.onTick),mainM.origLoadScreen=mainM.loadScreen.innerHTML}mainM.loadScreen.innerHTML=gameM.loadScreen.html},mainM.showLoadScreen=function(){mainM.inLoadScreen=1,mainM.loadScreen.style.opacity=1,mainM.loadScreen.style.display="block"},mainM.hideLoadScreen=function(t){gameM.loadScreen&&!t||(mainM.inLoadScreen=0,mainM.loadScreen.style.opacity=0,setTimeout((function(){mainM.loadScreen.style.display="none"}),600))},mainM._callback=function(t,e){if(Array.isArray(t)){if(void 0!==e)if(t[2]||(t[2]=[]),Array.isArray(e))for(let r=e.length;r--;)t[2].unshift(e[r]);else t[2].unshift(e);return t[0].apply(t[1],t[2])}return Array.isArray(e)?t.apply(null,e):t(e)},mainM.getWebStyle=function(t){let e="";for(;t.length;){const r=t.search(/(^url|[\:|\s|\,]url)\([\'|\"]?vyi\:[a-zA-Z0-9_\!\:\.\-\(\)\&\#\/\s]+[\'|\"]?\)([\;|\s|\}]|$)/g),n=t.search(/(^url|[\:|\s|\,]url)\([\'|\"]?vyf\:[a-zA-Z0-9_\!\:\.\-\(\)\&\#\/\s]+[\'|\"]?\)([\;|\s|\}]|$)/g);if(-1===r&&-1!==n||n>=0&&n<r){const r=t.match(/(^url|[\:|\s|\,]url)\([\'|\"]?vyf\:[a-zA-Z0-9_\!\:\.\-\(\)\&\#\/\s]+[\'|\"]?\)([\;|\s|\}]|$)/g)[0].replace(/\'|\"/g,""),i=r.substring(r.indexOf("vyf:")+4,r.lastIndexOf(")")).split(":"),s=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_1__.Q.resources["fil_"+i[0]];e+=t.substring(0,n),"u"!==r[0]&&(e+=r[0]),s?i[1]&&"text"===i[1]?e+="url("+_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_1__.Q.fileText[i[0]].text+")":e+='url("'+(s.r?s.f:serM.resourceServer+"/resources/"+s.f)+"?v="+s.v+'")':e+="none",")"!==r[r.length-1]&&(e+=r[r.length-1]),t=t.substr(n+r.length)}else{if(-1===r){e+=t;break}{const n=t.match(/(^url|[\:|\s|\,]url)\([\'|\"]?vyi\:[a-zA-Z0-9_\!\:\.\-\(\)\&\#\/\s]+[\'|\"]?\)([\;|\s|\}]|$)/g)[0].replace(/\'|\"/g,""),i=n.substring(n.indexOf("vyi:")+4,n.lastIndexOf(")")).split(":");e+=t.substring(0,r),"u"!==n[0]&&(e+=n[0]),e+='url("'+VYLO.Icon.getDataURL(i[0],i[1],i[2],parseInt(i[3]))+'")',")"!==n[n.length-1]&&(e+=n[n.length-1]),t=t.substring(r+n.length)}}}return e},mainM.getWebText=function(t){mainM.webDiv.innerHTML=t;const e=mainM.webDiv.getElementsByTagName("*");for(let t=0,r=e.length;t<r;t++){const r=e[t],n=[],i={};for(let t=0,e=r.attributes.length;t<e;t++){const e=r.attributes[t];if("href"===e.name){let t=r.getAttribute("style")||"";if(r.href.startsWith("command:")){if(r.href.replace(/"([^"]*)"|'([^']*)'/g,"").match(/^command\:[a-zA-Z0-9_]+\(([a-zA-Z0-9_\,\[\]\'\"\{\}\:]+)?\)[\;]?$/)){if(mainM.serSocket)i.onclick='VYLO.Client._vy_sendClientCommand("'+r.href.substr(8,r.href.indexOf("(")-8)+'", ['+r.href.substr(r.href.indexOf("(")+1,r.href.length-2-r.href.indexOf("("))+"])";else{let t=r.href.substr(r.href.indexOf("(")+1,r.href.length-2-r.href.indexOf("("));t&&(t=", "+t),i.onclick="VYLO.Client._vy_parentT._vy_com."+r.href.substr(8,r.href.indexOf("(")-8)+".call(VYLO.Client"+t+");"}t+="cursor: pointer;"}n.push(e)}else-1===r.href.indexOf("#")&&r.setAttribute("target","_blank");r.setAttribute("style",t+"pointer-events: auto;")}else if("src"===e.name){let t=r.getAttribute("style")||"";if(r.src.startsWith("diob:")){const e=_object_js__WEBPACK_IMPORTED_MODULE_0__.P.objects.get(r.src.substr(5));e&&e._vy_ico&&(t+="width: "+e._vy_icoW+"px;height: "+e._vy_icoH+"px;",e._vy_sprite?r.src=e._vy_sprite:r.src=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_1__.Q.getIconData(e._vy_ico))}else if(r.src.startsWith("vyi:")){const t=r.src.split(":");r.src=VYLO.Icon.getDataURL(t[1],t[2],t[3],parseInt(t[4]))}else if(r.src.startsWith("vyf:")){const t=r.src.split(":"),e=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_1__.Q.resources["fil_"+t[1]];t[2]&&"text"===t[2]?r.src=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_1__.Q.fileText[t[1]].text:r.src=(e.r?e.f:serM.resourceServer+"/resources/"+e.f)+"?v="+e.v}t&&r.setAttribute("style",t)}else if(mainM.webEvents[e.name.toLowerCase()]){const t=r.getAttribute(e.name.toLowerCase());if(t.replace(/"([^"]*)"|'([^']*)'/g,"").match(/^command\:[a-zA-Z0-9_]+\(([a-zA-Z0-9_ \,\[\]\'\"\{\}\:]+)?\)[\;]?$/)){if(mainM.serSocket)i["on"+mainM.webEvents[e.name]]='VYLO.Client._vy_sendClientCommand("'+t.substr(8,t.indexOf("(")-8)+'", ['+t.substr(t.indexOf("(")+1,t.length-2-t.indexOf("("))+"])";else{let r=t.substr(t.indexOf("(")+1,t.length-2-t.indexOf("("));r&&(r=", "+r),i["on"+mainM.webEvents[e.name]]="VYLO.Client._vy_parentT._vy_com."+t.substr(8,t.indexOf("(")-8)+".call(VYLO.Client"+r+");"}n.push(e)}}}for(let t=0,e=n.length;t<e;t++)r.removeAttributeNode(n[t]);for(const t in i)r.setAttribute(t,i[t]);"password"===r.type&&r.setAttribute("autocomplete","new-password")}return mainM.webDiv.innerHTML},mainM.canvasBackColor="#000",mainM._vy_mouseDown=0,mainM.scaleWidth=1,mainM.scaleHeight=1,mainM.mapScaleWidth=1,mainM.mapScaleHeight=1,mainM.xBodyPos=0,mainM.yBodyPos=0,mainM.codeVersion="14",mainM.webDomain=window.location.hostname,mainM.webEvents={onfocus:"focus",onunfocus:"blur",onmousedown:"mousedown",onmouseup:"mouseup",onmouseclick:"click",onmousedblclick:"dblclick",onmousemove:"mousemove",onmouseenter:"mouseenter",onmouseexit:"mouseout",onkeydown:"keydown",onkeyup:"keyup"},mainM.webDiv=document.createElement("div"),mainM.defaultTypes=["Diob","Movable","Mob","Tile","Interface","Client","Overlay","Region","Sound","Particle"],mainM.diobTypes=["Diob","Movable","Mob","Tile","Interface","Overlay","Region","Particle"],VYLO.JS=globalThis,VYLO.alert=function(t){_vy_cOb._vy_clearKeyDownEvents(),alert(t)},VYLO.prompt=function(t,e){return _vy_cOb._vy_clearKeyDownEvents(),prompt(t,e)},VYLO.confirm=function(t){return _vy_cOb._vy_clearKeyDownEvents(),confirm(t)},VYLO.aMes=function(t,e){t=mainM.getWebText(t),e?mainM.errorDisplay.innerText+=t:mainM.errorDisplay.innerText=t},VYLO.delProp=function(t,e){delete t[e]},VYLO.newDiob=function(t){t||(t="Diob");const e=_object_js__WEBPACK_IMPORTED_MODULE_0__.P.createObject(t);if(e&&e.onNew)if(arguments.length>1){const t=[];for(let e=1,r=arguments.length;e<r;e++)t.push(arguments[e]);e.onNew.apply(e,t)}else e.onNew();return e},VYLO.delDiob=function(t){if(!t||t._vy_isLoc)return;const e=Array.prototype.slice.call(arguments);e.shift(),e.length?_object_js__WEBPACK_IMPORTED_MODULE_0__.P.deleteDiob(t,e):_object_js__WEBPACK_IMPORTED_MODULE_0__.P.deleteDiob(t)},VYLO.newObject=function(t){const e=_object_js__WEBPACK_IMPORTED_MODULE_0__.P.createObject(t);if(e.onNew)if(arguments.length>1){const t=[];for(let e=1,r=arguments.length;e<r;e++)t.push(arguments[e]);e.onNew.apply(e,t)}else e.onNew();return e},VYLO.delObject=function(t){if(t&&!t._vy_isLoc)if(t._vy_id)VYLO.delDiob.apply(t,arguments);else{if(t._vy_tickerOb?._vy_isActive&&_object_js__WEBPACK_IMPORTED_MODULE_0__.P.removeTicker(t),t.onDel)if(arguments.length>1){const e=Array.prototype.slice.call(arguments);e.shift(),t.onDel.apply(t,e)}else t.onDel();t.__proto__=null;for(const e in t)delete t[e]}},VYLO.newMap=function(t,e){let r;if(VYLO.Util.isObject(t)){r=_object_js__WEBPACK_IMPORTED_MODULE_0__.P.createObject(t.type||"Map",_object_js__WEBPACK_IMPORTED_MODULE_0__.P.createMap,t.name,t.xMax,t.yMax);for(const e in t)r[e]=t[e]}else if(e){r=_object_js__WEBPACK_IMPORTED_MODULE_0__.P.createObject(t||"Map",_object_js__WEBPACK_IMPORTED_MODULE_0__.P.createMap,e.name,e.xMax,e.yMax);for(const t in e)r[t]=e[t]}else r=_object_js__WEBPACK_IMPORTED_MODULE_0__.P.createObject(t||"Map",_object_js__WEBPACK_IMPORTED_MODULE_0__.P.createMap);if(r.onNew)if(arguments.length>1){const n=[];for(let r=VYLO.Util.isObject(t)||!VYLO.Util.isObject(e)?1:2,i=arguments.length;r<i;r++)n.push(arguments[r]);r.onNew.apply(o,n)}else r.onNew();return r},globalThis._vy_global={},VYLO.global=globalThis._vy_global},140:(t,e,r)=>{"use strict";r.d(e,{P:()=>a});var n=r(518),i=r(681);class o{_vy_isTickerOb=!0;_vy_delay=null;_vy_resetAt=0;_vy_resetEnd=!1;_vy_currTick=0;_vy_delayTick=0;_vy_parent=null;_vy_isActive=!1;_vy_isPaused=!1;constructor(t){this._vy_parent=t}_vy_doTick=function(){if(!this._vy_isPaused){if(this._vy_delay){if(this._vy_delayTick++,this._vy_delayTick<this._vy_delay)return;this._vy_delayTick=0}this._vy_currTick++,this._vy_parent.onTick?.(this._vy_currTick,this._vy_delta),this._vy_resetAt&&this._vy_currTick>=this._vy_resetAt&&(this._vy_currTick=0,this._vy_resetEnd&&a.removeTicker(this._vy_parent))}};get delay(){return this._vy_delay||1}set delay(t){this._vy_delay=t}get resetAt(){return this._vy_resetAt}set resetAt(t){this._vy_resetAt=t}get resetEnd(){return this._vy_resetEnd}set resetEnd(t){this._vy_resetEnd=t}get currentTick(){return this._vy_currTick}set currentTick(t){this._vy_currTick=t}get c(){return this._vy_currTick}set c(t){this._vy_currTick=t}get parent(){return this._vy_parent}set parent(t){}get isActive(){return this._vy_isActive}set isActive(t){t?this._vy_parent.startTicker():this._vy_parent.stopTicker(this._vy_parent)}get isPaused(){return this._vy_isPaused}set isPaused(t){this._vy_isPaused=t}remove=function(){this._vy_parent.stopTicker()}}const a=new class{objIDCount=0;objectTypes={};objects=new Map;obIDCount=0;regions={};tags={};tickerDelay=10;hasActiveTicker=!0;tickers=[];lastTick=null;interval=null;baseTile=null;voidTile=null;movementObj=[];moveToObj=[];lastObjMove=performance.now();transDiobs=[];refTransLast=performance.now();dirNum=["","north","south","","east","northeast","southeast","","west","northwest","southwest"];dirPosX={east:1,northeast:1,southeast:1,west:-1,northwest:-1,southwest:-1,north:0,south:0};dirPosY={north:-1,northeast:-1,northwest:-1,south:1,southeast:1,southwest:1,east:0,west:0};baseClasses=["VyObject","Diob","MapObject","Overlay","Movable","Mob","Particle","Tile","Region","Interface","WebBox","TextInput","MapView","InterfacePane","Sound","Client","World","Map","TileMap"];clientShareVars=["_vy_id","_vy_type","_vy_mapN","_vy_x","_vy_y","_vy_xIcoOff","_vy_yIcoOff","_vy_atlas","_vy_icoName","_vy_icoState","_vy_layer","_vy_dir","_vy_invisibility","_vy_text","_vy_textSty","_vy_w","_vy_h","_vy_alpha","_vy_color","_vy_angle","_vy_scale","_vy_transform","_vy_composite","_vy_plane","_vy_name","_vy_anchor","_vy_animator","_vy_xOr","_vy_yOr","_vy_relayerH","_vy_tag","_vy_mouseOp","_vy_cSyncD","_vy_density"];defPropR={_vy_icoName:"iconName",_vy_atlas:"atlasName",_vy_icoState:"iconState",_vy_xIcoOff:"xIconOffset",_vy_yIcoOff:"yIconOffset",_vy_layer:"layer",_vy_relayerH:"relayerHeight",_vy_w:"width",_vy_h:"height",_vy_angle:"angle",_vy_anchor:"anchor",_vy_alpha:"alpha",_vy_scale:"scale",_vy_transform:"transform",_vy_animator:"animator",_vy_color:"color",_vy_composite:"composite",_vy_plane:"plane",_vy_mouseOp:"mouseOpacity",_vy_name:"name",_vy_id:"id",_vy_tag:"tag",_vy_mapN:"mapName",_vy_text:"text",_vy_textSty:"textStyle",_vy_x:"x",_vy_y:"y",_vy_xOr:"xOrigin",_vy_yOr:"yOrigin",_vy_invisibility:"invisibility",_vy_visibility:"visibility",_vy_xCoOff:"xCoordOffset",_vy_yCoOff:"yCoordOffset",_vy_dir:"dir",_vy_cSyncD:"clientSyncData",_vy_density:"density",_vy_mainOutput:"mainOutput",_vy_xViewEyeOffset:"xViewEyeOffset",_vy_yViewEyeOffset:"yViewEyeOffset",_vy_tint:"tint",_vy_screenBackground:"screenBackground",_vy_webBackground:"webBackground",_vy_display:"display",_vy_boxShadow:"boxShadow",_vy_boxSizing:"boxSizing",_vy_clip:"clip",_vy_cursor:"cursor",_vy_minWidth:"minWidth",_vy_maxWidth:"maxWidth",_vy_minHeight:"minHeight",_vy_maxHeight:"maxHeight",_vy_padding:"padding",_vy_margin:"margin",_vy_overflow:"overflow",_vy_float:"float",_vy_background:"background",_vy_border:"border",_vy_outline:"outline",_vy_accentColor:"accentColor",_vy_styleClass:"styleClass",_vy_style:"style",_vy_isMultiline:"isMultiline",_vy_isPasswordInput:"isPasswordInput",_vy_isCommandInput:"isCommandInput",_vy_maxLength:"maxLength",_vy_placeholder:"placeholder",_vy_tabIndex:"tabIndex",_vy_edgeLock:"edgeLock",_vy_mapView:"mapView",_vy_zoom:"zoom",_vy_maxZoom:"maxZoom",_vy_minZoom:"minZoom",_vy_maxView:"maxView",_vy_minView:"minView",_vy_autoZoomMulti:"autoZoomMulti",_vy_isDraggable:"isDraggable",_vy_isDraggable:"isDraggable",_vy_xEdgeLimit:"xEdgeLimit",_vy_yEdgeLimit:"yEdgeLimit"};defPropDiob={iconName:"_vy_icoName",atlasName:"_vy_atlas",iconState:"_vy_icoState",xIconOffset:"_vy_xIcoOff",yIconOffset:"_vy_yIcoOff",layer:"_vy_layer",relayerHeight:"_vy_relayerH",width:"_vy_w",height:"_vy_h",angle:"_vy_angle",anchor:"_vy_anchor",alpha:"_vy_alpha",scale:"_vy_scale",transform:"_vy_transform",animator:"_vy_animator",color:"_vy_color",composite:"_vy_composite",plane:"_vy_plane",mouseOpacity:"_vy_mouseOp",name:"_vy_name",id:"_vy_id",tag:"_vy_tag",mapName:"_vy_mapN",text:"_vy_text",textStyle:"_vy_textSty",x:"_vy_x",y:"_vy_y",xPos:"_vy_x",yPos:"_vy_y",xOrigin:"_vy_xOr",yOrigin:"_vy_yOr",invisibility:"_vy_invisibility",visibility:"_vy_visibility",xCoordOffset:"_vy_xCoOff",yCoordOffset:"_vy_yCoOff",dir:"_vy_dir",clientSyncData:"_vy_cSyncD",density:"_vy_density",tint:"_vy_tint"};defPropMapObject={};defPropTile={};defPropRegion={};defPropOverlay={};defPropMovable={};defPropInterface={edgeLock:"_vy_edgeLock"};defWebBoxStyleVars={domID:"_vy_domID",display:"_vy_display",boxShadow:"_vy_boxShadow",boxSizing:"_vy_boxSizing",clip:"_vy_clip",cursor:"_vy_cursor",minWidth:"_vy_minWidth",maxWidth:"_vy_maxWidth",minHeight:"_vy_minHeight",maxHeight:"_vy_maxHeight",padding:"_vy_padding",margin:"_vy_margin",overflow:"_vy_overflow",float:"_vy_float",transform:"_vy_transform",composite:"_vy_composite",background:"_vy_background",border:"_vy_border",outline:"_vy_outline",scale:"_vy_scale",accentColor:"_vy_accentColor",textStyle:"_vy_textSty",styleClass:"_vy_styleClass",style:"_vy_style",edgeLock:"_vy_edgeLock",zoom:"_vy_zoom",minZoom:"_vy_minZoom",maxZoom:"_vy_maxZoom",minZoom:"_vy_minZoom",autoZoomMulti:"_vy_autoZoomMulti",anchor:"_vy_anchor",isDraggable:"_vy_isDraggable",isResizable:"_vy_isResizable",xEdgeLimit:"_vy_xEdgeLimit",yEdgeLimit:"_vy_yEdgeLimit"};defPropWebBox={domID:"_vy_domID",display:"_vy_display",boxShadow:"_vy_boxShadow",boxSizing:"_vy_boxSizing",clip:"_vy_clip",cursor:"_vy_cursor",minWidth:"_vy_minWidth",maxWidth:"_vy_maxWidth",minHeight:"_vy_minHeight",maxHeight:"_vy_maxHeight",padding:"_vy_padding",margin:"_vy_margin",overflow:"_vy_overflow",float:"_vy_float",background:"_vy_background",border:"_vy_border",outline:"_vy_outline",accentColor:"_vy_accentColor",styleClass:"_vy_styleClass",style:"_vy_style",isDraggable:"_vy_isDraggable",isResizable:"_vy_isResizable"};defPropTextInput={isMultiline:"_vy_isMultiline",isPasswordInput:"_vy_isPasswordInput",isCommandInput:"_vy_isCommandInput",maxLength:"_vy_maxLength",placeholder:"_vy_placeholder",tabIndex:"_vy_tabIndex"};defPropMapView={zoom:"_vy_zoom",maxZoom:"_vy_maxZoom",minZoom:"_vy_minZoom",maxView:"_vy_maxView",minView:"_vy_minView",autoZoomMulti:"_vy_autoZoomMulti",xEdgeLimit:"_vy_xEdgeLimit",yEdgeLimit:"_vy_yEdgeLimit"};defPropInterfacePane={};defPropMap={};defPropParticle={};defPropMob={};defPropSound={};defPropClient={yViewEyeOffset:"_vy_yViewEyeOffset",xEdgeLimit:"_vy_xEdgeLimit",yEdgeLimit:"_vy_yEdgeLimit",maxFPS:"_vy_maxFPS",macroAtlas:"_vy_macroAtlas",color:"_vy_color",mainOutput:"_vy_mainOutput",screenBackground:"_vy_screenBackground",webBackground:"_vy_webBackground",mapView:"_vy_mapView"};constructor(){for(const t in this.defPropDiob)this.defPropMapObject[t]=this.defPropDiob[t],this.defPropInterface[t]=this.defPropDiob[t],this.defPropOverlay[t]=this.defPropDiob[t];for(const t in this.defPropInterface)this.defPropWebBox[t]=this.defPropInterface[t];for(const t in this.defPropWebBox)this.defPropTextInput[t]=this.defPropWebBox[t],this.defPropMapView[t]=this.defPropWebBox[t];for(const t in this.defPropMapObject)this.defPropTile[t]=this.defPropMapObject[t],this.defPropRegion[t]=this.defPropMapObject[t],this.defPropMovable[t]=this.defPropMapObject[t];for(const t in this.defPropMovable)this.defPropMob[t]=this.defPropMovable[t],this.defPropParticle[t]=this.defPropMovable[t]}preinitiate=function(){if(this.createObjectType("Diob",null,["VyObject"]),this.createObjectType("MapObject",null,["Diob"]),this.createObjectType("Movable",null,["MapObject"]),this.createObjectType("Mob",null,["Movable"]),this.createObjectType("Tile",null,["MapObject"]),this.createObjectType("Overlay",null,["Diob"]),this.createObjectType("Region",null,["Diob"]),this.createObjectType("Client",null,["VyObject"])._vy_com={},this.createObjectType("World",null,["VyObject"]),this.createObjectType("Particle",null,["Movable"]),this.createObjectType("Sound",null,["VyObject"]),this.createObjectType("Interface",null,["Diob"]),this.createObjectType("WebBox",null,["Interface"]),this.createObjectType("TextInput",null,["WebBox"]),this.createObjectType("MapView",null,["WebBox"]),this.createObjectType("InterfacePane",null,["VyObject"]),this.createObjectType("Map",null,["VyObject"]),this.createObjectType("TileMap",null,["Map"]),globalThis._vy_types){const t=globalThis._vy_types.t;for(let e=0,r=t.length;e<r;e+=3)this.createObjectType(t[e],t[e+1],t[e+2]);delete globalThis._vy_types}};initiate=function(){for(const t in this.regions){const e=this.regions[t];this.regions[t]=this.createObject(e._vy_type)}this.baseTile=this.objectTypes.Tile,this.voidTile=this.createTile("Tile"),this.voidTile._vy_name="void",this.voidTile._vy_density=1,n.j3.Map.void=this.voidTile,this.lastTick=Date.now(),this.interval=setInterval((()=>{this.refreshTickers()}),this.tickerDelay)};createObject=function(t,e,...r){let n;if(t.includes("{")){const i=(t=decodeURIComponent(t)).substring(t.indexOf("{")+1,t.length-1).split(";");t=t.substring(0,t.indexOf("{")).trim(),e||(e=(this.objectTypes[t]||this.createObjectType(t))._vy_constructor),n=e.call(this,t,...r);for(const t in i){const e=i[t].split("=");if(e[0]){const t=e[0].trim(),r=e[1]?e[1].trim():e[1];r?"'"===r[0]||'"'===r[0]?n[t]=decodeURIComponent(r.substring(1,r.length-1)):"{"===r[0]||"["===r[0]?n[t]=JSON.parse(r):isNaN(r)?n[t]=decodeURIComponent(r):n[t]=parseFloat(r):n[t]=r}}}else e||(e=(this.objectTypes[t]||this.createObjectType(t))._vy_constructor),n=e.call(this,t,...r);return n.isDiob&&(32===n._vy_w&&32===n._vy_h||n.setSize(n._vy_w,n._vy_h),n._vy_tag&&n.setTag(n._vy_tag),(n._vy_xOr||n._vy_yOr)&&n.setOrigin(n._vy_xOr,n._vy_yOr),n._vy_color&&n.setColor(n._vy_color),n._vy_tint&&(n.tint=n._vy_tint),1!==n._vy_alpha?n.setAlpha(n._vy_alpha):n._vy_composite&&n.setComposite(n._vy_composite),n._vy_animator&&n.setAnimator(n._vy_animator),n._vy_transform&&n.setTransform(n._vy_transform),n._vy_angle&&n.setAngle(n._vy_angle),null!==n._vy_relayerH&&(n.relayerHeight=n._vy_relayerH)),n};createObjectNew=function(t,e,...r){const n=this.createObject(t,e,...r);return n.onNew?.(),n};_copyObjectVars=function(t,e,r,n,i){for(const s in e){const o=e[s];if(void 0!==o){if(r&&s.startsWith("_vy_")||n&&o.constructor===Function||i&&o?._vy_type)continue;!(o instanceof Object)||r&&o._vy_type||o.constructor===Function?t[s]=o:t[s]=this._copyObjectVars(Array.isArray(o)?[]:{},o,r,n,i)}else t[s]=o}return t};_createObject=function(t){const e=this.objectTypes[t]||this.createObjectType(t),r=Object.create(e._vy_object);if(e._vy_obVars)for(const t in e._vy_obVars)r[t]=this._copyObjectVars(e._vy_obVars[t].constructor===Array?[]:{},e._vy_obVars[t],0,0,1);return r};createVyObject=function(t){return this._createObject(t)};createDiob=function(t,e,r,n,i){const s=this._createObject(t);return void 0!==e?s.id=e:s._vy_id||(s.id=0),s};createTile=function(t,e,r=0,n=0,i){const s=this._createObject(t);return s._vy_id=e,i&&(s._vy_x=(r-1)*i._vy_tileW,s._vy_y=(n-1)*i._vy_tileH,i._vy_tiles[r+i._vy_xMax*n]=s,s._vy_map=i,s._vy_mapN=i._vy_mapN),s};createClient=function(t){const e=this.objectTypes[t]||this.createObjectType(t),r=Object.create(e._vy_object);if(r._vy_preinitiate(),e._vy_obVars)for(const t in e._vy_obVars)r[this.defPropClient[t]||t]=this._copyObjectVars(e._vy_obVars[t].constructor===Array?[]:{},e._vy_obVars[t],0,0,1);return r};createInterface=function(t,e){const r=this._createObject(t);return void 0!==e?r.id=e:r._vy_id||(r.id=0),r};createWebBox=function(t,e,r){const n=this.objectTypes[t]||this.createObjectType(t),i=Object.create(n._vy_object);if(void 0!==e?i.id=e:i._vy_id||(i.id=0),i._vy_initiate(r),n._vy_obVars)for(const t in n._vy_obVars)i[t]=this._copyObjectVars(n._vy_obVars[t].constructor===Array?[]:{},n._vy_obVars[t],0,0,1);for(const t in a.defWebBoxStyleVars)i._vy_parentT._vy_vars.hasOwnProperty(t)&&(i[t]=i[a.defWebBoxStyleVars[t]]);return(i._vy_w||i._vy_h)&&i.setSize(i._vy_w,i._vy_h),i};createInterfacePane=function(t){const e=this._createObject(t);return e._vy_conts=[],e._vy_aContents={},e};createMap=function(t="Map",e,r=0,i=0){const s=this._createObject(t);return e&&(s._vy_name=e,s._vy_mapN=e,s._vy_deleted||(s._vy_deleted=[e])),32===s._vy_tileW&&32!==n.a$.tileSize.width&&(s._vy_tileW=n.a$.tileSize.width),32===s._vy_tileH&&32!==n.a$.tileSize.height&&(s._vy_tileH=n.a$.tileSize.height),s._vy_xMax=r,s._vy_yMax=i,s._vy_width=r*s._vy_tileW,s._vy_height=i*s._vy_tileH,s._vy_tiles=[],s._vy_particles=[],s};createObjectType=function(t,e,r){let n=this.objectTypes[t];if(n){if(r)for(let t=0,e=r.length;t<e;t++)n.addInherit(r[t]);n._vy_initiate(e)}else n=new i.a(t,e,r),this.objectTypes[t]=n;return n};deleteDiob=function(t,e,r){if(t._vy_type){if(t._vy_transitions&&this.setTransition(t),t._vy_isOverlay&&t._vy_isOverlay.id&&t._vy_isOverlay.removeOverlay(t,!0),t._vy_moving&&this.removeMovementObj(t),t._vy_locs){for(let e=t._vy_locs.length;e--;)t._vy_locs[e]._vy_removeFromContents(t,!0);if(t._vy_crossed)for(let e=t._vy_crossed.length;e--;){const r=t._vy_crossed[e];r&&r._vy_crossed&&r._vy_crossed.splice(r._vy_crossed.indexOf(t),1),t._vy_crossed.splice(t._vy_crossed.indexOf(r),1),t.onUncrossed?.(r),r&&r.onUncrossed&&r.onUncrossed(t)}}if(t._vy_isLoc&&t._vy_clearContents(),t._vy_tickerOb?._vy_isActive&&t.stopTicker(),t._vy_id&&(n.vC.serSocket&&t._vy_mID&&t._vy_map&&t._vy_map._vy_deleted.push(t._vy_id),!r))if(t.onDel){const r=t._vy_id;e?t.onDel.apply(t,e):t.onDel(),this.objects.delete(r)}else this.objects.delete(t._vy_id);if(t._vy_gui?t._vy_pane&&n.um.removeInterfaceElement(t._vy_pane._vy_name,t._vy_name,!0):t._vy_onScr&&t._vy_onScr._vy_removeFromScreen(t),t._vy_tag&&this.tags[t._vy_tag]){const e=this.tags[t._vy_tag].indexOf(t);-1!==e&&this.tags[t._vy_tag].splice(e,1)}if(!t._vy_isCullable&&t._vy_map){const e=t._vy_map._vy_particles.indexOf(t);-1!==e&&t._vy_map._vy_particles.splice(e,1)}if(n.um._vy_focused===t&&(n.um._vy_focused=null),n.vC._vy_mouseOver===t&&(n.vC._vy_mouseOver=null),t._vy_isViewEye&&n.um.setViewEye(),t._vy_over)for(const n in t._vy_over){const i=t._vy_over[n];i._vy_isOverlay=null,this.deleteDiob(i,e,r)}t.__proto__=null;for(const e in t)delete t[e]}};isType=function(t,e,r){if(t)return t===e||(!(!r||!t.startsWith(e+"/")||"/"!==t[e.length])||void 0)};createTickerObject=function(t){return new o(t)};refreshTickers=function(t){const e=Date.now(),r=Math.max(Math.floor((e-this.lastTick)/this.tickerDelay),1);this.lastTick=e-(e-this.lastTick)%this.tickerDelay;for(let t=0;t<r;t++)for(const t of this.tickers)t?._vy_doTick()};refreshTickers_inactive=null;getTickers=function(t,e){const r=[];for(const n of this.tickers)t&&!a.isType(n._vy_parent.type,t,e)||r.includes(n._vy_parent)||r.push(n._vy_parent);return r};toggleTicker=function(t){void 0===t&&(t=!this.hasActiveTicker),t?this.hasActiveTicker||(this.refreshTickers=this.refreshTickers_inactive,this.refreshTickers_inactive=null):this.hasActiveTicker&&(this.refreshTickers_inactive=this.refreshTickers,this.refreshTickers=()=>{}),this.hasActiveTicker=t};addMovementObj=function(t){t&&!this.movementObj.includes(t)&&(t._vy_moving=!0,t.isMoving=!0,this.movementObj.push(t),t._vy_anim&&t._vy_anim.playAnim&&t._vy_anim.playAnim.def?t._vy_anim.playAnim.state="move_"+t._vy_dir:t._vy_defIconState&&t._vy_setIconState("move_"+t._vy_dir,1,0,!0),t.onMoveStart?.())};removeMovementObj=function(t){const e=this.movementObj.indexOf(t);-1!==e&&(this.movementObj.splice(e,1),t&&(t._vy_moving=!1,t.isMoving=!1,t._vy_anim&&t._vy_anim.playAnim&&t._vy_anim.playAnim.def?t._vy_anim.playAnim.state=t._vy_dir:t._vy_defIconState&&t._vy_setIconState(t._vy_dir),t.onMoveEnd?.()))};refreshObjectMovement=function(t){let e=(t-this.lastObjMove)/16.6667;for(let e=this.moveToObj.length;e--;){const r=this.moveToObj[e];if(!r||!r.type||!r._vy_tMov){this.removeMoveToObj(r);continue}const i=(t-r._vy_tMov)/n.U3.packetDelay/4;i>=1?(r._vy_setPos(r._vy_xMov,r._vy_yMov),this.removeMoveToObj(r)):r._vy_setPos(r._vy_xMovS*(1-i)+r._vy_xMov*i,r._vy_yMovS*(1-i)+r._vy_yMov*i)}for(let r=this.movementObj.length;r--;){const n=this.movementObj[r];n&&n.type&&(n._vy_movingX||n._vy_movingY)?n._vy_moveSet?(n._vy_moveSet.stepTick&&(e=(t-this.lastObjMove)/n._vy_moveSet.stepTick),n._vy_stepPos(n._vy_movingX*n._vy_stepSize*e,n._vy_movingY*n._vy_stepSize*e,!0,0,n._vy_moveSet.stepSlide)):n._vy_stepPos(n._vy_movingX*n._vy_stepSize*e,n._vy_movingY*n._vy_stepSize*e,!0):this.removeMovementObj(n)}this.lastObjMove=t};setMovementObjPos=function(t){t._vy_movingX=0,t._vy_movingY=0,t._vy_movingNorth&&!t._vy_movingSouth?t._vy_movingEast&&!t._vy_movingWest?(t._vy_movingX=1,t._vy_movingY=-1):t._vy_movingWest&&!t._vy_movingEast?(t._vy_movingX=-1,t._vy_movingY=-1):t._vy_movingY=-1:t._vy_movingSouth&&!t._vy_movingNorth?t._vy_movingEast&&!t._vy_movingWest?(t._vy_movingX=1,t._vy_movingY=1):t._vy_movingWest&&!t._vy_movingEast?(t._vy_movingX=-1,t._vy_movingY=1):t._vy_movingY=1:t._vy_movingEast&&!t._vy_movingWest?t._vy_movingX=1:t._vy_movingWest&&!t._vy_movingEast&&(t._vy_movingX=-1),!t._vy_movingX&&!t._vy_movingY||t._vy_moving||(t.moveSettings||t._vy_setMoveSettings(),this.addMovementObj(t))};movMoveTo=function(t,e,r){t.preventInterpolation||!t._vy_onScr||!t._vy_x&&0!==t._vy_x||!t._vy_y&&0!==t._vy_y||Math.abs(e-t._vy_x)>t._vy_onScr._vy_mapWidthHalf||Math.abs(r-t._vy_y)>t._vy_onScr._vy_mapHeightHalf?(void 0!==t._vy_tMov&&this.removeMoveToObj(t),t.setPos(e,r)):(this.moveToObj.includes(t)||this.moveToObj.push(t),t._vy_xMov=e,t._vy_xMovS=t._vy_x,t._vy_yMov=r,t._vy_yMovS=t._vy_y,t._vy_tMov=performance.now(),t._vy_tMov-=t._vy_tMov-this.lastObjMove)};removeMoveToObj=function(t){const e=this.moveToObj.indexOf(t);-1!==e&&this.moveToObj.splice(e,1),t._vy_tMov=0};setTransition=function(t,e,r,n,i,s,o,a,l){if(t._vy_transitions||(t._vy_transitions={}),i||s||(t._vy_transQ&&(t._vy_transQ=[]),t._vy_transL&&(t._vy_transL=[])),!e){for(const e in t._vy_transitions)t._vy_transitions.hasOwnProperty(e)&&(t[e]=t._vy_transitions[e].v,delete t._vy_transitions[e]);const e=this.transDiobs.indexOf(t);return void(-1!==e&&this.transDiobs.splice(e,1))}if(s&&!l&&(t._vy_transL||(t._vy_transL=[]),t._vy_transL.length||t._vy_transL.push(s),t._vy_transL.push([e,r,n,i,s,o])),i&&this.transDiobs.includes(t)&&!a){if(t._vy_transQ||(t._vy_transQ=[]),-1===i)if(t._vy_transQ.length){const a=t._vy_transQ[t._vy_transQ.length-1];Array.isArray(a[1])?a.push([e,r,n,i,s,o]):t._vy_transQ[t._vy_transQ.length-1]=[a,[e,r,n,i,s,o]]}else t._vy_transQ.push([e,r,n,i,s,o]);else t._vy_transQ.push([e,r,n,i,s,o]);return}const _=!n||n<=0?100:n;for(let n in e){let i=r||1;const s={v:e[n],t:_,i:0,iT:0,s:i};switch(o&&(s.cV=Math.abs(t[n]-s.v),s.e=o),s.s<0?(s.r=1,i=1,s.eT=_):s.eT=_*s.s,n){case"xScale":s.c=(e[n]-t.scale._vy_x)/i,s.cV=Math.abs(t._vy_scale._vy_x-s.v);break;case"yScale":s.c=(e[n]-t.scale._vy_y)/i,s.cV=Math.abs(t._vy_scale._vy_y-s.v);break;case"scale":const r=Math.max(t.scale._vy_x,t._vy_scale._vy_y);s.c=(e[n]-r)/i,s.cV=Math.abs(r-s.v);break;default:s.c=(e[n]-t[n])/i,s.c||(n="")}t._vy_transitions[n]=s,this.transDiobs.includes(t)||this.transDiobs.push(t)}t.onTransition?.("",0,e)};refreshTransitions=function(t){let e=this.transDiobs.length;const r=t-this.refTransLast,i=Math.max(r,1);for(;e--;){const t=this.transDiobs[e];let s=0;const o=t._vy_transitions;for(const e in o){const n=o[e];if(n.i+=i,n.iT+=i,s++,n.i>=n.t||n.r){const o=Math.round(n.t/n.i);n.i=0,n.s-=o;let a=n.c*o;switch(n.r&&(a=n.c/(n.t/r)),a*=this._refreshTransitionsEase(n.e,n),e){case"":n.t-=i,n.t<=0&&s--;break;case"xScale":n.s<=0&&!n.r||n.c>0&&t._vy_scale._vy_x+a>=n.v||n.c<0&&t._vy_scale._vy_x+a<=n.v?(t._vy_scale._vy_x=n.v,s--,delete t._vy_transitions[e]):t._vy_scale._vy_x+=a,t.setScale(t._vy_scale._vy_x,t._vy_scale._vy_y);break;case"yScale":n.s<=0&&!n.r||n.c>0&&t._vy_scale._vy_y+a>=n.v||n.c<0&&t._vy_scale._vy_y+a<=n.v?(t._vy_scale._vy_y=n.v,s--,delete t._vy_transitions[e]):t._vy_scale._vy_y+=a,t.setScale(t._vy_scale._vy_x,t._vy_scale._vy_y);break;case"scale":let r=0;n.s<=0&&!n.r||n.c>0&&t._vy_scale._vy_x+a>=n.v||n.c<0&&t._vy_scale._vy_x+a<=n.v?(t._vy_scale._vy_x=n.v,r++):t._vy_scale._vy_x+=a,n.s<=0&&!n.r||n.c>0&&t._vy_scale._vy_y+a>=n.v||n.c<0&&t._vy_scale._vy_y+a<=n.v?(t._vy_scale._vy_y=n.v,r++):t._vy_scale._vy_y+=a,t.setScale(t._vy_scale._vy_x,t._vy_scale._vy_y),r>=2&&(s--,delete t._vy_transitions[e]);break;default:n.s<=0&&!n.r||n.c>0&&t[e]+a>=n.v||n.c<0&&t[e]+a<=n.v?(t[e]=n.v,s--,delete t._vy_transitions[e]):t[e]+=a}t.onTransition?.(e,a)}}if(t._vy_gui&&t._vy_onScr&&(n.up.refreshInt=!0),!s)if(t.onTransition?.(),t._vy_transQ&&t._vy_transQ.length){const e=t._vy_transQ.shift();if(Array.isArray(e[1]))for(let r=0,n=e.length;r<n;r++){const n=e[r];this.setTransition(t,n[0],n[1],n[2],n[3],n[4],n[5],1,1)}else this.setTransition(t,e[0],e[1],e[2],e[3],e[4],e[5],1,1)}else{const e=this.transDiobs.indexOf(t);if(-1!==e&&this.transDiobs.splice(e,1),t._vy_transitions=null,t._vy_transL&&t._vy_transL.length){for(let e=1,r=t._vy_transL.length;e<r;e++){const r=t._vy_transL[e];this.setTransition(t,r[0],r[1],r[2],r[3],r[4],r[5],0,1)}-1!==t._vy_transL[0]&&(t._vy_transL[0]--,t._vy_transL[0]<=0&&(t._vy_transL=[]))}}}this.refTransLast=t};_refreshTransitionsEase=function(t,e){if(!t)return 1;let r=e.iT,i=e.eT,o=e.cV;if(n.j3.Util.isFunction(t))return t(r,e.v,i,o);if("quadraticIn"===t)return o*(r/=i)*r;if("quadraticOut"===t)return-o*(r/=i)*(r-2);if("quadraticInOut"===t)return(r/=i/2)<1?o/2*r*r:-o/2*(--r*(r-2)-1);if("cubicIn"===t)return o*(r/=i)*r*r;if("cubicOut"===t)return o*((r=r/i-1)*r*r+1);if("cubicInOut"===t)return(r/=i/2)<1?o/2*r*r*r:o/2*((r-=2)*r*r+2);if("quarticIn"===t)return o*(r/=i)*r*r*r;if("quarticOut"===t)return-o*((r=r/i-1)*r*r*r-1);if("quarticInOut"===t)return(r/=i/2)<1?o/2*r*r*r*r:-o/2*((r-=2)*r*r*r-2);if("quinticIn"===t)return o*(r/=i)*r*r*r*r;if("quinticOut"===t)return o*((r=r/i-1)*r*r*r*r+1);if("quinticInOut"===t)return(r/=i/2)<1?o/2*r*r*r*r*r:o/2*((r-=2)*r*r*r*r+2);if("sineIn"===t)return-o*Math.cos(r/i*(Math.PI/2))+o;if("sineOut"===t)return o*Math.sin(r/i*(Math.PI/2));if("sineInOut"===t)return-o/2*(Math.cos(Math.PI*r/i)-1);if("expoIn"===t)return 0==r?0:o*Math.pow(2,10*(r/i-1));if("expoOut"===t)return r==i?o:o*(1-Math.pow(2,-10*r/i));if("expoInOut"===t)return 0===r?0:r===i?o:(r/=i/2)<1?o/2*Math.pow(2,10*(r-1)):o/2*(2-Math.pow(2,-10*--r));if("circularIn"===t)return-o*(Math.sqrt(1-(r/=i)*r)-1);if("circularOut"===t)return o*Math.sqrt(1-(r=r/i-1)*r);if("circularInOut"===t)return(r/=i/2)<1?-o/2*(Math.sqrt(1-r*r)-1):o/2*(Math.sqrt(1-(r-=2)*r)+1);if("elasticIn"===t){let t=1.70158,e=0,n=o;return 0===r?0:1==(r/=i)?o:(e||(e=.3*i),n<Math.abs(o)?(n=o,t=e/4):t=e/(2*Math.PI)*Math.asin(o/n),-n*Math.pow(2,10*(r-=1))*Math.sin((r*i-t)*(2*Math.PI)/e))}if("elasticOut"===t){let t=1.70158,e=0,n=o;return 0===r?0:1==(r/=i)?o:(e||(e=.3*i),n<Math.abs(o)?(n=o,t=e/4):t=e/(2*Math.PI)*Math.asin(o/n),n*Math.pow(2,-10*r)*Math.sin((r*i-t)*(2*Math.PI)/e)+o)}if("elasticInOut"===t){let t=1.70158,e=0,n=o;return 0===r?0:2==(r/=i/2)?o:(e||(e=i*(.3*1.5)),n<Math.abs(o)?(n=o,t=e/4):t=e/(2*Math.PI)*Math.asin(o/n),r<1?n*Math.pow(2,10*(r-=1))*Math.sin((r*i-t)*(2*Math.PI)/e)*-.5:n*Math.pow(2,-10*(r-=1))*Math.sin((r*i-t)*(2*Math.PI)/e)*.5+o)}return"backIn"===t?(void 0===s&&(s=1.70158),o*(r/=i)*r*((s+1)*r-s)):"backOut"===t?(void 0===s&&(s=1.70158),o*((r=r/i-1)*r*((s+1)*r+s)+1)):"backInOut"===t?(void 0===s&&(s=1.70158),(r/=i/2)<1?o/2*(r*r*((1+(s*=1.525))*r-s)):o/2*((r-=2)*r*((1+(s*=1.525))*r+s)+2)):1}}},347:(__unused_webpack_module,__unused_webpack___webpack_exports__,__webpack_require__)=>{"use strict";var _main_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(518),_object_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(140),_lib_pako_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(979),_lib_pako_js__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(_lib_pako_js__WEBPACK_IMPORTED_MODULE_2__),_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(868);if(globalThis._vy_resources){for(let t=0,e=globalThis._vy_resources.length;t<e;t+=3)_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.resources[globalThis._vy_resources[t]]={p:globalThis._vy_resources[t],v:globalThis._vy_resources[t+1],f:globalThis._vy_resources[t+2]};delete globalThis._vy_resources}_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconStates=["","north","south","east","west","northeast","northwest","southeast","southwest","move_north","move_south","move_east","move_west","move_northeast","move_northwest","move_southwest","move_southeast"],_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.appearVars=["_vy_atlas","_vy_icoName","_vy_icoState","_vy_w","_vy_h","_vy_scale","_vy_transform","_vy_composite","_vy_textSty","_vy_xIcoOff","_vy_yIcoOff","_vy_anchor"],_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.maps={},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.mapSerUpdated={},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.mapSerUpdatedT={},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.blankPixiTex=PIXI.Texture.EMPTY,_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.initiate=function(){if(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.maps[""]=_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createMap(),_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconCanvas=document.createElement("canvas"),_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconCanvasBrush=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconCanvas.getContext("2d"),_main_js__WEBPACK_IMPORTED_MODULE_0__.vC.serSocket){if((!location.ancestorOrigins||!location.ancestorOrigins.length||location.ancestorOrigins[0].startsWith("file://")||"vylocity.com"!==location.ancestorOrigins[0].match(/:\/\/(www.)?(.[^/]+)/)[2])&&(window.parent===window||!document.referrer||"vylocity.com"!==document.referrer.match(/:\/\/(www.)?(.[^/]+)/)[2])){if(_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.requireAccount)return void(document.getElementById("load_screen_login_box_2").style.display="block");globalThis.vyM.disableAPI=!0}globalThis.vyM.disableLoad||(_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.loadScreen?_main_js__WEBPACK_IMPORTED_MODULE_0__.vC.showCustomLoadScreen():_main_js__WEBPACK_IMPORTED_MODULE_0__.vC.showLoadScreen()),_main_js__WEBPACK_IMPORTED_MODULE_0__.um._vy_clientID?_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.typesLoaded():_main_js__WEBPACK_IMPORTED_MODULE_0__.um._vy_typesLoadedQueue=1}else{_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.game?(_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.game.child=window,_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.playerAcc={name:_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.game.user||"Guest"},("Guest"===_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.playerAcc.name||_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.playerAcc.name.startsWith("Guest-"))&&(_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.playerAcc.guest=!0)):(_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.game={sound:!0,child:window},_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.playerAcc={name:"Guest",guest:!0});const t={};try{for(let e=0,r=window.localStorage.length;e<r;e++){const r=window.localStorage.key(e);r&&r.startsWith(_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.gameID+"_")&&(t[r.slice(r.indexOf("_")+1)]=window.localStorage.getItem(r))}}catch(t){}_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.locStorage=t,_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.webDomain=_main_js__WEBPACK_IMPORTED_MODULE_0__.vC.webDomain,_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.setLocalStorage=function(t,e){if(!t){if(!e){const t=[];for(let e=0,r=_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.localStorage.length;e<r;e++){const r=_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.localStorage[e];r&&r.startsWith(_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.gameID+"_")&&t.push(r)}for(let e=0,r=t.length;e<r;e++)_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.localStorage.removeItem(t[e])}return}let r=t+e;for(let e=0,n=_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.localStorage.length;e<n;e++){const n=_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.localStorage[e];n&&n.startsWith(_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.gameID+"_")&&n!=_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.gameID+"_"+t&&(r+=n.slice(n.indexOf("_")+1)+_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.localStorage.getItem(n))}r.length>3e3||_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.localStorage.setItem(_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.gameID+"_"+t,e)},_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.authenticateGameAccount=function(t){const e=new _main_js__WEBPACK_IMPORTED_MODULE_0__.aK.XMLHttpRequest;e.open("GET","https://"+_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.webDomain+"/incajax/?qd=gameAccountAuthenticate",!0),e.onreadystatechange=function(){if(4==e.readyState){const r=e.responseText.split(";");r.length>1&&(_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.playerAcc.authID=r[0],_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.playerAcc.authIP=r[1],r[2]&&(_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.playerAcc.name=r[2]),_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.playerAcc.guest=parseInt(r[3])),t&&t()}},e.send()},1===_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.playerMode||globalThis.vyM.disableAPI&&!_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.mainServer?(window.parent!==window&&document.referrer&&document.referrer.match(/:\/\/(.[^/]+)/)[1].includes("vylocity.com")||(globalThis.vyM.disableAPI=!0),_main_js__WEBPACK_IMPORTED_MODULE_0__.vC.finishInitialize()):(window.parent!==window&&document.referrer&&document.referrer.match(/:\/\/(.[^/]+)/)[1].includes("vylocity.com")||(globalThis.vyM.disableAPI=!0),_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.requireAccount&&("Guest"===_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.playerAcc.name||_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.playerAcc.name.startsWith("Guest-"))?document.getElementById("load_screen_login_box_1").style.display="block":_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.checkServerList())}},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.checkServerList=function(){if(_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.mainServer){const t=urlPar?"?"+urlPar:"",e=_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.mainServer;0!==e.indexOf("http")&&(e="https://"+e),globalThis.vyM.disableAPI?location.href=e+t:_main_js__WEBPACK_IMPORTED_MODULE_0__.aK.authenticateGameAccount((function(){location.href=e+t}))}else{_main_js__WEBPACK_IMPORTED_MODULE_0__.vC.showServerList();let t="";2!=_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.playerMode&&(t+='<div class="box_title"><div class="box_title_inner">Play Options</div></div><div class="list_entry_ser"></div>',t+='<div class="list_entry" onClick=\'return mainM.finishInitialize();\'><img class="list_entry_img" src="'+_main_js__WEBPACK_IMPORTED_MODULE_0__.Bn.gameMedBanner+'" /><span class="solo_span">Play Solo</span></div>'),t+='<div class="box_title"><div class="box_title_inner">Servers</div></div><div class="list_entry_div"></div>',_main_js__WEBPACK_IMPORTED_MODULE_0__.vC.gamesList.innerHTML=t+'<span class="server_list_mes">Searching for servers...</span>';const e=new XMLHttpRequest;e.open("GET","https://www.vylocity.com/api/?a=getServerList&gameID="+encodeURIComponent(_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.gameID)+"&trial="+encodeURIComponent(_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.trial),!0),e.onreadystatechange=function(){if(4==e.readyState)if(e.responseText){let r='<div id="server_list">';const n=e.responseText.split(";");for(let t=0,e=n.length;t<e;t++){const e=n[t];if(!e)continue;const i=e.split("+");let s=parseInt(i[2]);const o=parseInt(i[3]);o&&(s+=o),r+='<div class="list_entry list_entry_ser" onClick=\'return mainM.joinNewServer("'+i[0]+'", event);\'><img class="list_entry_img" src="'+_main_js__WEBPACK_IMPORTED_MODULE_0__.Bn.gameMedBanner+'" /><span class="server_name">'+decodeURIComponent(i[1])+'</span><span class="player_count">'+s+(1==s?" player":" players")+"</span></div>"}_main_js__WEBPACK_IMPORTED_MODULE_0__.vC.gamesList.innerHTML=t+r+"</div>"}else _main_js__WEBPACK_IMPORTED_MODULE_0__.vC.gamesList.innerHTML=t+'<span class="server_list_mes">No servers found.</span>'},e.send()}},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.getIconData=function(t){return t&&t._vy_imageData?t._vy_imageData:_main_js__WEBPACK_IMPORTED_MODULE_0__.Bn.blankIcon},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.alterIcon=function(t,e,r,n,i){if(t&&(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconsO[t]||_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadAtlas(t),_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconsO[t]))if(e||""===e){if(!_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconsO[t][e])return;if(r||""===r){if(!_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconsO[t][e][r])return;const s=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconsO[t][e][r];if(n){if(!s._vy_frames||!s._vy_frames[n-1])return;i(s._vy_frames[n-1])}else if(s._vy_frames)for(let t=0,e=s._vy_frames.length;t<e;t++)i(s._vy_frames[t]);else i(s)}else{const r=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconsO[t][e][""];if(n){if(!r._vy_frames||!r._vy_frames[n-1])return;i(r._vy_frames[n-1])}else{if(r._vy_frames)for(let t=0,e=r._vy_frames.length;t<e;t++)i(r._vy_frames[t]);else i(r);for(let t=0,e=r._vy_states.length;t<e;t++){const e=r._vy_states[t];if(e._vy_frames)for(let t=0,r=e._vy_frames.length;t<r;t++)i(e._vy_frames[t]);else i(e)}}}}else for(const e in _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconsO[t])for(const r in _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconsO[t][e]){const n=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconsO[t][e][r];if(n._vy_frames)for(let t=0,e=n._vy_frames.length;t<e;t++)i(n._vy_frames[t]);else i(n)}},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.getColorIcon=function(t){let e,r=t;if(!Array.isArray(t)||20!==t.length){if("number"==typeof t){e=t.toString(16).padStart(6,"0").match(/.{1,2}/g);for(let t=e.length;t--;)e[t]=parseInt(e[t],16)}else if("string"==typeof t)if(t.startsWith("#")){3===(t=t.substring(1)).length&&(t=t.replace(/./g,"$&$&")),e=t.match(/.{1,2}/g);for(let t=e.length;t--;)e[t]=parseInt(e[t],16)}else if(t.startsWith("rgb")){e=t.replace(/[^\d,]/g,"").split(",");for(let t=e.length;t--;)e[t]=parseInt(e[t])}e&&(e.length<4&&e.push(255),t=r,r=[e[0]/255,0,0,0,0,0,e[1]/255,0,0,0,0,0,e[2]/255,0,0,0,0,0,e[3]/255,0])}return{color:t,m:r}},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.typesLoaded=function(){_main_js__WEBPACK_IMPORTED_MODULE_0__.vC.serSocket?(_object_js__WEBPACK_IMPORTED_MODULE_1__.P.objectTypes.Client._vy_com.startMove||(_object_js__WEBPACK_IMPORTED_MODULE_1__.P.objectTypes.Client._vy_com.startMove=function(t){}),_object_js__WEBPACK_IMPORTED_MODULE_1__.P.objectTypes.Client._vy_com.endMove||(_object_js__WEBPACK_IMPORTED_MODULE_1__.P.objectTypes.Client._vy_com.endMove=function(t){})):(_object_js__WEBPACK_IMPORTED_MODULE_1__.P.objectTypes.Client._vy_com.startMove||(_object_js__WEBPACK_IMPORTED_MODULE_1__.P.objectTypes.Client._vy_com.startMove=function(t){const e=this._vy_playerMob;t&&(t=t.toLowerCase()),t.startsWith("north")?e._vy_movingNorth=1:t.startsWith("south")&&(e._vy_movingSouth=1),t.includes("east")?e._vy_movingEast=1:t.includes("west")&&(e._vy_movingWest=1),_object_js__WEBPACK_IMPORTED_MODULE_1__.P.setMovementObjPos(e)}),_object_js__WEBPACK_IMPORTED_MODULE_1__.P.objectTypes.Client._vy_com.endMove||(_object_js__WEBPACK_IMPORTED_MODULE_1__.P.objectTypes.Client._vy_com.endMove=function(t){const e=this._vy_playerMob;t&&(t=t.toLowerCase()),t&&!t.startsWith("north")||(e._vy_movingNorth=0),t&&!t.startsWith("south")||(e._vy_movingSouth=0),t&&!t.includes("east")||(e._vy_movingEast=0),t&&!t.includes("west")||(e._vy_movingWest=0),_object_js__WEBPACK_IMPORTED_MODULE_1__.P.setMovementObjPos(e)})),_object_js__WEBPACK_IMPORTED_MODULE_1__.P.objectTypes.Client._vy_obVars?.screenView&&(_object_js__WEBPACK_IMPORTED_MODULE_1__.P.objectTypes.Client._vy_obVars.screenView.disableImageSmoothing||_object_js__WEBPACK_IMPORTED_MODULE_1__.P.objectTypes.Client._vy_obVars.screenView.scaleNearest)?PIXI.TextureStyle.defaultOptions.scaleMode="nearest":PIXI.TextureStyle.defaultOptions.scaleMode="linear";for(const t in _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.resources){const e=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.resources[t].p.split("_"),r=e[0];e.shift();const n=e.join("_");"int"!==r&&"mac"!==r||(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources[r+"_"+n]={type:r,name:n})}if(_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.preloadResources)if("string"!=typeof _main_js__WEBPACK_IMPORTED_MODULE_0__.a$.preloadResources)for(let t=0,e=_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.preloadResources.length;t<e;t++){const e=_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.preloadResources[t];if(e.name)if(Array.isArray(e.name))for(const t in e.name)_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources[e.type.substr(0,3)+"_"+e.name[t]]={type:e.type.substr(0,3),name:e.name[t]},"map"===e.type&&(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources[e.type.substr(0,3)+"_"+e.name[t]].diobs=[]);else e.remote&&_main_js__WEBPACK_IMPORTED_MODULE_0__.j3.Resource.setResource(e.type,e.name,e.remote,!0),e.type=e.type.substr(0,3),_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources[e.type+"_"+e.name]=e,"map"===e.type&&(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources[e.type+"_"+e.name].diobs=[]);else for(const t in _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.resources){const r=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.resources[t].p.split("_"),n=r.shift(),i=r.join("_");e.type.startsWith(n)&&(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources[n+"_"+i]={type:n,name:i},"map"===e.type&&(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources[n+"_"+i].diobs=[]))}}else if("*"===_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.preloadResources)for(const t in _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.resources){const e=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.resources[t].p.split("_"),r=e.shift(),n=e.join("_");_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources[r+"_"+n]={type:r,name:n},"map"===r&&(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources[r+"_"+n].diobs=[])}_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.mainMap&&!_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.maps[_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.mainMap]&&!_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["map_"+_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.mainMap]&&_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.resources["map_"+_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.mainMap]&&(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["map_"+_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.mainMap]={type:"map",name:_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.mainMap,diobs:[]});for(const i in _vy_global)_vy_global[i]&&"string"==typeof _vy_global[i]&&(_vy_global[i]=eval("("+decodeURIComponent(_vy_global[i])+")"));for(const t in _object_js__WEBPACK_IMPORTED_MODULE_1__.P.regions)_object_js__WEBPACK_IMPORTED_MODULE_1__.P.regions[t].onNew?.();_main_js__WEBPACK_IMPORTED_MODULE_0__.j3.World.onNew?.();for(const t in _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources){const e=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources[t];_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadResource(e.type,e.name)}let lastLen=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadResCount=Object.keys(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources).length;_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadResPercent="0.00";let c=0,lenStuck=0;const loader=setInterval((function(){c++;let t=Object.keys(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources).length;t===lastLen?(lenStuck++,lenStuck>=200&&(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources={},t=0)):lenStuck=0,lastLen=t,t?(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadResPercent=(100-t/_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadResCount*100).toFixed(2),_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.loadScreen?_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.loadScreen.onTick&&_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.loadScreen.onTick(t,_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadResPercent):(document.getElementById("load_screen_loader_text").innerText=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadResPercent+"%",document.getElementById("load_screen_loader").style.width=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadResPercent/100*192+"px",c>=4&&(document.getElementById("load_screen_loader_text").style.display="block",document.getElementById("load_screen_loader_back").style.display="block",document.getElementById("load_screen_loader").style.display="block"))):(_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.loadScreen?_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.loadScreen.onTick&&_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.loadScreen.onTick(t,100):(document.getElementById("load_screen_loader_text").style.display="none",document.getElementById("load_screen_loader_back").style.display="none",document.getElementById("load_screen_loader").style.display="none"),_main_js__WEBPACK_IMPORTED_MODULE_0__.vC.initialized(),clearInterval(loader))}),25)},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadResource=function(t,e,r){"ico"===t?_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadAtlas(e,r):"int"===t?_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadInterface(e,r):"sou"===t?_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadSound(e,0,r):"mac"===t?_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadMacro(e,r):"map"===t?_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadMap(e,r):"fil"===t&&_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadFile(e,r)},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadAtlas=function(t,e){if(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases.hasOwnProperty(t))return void(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases[t].loading?e&&(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases[t].loadFuncs||(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases[t].loadFuncs=[]),_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases[t].loadFuncs.push(e)):(delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["ico_"+t],e&&_main_js__WEBPACK_IMPORTED_MODULE_0__.vC._callback(e,"exists")));const r=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.resources["ico_"+t];if(!r)return delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["ico_"+t],void(e&&_main_js__WEBPACK_IMPORTED_MODULE_0__.vC._callback(e));if(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles.hasOwnProperty(r.f))return _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconsO[t]=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconsO[_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles[r.f]],_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconAtlasO=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconAtlasO[_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles[r.f]],_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases.hasOwnProperty(t)&&_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases[t].loading||delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["ico_"+t],void(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases[_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles[r.f]].loading?_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadAtlas(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles[r.f],e):e&&_main_js__WEBPACK_IMPORTED_MODULE_0__.vC._callback(e));const n=(r.r?r.f:_main_js__WEBPACK_IMPORTED_MODULE_0__.U3.resourceServer+"/resources/"+r.f)+"?v="+r.v;_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases[t]={loading:[]},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconsO[t]||_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.newIconAtlas(t),_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles[r.f]=t;const i=new XMLHttpRequest;i.open("GET",n,!0),i.overrideMimeType("text/plain; charset=x-user-defined"),i.onreadystatechange=async()=>{if(4===i.readyState){if(404!==i.status&&i.response){let r="";try{r=_lib_pako_js__WEBPACK_IMPORTED_MODULE_2___default().inflate(i.response,{to:"string"})}catch(t){r=i.response}r?await _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q._loadAtlas(t,JSON.parse(r),e):await _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q._loadAtlas(t,r,e)}else{if(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases[t].loadFuncs){for(const e in _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases[t].loadFuncs)_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases[t].loadFuncs.hasOwnProperty(e)&&_main_js__WEBPACK_IMPORTED_MODULE_0__.vC._callback(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases[t].loadFuncs[e]);delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases[t].loadFuncs}e&&_main_js__WEBPACK_IMPORTED_MODULE_0__.vC._callback(e,!1)}delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["ico_"+t]}},i.send()},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q._loadAtlas=async function(t,e,r){const n=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.iconAtlasO[t]||_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.newIconAtlas(t);if(e.v){if(1===e.v){const r=_main_js__WEBPACK_IMPORTED_MODULE_0__.Bn.imgPre;for(let i=0,s=e.i.length;i<s;i++){const s=e.i[i],o=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.newIcon(t,decodeURIComponent(s[0]),"",s[3],s[1],s[2],r+s[4],await PIXI.Assets.load(`${r}${s[4]}`));let a=s[3];if(s[5].length)for(let e=0,n=s[5].length;e<n;e++){const n=s[5][e],i=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.newIcon(t,decodeURIComponent(s[0]),"",n[1]||a,s[1],s[2],r+n[0],await PIXI.Assets.load(`${r}${n[0]}`));o._vy_addFrame(i),n[1]&&(a=n[1])}if(n._vy_addIcon(o),s[6])for(let e=0,n=s[6].length;e<n;e++){const n=s[6][e],i=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.newIcon(t,o._vy_iconName,decodeURIComponent(n[0]),n[2],s[1],s[2],r+n[1],await PIXI.Assets.load(`${r}${n[1]}`));if(a=n[2],o._vy_addState(i),n[3])for(let e=0,l=n[3].length;e<l;e++){const l=n[3][e],_=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.newIcon(t,o._vy_iconName,i._vy_iconState,l[1]||a,s[1],s[2],r+l[0],await PIXI.Assets.load(`${r}${l[0]}`));i._vy_addFrame(_),l[1]&&(a=l[1])}}}}}else dE("unknown","unknown","Invalid icon format: "+t);if(delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases[t].loading,_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases[t].loadFuncs){for(const e in _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases[t].loadFuncs)_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases[t].loadFuncs.hasOwnProperty(e)&&_main_js__WEBPACK_IMPORTED_MODULE_0__.vC._callback(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases[t].loadFuncs[e],"loaded");delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedAtlases[t].loadFuncs}r&&_main_js__WEBPACK_IMPORTED_MODULE_0__.vC._callback(r,"loaded")},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadFile=function(t,e){const r=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.resources["fil_"+t];if(!r)return delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["fil_"+t],void(e&&e());if(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles.hasOwnProperty(r.f))return _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.fileText[t]=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.fileText[_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles[r.f]],delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["fil_"+t],void(e&&e());_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.fileText[t]={loading:[]},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles[r.f]=t;const n=new XMLHttpRequest;n.open("GET",(r.r?r.f:_main_js__WEBPACK_IMPORTED_MODULE_0__.U3.resourceServer+"/resources/"+r.f)+"?v="+r.v,!0),n.onreadystatechange=function(){4==n.readyState&&(404!==n.status?(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.fileText[t].text=n.responseText,e&&e("loaded")):e&&e(!1),delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["fil_"+t])},n.send()},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadIntSkipVars=["type","x","y","xPos","yPos","hidden","isHidden","name","text"],_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadInterface=function(t,e){if(_main_js__WEBPACK_IMPORTED_MODULE_0__.um._vy_interfaces[t])return delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["int_"+t],void(e&&e("exists"));const r=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.resources["int_"+t];if(!r)return delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["int_"+t],void(e&&e());if(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles.hasOwnProperty(r.f))return _main_js__WEBPACK_IMPORTED_MODULE_0__.um._vy_interfaces[t]=_main_js__WEBPACK_IMPORTED_MODULE_0__.um._vy_interfaces[_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles[r.f]],delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["int_"+t],void(e&&e());const n=_main_js__WEBPACK_IMPORTED_MODULE_0__.um._vy_interfaces[t]=_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createObject("InterfacePane");_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles[r.f]=t;const i=new XMLHttpRequest;i.open("GET",(r.r?r.f:_main_js__WEBPACK_IMPORTED_MODULE_0__.U3.resourceServer+"/resources/"+r.f)+"?v="+r.v,!0),i.onreadystatechange=function(){if(4===i.readyState){if(404!==i.status&&i.responseText){n._vy_client=_main_js__WEBPACK_IMPORTED_MODULE_0__.um,n._vy_name=t;const r=JSON.parse(i.responseText);let s=0;const o="i_"+_main_js__WEBPACK_IMPORTED_MODULE_0__.um._vy_clientID+"_"+t+"_";for(let t=0,e=r.elements.length;t<e;t++){const e=r.elements[t],i=_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createObject(e.type,null,o+ ++s);i._vy_x=e.x||e.xPos||0,i._vy_y=e.y||e.yPos||0;for(const t in e)if(!_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadIntSkipVars.includes(t))if(isNaN(e[t]))try{i[t]=JSON.parse(decodeURIComponent(e[t]))}catch(r){i[t]=decodeURIComponent(e[t])}else i[t]=e[t];i._vy_edgeLock&&i._vy_isWebBox&&(i._vy_edgeLock.includes("bottom")&&(i._vy_y=_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.origHeight-(i._vy_y+i._vy_h)),i._vy_edgeLock.includes("right")&&(i._vy_x=_main_js__WEBPACK_IMPORTED_MODULE_0__.a$.origWidth-(i._vy_x+i._vy_w))),void 0!==e.text&&(i._vy_text=decodeURIComponent(e.text)),i.isHidden=e.hidden||e.isHidden||i.isHidden||0,i._vy_name=e.name,i.onNew?.(),n._vy_addChild(i)}e&&e("loaded"),_main_js__WEBPACK_IMPORTED_MODULE_0__.um.onInterfaceLoaded?.(t)}else e&&e(!1);delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["int_"+t]}},i.send()},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadMacro=function(t,e){const r=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.resources["mac_"+t];if(!r||_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.macros[t])return delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["mac_"+t],void(e&&e());if(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles.hasOwnProperty(r.f))return _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.macros[t]=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.macros[_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles[r.f]],delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["mac_"+t],void(e&&e());_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.macros[t]={},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles[r.f]=t;const n=new XMLHttpRequest;n.open("GET",(r.r?r.f:_main_js__WEBPACK_IMPORTED_MODULE_0__.U3.resourceServer+"/resources/"+r.f)+"?v="+r.v,!0),n.onreadystatechange=function(){if(4==n.readyState){if(404!==n.status&&n.responseText){const r=JSON.parse(n.responseText);for(let e=0,n=r.macros.length;e<n;e++){const n=r.macros[e],i=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.macros[t][n.key]={name:decodeURIComponent(n.name)};if(n.keyDown){const t=decodeURIComponent(n.keyDown),e=t.includes(".call(this,")?t.substring(0,t.length-2).split(".call(this,"):t.substring(0,t.length-2).split(".call(this");_object_js__WEBPACK_IMPORTED_MODULE_1__.P.objectTypes.Client._vy_com[e[0]]&&(i.down=e[0],e[1]&&(i.downArgs=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.parseMacroFileKeyArgs(e[1])))}if(n.keyUp){const t=decodeURIComponent(n.keyUp),e=t.includes(".call(this,")?t.substring(0,t.length-2).split(".call(this,"):t.substring(0,t.length-2).split(".call(this");_object_js__WEBPACK_IMPORTED_MODULE_1__.P.objectTypes.Client._vy_com[e[0]]&&(i.up=e[0],e[1]&&(i.upArgs=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.parseMacroFileKeyArgs(e[1])))}}e&&e("loaded")}else e&&e(!1);delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["mac_"+t]}},n.send()},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadSound=function(t,e,r){if(!_main_js__WEBPACK_IMPORTED_MODULE_0__.R5.player)return delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["sou_"+t],void(r&&r("loaded"));const n=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.resources["sou_"+t];if(!n)return delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["sou_"+t],void(r&&r());if(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles.hasOwnProperty(n.f))return _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedSounds[t]=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedSounds[_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles[n.f]],delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["sou_"+t],void(r&&r());if(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedSounds.hasOwnProperty(t))return delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["sou_"+t],void(r&&r("loaded"));n.loading=[],_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedSounds[t]=n,_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles[n.f]=t;const i=new XMLHttpRequest;i.open("GET",(n.r?n.f:_main_js__WEBPACK_IMPORTED_MODULE_0__.U3.resourceServer+"/resources/"+n.f)+"?v="+n.v,!0),i.responseType="arraybuffer",i.onreadystatechange=function(){if(4==i.readyState){if(404===i.status)return delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["sou_"+t],delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedSounds[t],void(r&&r(!1));_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadedSounds[t].data=i.response,delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["sou_"+t],e&&(Array.isArray(e)?e[0]._vy_isStopped||_main_js__WEBPACK_IMPORTED_MODULE_0__.R5.playSound(e[0],e[1],e[2]):e._vy_isStopped||_main_js__WEBPACK_IMPORTED_MODULE_0__.R5.playSound(e)),r&&r("loaded")}},i.send()},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadMap=function(t,e){const r=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.resources["map_"+t];if(!r)return _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.maps[t]||(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.createMap(t)._vy_isLoaded=!1),void(e&&e());if(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles.hasOwnProperty(r.f))return _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.maps[t]=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.maps[_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles[r.f]],delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["map_"+t],void(e&&e());if(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["map_"+t]){if(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["map_"+t].loading)return void(e&&e())}else _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["map_"+t]={type:"map",name:t,diobs:[]};_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["map_"+t].loading=!0,_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.maps[t]||(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.maps[t]=_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createObject("TileMap",_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createMap,t)),_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles[r.f]=t;const n=new XMLHttpRequest;n.open("GET",(r.r?r.f:_main_js__WEBPACK_IMPORTED_MODULE_0__.U3.resourceServer+"/resources/"+r.f)+"?v="+r.v,!0),n.onreadystatechange=function(){if(4===n.readyState)if(404!==n.status&&n.responseText){const r=JSON.parse(n.responseText);e?_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.newMap(t,r,0,(function(){e("loaded")})):_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.newMap(t,r)}else delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["map_"+t],e&&e(!1)},n.send()},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.newMap=function(t,e,r,n){let i=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.maps[t];i?(i._vy_name=t,i._vy_mapN=t,i._vy_xMax=e.map.xMax,i._vy_width=i._vy_xMax*i._vy_tileW,i._vy_yMax=e.map.yMax,i._vy_height=i._vy_yMax*i._vy_tileH):i=_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createObject("TileMap",_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createMap,t,e.map.xMax,e.map.yMax),i._vy_tiles=new Array(i._vy_xMax+i._vy_xMax*i._vy_yMax),r&&(i._vy_isClone=r);let s=0,o=1,a=e.tiles,l=e.map.fCTLen,_=0,u="m_"+t+"_",c={};const h=e.objects,d=e.map.fCOLen,p={};for(let t=0,r=e.tTypes.length;t<r;t++)c[e.tTypes[t].fC]=t;for(let t=0,r=e.oTypes.length;t<r;t++)p[e.oTypes[t].fC]=t;let y=0;const v=[],f=setInterval((function(){const t=Math.min(2e4,a.length-y);for(const r=y+t;y<r;y+=l){s++,s>i._vy_xMax&&(s=1,o++);let t,r=e.tTypes[c[a.substring(y,y+l)]].type;r.includes(",")&&(t=r.split(","),r=t[0]);const n=_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createObject(r,null,u+s+"x"+o,s,o,i);if(n.onNew&&v.push(n),t&&t.length>1){for(let e=1,r=t.length;e<r;e++){let i=t[e];if(i.includes("{")&&(i=decodeURIComponent(i)),e===r-1&&(_object_js__WEBPACK_IMPORTED_MODULE_1__.P.regions.hasOwnProperty(i)||i.startsWith("Region/")))"Region"!==i&&_object_js__WEBPACK_IMPORTED_MODULE_1__.P.regions[i]&&(n._vy_region=_object_js__WEBPACK_IMPORTED_MODULE_1__.P.regions[i]);else{const t=n._vy_addOverlay(i,_main_js__WEBPACK_IMPORTED_MODULE_0__.Bn.appMaskS,0,0,u+ ++_);t.onNew&&v.push(t),t._vy_localOver=1,t._vy_xCoOff&&(t._vy_xIcoOff+=t._vy_xCoOff),t._vy_yCoOff&&(t._vy_yIcoOff+=t._vy_yCoOff)}}t=0}}y>=a.length&&(clearInterval(f),m())}),1),m=function(){_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.maps[t]=i,i._vy_generateMapChunks(),s=0,o=1;for(let r=0,n=h.length;r<n;r+=d){s++,s>i._vy_xMax&&(s=1,o++);const n=p[h.substring(r,r+d)];if(n){const r=e.oTypes[n],a=r.type.includes(",")?r.type.split(","):[r.type];for(let e=0,r=a.length;e<r;e++){const r=_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createObject(a[e],null,u+ ++_);r._vy_locs=[],r._vy_mapN=t,r._vy_map=i,r._vy_yTiles=Math.floor(r._vy_h/i._vy_tileH)+1,r._vy_xTiles=Math.floor(r._vy_w/i._vy_tileW)+1,r._vy_setPos((s-1)*i._vy_tileW+r._vy_xCoOff,(o-1)*i._vy_tileH+r._vy_yCoOff,t),r.onNew&&v.push(r)}}}if(i._vy_file=e,i._vy_isLoaded=!0,i._vy_deleted.length>1)for(let t=1,e=i._vy_deleted.length;t<e;t++){const e=_main_js__WEBPACK_IMPORTED_MODULE_0__.vC._getObject(i._vy_deleted[t]);e&&_object_js__WEBPACK_IMPORTED_MODULE_1__.P.deleteDiob(e)}for(const t of v)t.onNew?.();i.onNew?.(),_main_js__WEBPACK_IMPORTED_MODULE_0__.j3.World.onMapLoaded?.(t);const r=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["map_"+t];if(r&&(delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.loadingResources["map_"+t],r.diobs))for(let e=0,n=r.diobs.length;e<n;e++){const n=r.diobs[e],s=n._vy_waitingMap;n&&n._vy_type&&s&&s.map===t&&(s.coords?n._vy_setMap_(t,(s.x-1)*i._vy_tileW,(s.y-1)*i._vy_tileH):n._vy_setMap_(t,s.x,s.y),n._vy_waitingMap=null)}if(n&&_main_js__WEBPACK_IMPORTED_MODULE_0__.vC._callback(n),r&&r.clones)for(let t=0,e=r.clones.length;t<e;t++)_main_js__WEBPACK_IMPORTED_MODULE_0__.vC._callback(r.clones[t]);if(_main_js__WEBPACK_IMPORTED_MODULE_0__.vC.serSocket&&(_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.mapSerUpdatedT[t]&&(_main_js__WEBPACK_IMPORTED_MODULE_0__.vC.serPacketFunc[51].apply(_main_js__WEBPACK_IMPORTED_MODULE_0__.vC,_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.mapSerUpdatedT[t]),delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.mapSerUpdatedT[t]),_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.mapSerUpdated[t])){for(let e=0,r=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.mapSerUpdated[t].length;e<r;e++)_main_js__WEBPACK_IMPORTED_MODULE_0__.vC.serPacketFunc[5].apply(_main_js__WEBPACK_IMPORTED_MODULE_0__.vC,_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.mapSerUpdated[t][e]);delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.mapSerUpdated[t]}i._vy_mapView?._vy_eye&&i._vy_mapView._vy_updateScreen()};return i},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.clearMap=function(t,e){const r=[],n=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.maps[t];if(n)for(let t=1,e=n._vy_yMax;t<=e;t++)for(let e=1,i=n._vy_xMax;e<=i;e++){const i=n._vy_tiles[e+n._vy_xMax*t];if(i){r.push(i);for(const t in i.contents){const e=i.contents[t];e&&e.loc===i&&!e._vy_client&&(r.includes(e)||r.push(e))}}}delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.maps[t];const i=_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.resources["map_"+t];if(i&&delete _ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.vyrFiles[i.f],e){for(let t=r.length;t--;)r[t]._vy_mapN=null;return r}for(let t=r.length;t--;)_object_js__WEBPACK_IMPORTED_MODULE_1__.P.deleteDiob(r[t])},_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.createMap=function(t,e,r,n){if(!t)return;e||(e=0),void 0===r&&(r=e),n||(n="Tile"),_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.maps[t]&&_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.clearMap(t);const i=_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createObject("TileMap",_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createMap,t,e,r),s=[];if(e&&r){const o="m_"+t+"_";i._vy_tiles=new Array(e+e*r);for(let t=1;t<=e;t++)for(let e=1;e<=r;e++){const r=_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createObject(n,null,o+t+"x"+e,t,e,i);r.onNew&&s.push(r)}}i._vy_isLoaded=!0,_ResourceManager_ts__WEBPACK_IMPORTED_MODULE_3__.Q.maps[t]=i;for(const t of s)t.onNew?.();return i._vy_generateMapChunks(),i.onNew?.(),_main_js__WEBPACK_IMPORTED_MODULE_0__.j3.World.onMapLoaded?.(t),i}},461:(t,e,r)=>{"use strict";r.d(e,{K:()=>a});var n=r(518),i=r(140),s=r(708),o=r(868);class a extends s.z{_vy_isClient=!0;_vy_playerMob=null;_vy_address="localhost";_vy_accountName="Guest";_vy_xViewEyeOffset=0;_vy_yViewEyeOffset=0;_vy_maxFPS=0;_vy_inInput=!1;_vy_mainOutput=null;_vy_mainOutputInt=null;_vy_mainOutputEl=null;_vy_mainWebStyle="";_vy_screenBackground=null;_vy_webBackground=null;_vy_macroAtlas=null;_vy_customMacros=null;_vy_commands=null;_vy_remCom=null;_vy_cursor=null;_vy_focused=null;_vy_xEdgeLimit=null;_vy_yEdgeLimit=null;_vy_volume=100;_vy_onScr=!0;_vy_color=null;_vy_mouseOp=0;_vy_x=0;_vy_y=0;_vy_over=null;_vy_filters=null;_vy_inCommandInput=null;_vy_keyDown=null;_vy_keysDown=null;_vy_interfaces=null;_vy_pauseMacros=!1;_vy_navigator=null;_vy_mousePos=null;_vy_mouseEvent=null;_vy_fps=0;_vy_clientID=0;_vy_typesLoadedQueue=!1;_vy_isKicked=!1;_vy_isReboot=!1;_vy_mapView=null;_vy_renderOptions=null;onNew=null;onDel=null;onWindowResize=null;onWindowFocus=null;onWindowBlur=null;onScreenMoved=null;onScreenRender=null;onConnect=null;onDisconnect=null;onPacket=null;onMouseClick=null;onMouseDblClick=null;onMouseEnter=null;onMouseExit=null;onMouseMove=null;onMouseDown=null;onMouseUp=null;onMouseWheelScrollUp=null;onMouseWheelScrollDown=null;onKeyDown=null;onKeyUp=null;onInterfaceLoaded=null;onInterfaceShow=null;onInterfaceHide=null;constructor(){super()}_vy_preinitiate=function(){this._vy_interfaces={},this._vy_cursor={cursor:"default",x:0,y:0},this._vy_customMacros={},this._vy_commands={},this._vy_over=[],this._vy_keyDown={},this._vy_keysDown=[],this._vy_navigator={platform:navigator.appName,version:navigator.appVersion,vendor:navigator.vendor,language:navigator.language,system:navigator.oscpu},this._vy_mousePos={x:0,y:0},this._vy_mouseEvent={}};_vy_initiate=function(){if(this.createInterface(""),this._vy_w=n.a$.gameWidth,this._vy_h=n.a$.gameHeight,this.mainOutput&&(this._vy_mainOutputInt=this.mainOutput.substring(0,this.mainOutput.indexOf(".")),this._vy_mainOutputEl=this.mainOutput.substring(this.mainOutput.indexOf(".")+1,this.mainOutput.length)),this.hideFPS||(n.vC.fpsLabel.style.display="block"),this.mainWebStyle&&this._vy_addWebStyle("default",this.mainWebStyle),this.webBackground&&this.setWebBackground(this.webBackground),n.up.initiate(),n.j3.Util.isString(this._vy_mapView)?this.mapView=this._vy_mapView:this._vy_mapView?this._vy_mapView._vy_isMapView||(this.mapView=this._vy_mapView):this.mapView={},this.getInterfacePane("").addChild(this._vy_mapView),this.screenView?this.setScreenView(this.screenView):this.setScreenView(),null!==this.screenBackground&&this.setScreenBackground(this.screenBackground),this._vy_color&&this.setColor(this._vy_color),this._vy_loc=this,null===this._vy_xEdgeLimit&&null===this._vy_yEdgeLimit||this.setEdgeLimit(this._vy_xEdgeLimit,this._vy_yEdgeLimit),!n.vC.serSocket&&(this._vy_accountName=n.aK.playerAcc.name,this.setMacroAtlas(n.a$.mainMacro),!this._vy_playerMob)){const t=i.P.createObjectNew(n.a$.mainMob||"Mob");""===t._vy_mapN&&n.a$.mainMap&&t._vy_setMap(n.a$.mainMap,t._vy_x,t._vy_y),this._vy_playerMob=t,t._vy_clientC=this,this._vy_setPlayerMob(t,!0)}this.showInterface(""),this.onNew?.(n.vX),this.onConnect&&!n.vC.serSocket&&this.onConnect(n.vX),n.vC.setWindowSize(),n.vC.resizeWindow?(this.onWindowResize?.(window.innerWidth,window.innerHeight),delete n.vC.resizeWindow):window.innerWidth===n.a$.gameWidth&&window.innerHeight===n.a$.gameHeight||this.onWindowResize?.(window.innerWidth,window.innerHeight),n.vC.hideLoadScreen(),this._vy_initiated=!0};_vy_setPlayerMob=function(t,e){const r=this._vy_playerMob;if(this._vy_playerMob&&!e){if(this._vy_playerMob===t)return;this._vy_clearPlayerMob()}if(t){if(this._vy_playerMob=t,t._vy_clientC=this,n.vC.serSocket&&t._vy_chunks&&t._vy_id&&t._vy_id.startsWith("r"))for(let e=t._vy_chunks.length;e--;){const r=t._vy_chunks[e],n=r.c.indexOf(t);-1!==n&&r.c.splice(n,1)}this._vy_mapView._vy_lastDisS=0,this._vy_mapView._vy_eye&&this._vy_mapView._vy_eye!==r||this.setViewEye(t),t.onLogin?.()}};_vy_clearPlayerMob=function(){if(n.vC.serSocket){const t=this._vy_playerMob;if(t.onLogout?.(),t._vy_clientC===this&&(t._vy_clientC=void 0),this._vy_clearKeyDownEvents(),t._vy_chunks&&!t.preventInterest&&t._vy_id&&t._vy_id.startsWith("r"))for(let e=t._vy_chunks.length;e--;){const r=t._vy_chunks[e];r.c.includes(t)||r.c.push(t)}}else this._vy_playerMob.onLogout?.(),this._vy_playerMob._vy_clientC===this&&(this._vy_playerMob._vy_clientC=void 0),this._vy_clearKeyDownEvents();this._vy_playerMob=void 0};_vy_disconnected=function(){this.onDisconnect&&!n.vC.serSocket&&this.onDisconnect(),this._vy_clearPlayerMob(),this.onDel?.()};_vy_sendClientCommand=function(t,e){this._vy_parentT._vy_com[t]&&this._vy_parentT._vy_com[t].apply(this,e),n.vC.serSocket.sendPacket([4,t,e])};_vy_onFocus=function(t){if(this._vy_focused){if(this._vy_focused===t)return;this._vy_onUnfocus(this._vy_focused)}this._vy_focused=t,t.onFocus?.(this),t._vy_gui&&t._vy_isTextInput&&(this._vy_clearKeyDownEvents(),t._vy_isCommandInput?this._vy_inCommandInput=t:t._vy_isTextInput&&(this._vy_inTextInput=t),t._vy_dom.value=t._vy_text,t._vy_dom.focus())};_vy_unfocus=function(t){if(!t){if(!this._vy_focused)return void window.focus();t=this._vy_focused}this._vy_onUnfocus(t),window.focus()};_vy_onUnfocus=function(t){this._vy_focused===t&&(this._vy_focused=null),t.onUnfocus?.(this),t._vy_gui&&t._vy_isTextInput&&(t._vy_isCommandInput?this._vy_inCommandInput=0:t._vy_isTextInput&&(this._vy_inTextInput=0),t._vy_dom.value=t._vy_text,t._vy_dom.blur())};_vy_setKeyDownEvent=function(t,e){this._vy_keysDown.includes(e)||(t&&(this._vy_keyDown[e]=t,1!==t.down&&(this._vy_commands?.[t.down]?this._vy_commands[t.down].apply(this,t.downArgs):this._vy_parentT._vy_com[t.down]&&this._vy_parentT._vy_com[t.down].apply(this,t.downArgs))),this._vy_keysDown.push(e))};_vy_clearKeyDownEvent=function(t){this._vy_keyDown[t]=0;const e=this._vy_keysDown.indexOf(t);-1!==e&&this._vy_keysDown.splice(e,1)};_vy_clearKeyDownEvents=function(t,e){if(this._vy_keysDown){for(let r=0,i=this._vy_keysDown.length;r<i;r++){if(!this._vy_keysDown[r])continue;const i=this._vy_keysDown[r];if(t||(this._vy_keysDown[r]=void 0),this.onKeyUp?.(i),this._vy_keyDown[i])if(!this._vy_pauseMacros||e){let t=null;this._vy_customMacros[i]?.up?t=this._vy_customMacros[i]:o.Q.macros[this._vy_macroAtlas]?.[i]?.up&&(t=o.Q.macros[this._vy_macroAtlas][i]),t?(1!==t.up&&(this._vy_commands?.[t.up]?this._vy_commands.apply(this,t.upArgs):this._vy_parentT._vy_com[t.up].apply(this,t.upArgs)),n.vC.serSocket?.sendPacket([1,i])):this._vy_ser_onKeyUp&&n.vC.serSocket?.sendPacket([1,i])}else this._vy_ser_onKeyUp&&n.vC.serSocket?.sendPacket([11,i])}t||(this._vy_keyDown={},this._vy_keysDown=[])}};_vy_addOverlay=function(t,e,r,n){if(this._vy_isOverlay&&!0!==this._vy_isOverlay)return;t||(t="Overlay");let s,o=t;if("string"==typeof t)(t=i.P.createObject(t,null,n))._vy_loc=this,t._vy_isOverlay=this,t.onNew&&!n&&t.onNew(),o=t;else{if(!t._vy_type)return;if(s=!0,t._vy_isOverlay&&"object"==typeof t._vy_isOverlay){if(t._vy_isOverlay===this)return t;t._vy_isOverlay.removeOverlay(t,!0)}else e?(o=i.P.createObject(t._vy_type,null,n),o._vy_loc=this,o._vy_isOverlay=this,o.onNew?.()):(t._vy_x<0||t._vy_y<0)&&(t._vy_x=0,t._vy_y=0,this._vy_updateScreenSpritePos())}return s="Overlay"===t._vy_baseType&&!e,o._vy_id||(o.id=n),s||(o!==t&&o.setAppearance(t),o.mouseOpacity=t._vy_mouseOp,t._vy_x&&(o._vy_x=t._vy_x),t._vy_y&&(o._vy_y=t._vy_y)),o._vy_loc=this,o._vy_isOverlay=this,o._vy_parent=this,o._vy_isLoc&&(o._vy_isLoc=!1),o._vy_appMask=null,o._vy_setAtlas(o._vy_atlas,o._vy_icoName,!0),o._vy_x||(o._vy_x=0),o._vy_y||(o._vy_y=0),this._vy_over?this._vy_over.push(o):this._vy_over=[o],o._vy_client=_vy_cOb,this._vy_mapView._vy_addToScreen(o),r||(this.onAddOverlay?.(o),o.onOverlayed?.(this)),isNaN(o._vy_id)||(o._vy_localOver=1),o};_vy_removeOverlay=function(t,e){const r=this._vy_over.indexOf(t);-1!==r&&this._vy_over.splice(r,1),t&&(t._vy_onScr?._vy_removeFromScreen(t),this.onRemoveOverlay?.(t),t.onUnoverlayed?.(this),e?(t._vy_isOverlay=null,t._vy_parent=null):i.P.deleteDiob(t))};_vy_addWebStyle=function(t,e,r){if(!e)return;r||(r="css_");const i=document.getElementsByTagName("head")[0],s=document.createElement("style");t&&s.setAttribute("id",r+t),s.setAttribute("type","text/css"),"css_"===r?s.appendChild(document.createTextNode(n.vC.getWebStyle(e))):s.appendChild(document.createTextNode(e)),i.appendChild(s)};_vy_removeWebStyle=function(t,e){e||(e="css_");const r=document.getElementById(e+t);r&&r.parentNode.removeChild(r)};get mob(){return this._vy_playerMob}set mob(t){this._vy_setPlayerMob(t)}setPlayerMob=function(t){this._vy_setPlayerMob(t)};getPlayerMob=function(){return this._vy_playerMob};getAddress=function(){return this._vy_address};get address(){return this._vy_address}set address(t){}setMaxFPS=function(t){this._vy_maxFPS=t,PIXI.Ticker.shared.maxFPS=t};get maxFPS(){return this._vy_maxFPS}set maxFPS(t){this.setMaxFPS(t)}getFPS=function(){return this._vy_fps};get inInput(){return this._vy_inInput}set inInput(t){this._vy_inInput=t}setMainOutput=function(t){this._vy_mainOutput=t,this._vy_mainOutputInt=this._vy_mainOutput.substring(0,this._vy_mainOutput.indexOf(".")),this._vy_mainOutputEl=this._vy_mainOutput.substring(this._vy_mainOutput.indexOf(".")+1,this._vy_mainOutput.length)};get mainOutput(){return this._vy_mainOutput}set mainOutput(t){this.setMainOutput(t)}get mainWebStyle(){return this._vy_mainWebStyle}set mainWebStyle(t){this._vy_mainWebStyle=t}get volume(){return this._vy_volume}set volume(t){this._vy_volume=t}setColor=function(t){const e=n.up.pixiApp?.stage;if(e)if(t&&"object"==typeof t&&!Array.isArray(t))void 0!==t.tint&&(e.tint=t.tint||1048575);else{this._vy_color&&this._vy_color.tint&&(e.tint=16777215);const r=o.Q.getColorIcon(t);if(t=r.color,this._vy_colorAtlas&&o.Q.colorMatrix[this._vy_colorAtlas]){const t=e.filters;if(t){const r=t.indexOf(o.Q.colorMatrix[this._vy_colorAtlas]);-1!==r&&(t.splice(r,1),e.filters=t)}}if(t||0===t){if(this._vy_colorAtlas=r.m.toString().split(",",20).join(","),this._vy_colorMatrix=r.m,!o.Q.colorMatrix[this._vy_colorAtlas]){const t=new PIXI.ColorMatrixFilter;t.matrix=this._vy_colorMatrix,o.Q.colorMatrix[this._vy_colorAtlas]=t}if(e){let t=[o.Q.colorMatrix[this._vy_colorAtlas]];e.filters&&(t=e.filters.concat(t)),e.filters=t}}}this._vy_color=t};getColor=function(){return this._vy_color};get color(){return this._vy_color}set color(t){this.setColor(t)}getPlane=function(t){if(void 0===t){const t=[];for(const e in this._vy_mapView._vy_planes)t.push(parseFloat(e));return t}return this._vy_mapView._vy_planes[t]};setPlane=function(t,e,r){let n=this._vy_mapView._vy_planes[t];n||(this._vy_mapView._vy_setPlane(t),n=this._vy_mapView._vy_planes[t]),e&&(n[e]=r)};addOverlay=function(t,e){return this._vy_addOverlay(t,e)};removeOverlay=function(t,e){if(this._vy_over)if("string"==typeof t)for(let r=this._vy_over.length;r--;){const n=this._vy_over[r];n&&n!==t&&n._vy_type!==t||this._vy_removeOverlay(n,e)}else this._vy_removeOverlay(t,e)};getOverlays=function(t,e){if(this._vy_over||(this._vy_over=[]),t){const r=[];for(let n=0,s=this._vy_over.length;n<s;n++){const s=this._vy_over[n];s&&(i.P.isType(s._vy_type,t,e)&&r.push(s))}return r}return this._vy_over};setOverlays=function(t,e){this._vy_over||(this._vy_over=[]),t&&t instanceof Array||(t=[]);for(let r=this._vy_over.length;r--;){const n=this._vy_over[r];t.includes(n)||this.removeOverlay(n,e)}for(let e=0,r=t.length;e<r;e++)this._vy_addOverlay(t[e]);return this._vy_over};get overlays(){return this.getOverlays()}set overlays(t){this.setOverlays(t)}addFilter=function(t,e,r){let i;if(this._vy_filters||(this._vy_filters={}),this._vy_filters[t]&&this.removeFilter(t),"colorMatrix"===e)i=new PIXI.ColorMatrixFilter,r&&(r.matrix&&(i.matrix=r.matrix),void 0!==r.contrast&&i.contrast(r.amount),void 0!==r.brightness&&i.brightness(r.brightness),void 0!==r.saturate&&i.saturate(r.saturate),void 0!==r.hue&&i.hue(r.hue));else if("blackAndWhite"===e)i=new PIXI.ColorMatrixFilter,i.blackAndWhite();else if("grayscale"===e)i=new PIXI.ColorMatrixFilter,i.greyscale(r?.amount);else if("lsd"===e)i=new PIXI.ColorMatrixFilter,i.lsd();else if("negative"===e)i=new PIXI.ColorMatrixFilter,i.negative();else if("night"===e)i=new PIXI.ColorMatrixFilter,i.night(r?.intensity);else if("predator"===e)i=new PIXI.ColorMatrixFilter,i.predator(r?.amount);else if("sepia"===e)i=new PIXI.ColorMatrixFilter,i.sepia();else if("rbSwap"===e)i=new PIXI.ColorMatrixFilter,i.toBGR();else if("blur"===e)r?(i=new PIXI.BlurFilter(r.strength,r.quality,r.resolution,r.kernelSize),r.blurX&&(i.blurX=r.blurX),r.blurY&&(i.blurY=r.blurY)):i=new PIXI.BlurFilter;else if("displacement"===e)if(r){const t=r.diob;t._vy_pixS||t._vy_setScreenSprite(),i=new PIXI.DisplacementFilter(t._vy_pixS,r.scale)}else i=new PIXI.DisplacementFilter;else"noise"===e?i=r?new PIXI.NoiseFilter(r.amount,r.seed):new PIXI.NoiseFilter:"brightness"===e?(i=new PIXI.ColorMatrixFilter,i.brightness(r?.b,r?.multiply)):"contrast"===e?(i=new PIXI.ColorMatrixFilter,i.contrast(r?.amount,r?.multiply)):"hue"===e?(i=new PIXI.ColorMatrixFilter,i.contrast(r?.rotation,r?.multiply)):i="outline"===e?new PIXI.filters.OutlineFilter(r):"custom"===e&&r?r.filter:new PIXI.ColorMatrixFilter;r&&(void 0!==r.alpha&&(i.alpha=r.alpha),r.blendMode&&(i.blendMode=r.blendMode),void 0!==r.padding&&(i.padding=r.padding),void 0!==r.resolution&&(i.resolution=r.resolution));let s=[i];n.up.pixiApp.stage.filters&&(s=n.up.pixiApp.stage.filters.concat(s)),n.up.pixiApp.stage.filters=s,this._vy_filters[t]=i};removeFilter=function(t){if(!this._vy_filters)return;const e=this._vy_filters[t],r=Array.prototype.slice.call(n.up.pixiApp.stage.filters),i=r.indexOf(e);-1!==i&&r.splice(i,1),n.up.pixiApp.stage.filters=r,delete this._vy_filters[t]};getFilters=function(){return this._vy_filters||(this._vy_filters={}),Object.keys(this._vy_filters)};alert=function(t){return this._vy_clearKeyDownEvents(),alert(t)};prompt=function(t,e,r){this._vy_clearKeyDownEvents();const i=prompt(t,e);return r&&n.vC._callback(r,i),i};confirm=function(t,e){this._vy_clearKeyDownEvents();const r=confirm(t);return e&&n.vC._callback(e,r),r};aMes=function(t,e){n.j3.aMes(t,e)};log=function(t){console.log(t)};isGuest=function(){return!("Guest"!==this._vy_accountName&&!this._vy_accountName.match(/^Guest\-(.*)$/)&&!this._vy_accountName.match(/^Guest[0-9]+$/)||this._vy_accountName.includes("@"))};setScreenBackground=function(t){this._vy_screenBackground=t,t||(t=""),n.vC.canvasBackColor=t,t||(t="transparent"),n.vC.gameBody.style.backgroundColor=t,n.vC.gameCanvasControl.style.backgroundColor=t,document.body.style.backgroundColor=t};get screenBackground(){return this._vy_screenBackground}set screenBackground(t){this._vy_screenBackground=t}setWebBackground=function(t){t||(t=""),document.getElementById("web_background").innerHTML=n.vC.getWebText(t),this._vy_webBackground=t};get webBackground(){return this._vy_webBackground}set webBackground(t){this._vy_webBackground=t}setMacroAtlas=function(t){this._vy_clearKeyDownEvents(),this._vy_macroAtlas=t};get macroAtlas(){return this._vy_macroAtlas}set macroAtlas(t){this.setMacroAtlas(t)}addCustomMacro=function(t,e,r,n){if(!e||this._vy_customMacros[e])return;const i={name:t,key:e};if(n){let t=n.match(/^(.*)\((.*)\)$/);t&&(i.up=t[1],t[2]&&(i.upArgs=o.Q.parseMacroFileKeyArgs(t[2])))}if(r){let t=r.match(/^(.*)\((.*)\)$/);t&&(i.down=t[1],t[2]&&(i.downArgs=o.Q.parseMacroFileKeyArgs(t[2])))}this._vy_customMacros[e]=i};removeCustomMacro=function(t){let e="";for(const r in this._vy_customMacros){const n=this._vy_customMacros[r];if(n&&n.name===t){e=r;break}}this._vy_customMacros[e]=void 0};getCustomMacroNames=function(){const t=[];for(const e in this._vy_customMacros){const r=this._vy_customMacros[e];r&&t.push(r.name)}return t};setMouseCursor=function(t,e,r){let n=t;if(t){const i=void 0!==e&&void 0!==r?" "+e+" "+r:"";"string"==typeof t?-1===t.indexOf("/")&&-1===t.indexOf(".")||(n='url("'+t+'")'+i+", auto"):t._vy_type&&(t._vy_ico||t._vy_setIconCheck(),t._vy_ico&&(n='url("'+o.Q.getIconData(t._vy_ico)+'")'+i+", auto"))}else n="default";this._vy_cursor={cursor:t,x:e||0,y:r||0},document.body.style.cursor=n};getMouseCursor=function(){return this._vy_cursor};getMousePos=function(){return this._vy_mousePos};getAccountName=function(){return this._vy_accountName};get accountName(){return this._vy_accountName}set accountName(t){}showInterface=function(t,e,r){this._vy_interfaces[t]?.show(e,r)};hideInterface=function(t,e){this._vy_interfaces[t]?.hide(e)};getInterfacePane=function(t){return this._vy_interfaces[t]};getInterface=function(t,e){t||(t="");const r=t._vy_isIntPane?t:this._vy_interfaces[t];return void 0!==e?r?._vy_aContents[e]:r};refreshInterface=function(t){n.up.refreshInt=!0};checkInterfaceShown=function(t,e){const r=this._vy_interfaces[t];if(!r)return!1;if(e){const t=r._vy_aContents[e];return!!t&&!t.isHidden}return!!r._vy_isShown};outputText=function(t,e,r){if(!e&&!(e=this._vy_mainOutputInt))return;r||(e=this._vy_mainOutputInt,r=this._vy_mainOutputEl);const i=this._vy_interfaces[e];if(!i)return;const s=i._vy_aContents[r];s&&(s.isWebBox?s._vy_dom?(s._vy_text+=(s._vy_text.length?"\n":"")+t,s._vy_outputQueue||(s._vy_outputQueue=""),s._vy_outputQueue+='<div class="web_box_div" style="margin-bottom: '+(s._vy_textSty?.lineSpace?s._vy_textSty.lineSpace:n.up.defaultText.lineSpace)+'px">'+n.vC.getWebText(t)+"</div>",n.up.outputQueue.includes(s)||n.up.outputQueue.push(s)):(s._vy_outputs||(s._vy_outputs=[],s._vy_text.length&&s._vy_outputs.push(s._vy_text)),s._vy_outputs.push(t),s._vy_text+=(s._vy_text.length?"\n":"")+t):("TextBox"===s.interfaceType?(s._vy_text+=(s._vy_text.length?"\n":"")+t,s._vy_scrollToBot=!0):s._vy_text+=t,n.up.refreshInt=!0))};createInterface=function(t=""){const e=i.P.createObject("InterfacePane");e._vy_client=this,e._vy_name=t,this._vy_interfaces[t]=e,e.onNew?.()};addInterfaceElement=function(t="Interface",e="",r,n,s,o){const a="object"==typeof t&&null!==t?t:i.P.createObject(t);let l="object"==typeof e&&null!==e?e:this._vy_interfaces[e];return l||(l=this.createInterface(e)),a._vy_gui||(a.setText=i.P.objectTypes.Interface._vy_object.setText,a.setPos=i.P.objectTypes.Interface._vy_object.setPos,a._vy_gui=!0),void 0!==n&&(a._vy_x=n),void 0!==s&&(a._vy_y=s),r&&(a._vy_name=r),a._vy_client=l._vy_client,a.onNew&&a!==t&&a.onNew.apply(a,o),l._vy_addChild(a),a};removeInterfaceElement=function(t,e,r){const n=this._vy_interfaces[t];if(!n)return;const i="object"==typeof e&&null!==e?e:n._vy_aContents[e];i&&n._vy_removeChild(i,r)};getInterfaceElement=function(t="",e){if(!e)return;const r=this._vy_interfaces[t];if(!r)return;const n=r._vy_aContents[e];return n||void 0};getInterfaceElements=function(t,e,r){const n=[];if(!t)return n;const s=this._vy_interfaces[t];if(!s)return n;for(let t=0,o=s._vy_conts.length;t<o;t++){const o=s._vy_conts[t];o&&(e&&!i.P.isType(o._vy_type,e,r)||n.push(o))}return n};getInterfaceElementsFromScreen=function(t,e,r,s,o,a,l){const _=[];r||(r=t),s||(s=e),l?(t+=n.vC.xBodyPos,e+=n.vC.yBodyPos,r+=n.vC.xBodyPos,s+=n.vC.yBodyPos):(t*=n.vC.scaleWidth,e*=n.vC.scaleHeight,r*=n.vC.scaleWidth,s*=n.vC.scaleHeight);for(let l=0,u=n.up.interfaceElements.length;l<u;l++){const u=n.up.interfaceElements[l],c=u._vy_isOverlay?u._vy_isOverlay:u,h=(u._vy_isOverlay?u._vy_x:0)+c._vy_x+c._vy_xOr,d=(u._vy_isOverlay?u._vy_y:0)+c._vy_y+c._vy_yOr;if(void 0!==c._vy_x&&void 0!==c._vy_y)if(u.preventAutoScale){if(h+u._vy_w<t||h>r||d+u._vy_h<e||d>s)continue;o&&!i.P.isType(u._vy_type,o,a)||_.includes(u)||_.push(u)}else{if((h+u._vy_w)*n.vC.scaleWidth<t||h*n.vC.scaleWidth>r||(d+u._vy_h)*n.vC.scaleHeight<e||d*n.vC.scaleHeight>s)continue;o&&!i.P.isType(u._vy_type,o,a)||_.includes(u)||_.push(u)}}return _};getInterfaceNames=function(t){const e=Object.keys(this._vy_interfaces);for(let r=e.length;r--;){const n=e[r].includes("/");t&&n||!t&&!n||e.splice(r,1)}return e};setFocus=function(t,e){t&&"string"==typeof t&&e&&(t=this.getInterfaceElement(t,e)),t?this._vy_onFocus(t):this._vy_unfocus()};getFocus=function(){return this._vy_focused};setViewEye=function(t){this._vy_mapView.eye=t};getViewEye=function(){return this._vy_mapView._vy_eye};setViewEyeOffsets=function(t,e){t||(t=0),void 0===e&&(e=t),this._vy_xViewEyeOffset=t,this._vy_yViewEyeOffset=e,this._vy_mapView?._vy_isMapView&&this._vy_mapView.setEyeOffsets(t,e)};getViewEyeOffsets=function(){return this._vy_xViewEyeOffset||(this._vy_xViewEyeOffset=0),this._vy_yViewEyeOffset||(this._vy_yViewEyeOffset=0),{x:this._vy_xViewEyeOffset,y:this._vy_yViewEyeOffset}};get xViewEyeOffset(){return this._vy_xViewEyeOffset}set xViewEyeOffset(t){this.setViewEyeOffsets(t,this._vy_yViewEyeOffset||0)}get yViewEyeOffset(){return this._vy_yViewEyeOffset}set yViewEyeOffset(t){this.setViewEyeOffsets(this._vy_xViewEyeOffset||0,t)}setEdgeLimit=function(t,e){this._vy_xEdgeLimit=t,this._vy_yEdgeLimit=e,this._vy_mapView?.setEdgeLimit(t,e)};playSound=function(t,e,r){return n.R5.playSound(t,e,r)};setLocalStorage=function(t,e){n.vC.serSocket?window.parent.postMessage('{"type": "setLocalStorage", "key": "'+t+'", "data": "'+e+'"}',"*"):n.aK.setLocalStorage(t,e)};getLocalStorage=function(t){if(t)return window.localStorage.getItem(n.a$.gameID+"_"+t)};checkLocalStorage=function(){try{return window.localStorage.setItem("vylo-check","check"),window.localStorage.removeItem("vylo-check"),!0}catch(t){return!1}};addWebStyle=function(t,e){this._vy_addWebStyle(t,e)};removeWebStyle=function(t){this._vy_removeWebStyle(t)};addCustomFont=function(t,e,r,i){let s=r?e:n.j3.Resource.getResourcePath("file",e);r||(s=s.substring(0,s.indexOf("?v=")));let o=s.substring(s.lastIndexOf(".")+1);"ttf"===o?o="truetype":"otf"===o?o="opentype":"eot"===o&&(o="embedded-opentype");let a='@font-face { font-family: "'+t+'"; src: local("'+t+'"), url("'+s+'") format("'+o+'");';if(i)for(const t in i)a+=" "+t+": "+i[t]+";";a+=" }",this._vy_addWebStyle(t,a,"cfont_")};removeCustomFont=function(t){this._vy_removeWebStyle(t,"cfont_")};getWebTag=function(t){return document.getElementById(t)};setWebTagStyle=function(t,e,r){if(!t||!e)return;const i=document.getElementById(t);i&&(i.style[e]=n.vC.getWebStyle(r))};setWebTagContent=function(t,e,r){if(!t)return;const n=document.getElementById(t);n&&(r?"INPUT"===n.tagName||"TEXTAREA"===n.tagName?n.value=n.value+e:n.innerHTML+=e:"INPUT"===n.tagName||"TEXTAREA"===n.tagName?n.value=e:n.innerHTML=e)};getWebTagContent=function(t){if(!t)return;const e=document.getElementById(t);return e?"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:e.innerHTML:void 0};setWebTagFocus=function(t){if(!t)return;const e=document.getElementById(t);e&&e.focus()};callWebTagEvent=function(t,e){if(!t||!e)return;const r=n.vC.webEvents[e.toLowerCase()];if(!r)return;const i=document.getElementById(t);i&&i[r]()};removeWebTag=function(t){if(!t)return;const e=document.getElementById(t);e&&e.parentNode.removeChild(e)};getInterfaceCanvas=function(t,e){return n.up.intApp.view};addWebScript=function(t,e,r,n){if(!e)return;const i=document.getElementsByTagName("head")[0],s=document.createElement("script");t&&s.setAttribute("id","script_"+t),r?s.setAttribute("type","module"):s.setAttribute("type","text/javascript"),s.setAttribute("src",e),n&&(s.onload=n),i.appendChild(s)};removeWebScript=function(t){const e=document.getElementById("script_"+t);e&&e.parentNode.removeChild(e)};evalWebScript=function(t){return eval.call(null,t)};createTopScreen=function(t,e,r){t&&n.up.createTopScreenCanvas(t,e,r)};topScreenDraw=function(t,e){const r=n.up.topScreenBrush[e];r&&n.up.customScreenDraw(r,t)};setTopScreen=function(t,e,r,i,s){if(t&&e&&n.up.topScreenCanvas[t]&&!n.up.topScreenCanvas[e]&&(n.up.topScreenCanvas[e]=n.up.topScreenCanvas[t],n.up.topScreenCanvas[e].name=e,n.up.topScreenBrush[e]=n.up.topScreenBrush[t],delete n.up.topScreenCanvas[t],r||(r=99999),s&&n.up._setTopScreenSet(n.up.topScreenBrush[e],s),n.up.topScreenCanvas[e].style.zIndex=9e4+r,i&&n.up.topScreenBrush[t]))if("string"==typeof i){const e=new Image;e.onload=function(){n.up.topScreenBrush[t].drawImage(e,0,0)},e.src=i}else n.up.topScreenBrush[t].putImageData(i,0,0)};getTopScreen=function(t,e){e||(e="pixels");const r={name:t,layer:n.up.topScreenCanvas[t].style.zIndex-9e4,settings:{}};if(n.up.topScreenBrush[t]){const i=n.up.topScreenBrush[t];"url"===e?r.data=n.up.topScreenCanvas[t].toDataURL():"pixels"===e?r.data=i.getImageData(0,0,n.a$.gameWidth,n.a$.gameHeight):"canvas"===e&&(r.canvas=n.up.topScreenCanvas[t]),i.imageSmoothingEnabled,r.settings.scaleType="smooth"}return r};setMapView=function(t){if(t===this._vy_mapView&&t._vy_isMapView)return;const e=i.P.createWebBox(n.j3.Util.isString(t)?t:"MapView",null,this);if(null===this._vy_xViewEyeOffset&&null===this._vy_yViewEyeOffset||e.setEyeOffsets(this._vy_xViewEyeOffset,this._vy_yViewEyeOffset),null===this._vy_xEdgeLimit&&null===this._vy_yEdgeLimit||e.setEdgeLimit(this._vy_xEdgeLimit,this._vy_yEdgeLimit),n.j3.Util.isObject(t))for(const r in t)e[r]=t[r];this._vy_mapView=e};getMapView=function(){return this._vy_mapView};get mapView(){return this._vy_mapView}set mapView(t){this.setMapView(t)}setScreenView=function(t){t||(t={}),this.screenView=t,t.disableImageSmoothing||t.scaleNearest?PIXI.TextureStyle.defaultOptions.scaleMode="nearest":PIXI.TextureStyle.defaultOptions.scaleMode="linear",this.screenView.scaleNearest||this.screenView.disableImageSmoothing?(n.vC.gameCanvasControl.style["image-rendering"]="pixelated",n.vC.intCanvasControl.style["image-rendering"]="pixelated"):(n.vC.gameCanvasControl.style["image-rendering"]="auto",n.vC.intCanvasControl.style["image-rendering"]="auto"),n.up.disableImageSmoothing=!!t.disableImageSmoothing,t.resolution||(t.resolution=1),n.up.pixiApp?._vy_renderer&&(n.up.pixiApp._vy_renderer.resolution=this.screenView.resolution),n.vC.setWindowSize()};getScreenView=function(){return this.screenView};getScreenPos=function(t){return t?(t.x=this._vy_mapView._vy_xScr,t.y=this._vy_mapView._vy_yScr,t):{x:this._vy_mapView._vy_xScr,y:this._vy_mapView._vy_yScr}};get xView(){return this._vy_mapView._vy_xScr}set xView(t){}get yView(){return this._vy_mapView._vy_yScr}set yView(t){}getPosFromScreen=function(t,e,r){return r||(r={}),r.x=(t-this._vy_mapView._vy_dom.offsetLeft)/n.vC.mapScaleWidth+this._vy_mapView._vy_xScr,r.y=(e-this._vy_mapView._vy_dom.offsetTop)/n.vC.mapScaleHeight+this._vy_mapView._vy_yScr,r};changeServer=function(t){t&&n.vC.changeServer(t)};callCommand=function(t,e,r){if(this._vy_remCom&&this._vy_remCom.includes(t))return;r&&n.vC.serSocket?.sendPacket([4,t,e]);const i=this._vy_commands&&this._vy_commands[t]?this._vy_commands[t]:this._vy_parentT._vy_com[t];i&&(e&&e.constructor===Array?i.apply(this,e):i.call(this,e))};addCommand=function(t,e){t&&(this._vy_commands||(this._vy_commands={}),this._vy_commands[t]=e)};removeCommand=function(t){t&&(this._vy_commands&&this._vy_commands[t]?delete this._vy_commands[t]:this._vy_parentT._vy_com[t]&&(this._vy_remCom||(this._vy_remCom=[]),this._vy_remCom.includes(t)||this._vy_remCom.push(t)))};sendPacket=function(t,e){n.vC.serSocket?void 0!==e?n.vC.serSocket.sendPacket([3,t,e]):n.vC.serSocket.sendPacket([3,t]):this.onPacket?.(t,e)};getNavigator=function(){return this._vy_navigator};toggleScreenDrawing=function(t){let e=t;e=!1===t||!0!==t&&(!n.up.pauseDraw&&(t||!0)),n.up.lastPauseDraw=e,e?n.up.pauseRender(e):n.up.resumeRender()};toggleMacroCapture=function(t){const e=this._vy_pauseMacros;if(!1===t?this._vy_pauseMacros=!0:!0===t||t||this._vy_pauseMacros?this._vy_pauseMacros=!1:this._vy_pauseMacros=!0,this._vy_pauseMacros)this._vy_clearKeyDownEvents(1,e?0:1);else if(e)for(let t=0,e=this._vy_keysDown.length;t<e;t++){const e=this._vy_keysDown[t];if(e&&(this.onKeyDown?.(e),this._vy_keyDown[e]))if(this._vy_pauseMacros)this._vy_ser_onKeyDown&&n.vC.serSocket?.sendPacket([10,e]);else{let t=null;this._vy_customMacros[e]?.down?t=this._vy_customMacros[e]:o.Q.macros[this._vy_macroAtlas]?.[e]?.down&&(t=o.Q.macros[this._vy_macroAtlas][e]),t?(1!==t.up&&(this._vy_commands?.[t.up]?this._vy_commands.apply(this,t.upArgs):this._vy_parentT._vy_com[t.down].apply(this,t.downArgs)),n.vC.serSocket?.sendPacket([0,e])):this._vy_ser_onKeyDown&&n.vC.serSocket?.sendPacket([10,e])}}};getWindowSize=function(t){return t||(t={}),t.width=window.innerWidth,t.height=window.innerHeight,t};setScreenSize=function(t,e){n.a$.gameWidth=t,n.a$.gameHeight=e,n.vC.setWindowSize(),this.setViewEye(this._vy_mapView._vy_eye)};getScreenSize=function(t){return t||(t={}),t.width=document.getElementById("web_background").offsetWidth,t.height=document.getElementById("web_background").offsetHeight,t};getScreenScale=function(t){return t||(t={}),t.x=n.vC.scaleWidth,t.y=n.vC.scaleHeight,t};toggleLoadScreen=function(t){!1===t?n.vC.inLoadScreen&&n.vC.hideLoadScreen(1):!0===t?n.vC.inLoadScreen||n.vC.showLoadScreen():t||!n.vC.inLoadScreen?n.vC.showLoadScreen():n.vC.hideLoadScreen(1)};uploadFile=async function(t,e){return new Promise(((r,i)=>{const s=document.createElement("input");if(s.type="file",e)for(const t in e)s.setAttribute(t,e[t]);s.addEventListener("cancel",i),s.addEventListener("change",(async()=>{const e=`${this._vy_accountName}:${Date.now()}:${Math.random()}`;for(let t=s.files.length;t--;)if(s.files[t].size>n.j3.World._vy_maxUploadFilesize)return void i(`Error: ${s.files[t].name} over upload filesize limit.`);if(this.onFileUpload){if(!await this.onFileUpload(s.files))return void i()}const o=new FormData;o.append("id",e);for(let t=0,e=s.files.length;t<e;t++)o.append(`file_${t}`,s.files[t]);if(t){n.vC.serSocket&&t===n.U3.serverPath&&(n.vC.serSocket.sendPacket([16,e]),t+="/api?upload");try{const e=await fetch(t,{method:"POST",headers:{"Content-Type":"multipart/form-data"},body:o});r(await e.text())}catch(t){i(t)}}else r()})),s.click()}))};get renderApp(){return n.up.pixiApp}set renderApp(t){}get renderOptions(){return this._vy_renderOptions}set renderOptions(t){this._vy_renderOptions=t}get document(){return document}set document(t){}clearKeyDownEvents=function(){this._vy_clearKeyDownEvents()};sendDiob=function(t,e){}}},428:(t,e,r)=>{"use strict";r.d(e,{S7:()=>_,Z9:()=>l,jG:()=>a});var n=r(518),i=r(140),s=r(708),o=r(868);class a extends s.z{_vy_id="";_vy_mID=!1;_vy_tag=null;_vy_name=null;_vy_x=0;_vy_y=0;_vy_mapN="";_vy_map=null;_vy_waitingMap=null;_vy_atlas=null;_vy_icoName="";_vy_icoState="";_vy_recheckState=null;_vy_recheckStateM=null;_vy_ico=null;_vy_w=32;_vy_wH=16;_vy_icoW=32;_vy_h=32;_vy_hH=16;_vy_icoH=32;_vy_mouseOp=2;_vy_text="";_vy_layer=1;_vy_plane=0;_vy_preventRelayer=!0;_vy_angle=0;_vy_scale=null;_vy_anchor=null;_vy_xIcoOff=0;_vy_yIcoOff=0;_vy_xTiles=1;_vy_yTiles=1;_vy_xCoOff=0;_vy_yCoOff=0;_vy_xOr=0;_vy_yOr=0;_vy_alpha=1;_vy_onScr=null;_vy_onScrAnim=!1;_vy_onScrRelayer=!1;_vy_pixS=null;_vy_sprite=null;_vy_solidColor=null;_vy_pattern=null;_vy_chunks=null;_vy_recacheChunk=!1;_vy_hasUpdatedChunk=!1;_vy_composite="normal";_vy_tint=null;_vy_isViewEye=null;_vy_interact=!1;_vy_maskID=null;_vy_color=null;_vy_over=null;_vy_underApp=null;_vy_overApp=null;_vy_isOverlay=!1;_vy_appMask=null;_vy_viewers=null;_vy_invisibility=0;_vy_visibility=0;_vy_allowDenseCross=!1;_vy_defIconState=1;_vy_relayerH=null;_vy_rrelayerH=32;_vy_isCullable=!0;_vy_origin=null;onCross=null;onCrossed=null;onUncrossed=null;onCrossedRelocated=null;onBumped=null;onMouseClick=null;onMouseDblClick=null;onMouseEnter=null;onMouseExit=null;onMouseMove=null;onMouseDown=null;onMouseUp=null;onMouseWheelScrollUp=null;onMouseWheelScrollDown=null;onTouchStart=null;onTouchEnd=null;onTouchMove=null;onScreenShow=null;onScreenHide=null;onAddOverlay=null;onRemoveOverlay=null;onIconUpdate=null;onMapChange=null;onTransition=null;onPacket=null;onClientSyncData=null;onResized=null;onClientSync=null;constructor(){super()}_vy_setIcon=function(t,e,r){const i=this._vy_ico;return this._vy_ico=t,this._vy_appMask&&!this._vy_appMask.ownAnim||(this._vy_anim&&(r||this._vy_animator&&this._vy_animator.keepFrame||this._vy_anim.keepFrame)&&this._vy_ico&&this._vy_ico._vy_parent._vy_frames&&(t._vy_parent._vy_frames.length>this._vy_anim.frame?(r=1,this._vy_ico=this._vy_ico._vy_parent._vy_frames[this._vy_anim.frame],this._vy_ico||(this._vy_ico=t),t=this._vy_ico):r=0),e||(this._vy_anim&&!r&&(this._vy_anim.frame=0,this._vy_anim.timer=0),t&&t._vy_parent._vy_frames&&t._vy_parent._vy_frames.length>1&&(this._vy_anim||this._vy_setAnimator(),r||(this._vy_animator&&(this._vy_animator.reverse&&(this._vy_anim.frame=t._vy_parent._vy_frames.length-1),this._vy_altFrameDelay()),this._vy_anim.lastCheck=performance.now()),this._vy_anim.delay=t._vy_parent._vy_frames[this._vy_anim.frame]._vy_frameDelay,this._vy_anim.isPaused=!1,this._vy_onScr&&!this._vy_onScrAnim&&n.up.addScreenAnimation(this))),!this._vy_anim||this._vy_anim.isPaused||this._vy_ico&&this._vy_ico._vy_parent._vy_frames&&1!==this._vy_ico._vy_parent._vy_frames.length||this._vy_anim.sync||this._vy_anim.playAnim||(this._vy_anim.isPaused=!0)),this._vy_onScr?(this._vy_pixS&&this._vy_updateScreenSpriteIcon(),this._vy_gui?n.up.refreshInt=!0:this._vy_onChunkScr&&this._vy_onScr._vy_cacheChunk(this,this._vy_chunk)):this._vy_onChunkScr&&(this._vy_recacheChunk=!0),this.onIconUpdate&&this._vy_ico!==i&&(i?i._vy_parent._vy_parState?this.onIconUpdate(i._vy_atlasName,i._vy_iconName,i._vy_iconState,i._vy_parent._vy_frames?i._vy_parent._vy_frames.indexOf(i)+1:1):this.onIconUpdate(i._vy_atlasName,i._vy_iconName,"",i._vy_parent._vy_frames?i._vy_parent._vy_frames.indexOf(i)+1:1):this.onIconUpdate()),i};_vy_setIconCheck=function(t,e){if(this._vy_atlas){if(!o.Q.loadedAtlases.hasOwnProperty(this._vy_atlas)||o.Q.loadedAtlases[this._vy_atlas].loading)return void(e||o.Q.loadAtlas(this._vy_atlas,this._vy_setIconCheck.bind(this,t,!0)));this._vy_isOverlay&&this._vy_appMask&&!this._vy_appMask.ownAnim?this._vy_setIconOverlay(this._vy_isOverlay):this._vy_setIcon(o.Q.iconsO[this._vy_atlas][this._vy_icoName]?.[this._vy_icoState])}else this._vy_setIcon(null);t||(t=this),!this._vy_ico&&this._vy_atlas&&this._vy_setIconState(this._vy_icoState,t._vy_moving,0,!0),this._vy_setIconSize(),this._vy_gui&&(n.up.refreshInt=!0)};_vy_setIconOverlay=function(t){const e=this._vy_ico;if(this._vy_atlas){if(o.Q.iconsO[this._vy_atlas]&&o.Q.iconsO[this._vy_atlas][this._vy_icoName]){let e=o.Q.iconsO[this._vy_atlas][this._vy_icoName][this._vy_icoState];if(e&&t._vy_ico&&t._vy_ico._vy_parent._vy_frames&&t._vy_anim&&e._vy_parent._vy_frames){const r=e._vy_parent._vy_frames[t._vy_anim.frame];if(!r)return;e=r}this._vy_ico=e}}else this._vy_ico=null;this._vy_onScr?(this._vy_pixS&&this._vy_updateScreenSpriteIcon(!0),this._vy_isOverlay&&this._vy_appMask&&this._vy_isOverlay._vy_onChunkScr&&this._vy_onScr._vy_cacheChunk(this._vy_isOverlay,this._vy_isOverlay._vy_chunk)):this._vy_isOverlay&&this._vy_appMask&&this._vy_isOverlay._vy_onChunkScr&&(this._vy_isOverlay._vy_recacheChunk=!0),this.onIconUpdate&&this._vy_ico!==e&&(e?e._vy_parent._vy_parState?this.onIconUpdate(e._vy_atlasName,e._vy_iconName,e._vy_iconState,e._vy_parent._vy_frames?e._vy_parent._vy_frames.indexOf(e)+1:1):this.onIconUpdate(e._vy_atlasName,e._vy_iconName,"",e._vy_parent._vy_frames?e._vy_parent._vy_frames.indexOf(e)+1:1):this.onIconUpdate())};_vy_setIconSize=function(){if(this._vy_sprite)return this._vy_icoW=this._vy_pixS.width,this._vy_icoH=this._vy_pixS.height,void(this._vy_onScr&&this._vy_updateScreenSpritePos());const t=this._vy_ico;t?this._vy_icoW===t._vy_width&&this._vy_icoH===t._vy_height||(this._vy_icoW=t._vy_width,this._vy_icoH=t._vy_height,this._vy_relayerH||this._vy_rrelayerH===t._vy_height||(this._vy_rrelayerH=this._vy_icoH),this._vy_onScr&&this._vy_updateScreenSpritePos()):this._vy_icoW===this._vy_w&&this._vy_icoH===this._vy_h||(this._vy_icoW=this._vy_w,this._vy_icoH=this._vy_h,this._vy_relayerH||this._vy_rrelayerH===this._vy_h||(this._vy_rrelayerH=this._vy_icoH),this._vy_onScr&&this._vy_updateScreenSpritePos())};_vy_setAtlas=function(t,e,r){if(this._vy_isOverlay&&this._vy_appMask&&(this._vy_appMask.shareIcon&&(e=this._vy_isOverlay._vy_icoName),this._vy_appMask.ownState||this._vy_icoState===this._vy_isOverlay._vy_icoState||(this._vy_icoState=this._vy_isOverlay._vy_icoState)),this._vy_anim&&this._vy_anim.playAnim)return this._vy_anim.playAnim.atlas=t,void(this._vy_anim.playAnim.icon=e);if(this._vy_atlas===t&&this._vy_icoName===e){if(!r)return}else if(this._vy_atlas=t,this._vy_icoName=e,this._vy_solidColor&&t)if(this._vy_solidColor=null,this._vy_gui)this._vy_pixS=null,n.up.refreshInt=!0;else if(this._vy_onScr){const t=this._vy_onScr;t._vy_removeFromScreen(this,0,0,1),this._vy_pixS=null,t._vy_addToScreen(this,1)}else this._vy_pixS=null;if(this._vy_overApp?.length||this._vy_underApp?.length)for(const t of this._vy_over)t._vy_appMask&&t._vy_appMask.shareIcon&&t._vy_setAtlas(t._vy_atlas,e,r);this._vy_onScr?this._vy_setIconCheck():this._vy_ico=null};_vy_setIconState=function(t,e,r,i){if(t||(t=""),this._vy_anim){if(this._vy_anim.playAnim)return this._vy_anim.playAnim.state=t,void(o.Q.iconStates.includes(t)?this._vy_anim.playAnim.def=!0:this._vy_anim.playAnim.def&&delete this._vy_anim.playAnim.def);!r&&(this._vy_animator&&this._vy_animator.keepFrame||this._vy_anim.keepFrame)&&(r=!0)}if(this._vy_recheckState&&(this._vy_recheckState=null,this._vy_recheckStateM=null),this._vy_icoState===t&&!i)return;let s;if(o.Q.iconsO[this._vy_atlas]&&o.Q.iconsO[this._vy_atlas][this._vy_icoName]&&(s=o.Q.iconsO[this._vy_atlas][this._vy_icoName][t],!s&&o.Q.iconStates.includes(t))){this._vy_recheckState=t;const r=this._vy_currCarDir?this._vy_currCarDir:this._vy_dir;if(e?(this._vy_recheckStateM=1,t=t.substr(5),s=o.Q.iconsO[this._vy_atlas][this._vy_icoName][t],s||(t=o.Q.iconsO[this._vy_atlas][this._vy_icoName]["move_"+r]?"move_"+r:r,s=o.Q.iconsO[this._vy_atlas][this._vy_icoName][t],s||(t=""))):n.j3.Map._cDirs.includes(t)||(t=r,s=o.Q.iconsO[this._vy_atlas][this._vy_icoName][t]),s||(t="",s=o.Q.iconsO[this._vy_atlas][this._vy_icoName][t]),this._vy_icoState===t&&!i)return}if(void 0===t&&(t=""),this._vy_icoState=t,o.Q.iconStates.includes(this._vy_icoState)?this._vy_defIconState=1:this._vy_defIconState=0,s&&(this._vy_isOverlay&&this._vy_appMask&&!this._vy_appMask.ownAnim?this._vy_setIconOverlay(this._vy_isOverlay):this._vy_setIcon(s,!1,r),this._vy_setIconSize()),this._vy_overApp?.length||this._vy_underApp?.length)for(const t of this._vy_over)t&&t._vy_appMask&&!t._vy_appMask.ownState&&t._vy_setIconState(this._vy_icoState,e,r,i)};_vy_setFrame=function(t){const e=t-this._vy_anim.lastCheck;if(this._vy_anim.lastCheck=t,!this._vy_animator?.isPaused)for(this._vy_anim.timer+=e;this._vy_anim.timer>=this._vy_anim.delay&&this._vy_ico;){if(this._vy_anim.timer>this._vy_ico._vy_parent._vy_totalDelay&&(this._vy_anim.timer=this._vy_anim.timer%this._vy_ico._vy_parent._vy_totalDelay),this._vy_setOnFrame())return;this._vy_setIcon(this._vy_ico&&this._vy_ico._vy_parent._vy_frames?this._vy_ico._vy_parent._vy_frames[this._vy_anim.frame]:o.Q.iconsO[this._vy_atlas][this._vy_icoName][this._vy_icoState],!0),this._vy_altFrameDelay()}};_vy_setOnFrame=function(){const t=this._vy_ico._vy_parent._vy_frames?this._vy_ico._vy_parent._vy_frames.length:1;if(this._vy_animator?.reverse){if(this._vy_anim.frame--,this._vy_anim.frame<0&&(this._vy_anim.frame=t-1,this._vy_anim.playAnim)){if(!this._vy_anim.playAnim.l)return this._vy_stopAnimation(),!0;this._vy_anim.playAnim.l--}}else if(this._vy_anim.frame++,this._vy_anim.frame>=t&&(this._vy_anim.frame=0,this._vy_anim.playAnim)){if(!this._vy_anim.playAnim.l)return this._vy_stopAnimation(),!0;this._vy_anim.playAnim.l--}if(this._vy_anim.timer-=this._vy_anim.delay,this._vy_anim.playAnim&&this._vy_anim.playAnim.eF&&this._vy_anim.playAnim.eF<this._vy_anim.frame+1&&!this._vy_anim.playAnim.l)return this._vy_stopAnimation(),!0;this._vy_anim.fF&&(this._vy_anim.fF.c||(this._vy_anim.frame=this._vy_anim.fF.f,this._vy_animator&&this._vy_animator.reverse&&(this._vy_anim.frame=this._vy_anim.fF.f),this._vy_setIcon(this._vy_ico._vy_parent._vy_frames?this._vy_ico._vy_parent._vy_frames[this._vy_anim.frame]:o.Q.iconsO[this._vy_atlas][this._vy_icoName][this._vy_icoState],!0)),this._vy_anim.fF=0),this._vy_anim.keepFrame&&(this._vy_anim.keepFrame=0)};_vy_altFrameDelay=function(){this._vy_ico&&(this._vy_anim.delay=this._vy_ico._vy_frameDelay,this._vy_animator?.speed&&(this._vy_animator.speed<0?this._vy_anim.delay=this._vy_anim.delay*Math.abs(this._vy_animator.speed):this._vy_anim.delay=this._vy_anim.delay/this._vy_animator.speed))};_vy_setScreenSprite=function(){if(!this._vy_pixS){this._vy_pixS=new PIXI.Sprite;const t=this._vy_isOverlay&&this._vy_appMask&&!this._vy_appMask.ownMod?this._vy_isOverlay:this;t._vy_scale&&this._vy_pixS.scale.set(t.scale._vy_x,t._vy_scale._vy_y)}this._vy_pixT?this._vy_gui&&this._vy_dom||(this._vy_textSty&&this._vy_textSty.bitmap?this._vy_setText_bitmap(this._vy_text):this._vy_pixT.text=this._vy_text):this._vy_text&&!this._vy_dom&&this._vy_setScreenSpriteText(),this._vy_overScr&&!this._vy_overScrSprite&&(this._vy_overScrSprite=new PIXI.Sprite(PIXI.Texture.from(this._vy_overScr.canvas)),this._vy_overScrMod&&this.setOverScreenMod(this._vy_overScrMod)),this._vy_pixS.anchor&&(this._vy_anchor||0===this._vy_anchor?this._vy_pixS.anchor.set(this.anchor._vy_x,this._vy_anchor._vy_y):this._vy_pixS.anchor.set(.5,.5)),this._vy_pixS.blendMode=this._vy_composite,this._vy_invisibility&&n.um._vy_playerMob&&n.um._vy_playerMob._vy_visibility<this._vy_invisibility&&!this._vy_viewers?.includes(n.um._vy_playerMob)&&(this._vy_pixS.renderable=!1)};_vy_updateScreenSprite=function(t){if(this._vy_updateScreenSpriteIcon(!0),this._vy_updateScreenSpritePos(!0),this._vy_updateScreenSpriteTrans(!0),this._vy_pixT&&(this._vy_gui&&this._vy_dom||(this._vy_textSty&&this._vy_textSty.bitmap?this._vy_setText_bitmap(this._vy_text):this._vy_pixT.text=this._vy_text),this._vy_pixT.style=this._vy_textSty||n.up.defaultText),this._vy_over&&!t)for(const t of this._vy_over)t._vy_pixS&&t._vy_updateScreenSprite(!0)};_vy_updateScreenSpriteIcon=function(t){if(this._vy_sprite||(this._vy_ico&&this._vy_ico._vy_texture?this._vy_pixS.texture=this._vy_ico._vy_texture:this._vy_solidColor||(this._vy_pixS.texture=o.Q.blankPixiTex)),(this._vy_overApp?.length||this._vy_underApp?.length)&&!t)for(const t of this._vy_over)t._vy_appMask&&!t._vy_appMask.ownAnim&&(t._vy_setIconOverlay(this),t._vy_setIconSize())};_vy_updateScreenSpritePos=function(t){let e=0,r=0;if(this._vy_isOverlay?this._vy_appMask?this._vy_isOverlay._vy_isLoc&&this._vy_isOverlay._vy_chunk?(e=this._vy_isOverlay._vy_x+this._vy_x-this._vy_isOverlay._vy_chunk.xC*this._vy_isOverlay._vy_chunk.map._vy_tileW,r=this._vy_isOverlay._vy_y+this._vy_y-this._vy_isOverlay._vy_chunk.yC*this._vy_isOverlay._vy_chunk.map._vy_tileH):(e=this._vy_isOverlay._vy_x+this._vy_xIcoOff+this._vy_isOverlay._vy_xIcoOff,r=this._vy_isOverlay._vy_y+this._vy_yIcoOff+this._vy_isOverlay._vy_yIcoOff):this._vy_isOverlay._vy_isClient?(e=this._vy_onScr._vy_xScr+this._vy_x+this._vy_xIcoOff,r=this._vy_onScr._vy_yScr+this._vy_y+this._vy_yIcoOff):(e=this._vy_isOverlay._vy_x+this._vy_x+this._vy_xIcoOff,r=this._vy_isOverlay._vy_y+this._vy_y+this._vy_yIcoOff):(e=this._vy_x+this._vy_xIcoOff,r=this._vy_y+this._vy_yIcoOff),this._vy_pixT&&this._vy_pixT.position.set(e+this._vy_pixT._vy_xPos+this._vy_icoW*this._vy_pixT.anchor.x,r+this._vy_pixT._vy_yPos+this._vy_icoH*this._vy_pixT.anchor.y),this._vy_overScrSprite&&(this._vy_overScrMod?this._vy_overScrSprite.position.set(e+this._vy_overScr.x+this._vy_overScr.canvas.width*this._vy_overScrSprite.anchor.x,r+this._vy_overScr.y+this._vy_overScr.canvas.height*this._vy_overScrSprite.anchor.y):this._vy_overScrSprite.position.set(e+this._vy_overScr.x,r+this._vy_overScr.y)),this._vy_pixS&&this._vy_pixS.position.set(e+this._vy_icoW*this._vy_pixS.anchor.x,r+this._vy_icoH*this._vy_pixS.anchor.y),this._vy_over&&!t)for(const t of this._vy_over)t._vy_updateScreenSpritePos(!0)};_vy_updateScreenSpriteTrans=function(t){const e=this._vy_isOverlay&&this._vy_appMask&&!this._vy_appMask.ownMod?this._vy_isOverlay:this;if(this._vy_pixS.alpha=e._vy_alpha,this._vy_pixS.rotation=-e._vy_angle,e._vy_scale&&this._vy_pixS.scale.set(e.scale._vy_x,e._vy_scale._vy_y),e._vy_transform&&(this._vy_pixS.scale.x=e.scale._vy_x*e._vy_transform[0],this._vy_pixS.scale.y=e._vy_scale._vy_y*e._vy_transform[4],this._vy_pixS.skew.set(e._vy_transform[3],e._vy_transform[1]),this._vy_pixS.pivot.set(-e._vy_transform[6],-e._vy_transform[7])),this._vy_over&&!t)for(const t of this._vy_over)t._vy_appMask&&t._vy_pixS&&t._vy_updateScreenSpriteTrans(!0)};_vy_setScreenSpriteText=function(){this._vy_textSty?(this._vy_pixT=new PIXI.Text(this._vy_text,this._vy_textSty),this._vy_textSty.anchor&&this._vy_pixT.anchor.set(this._vy_textSty.anchor.x,this._vy_textSty.anchor.y),void 0!==this._vy_textSty.alpha&&(this._vy_pixT.alpha=this._vy_textSty.alpha),this._vy_textSty.resolution&&(this._vy_pixT.resolution=this._vy_textSty.resolution),this._vy_textSty.scale&&(this._vy_pixT.scale.x=this._vy_textSty.scale.x,this._vy_pixT.scale.y=this._vy_textSty.scale.y),this._vy_pixT._vy_xPos=this._vy_textSty.xPos||0,this._vy_pixT._vy_yPos=this._vy_textSty.yPos||0):(this._vy_pixT=new PIXI.Text(this._vy_text,this.defaultText),this._vy_pixT._vy_xPos=0,this._vy_pixT._vy_yPos=0)};_vy_playAnimation=function(t,e,r,i,s,o,a,l){"loaded"===t&&this.playAnimation?this.playAnimation(e,r,i,s,o,a,l):l&&n.vC._callback(l)};_vy_stopAnimation=function(){if(!this._vy_anim.playAnim)return;const t={atlas:this._vy_anim.playAnim.atlas,icon:this._vy_anim.playAnim.icon,state:this._vy_anim.playAnim.state,frame:this._vy_anim.playAnim.frame,f:this._vy_anim.playAnim.f,anim:this._vy_anim.playAnim.anim};this._vy_anim.playAnim=!1,this._vy_stopAnimationSet(t),t.f&&n.vC._callback(t.f)};_vy_stopAnimationSet=function(t){this._vy_setAtlas(t.atlas,t.icon,!0),this._vy_setIconState(t.state,this._vy_moving||t.state?.startsWith("move_"),0,!0),(t.frame||0===t.frame)&&this.setFrame(t.frame),void 0!==t.anim&&(this._vy_animator=t.anim),t.sync&&(this._vy_animator.sync=t.sync,this.setAnimator(this._vy_animator))};_vy_setAnimator=function(){this._vy_anim={frame:0,timer:0,lastCheck:performance.now()}};_vy_setDir=function(t,e,r){if(t&&n.j3.Map.dirs.includes(t)||(t="south"),this._vy_dir!==t||e){if(t.length>5?(t.includes(this._vy_lastCarDir)?this._vy_currCarDir=this._vy_lastCarDir:r?this._vy_currCarDir=r:this._vy_moving?this._vy_movingX<=this._vy_movingY?this._vy_currCarDir=t.substr(0,5):this._vy_currCarDir=t.substr(5):this._vy_currCarDir=t.substr(0,5),this._vy_dir&&this._vy_dir.length>5&&(this._vy_lastCarDir=this._vy_currCarDir)):this._vy_lastCarDir=t,this.onDirUpdate){const e=this._vy_dir;this._vy_dir=t,this.onDirUpdate(e)}else this._vy_dir=t;this._vy_anim&&this._vy_anim.playAnim&&this._vy_anim.playAnim.def?this._vy_moving?this._vy_anim.playAnim.state="move_"+this._vy_dir:this._vy_anim.playAnim.state=this._vy_dir:this._vy_defIconState&&(this._vy_moving?this._vy_setIconState("move_"+this._vy_dir,1,0,!0):this._vy_setIconState(this._vy_dir,0,0,!0))}};_vy_setPos=function(t,e,r){const i=this._vy_x,s=this._vy_y,o=this._vy_map;if(this._vy_x=t,this._vy_y=e,this._vy_onScr&&this._vy_updateScreenSpritePos(),o){let r,i,s;if(this._vy_locs)for(const t of this._vy_locs)(!t._vy_map||this._vy_x+this._vy_xOr+this._vy_w<=t._vy_x||this._vy_x+this._vy_xOr>=t._vy_x+t._vy_map._vy_tileW||this._vy_y+this._vy_yOr+this._vy_h<=t._vy_y||this._vy_y+this._vy_yOr>=t._vy_y+t._vy_map._vy_tileH)&&t._vy_removeFromContents(this);if(this._vy_crossed){for(let t=this._vy_crossed.length;t--;){const e=this._vy_crossed[t];(!e||!e._vy_type||this._vy_x+this._vy_xOr+this._vy_w<=e._vy_x+e._vy_xOr||this._vy_x+this._vy_xOr>=e._vy_x+e._vy_xOr+e._vy_w||this._vy_y+this._vy_yOr+this._vy_h<=e._vy_y+e._vy_yOr||this._vy_y+this._vy_yOr>=e._vy_y+e._vy_yOr+e._vy_h)&&(e?._vy_crossed&&e._vy_crossed.splice(e._vy_crossed.indexOf(this),1),this._vy_crossed.splice(t,1),this.onUncrossed?.(e),e?.onUncrossed&&e.onUncrossed(this))}if(!this._vy_type)return}for(let n=Math.floor((e+this._vy_yOr)/o._vy_tileH)+1,a=n+this._vy_yTiles;n<=a;n++)for(let e=Math.floor((t+this._vy_xOr)/o._vy_tileW)+1,a=e+this._vy_xTiles;e<=a;e++){const t=o._vy_tiles[e+o._vy_xMax*n];if(!(!t||this._vy_x+this._vy_xOr+this._vy_w<=t._vy_x||this._vy_x+this._vy_xOr>=t._vy_x+o._vy_tileW||this._vy_y+this._vy_yOr+this._vy_h<=t._vy_y||this._vy_y+this._vy_yOr>=t._vy_y+o._vy_tileH)&&(t._vy_addToContents(this)&&(s=!0),t._vy_hasCrossed))for(let e=t._vy_conts.length;e--;){const n=t._vy_conts[e];!n._vy_type||n===this||this._vy_x+this._vy_xOr+this._vy_w<=n._vy_x+n._vy_xOr||this._vy_x+this._vy_xOr>=n._vy_x+n._vy_xOr+n._vy_w||this._vy_y+this._vy_yOr+this._vy_h<=n._vy_y+n._vy_yOr||this._vy_y+this._vy_yOr>=n._vy_y+n._vy_yOr+n._vy_h||(this._vy_crossed&&this._vy_crossed.includes(n)?(this.onCrossedRelocated||n.onCrossedRelocated)&&(i||(i=[]),i.includes(n)||i.push(n)):(r||(r=[]),r.includes(n)||r.push(n)))}}if(r)for(const t of r)if(this._vy_crossed?this._vy_crossed.push(t):this._vy_crossed=[t],t._vy_crossed?t._vy_crossed.push(this):t._vy_crossed=[this],t.onCrossed?.(this,!0),this.onCrossed?.(t),!this._vy_type)return;if(i)for(const t of i)if(this.onCrossedRelocated?.(t),t.onCrossedRelocated?.(this,1),!this._vy_type)return;this._vy_onScr&&(this.preventScreenRelayer||this._vy_onScrRelayer||(this._vy_onScrRelayer=!0,n.up.relayerRefresh.push(this)),this.onScreenMoved?.(n.um)),this._vy_isViewEye?._vy_setViewFromPos(this._vy_x,this._vy_y,s)}this.onRelocated&&!r&&this.onRelocated(i,s,this._vy_mapN)};_vy_setMapCheck=function(t,e,r,n){return!!(o.Q.maps[t]&&o.Q.maps[t]._vy_isLoaded||(o.Q.loadingResources["map_"+t]||(o.Q.loadingResources["map_"+t]={type:"map",name:t,diobs:[]},o.Q.loadMap(t)),!o.Q.loadingResources["map_"+t]))||(this._vy_waitingMap&&this._vy_waitingMap.map===t||(this._vy_setMap_(""),this.onMapChange?.(t,!0),o.Q.loadingResources["map_"+t].diobs.push(this)),this._vy_waitingMap={map:t,x:e,y:r},n&&(this._vy_waitingMap.coords=!0),!1)};_vy_setMap=function(t,e,r){t&&this._vy_mapN!==t&&!this._vy_setMapCheck(t,e,r)||this._vy_setMap_(t,e,r)};_vy_setMap_=function(t,e,r){const n=this._vy_mapN;if(this._vy_mapN!==t){if(this._vy_tMov&&i.P.removeMoveToObj(this),this._vy_locs)for(let t=this._vy_locs.length;t--;)this._vy_locs[t]._vy_removeFromContents(this,!0);if(this._vy_crossed){for(let t=this._vy_crossed.length;t--;){const e=this._vy_crossed[t];e&&e._vy_crossed&&e._vy_crossed.splice(e._vy_crossed.indexOf(this),1),this._vy_crossed.splice(t,1),this.onUncrossed?.(e),e&&e.onUncrossed&&e.onUncrossed(this)}if(!this._vy_type)return}if(this._vy_onScr?._vy_removeFromScreen(this),!this._vy_isCullable&&this._vy_map){const t=this._vy_map._vy_particles.indexOf(this);-1!==t&&this._vy_map._vy_particles.splice(t,1)}if(this._vy_mapN=t,this._vy_map=o.Q.maps[t],this._vy_map&&(this._vy_yTiles=Math.floor(this._vy_h/this._vy_map._vy_tileH)+1,this._vy_xTiles=Math.floor(this._vy_w/this._vy_map._vy_tileW)+1,this._vy_isCullable||(this._vy_map._vy_particles.includes(this)||this._vy_map._vy_particles.push(this),this._vy_map._vy_mapView?._vy_addToScreen(this))),this._vy_isViewEye&&this._vy_isViewEye._vy_setMap(this._vy_mapN),this._vy_over)for(let t=this._vy_over.length;t--;)this._vy_over[t]._vy_mapN=this._vy_mapN;this.onMapChange?.(n,!1)}this._vy_setPos(e,r)};_vy_addOverlay=function(t,e,r,s,o){if(this._vy_isOverlay&&!0!==this._vy_isOverlay)return;t||(t="Overlay");let a,l=t;if("string"==typeof t)(t=i.P.createObject(t,null,o))._vy_loc=this,t._vy_isOverlay=this,t.onNew&&!o&&t.onNew(),l=t;else{if(!t._vy_type)return;if(a=!0,t._vy_isOverlay&&"object"==typeof t._vy_isOverlay){if(t._vy_isOverlay===this)return t;t._vy_isOverlay.removeOverlay(t,!0)}else r?(l=i.P.createObject(t._vy_type,null,o),l._vy_loc=this,l._vy_isOverlay=this,l.onNew?.()):(t._vy_x<0||t._vy_y<0)&&(t._vy_x=0,t._vy_y=0,this._vy_onScr&&this._vy_updateScreenSpritePos())}if(a="Overlay"===t._vy_baseType&&!r,this._vy_client&&(l._vy_client=this._vy_client),l._vy_id||(l.id=o),a||(l!==t&&l.setAppearance(t),l.mouseOpacity=t._vy_mouseOp,t._vy_x&&(l._vy_x=t._vy_x),t._vy_y&&(l._vy_y=t._vy_y)),l._vy_loc=this,l._vy_isOverlay=this,l._vy_parent=this,l._vy_isLoc&&(l._vy_isLoc=!1),void 0!==e?l._vy_appMask=e:l._vy_appMask||(l._vy_appMask=l.appearMask),this._vy_gui&&(l._vy_gui||(null===l._vy_anchor&&(this._vy_anchor._vy_isDiobAnchor?l.setAnchor(this._vy_anchor._vy_x,this._vy_anchor._vy_y):l._vy_anchor=this._vy_anchor),l._vy_gui=this._vy_gui,l.setText=i.P.objectTypes.Interface._vy_object.setText),l._vy_checkDrawModified()),l._vy_appMask?(l._vy_plane=this._vy_plane,"object"!=typeof l._vy_appMask&&(l._vy_appMask=!0),l._vy_setAtlas(l._vy_atlas,l._vy_icoName,!0),l._vy_appMask.ownState||l._vy_setIconState(this._vy_icoState,this._vy_moving,!0),this._vy_addOverlayApp(l),(this._vy_anim||l._vy_appMask.ownAnim)&&(l._vy_anim||l._vy_setAnimator(),l._vy_appMask.ownAnim||(l._vy_animator=this._vy_animator))):l._vy_setAtlas(l._vy_atlas,l._vy_icoName,!0),l._vy_x||(l._vy_x=0),l._vy_y||(l._vy_y=0),this._vy_over?this._vy_over.push(l):this._vy_over=[l],l._vy_mapN=this._vy_mapN,l._vy_map=this._vy_map,this._vy_onScr)if(l._vy_appMask)if(this._vy_gui)n.up.removeFromInterface(this),n.up.addToInterface(this);else if(!l._vy_ico&&l._vy_atlas&&l._vy_setIconCheck(this),l._vy_onScr=this._vy_onScr,this._vy_onChunkScr)this._vy_onScr._vy_cacheChunk(this,this._vy_chunk);else{const t=this._vy_onScr;t._vy_removeFromScreen(this,0,0,1),t._vy_addToScreen(this,1)}else this._vy_gui?n.up.addToInterface(l):this._vy_onScr._vy_addToScreen(l);return s||(this.onAddOverlay?.(l),l.onOverlayed?.(this)),isNaN(l._vy_id)||(l._vy_localOver=1),l};_vy_removeOverlay=function(t,e){const r=this._vy_over.indexOf(t);-1!==r&&this._vy_over.splice(r,1),t&&(t._vy_appMask?this._vy_removeOverlayApp(t):t._vy_onScr&&(t._vy_gui?n.up.removeFromInterface(t):t._vy_onScr._vy_removeFromScreen(t)),this.onRemoveOverlay?.(t),t.onUnoverlayed?.(this),e?(t._vy_mapN=null,t._vy_map=null,t._vy_isOverlay=null,t._vy_parent=null):i.P.deleteDiob(t))};_vy_addOverlayApp=function(t){if(t._vy_appMask.isUnder){this._vy_underApp||(this._vy_underApp=[]);let e=!1;for(let r=0,n=this._vy_underApp.length;r<n;r++)if(this._vy_underApp[r]._vy_layer>t._vy_layer){this._vy_underApp.splice(r,0,t),e=!0;break}e||this._vy_underApp.push(t)}else{this._vy_overApp||(this._vy_overApp=[]);let e=!1;for(let r=0,n=this._vy_overApp.length;r<n;r++)if(this._vy_overApp[r]._vy_layer>t._vy_layer){this._vy_overApp.splice(r,0,t),e=!0;break}e||this._vy_overApp.push(t)}};_vy_removeOverlayApp=function(t){if(t._vy_appMask.isUnder){const e=this._vy_underApp.indexOf(t);-1!==e&&this._vy_underApp.splice(e,1)}else{const e=this._vy_overApp.indexOf(t);-1!==e&&this._vy_overApp.splice(e,1)}if(t._vy_onScr){if(t._vy_onScrAnim&&(t._vy_onScrAnim=!1),t._vy_gui){const e=this.preventAutoScale?n.up.intApp.stage:n.up.intApp.stageScale;e.removeChild(t._vy_pixS),t._vy_pixT&&e.removeChild(t._vy_pixT),t._vy_overScrSprite&&e.removeChild(t._vy_overScrSprite),n.up.refreshInt=!0}else if(this._vy_isLoc){const e=this._vy_chunk;e&&e._vy_pixS&&t._vy_onScr._vy_cacheChunk(this,e)}else{const e=t._vy_onScr._vy_planes[this._vy_plane];e&&(e._vy_pixS.removeChild(t._vy_pixS),t._vy_pixT&&e._vy_pixS.removeChild(t._vy_pixT),t._vy_overScrSprite&&e._vy_pixS.removeChild(t._vy_overScrSprite))}t._vy_onScr=null}};_vy_checkScreenTrans=function(){this._vy_onScr?this._vy_appMask&&!this._vy_appMask.ownMod||!this._vy_pixS||(this._vy_updateScreenSpriteTrans(),this._vy_onChunkScr&&this._vy_onScr._vy_cacheChunk(this,this._vy_chunk)):this._vy_onChunkScr&&(this._vy_recacheChunk=!0)};_vy_checkDrawModified=function(){this._vy_onScr&&this._vy_gui&&(this._vy_text&&this._vy_textSty&&this._vy_textSty.bitMask&&this._vy_setText_bitmap(this._vy_text),n.up.refreshInt=!0)};_vy_setText_bitmap=function(t){this._vy_pixT.text="";const e=this._vy_textSty.bitmap;if(!o.Q.loadedAtlases.hasOwnProperty(e)||o.Q.loadedAtlases[e].loading)return void o.Q.loadAtlas(e,this._vy_setText_bitmap.bind(this,t));let r=this._vy_textSty.vPadding?this._vy_textSty.vPadding:this._vy_textSty.padding?this._vy_textSty.padding:n.up.defaultText.padding,i=this._vy_textSty.hPadding?this._vy_textSty.hPadding:this._vy_textSty.padding?this._vy_textSty.padding:n.up.defaultText.padding;const s=this._vy_isOverlay&&this._vy_appMask?this._vy_isOverlay:this,a=this._vy_textSty.xPos?this._vy_textSty.xPos:0,l=this._vy_textSty.yPos?this._vy_textSty.yPos:0,_=this._vy_textSty.charSpace?this._vy_textSty.charSpace:0,u=this._vy_textSty.align&&"left"!==this._vy_textSty.align?"right":null;let c=u?this._vy_w:0;u&&(i*=-1),this._vy_pixT.removeChildren();for(let t=0,e=this._vy_text.length;t<e;t++){let h=this._vy_text[t];if(u&&(h=this._vy_text[e-t-1]),"\n"===h){r+=(this._vy_textSty.fontSize?this._vy_textSty.fontSize:n.up.defaultText.fontSize)+(this._vy_textSty.leading?this._vy_textSty.leading:n.up.defaultText.leading),c=u?this._vy_w:0;continue}let d=o.Q.iconsO[this._vy_textSty.bitmap][h];if(!d)continue;if(d=d[""],d||(d=o.Q.iconsO[this._vy_textSty.bitmap][""]),!d)continue;u&&(this._vy_textSty.bitMask&&s.scale?c-=d._vy_width*s._vy_scale._vy_x:c-=d._vy_width);const p=new PIXI.Sprite(d._vy_texture);p.position.set(a+c+i,l+r),this._vy_textSty.bitMask&&(p.alpha=s._vy_alpha,s.scale&&p.scale.set(s._vy_scale._vy_x,s._vy_scale._vy_y)),u?c-=_:this._vy_textSty.bitMask&&s.scale?c+=d._vy_width*s._vy_scale._vy_x+_:c+=d._vy_width+_,this._vy_pixT.addChild(p)}n.up.cacheBitmap(this._vy_pixT),this._vy_gui&&(n.up.refreshInt=!0)};_vy_removeFromChunk=function(t){let e=this._vy_chunks.indexOf(t);if(-1!==e&&(this._vy_chunks.splice(e,1),e=t.c.indexOf(this),-1!==e&&t.c.splice(e,1),this._vy_mID&&(e=t.u.indexOf(this),-1!==e&&t.u.splice(e,1),this._vy_mapN))){this._vy_hasUpdatedChunk=!0;for(let t=this._vy_chunks.length;t--;){const e=this._vy_chunks[t];e.u.includes(this)||e.u.push(this)}}};get isDiob(){return!0}set isDiob(t){}get isOverlay(){return this._vy_isOverlay}set isOverlay(t){}getID=function(){return this._vy_id};get id(){return this._vy_id}set id(t){return this._vy_id&&(i.P.objects.delete(this._vy_id),this._vy_id.startsWith("m_")&&(this._vy_mID=!1),this._vy_id="",!t)||(t||(t=++i.P.objIDCount),this._vy_id=""+t,this._vy_id.startsWith("m_")?this._vy_mID=!0:this._vy_mID&&(this._vy_mID=!1),i.P.objects.set(this._vy_id,this)),t}setSpriteData=async function(t,e){if(this._vy_pixS||this._vy_setScreenSprite(),!t)return this._vy_sprite=null,void this._vy_updateScreenSpriteIcon();this._vy_sprite=t,e||(e="url"),"url"===e?this._vy_pixS.texture=await PIXI.Assets.load(t):"texture"===e&&(this._vy_pixS.texture=t),this._vy_setIconSize?.()};getSpriteData=function(t){if(n.up.pixiAppOp.renderer.resize(n.a$.gameWidth,n.a$.gameHeight),this._vy_isPlane){if("url"===t)return n.up.pixiAppOp.renderer.extract.base64(this._vy_pixS);if("pixels"===t)return n.up.pixiAppOp.renderer.extract.pixels(this._vy_pixS);if("canvas"===t)return n.up.pixiAppOp.renderer.extract.canvas(this._vy_pixS)}if(!this._vy_ico&&this._vy_atlas&&this._vy_setIconCheck(),!t)return this._vy_sprite?this._vy_sprite:(this._vy_pixS||this._vy_setScreenSprite(),this._vy_pixS);t||(t="url");const e=new PIXI.Sprite(this._vy_ico?this._vy_ico._vy_texture:PIXI.Texture.EMPTY);let r;this._vy_pixS&&(e.filters=this._vy_pixS.filters),n.up.pixiAppOp.renderer.resize(this._vy_icoW,this._vy_icoH),n.up.pixiAppOp.stage.addChild(e),"url"===t?r=n.up.pixiAppOp.renderer.extract.base64(n.up.pixiAppOp.stage):"pixels"===t?r=n.up.pixiAppOp.renderer.extract.pixels(n.up.pixiAppOp.stage):"canvas"===t&&(r=n.up.pixiAppOp.renderer.extract.canvas(n.up.pixiAppOp.stage));for(let t=n.up.pixiAppOp.stage.children.length;t--;)n.up.pixiAppOp.stage.removeChild(n.up.pixiAppOp.stage.children[t]);return r};setPattern=function(t,e,r,i){if(void 0===t){const t=this._vy_onScr;return t&&(this._vy_gui?n.up.removeFromInterface(this):t._vy_removeFromScreen(this)),this._vy_pixS=null,this._vy_pattern=null,this._vy_setScreenSprite(),this._vy_updateScreenSprite(),void(t&&(this._vy_gui?n.up.addToInterface(this):t._vy_addToScreen(this)))}if(!this._vy_pattern){const t=this._vy_onScr;t&&(this._vy_gui?n.up.removeFromInterface(this):t._vy_removeFromScreen(this)),this._vy_pixS=new PIXI.TilingSprite(this._vy_ico&&this._vy_ico._vy_texture?this._vy_ico._vy_texture:o.Q.blankPixiTex),this._vy_pattern=!0,void 0===r&&(r=this._vy_w),void 0===i&&(i=this._vy_h),t&&(this._vy_gui?n.up.addToInterface(this):t._vy_addToScreen(this))}this._vy_pixS.tilePosition.set(t,e),void 0!==r&&(this._vy_pixS.width=r),void 0!==i&&(this._vy_pixS.height=i),this._vy_gui&&(n.up.refreshInt=!0)};sendPacket=function(t,e){n.vC.serSocket?void 0!==e?n.vC.serSocket.sendPacket([15,this._vy_id,t,e]):n.vC.serSocket.sendPacket([15,this._vy_id,t]):this.onPacket?.(n.um,t,e)};setTransition=function(t,e,r,n,s,o){i.P.setTransition(this,t,e,r,n,s,o)};setIcon=function(t,e){this._vy_setAtlas(t,e)};getIcon=function(){return{atlas:this.atlasName,icon:this.iconName}};get icon(){return!this._vy_ico&&this._vy_atlas&&this._vy_setIconCheck(),this._vy_ico}set icon(t){"string"==typeof t&&(this._vy_ico=o.Q.iconCache[t],this._vy_ico||(this._vy_ico=o.Q.newIcon(null,null,null,null,null,null,t),o.Q.iconCache[t]=this._vy_ico),this._vy_setIcon(this._vy_ico))}get iconName(){return this._vy_icoName}set iconName(t){this._vy_setAtlas(this.atlasName,t)}get atlasName(){return this._vy_atlas}set atlasName(t){this._vy_setAtlas(t,this._vy_icoName)}setIconState=function(t,e){this._vy_setIconState(t,0,e)};getIconState=function(){return this._vy_icoState};get iconState(){return this._vy_icoState}set iconState(t){this._vy_setIconState(t)}setFrame=function(t,e,r){if(this._vy_anim&&this._vy_ico&&this._vy_ico._vy_parent._vy_frames){if(t>this._vy_ico._vy_parent._vy_frames.length?t=this._vy_ico._vy_parent._vy_frames.length:t<=0&&(t=1),this._vy_anim&&this._vy_anim.playAnim)return this._vy_anim.playAnim.frame=t,void(e&&(this._vy_anim.playAnim.anim||(this._vy_anim.playAnim.anim={}),-1===e?this._vy_anim.playAnim.anim.isPaused=!0:this._vy_anim.playAnim.anim.delay=e));this._vy_anim.fF={f:this._vy_anim.frame,c:r},void 0!==e&&(e?-1===e&&(this._vy_animator?this._vy_animator.isPaused=!0:this._vy_animator={isPaused:!0},e=0):e=0,this._vy_anim.delay=e),this._vy_anim.keepFrame=1,this._vy_anim.frame=t-1,this._vy_animator&&this._vy_animator.reverse&&(this._vy_anim.frame=t+1),this._vy_setIcon(this._vy_ico&&this._vy_ico._vy_parent._vy_frames?this._vy_ico._vy_parent._vy_frames[this._vy_anim.frame]:o.Q.iconsO[this._vy_atlas][this._vy_icoName][this._vy_icoState],!0),this._vy_anim.timer=0,this._vy_anim.lastCheck=performance.now()}};setIconOffsets=function(t,e){this._vy_xIcoOff=t,this._vy_yIcoOff=e,this._vy_onScr&&this._vy_updateScreenSpritePos(),this._vy_onScr&&(this._vy_updateScreenSpritePos(),this._vy_gui&&(n.up.refreshInt=!0))};getIconOffsets=function(){return{x:this._vy_xIcoOff,y:this._vy_yIcoOff}};get xIconOffset(){return this._vy_xIcoOff}set xIconOffset(t){this.setIconOffsets(t,this._vy_yIcoOff)}get yIconOffset(){return this._vy_yIcoOff}set yIconOffset(t){this.setIconOffsets(this._vy_xIcoOff,t)}setLayer=function(t){if(this._vy_layer!==t)if(this._vy_onScr)if(this._vy_gui)n.up.removeFromInterface(this),this._vy_layer=t,this._vy_appMask||n.up.addToInterface(this,!0);else if(this._vy_layer=t,this._vy_appMask){if(this._vy_isOverlay&&!0!==this._vy_isOverlay)if(this._vy_isOverlay._vy_removeOverlayApp(this),this._vy_isOverlay._vy_addOverlayApp(this),this._vy_isOverlay._vy_onChunkScr)this._vy_onScr._vy_cacheChunk(this._vy_isOverlay,this._vy_isOverlay._vy_chunk);else if(this._vy_onScr){const t=this._vy_onScr;t._vy_removeFromScreen(this._vy_isOverlay,0,0,1),t._vy_addToScreen(this._vy_isOverlay,1)}}else this._vy_onScr._vy_readdToScreen(this,!0);else this._vy_appMask?(this._vy_layer=t,this._vy_isOverlay&&!0!==this._vy_isOverlay&&(this._vy_isOverlay._vy_removeOverlayApp(this),this._vy_isOverlay._vy_addOverlayApp(this))):this._vy_layer=t};getLayer=function(){return this._vy_layer};get layer(){return this._vy_layer}set layer(t){this.setLayer(t)}get relayerHeight(){return this._vy_relayerH}set relayerHeight(t){this._vy_relayerH=t,this._vy_rrelayerH=t}setSize=function(t,e){const r=this._vy_w,i=this._vy_h;this._vy_w=t,this._vy_wH=Math.round(this._vy_w/2),this._vy_h=e,this._vy_hH=Math.round(this._vy_h/2),this._vy_map&&(this._vy_yTiles=Math.floor(this._vy_h/this._vy_map._vy_tileW)+1,this._vy_xTiles=Math.floor(this._vy_w/this._vy_map._vy_tileH)+1),this._vy_solidColor&&(this._vy_pixS.width=this._vy_w,this._vy_pixS.height=this._vy_h,this._vy_setIconSize()),!this._vy_isOverlay&&this.loc&&(this._vy_locs||(this._vy_locs=[]),this._vy_setPos(this._vy_x,this._vy_y,!0)),this._vy_isViewEye&&(this._vy_isViewEye._vy_xEye=this._vy_isViewEye._vy_mapWidthHalf-(this._vy_xOr+this._vy_w/2)+n.um._vy_xViewEyeOffset,this._vy_isViewEye._vy_yEye=this._vy_isViewEye._vy_mapHeightHalf-(this._vy_yOr+this._vy_h/2)+n.um._vy_yViewEyeOffset),this.onResized?.(r,i)};getSize=function(){return{width:this._vy_w,height:this._vy_h}};get width(){return this._vy_w}set width(t){this.setSize(t,this._vy_h)}get height(){return this._vy_h}set height(t){this.setSize(this._vy_w,t)}setAngle=function(t){this._vy_angle=t,this._vy_isPlane&&this._vy_pixS?this._vy_updateScreenSpriteTrans():(this._vy_checkScreenTrans(),this._vy_gui&&this._vy_checkDrawModified())};getAngle=function(){return this._vy_angle};get angle(){return this._vy_angle}set angle(t){this.setAngle(t)}setAnchor=function(t,e){if(this._vy_anchor?._vy_isDiobAnchor||(this._vy_anchor=new _(this)),"object"==typeof t)if(t._vy_isDiobAnchor){if(t._vy_parent===this)return}else e=t.y,t=t.x;void 0===t&&(t=0),void 0===e&&(e=t),this._vy_anchor._vy_x=t,this._vy_anchor._vy_y=e,this._vy_pixS&&this._vy_pixS.anchor&&(this._vy_anchor?this._vy_pixS.anchor.set(this.anchor._vy_x,this._vy_anchor._vy_y):this._vy_pixS.anchor.set(.5,.5)),this._vy_gui?this._vy_checkDrawModified():this._vy_onScr&&this._vy_updateScreenSpritePos()};getAnchor=function(){return this.anchor};get anchor(){return this._vy_anchor&&this._vy_anchor._vy_isDiobAnchor||(this._vy_anchor=new _(this)),this._vy_anchor}set anchor(t){this.setAnchor(t)}setAlpha=function(t){this._vy_alpha=t,this._vy_alpha<0?this._vy_alpha=0:this._vy_alpha>1&&(this._vy_alpha=1),this._vy_isPlane&&this._vy_pixS?this._vy_updateScreenSpriteTrans():(this._vy_checkScreenTrans(),this._vy_gui&&(this._vy_dom&&(this._vy_dom.style.opacity=t),this._vy_checkDrawModified(this)))};getAlpha=function(){return this._vy_alpha};get alpha(){return this._vy_alpha}set alpha(t){this.setAlpha(t)}setScale=function(t,e){if(this._vy_scale?._vy_isDiobScale||(this._vy_scale=new l(this)),"object"==typeof t)if(t._vy_isDiobScale){if(t._vy_parent===this)return}else e=t.height?t.height:t.y,t=t.width?t.width:t.x;t||(t=0),void 0===e&&(e=t),this._vy_scale._vy_x=t,this._vy_scale._vy_y=e,this._vy_isPlane||(this._vy_checkScreenTrans(),this._vy_gui?this._vy_checkDrawModified():this._vy_onScr&&this._vy_updateScreenSpritePos())};getScale=function(){return this.scale};get scale(){return this._vy_scale?._vy_isDiobScale||(this._vy_scale=new l(this)),this._vy_scale}set scale(t){this.setScale(t)}setTransform=function(t){Array.isArray(t)?this._vy_transform=t:t instanceof Object?(t.scaleX||(t.scaleX=1),t.scaleY||(t.scaleY=1),t.skewX||(t.skewX=0),t.skewY||(t.skewY=0),t.moveX||(t.moveX=0),t.moveY||(t.moveY=0),this._vy_transform=[t.scaleX,t.skewY,0,t.skewX,t.scaleY,0,t.moveX,t.moveY,1]):this._vy_transform=0,!this._vy_transform&&this._vy_pixS&&(this._vy_pixS.skew.x&&(this._vy_pixS.skew.x=0),this._vy_pixS.skew.y&&(this._vy_pixS.skew.y=0),this._vy_pixS.pivot.x&&(this._vy_pixS.pivot.x=0),this._vy_pixS.pivot.y&&(this._vy_pixS.pivot.y=0)),this._vy_isPlane&&this._vy_pixS?this._vy_updateScreenSpriteTrans():(this._vy_checkScreenTrans(),this._vy_gui&&this._vy_checkDrawModified())};getTransform=function(t){if(t){const t=this._vy_transform;return{scaleX:t[0],skewY:t[1],skewX:t[3],scaleY:t[4],moveX:t[6],moveY:t[7]}}return this._vy_transform};get transform(){return this._vy_transform}set transform(t){this.setTransform(t)}setAnimator=function(t){if(this._vy_anim||this._vy_setAnimator(),this._vy_anim.playAnim)this._vy_anim.playAnim.anim=t;else{if(this._vy_animator&&(!t||this._vy_animator.sync!==t.sync||this._vy_anim.sync!==t.sync)&&(this._vy_setAnimator(),this._vy_onScr)){const e=this._vy_onScr;e._vy_removeFromScreen(this,0,0,1),this._vy_animator=t,e._vy_addToScreen(this,1)}if(this._vy_animator=t,this._vy_altFrameDelay(),this._vy_over)for(let t=0,e=this._vy_over.length;t<e;t++){const e=this._vy_over[t];e&&e._vy_appMask&&!e._vy_appMask.ownAnim&&e._vy_anim&&(e._vy_animator=this._vy_animator,e._vy_altFrameDelay())}}};getAnimator=function(){return this._vy_animator};get animator(){return this._vy_animator}set animator(t){this.setAnimator(t)}setColor=function(t){let e=this._vy_pixS;if(e||(this._vy_setScreenSprite(),e=this._vy_pixS),this._vy_atlas||!t&&0!==t||(this._vy_solidColor=!0,e.texture=PIXI.Texture.WHITE,e.width=this._vy_w,e.height=this._vy_h,this._vy_setIconSize()),t&&"object"==typeof t&&!Array.isArray(t))void 0!==t.tint&&(e.tint=t.tint||16777215);else{this._vy_color?.tint&&(e.tint=16777215);const r=o.Q.getColorIcon(t);if(t=r.color,this._vy_colorAtlas&&o.Q.colorMatrix[this._vy_colorAtlas]){const t=Array.prototype.slice.call(e.filters);if(t){const r=t.indexOf(o.Q.colorMatrix[this._vy_colorAtlas]);-1!==r&&(t.splice(r,1),e.filters=t)}}if(t||0===t){if(this._vy_colorAtlas=r.m.toString().split(",",20).join(","),this._vy_colorMatrix=r.m,!o.Q.colorMatrix[this._vy_colorAtlas]){const t=new PIXI.ColorMatrixFilter;t.matrix=this._vy_colorMatrix,o.Q.colorMatrix[this._vy_colorAtlas]=t}if(e){let t=[o.Q.colorMatrix[this._vy_colorAtlas]];e.filters&&(t=e.filters.concat(t)),e.filters=t}}}this._vy_color=t,this._vy_onScr?this._vy_gui?n.up.refreshInt=!0:this._vy_onChunkScr&&this._vy_onScr._vy_cacheChunk(this,this._vy_chunk):this._vy_onChunkScr&&(this._vy_recacheChunk=!0)};getColor=function(){return this._vy_color};get color(){return this._vy_color}set color(t){this.setColor(t)}get tint(){return this._vy_tint}set tint(t){this._vy_tint=t,this._vy_color&&n.j3.Util.isObject(this._vy_color)||(this._vy_color={}),this._vy_color.tint=t,this.setColor(this._vy_color)}setMask=function(t){if(this._vy_mask=t,t){if(this._vy_pixS||this._vy_setScreenSprite(),!t._vy_pixS){if(t.isSprite)return void(this._vy_pixS.mask=t);t._vy_setScreenSprite()}this._vy_pixS.mask=t._vy_pixS}else this._vy_pixS.mask=null};getMask=function(){return this._vy_mask};setComposite=function(t){t||(t="normal"),this._vy_composite=t,(this._vy_onScr||this._vy_isPlane)&&this._vy_pixS&&(this._vy_pixS.blendMode=this._vy_composite),this._vy_gui&&this._vy_checkDrawModified()};getComposite=function(){return this._vy_composite};get composite(){return this._vy_composite}set composite(t){this.setComposite(t)}setPlane=function(t){if(this._vy_onScr&&!this._vy_appMask){const e=this._vy_onScr;e._vy_setPlane(t),e._vy_removeFromScreen(this,0,0,1),this._vy_plane=t,e._vy_addToScreen(this,1,!0)}else this._vy_plane=t};getPlane=function(){return this._vy_plane};get plane(){return this._vy_plane}set plane(t){this.setPlane(t)}get mouseOpacity(){return this._vy_mouseOp}set mouseOpacity(t){if(this._vy_mouseOp=t,this._vy_onScr){const t=this._vy_onScr._vy_planes[this._vy_plane];if(t)if(this._vy_mouseOp)t._vy_mouseEventDiobs.includes(this)||t._vy_mouseEventDiobs.push(this);else{const e=t._vy_mouseEventDiobs.indexOf(this);-1!==e&&t._vy_mouseEventDiobs.splice(e,1)}}}get clientSyncData(){return this._vy_cSyncD}set clientSyncData(t){if(this.onClientSyncData){const e=this._vy_cSyncD;this._vy_cSyncD=t,this.onClientSyncData(e)}else this._vy_cSyncD=t}get density(){return this._vy_density}set density(t){this._vy_density=t}get sprite(){return this._vy_pixS||this._vy_setScreenSprite(),this._vy_pixS}set sprite(t){if(this._vy_sprite=t,this._vy_onScr){const e=this._vy_onScr;e._vy_removeFromScreen(this,!1,!1,!0),this._vy_pixS=t,e._vy_addToScreen(this,!0)}else this._vy_pixS=t;this._vy_setIconSize()}setAppearance=function(t){for(const e of o.Q.appearVars){const r=t[e];if(r)if(r instanceof Object&&!Array.isArray(r)){this[e]={};for(const t in r)this[e][t]=r[t]}else Array.isArray(r)?this[e]=r.slice(0):this[e]=r}if(this._vy_setAtlas(this._vy_atlas,this._vy_icoName,!0),void 0!==t.layer&&this.setLayer(t.layer),void 0!==t.plane&&this.setPlane(t.plane),t._vy_scale&&this.setScale(t.scale._vy_x,t._vy_scale._vy_y),void 0!==t.transform&&this.setTransform(this._vy_transform),void 0!==t._vy_alpha&&this.setAlpha(t._vy_alpha),void 0!==t.angle&&this.setAngle(t.angle),void 0!==t.color&&this.setColor(t.color),void 0!==t.text&&this.setText(t.text),void 0!==t.animator&&this.setAnimator(t.animator),void 0!==t.anchor&&this.setAnchor(t.anchor._vy_x,t._vy_anchor._vy_y),t._vy_type){this.setOverlays(null);for(const e in t._vy_over){const r=t._vy_over[e],n=this._vy_addOverlay(r._vy_type,r._vy_appMask,!0);n&&n.setAppearance(r)}if(t._vy_overScr){const e=t.getOverScreen("pixels");this.setOverScreen(e.x,e.y,e.width,e.height,e.data,e.settings)}else this._vy_overScr=null}};setName=function(t){this._vy_name=t};getName=function(){return this._vy_name};get name(){return this._vy_name}set name(t){this.setName(t)}getTag=function(){return this._vy_tag};setTag=function(t){if(this._vy_tag){const t=i.P.tags[this._vy_tag];if(t){const e=t.indexOf(this);e>=0&&t.splice(e,1)}}this._vy_tag=t,i.P.tags[t]||(i.P.tags[t]=[]),i.P.tags[t].push(this)};get tag(){return this._vy_tag}set tag(t){this._vy_tag!==t&&this.setTag(t)}getContents=function(t,e){if(!this._vy_conts)return[];if(t){const r=[];for(let n=0,s=this._vy_conts.length;n<s;n++){const s=this._vy_conts[n];s&&(i.P.isType(s._vy_type,t,e)&&r.push(s))}return r}return this._vy_conts};get contents(){return this._vy_conts||(this._vy_conts=[]),this._vy_conts}set contents(t){}getCrossed=function(t,e){const r=[];for(const n in this._vy_locs){const s=this._vy_locs[n];if(s._vy_conts)for(const n in s._vy_conts){const o=s._vy_conts[n];!o._vy_type||o===this||this._vy_x+this._vy_xOr+this._vy_w<=o._vy_x+o._vy_xOr||this._vy_x+this._vy_xOr>=o._vy_x+o._vy_xOr+o._vy_w||this._vy_y+this._vy_yOr+this._vy_h<=o._vy_y+o._vy_yOr||this._vy_y+this._vy_yOr>=o._vy_y+o._vy_yOr+o._vy_h||(t&&!i.P.isType(o._vy_type,t,e)||r.includes(o)||r.push(o))}}return r};get crossed(){return this.getCrossed()}set crossed(t){}getCoords=function(){return this._vy_map?{x:Math.floor(this._vy_x/this._vy_map._vy_tileW)+1,y:Math.floor(this._vy_y/this._vy_map._vy_tileH)+1}:{x:0,y:0}};setCoords=function(t,e,r){this._vy_map&&(r?this._vy_setPos((t-1)*this._vy_map._vy_tileW,(e-1)*this._vy_map._vy_tileH):this._vy_setPos((t-1)*this._vy_map._vy_tileW+this._vy_x%this._vy_map._vy_tileW,(e-1)*this._vy_map._vy_tileH+this._vy_y%this._vy_map._vy_tileH),this._vy_isViewEye?.setViewFromPos(this._vy_x,this._vy_y,!0))};get xCoord(){return this._vy_map?Math.floor(this._vy_x/this._vy_map._vy_tileW)+1:0}set xCoord(t){this._vy_map&&this.setLoc(t,Math.floor(this._vy_y/this._vy_map._vy_tileW)+1)}get yCoord(){return this._vy_map?Math.floor(this._vy_y/this._vy_map._vy_tileH)+1:0}set yCoord(t){this._vy_map&&this.setLoc(Math.floor(this._vy_x/this._vy_map._vy_tileH)+1,t)}setLoc=function(t,e,r){if(this._vy_locs||(this._vy_locs=[]),!t)return void this._vy_setMap(r,-1e5,-1e5);let n=t,i=e,s=this._vy_map;if("number"==typeof t){if(r&&(s=o.Q.maps[r]),!e)return}else if(t._vy_isLoc)s=o.Q.maps[t._vy_mapN],n=Math.floor(t._vy_x/s._vy_tileW)+1,i=Math.floor(t._vy_y/s._vy_tileH)+1,r=t._vy_mapN;else{if(!t.loc)return;s=o.Q.maps[t._vy_mapN],n=Math.floor(t._vy_loc._vy_x/s._vy_tileW)+1,i=Math.floor(t._vy_loc._vy_y/s._vy_tileH)+1,r=t._vy_mapN}if(!r)return this._vy_locs||(this._vy_locs=[]),void this._vy_setPos((n-1)*s._vy_tileW,(i-1)*s._vy_tileH);r&&this._vy_mapN!==r&&!this._vy_setMapCheck(r,n,i,!0)||(s?this._vy_setMap_(r,(n-1)*s._vy_tileW,(i-1)*s._vy_tileH):this._vy_setMap_(r))};getLoc=function(){return this.loc};getLocs=function(){return this._vy_locs||(this._vy_locs=[]),this._vy_locs};get loc(){if(!this._vy_isOverlay&&this._vy_map){let t=Math.floor(this._vy_x/this._vy_map._vy_tileW)+1,e=Math.floor(this._vy_y/this._vy_map._vy_tileH)+1;this._vy_origin&&(t<=0&&this._vy_x+this._vy_xOr>=0&&(t=1),e<=0&&this._vy_y+this._vy_yOr>=0&&(e=1)),this._vy_loc=this._vy_map._vy_tiles[t+this._vy_map._vy_xMax*e]}return this._vy_loc}set loc(t){t?t._vy_isLoc&&this._vy_setMap(t._vy_mapN,t._vy_x,t._vy_y):this.setLoc()}getMapName=function(){return this._vy_mapN};get mapName(){return this._vy_mapN}set mapName(t){this._vy_setMap(t,this._vy_x,this._vy_y)}get map(){return this._vy_map}set map(t){}getRegion=function(){return this._vy_isRegion?this:this.loc?this.loc._vy_region||i.P.regions.Region:void 0};get region(){return this.getRegion()}set region(t){}addOverlay=function(t,e,r){return this._vy_addOverlay(t,e,!1,r)};removeOverlay=function(t,e){if(this._vy_over)if("string"==typeof t)for(let r=this._vy_over.length;r--;){const n=this._vy_over[r];n&&n!==t&&n._vy_type!==t||this._vy_removeOverlay(n,e)}else this._vy_removeOverlay(t,e)};getOverlays=function(t,e){if(this._vy_over||(this._vy_over=[]),t){const r=[];for(let n=0,s=this._vy_over.length;n<s;n++){const s=this._vy_over[n];s&&(i.P.isType(s._vy_type,t,e)&&r.push(s))}return r}return this._vy_over};setOverlays=function(t,e){this._vy_over||(this._vy_over=[]),t&&t instanceof Array||(t=[]);for(let r=this._vy_over.length;r--;){const n=this._vy_over[r];t.includes(n)||this.removeOverlay(n,e)}for(let e=0,r=t.length;e<r;e++)this._vy_addOverlay(t[e]);return this._vy_over};get overlays(){return this.getOverlays()}set overlays(t){this.setOverlays(t)}getText=function(){return this._vy_gui&&this._vy_dom&&(this._vy_dom.classList.contains("text_input")?this._vy_text=this._vy_dom.value:this._vy_text=this._vy_dom.innerHTML),this._vy_text};setText=function(t){return t||0===t||(t=""),this._vy_text=t.toString(),this._vy_onScr?(this._vy_pixT?this._vy_textSty&&this._vy_textSty.bitmap?this._vy_setText_bitmap(t):this._vy_pixT.text=this._vy_text:(this._vy_setScreenSpriteText(),this._vy_updateScreenSprite(),this._vy_onScr._vy_readdToScreen(this)),this._vy_onChunkScr&&this._vy_onScr._vy_cacheChunk(this,this._vy_chunk)):this._vy_onChunkScr&&(this._vy_recacheChunk=!0),this._vy_text};get text(){return this.getText()}set text(t){this.setText(t)}getTextStyle=function(){return this._vy_textSty};setTextStyle=function(t){t||(t={}),this._vy_textSty=t,this._vy_pixT&&(this._vy_textSty.anchor&&this._vy_pixT.anchor.set(this._vy_textSty.anchor.x,this._vy_textSty.anchor.y),this._vy_textSty.alpha&&(this._vy_pixT.alpha=this._vy_textSty.alpha),this._vy_textSty.resolution&&(this._vy_pixT.resolution=this._vy_textSty.resolution),this._vy_textSty.scale?(this._vy_pixT.scale.x=this._vy_textSty.scale.x,this._vy_pixT.scale.y=this._vy_textSty.scale.y):(this._vy_pixT.scale.x=1,this._vy_pixT.scale.y=1),this._vy_pixT._vy_xPos=this._vy_textSty.xPos||0,this._vy_pixT._vy_yPos=this._vy_textSty.yPos||0),this._vy_onScr?(this._vy_pixT&&(this._vy_pixT.style=this._vy_textSty,this._vy_textSty.bitmap&&this._vy_setText_bitmap(this._vy_text)),this._vy_gui&&(n.up.refreshInt=!0),this._vy_updateScreenSpritePos(!0),this._vy_onChunkScr&&this._vy_onScr._vy_cacheChunk(this,this._vy_chunk)):this._vy_onChunkScr&&(this._vy_recacheChunk=!0)};get textStyle(){return this._vy_textSty||(this._vy_textSty={}),this._vy_textSty}set textStyle(t){this.setTextStyle(t)}get textSprite(){return this._vy_pixT||this._vy_setScreenSpriteText(),this._vy_pixT}set textSprite(t){}setPos=function(t,e,r){r&&this._vy_mapN!==r?this._vy_setMap(r,t,e):this._vy_setPos(t,e)};getPos=function(){return{x:this._vy_x,y:this._vy_y}};get x(){return this._vy_x}set x(t){this._vy_setPos(t,this._vy_y)}get xPos(){return this._vy_x}set xPos(t){this._vy_setPos(t,this._vy_y)}get y(){return this._vy_y}set y(t){this._vy_setPos(this._vy_x,t)}get yPos(){return this._vy_y}set yPos(t){this._vy_setPos(this._vy_x,t)}setOrigin=function(t,e){this._vy_xOr=t,this._vy_yOr=e,this._vy_xOr||this._vy_yOr?this._vy_origin=1:this._vy_origin=null,this._vy_isViewEye&&(this._vy_isViewEye._vy_xEye=this._vy_isViewEye._vy_mapWidthHalf-(this._vy_xOr+this._vy_w/2)+n.um._vy_xViewEyeOffset,this._vy_isViewEye._vy_yEye=this._vy_isViewEye._vy_mapHeightHalf-(this._vy_yOr+this._vy_h/2)+n.um._vy_yViewEyeOffset),!this._vy_isOverlay&&this.loc&&(this._vy_locs||(this._vy_locs=[]),this._vy_setPos(this._vy_x,this._vy_y,!0))};getOrigin=function(){return{x:this._vy_xOr,y:this._vy_yOr}};get xOrigin(){return this._vy_xOr}set xOrigin(t){this.setOrigin(t,this._vy_yOr)}get yOrigin(){return this._vy_yOr}set yOrigin(t){this.setOrigin(this._vy_xOr,t)}setInvisibility=function(t){t||(t=0),this._vy_invisibility=t,this._vy_viewers||(this._vy_viewers=[]),n.um&&n.um._vy_playerMob&&(this._vy_gui?(this._vy_pixS&&(!t||this._vy_viewers.includes(n.um._vy_playerMob)?this._vy_pixS.renderable=!0:t&&!this._vy_viewers.includes(n.um._vy_playerMob)&&n.um._vy_playerMob._vy_visibility<this._vy_invisibility&&(this._vy_pixS.renderable=!1)),this._vy_onScr&&(n.up.refreshInt=!0)):!t||this._vy_viewers.includes(n.um._vy_playerMob)?this.loc&&this._vy_loc._vy_onScr?this._vy_loc._vy_onScr._vy_addToScreen(this):this._vy_isOverlay&&this._vy_isOverlay._vy_onScr?this._vy_isOverlay._vy_onScr._vy_addToScreen(this):this._vy_pixS&&(this._vy_pixS.renderable=!0):t&&this._vy_onScr&&!this._vy_viewers.includes(n.um._vy_playerMob)&&n.um._vy_playerMob._vy_visibility<this._vy_invisibility&&this._vy_onScr._vy_removeFromScreen(this,!0))};getInvisibility=function(){return this._vy_invisibility};get invisibility(){return this._vy_invisibility}set invisibility(t){this.setInvisibility(t)}setVisibility=function(t){t||(t=0),this._vy_visibility=t};getVisibility=function(){return this._vy_visibility};get visibility(){return this._vy_visibility}set visibility(t){this.setVisibility(t)}addInvisibilityViewer=function(t){this._vy_viewers||(this._vy_viewers=[]),this._vy_viewers.includes(t)||(this._vy_viewers.push(t),this.loc&&this._vy_loc._vy_onScr&&this._vy_loc._vy_onScr._vy_addToScreen(this))};removeInvisibilityViewer=function(t){this._vy_viewers?.includes(t)&&(this._vy_viewers.splice(this._vy_viewers.indexOf(t),1),this._vy_onScr&&n.um&&t===n.um._vy_playerMob&&(n.um._vy_playerMob._vy_visibility<this._vy_invisibility||!this._vy_viewers.includes(n.um._vy_playerMob))&&this._vy_onScr._vy_removeFromScreen(this))};getInvisibilityViewers=function(){return this._vy_viewers||(this._vy_viewers=[]),this._vy_viewers};playAnimation=function(t,e,r,i,s,a,l){if(this._vy_anim||this._vy_setAnimator(),this._vy_anim.playAnim&&this._vy_stopAnimation(),!t)return;if(!o.Q.loadedAtlases.hasOwnProperty(t)||o.Q.loadedAtlases[t].loading)return void o.Q.loadAtlas(t,[this._vy_playAnimation,this,Array.prototype.slice.call(arguments)]);-1===i&&(i=this._vy_anim.frame+1);const _={atlas:this._vy_atlas,icon:this._vy_icoName,state:this._vy_icoState,eF:s,f:l};_.def=this._vy_defIconState,this._vy_atlas===t&&this._vy_icoName===e||this._vy_setAtlas(t,e),this._vy_icoState!==r&&this._vy_setIconState(r),this._vy_animator&&this._vy_animator.sync&&(_.sync=this._vy_animator.sync,delete this._vy_animator.sync,this.setAnimator(this._vy_animator)),a&&(a.loop&&(_.l=a.loop),this._vy_animator&&(_.anim=this._vy_animator),this._vy_animator=a,a.rFrame&&this._vy_anim.frame&&(_.frame=this._vy_anim.frame+1),a.delay&&(this._vy_anim.delay=a.delay)),this._vy_ico&&(this._vy_ico._vy_parent._vy_frames&&this._vy_ico._vy_parent._vy_frames.length||a&&a.delay)?(this._vy_ico&&this._vy_ico._vy_parent._vy_frames?i?this._vy_ico._vy_parent._vy_frames.length<i?i=this._vy_ico._vy_parent._vy_frames.length:i<1&&(i=1):i=1:this._vy_anim.isPaused&&(this._vy_anim.isPaused=!1),this._vy_anim.lastCheck=performance.now(),this._vy_anim.frame=i-1,this._vy_anim.timer=0,this._vy_anim.playAnim=_,this._vy_setIcon(this._vy_ico&&this._vy_ico._vy_parent._vy_frames?this._vy_ico._vy_parent._vy_frames[this._vy_anim.frame]:o.Q.iconsO[this._vy_atlas][this._vy_icoName][this._vy_icoState],!0),this._vy_altFrameDelay(),this._vy_onScr&&!this._vy_onScrAnim&&n.up.addScreenAnimation(this)):this._vy_stopAnimationSet(_)};getAnimation=function(t){if("onFrame"===t)return this._vy_anim?this._vy_anim.frame+1:0;if("frameCount"===t)return this._vy_ico&&this._vy_ico._vy_parent._vy_frames?this._vy_ico._vy_parent._vy_frames.length:0;if("atlasName"===t)return this._vy_ico?this._vy_ico._vy_atlasName:"";if("iconName"===t)return this._vy_ico?this._vy_ico._vy_iconName:"";if("iconState"===t)return this._vy_ico._vy_iconState;if(this._vy_ico){const t={onFrame:this._vy_anim?this._vy_anim.frame+1:0,frameCount:this._vy_ico._vy_parent._vy_frames?this._vy_ico._vy_parent._vy_frames.length:0,atlasName:this._vy_ico._vy_atlasName};return this._vy_ico._vy_parent._vy_parState?(t.iconName=this._vy_ico._vy_iconName,t.iconState=this._vy_ico._vy_iconState):(t.iconName=this._vy_ico._vy_iconName,t.iconState=""),t}return{onFrame:0,frameCount:0,atlasName:"",iconName:"",iconState:""}};setCoordOffsets=function(t=0,e=0){if(!this._vy_map)return;let r=Math.floor(this._vy_x/this._vy_map._vy_tileW)+1,i=Math.floor(this._vy_y/this._vy_map._vy_tileH)+1;this._vy_xCoOff=t,this._vy_xCoOff>=n.a$.tileSize.width?(r+=Math.floor(this._vy_xCoOff/n.a$.tileSize.width),this._vy_xCoOff=this._vy_xCoOff%n.a$.tileSize.width):this._vy_xCoOff<0&&(this._vy_xCoOff=Math.abs(this._vy_xCoOff),r-=Math.ceil(this._vy_xCoOff/n.a$.tileSize.width),this._vy_xCoOff=n.a$.tileSize.width-this._vy_xCoOff%n.a$.tileSize.width),this._vy_yCoOff=e,this._vy_yCoOff>=n.a$.tileSize.height?(i+=Math.floor(this._vy_yCoOff/n.a$.tileSize.height),this._vy_yCoOff=this._vy_yCoOff%n.a$.tileSize.height):this._vy_yCoOff<0&&(this._vy_yCoOff=Math.abs(this._vy_yCoOff),i-=Math.ceil(this._vy_yCoOff/n.a$.tileSize.height),this._vy_yCoOff=n.a$.tileSize.height-this._vy_yCoOff%n.a$.tileSize.height),this._vy_locs||(this._vy_locs=[]),this._vy_setPos((r-1)*this._vy_map._vy_tileW+this._vy_xCoOff,(i-1)*this._vy_map._vy_tileH+this._vy_yCoOff)};getCoordOffsets=function(){return this._vy_map?{x:this._vy_x%this._vy_map._vy_tileW,y:this._vy_y%this._vy_map._vy_tileH}:{x:0,y:0}};get xCoordOffset(){return this._vy_map?this._vy_x%this._vy_map._vy_tileW:0}set xCoordOffset(t){this._vy_xCoOff=t,void 0!==this._vy_y&&this._vy_map&&this.setCoordOffsets(t,this._vy_y%this._vy_map._vy_tileH)}get yCoordOffset(){return this._vy_map?this._vy_y%this._vy_map._vy_tileH:0}set yCoordOffset(t){this._vy_yCoOff=t,void 0!==this._vy_x&&this._vy_map&&this.setCoordOffsets(this._vy_x%this._vy_map._vy_tileW,t)}getDir=function(){return this._vy_dir};setDir=function(t){"number"==typeof t&&(t=i.P.dirNum[t]),this._vy_setDir(t)};get dir(){return this._vy_dir}set dir(t){this.setDir(t)}setOverScreen=function(t,e,r,i,s,o){if(t||(t=0),e||(e=0),r||(r=this._vy_w),i||(i=this._vy_h),!this._vy_overScr){this._vy_overScr={};const t=document.createElement("canvas");this._vy_overScr.brush=t.getContext("2d"),this._vy_overScr.canvas=t}if(this._vy_overScr.x=t,this._vy_overScr.y=e,this._vy_overScr.canvas.width=r,this._vy_overScr.canvas.height=i,this._vy_overScr.settings=o||{},this._vy_overScr.settings.scaleNearest?this._vy_overScr.brush.imageSmoothingEnabled=!1:this._vy_overScr.brush.imageSmoothingEnabled=!n.up.disableImageSmoothing,this._vy_overScr.settings.composite?this._vy_overScr.brush.globalCompositeOperation=this._vy_overScr.settings.composite:this._vy_overScr.brush.globalCompositeOperation="source-over",this._vy_overScr.settings.alpha?this._vy_overScr.brush.globalAlpha=this._vy_overScr.settings.alpha:this._vy_overScr.brush.globalAlpha=1,s)if("string"==typeof s){const t=new Image;t.onload=function(){this._vy_overScr.brush.drawImage(t,0,0)},t.src=s}else this._vy_overScr.brush.putImageData(s,0,0);this._vy_onScr&&(this._vy_overScrSprite?this._vy_overScrSprite.texture=PIXI.Texture.from(this._vy_overScr.canvas):(this._vy_overScrSprite=new PIXI.Sprite(PIXI.Texture.from(this._vy_overScr.canvas)),this._vy_overScrMod&&this.setOverScreenMod(this._vy_overScrMod),this._vy_gui?(n.up.removeFromInterface(this),n.up.addToInterface(this)):this._vy_isLoc||this._vy_onScr._vy_readdToScreen(this)),this._vy_updateScreenSpritePos(!0))};getOverScreen=function(t){if(!this._vy_overScr)return;const e={x:this._vy_overScr.x,y:this._vy_overScr.y,width:this._vy_overScr.canvas.width,height:this._vy_overScr.canvas.height};return"url"===t?e.data=this._vy_overScr.canvas.toDataURL():"pixels"===t?e.data=this._vy_overScr.brush.getImageData(0,0,n.a$.gameWidth,n.a$.gameHeight):"canvas"===t?e.data=this._vy_overScr.canvas:"sprite"===t&&(e.data=this._vy_overScrSprite),e.settings=this._vy_overScr.settings,e};overScreenDraw=function(t,e){this._vy_overScr||this.setOverScreen(),t||(t=this._vy_overScr.settings);n.up.customScreenDraw(this._vy_overScr.brush,t,function(){this._vy_onScr&&this._vy_overScrSprite&&(this._vy_overScrSprite.texture&&this._vy_overScrSprite.texture.destroy(),this._vy_overScrSprite.texture=PIXI.Texture.from(this._vy_overScr.canvas),n.up.refreshInt=!0),e&&n.vC._callback(e)}.bind(this))};setOverScreenMod=function(t,e){if(e){this._vy_overScrMod||(this._vy_overScrMod={});for(const e in t)this._vy_overScrMod[e]=t[e];t=this._vy_overScrMod}else this._vy_overScrMod=t;this._vy_overScr||this.setOverScreen(),this._vy_gui?n.up.refreshInt=!0:this._vy_overScrSprite&&(this._vy_overScr.settings&&this._vy_overScr.settings.anchor?this._vy_overScrSprite.anchor.set(this._vy_overScr.settings.anchor.x,this._vy_overScr.settings.anchor.y):this._vy_overScrSprite.anchor.set(.5,.5),t.scale?"object"==typeof t.scale?this._vy_overScrSprite.scale.set(t.scale.x,t.scale.y):this._vy_overScrSprite.scale.set(t.scale,t.scale):this._vy_overScrSprite.scale.set(1,1),this._vy_overScrSprite.alpha=t.alpha?t.alpha:1,this._vy_overScrSprite.rotation=t.angle?-t.angle:0,this._vy_updateScreenSpritePos(!0))};getOverScreenMod=function(){return this._vy_overScrMod};checkScreenShown=function(){return!!this._vy_onScr};addFilter=function(t,e,r){let n;if(this._vy_pixS||this._vy_setScreenSprite(),this._vy_filters||(this._vy_filters={}),this._vy_filters[t]&&this.removeFilter(t),"colorMatrix"===e)n=new PIXI.ColorMatrixFilter,r&&(r.matrix&&(n.matrix=r.matrix),void 0!==r.contrast&&n.contrast(r.amount),void 0!==r.brightness&&n.brightness(r.brightness),void 0!==r.saturate&&n.saturate(r.saturate),void 0!==r.hue&&n.hue(r.hue));else if("blackAndWhite"===e)n=new PIXI.ColorMatrixFilter,n.blackAndWhite();else if("grayscale"===e)n=new PIXI.ColorMatrixFilter,n.greyscale(r?.amount);else if("lsd"===e)n=new PIXI.ColorMatrixFilter,n.lsd();else if("negative"===e)n=new PIXI.ColorMatrixFilter,n.negative();else if("night"===e)n=new PIXI.ColorMatrixFilter,n.night(r?.intensity);else if("predator"===e)n=new PIXI.ColorMatrixFilter,n.predator(r?.amount);else if("sepia"===e)n=new PIXI.ColorMatrixFilter,n.sepia();else if("rbSwap"===e)n=new PIXI.ColorMatrixFilter,n.toBGR();else if("blur"===e)r?(n=new PIXI.BlurFilter(r.strength,r.quality,r.resolution,r.kernelSize),r.blurX&&(n.blurX=r.blurX),r.blurY&&(n.blurY=r.blurY)):n=new PIXI.BlurFilter;else if("displacement"===e)if(r){const t=r.diob;t._vy_pixS||t._vy_setScreenSprite(),n=new PIXI.DisplacementFilter(t._vy_pixS,r.scale)}else n=new PIXI.DisplacementFilter;else"noise"===e?n=r?new PIXI.NoiseFilter(r.amount,r.seed):new PIXI.NoiseFilter:"brightness"===e?(n=new PIXI.ColorMatrixFilter,n.brightness(r?.b,r?.multiply)):"contrast"===e?(n=new PIXI.ColorMatrixFilter,n.contrast(r?.amount,r?.multiply)):"hue"===e?(n=new PIXI.ColorMatrixFilter,n.contrast(r?.rotation,r?.multiply)):n="outline"===e?new PIXI.filters.OutlineFilter(r):"custom"===e&&r?r.filter:new PIXI.ColorMatrixFilter;r&&(void 0!==r.alpha&&(n.alpha=r.alpha),r.blendMode&&(n.blendMode=r.blendMode),void 0!==r.padding&&(n.padding=r.padding),void 0!==r.resolution&&(n.resolution=r.resolution));let i=[n];this._vy_pixS.filters&&(i=this._vy_pixS.filters.concat(i)),this._vy_pixS.filters=i,this._vy_filters[t]=n};removeFilter=function(t){if(!this._vy_filters)return;const e=this._vy_filters[t];if(this._vy_pixS&&this._vy_pixS.filters){const t=Array.prototype.slice.call(this._vy_pixS.filters),r=t.indexOf(e);-1!==r&&t.splice(r,1),this._vy_pixS.filters=t}delete this._vy_filters[t]};getFilters=function(){return this._vy_filters||(this._vy_filters={}),Object.keys(this._vy_filters)};getScreenPos=function(t){let e=0,r=0;return this._vy_onScr&&(e=(this._vy_x-this._vy_onScr._vy_xScr)*n.vC.mapScaleWidth/n.vC.scaleWidth,r=(this._vy_y-this._vy_onScr._vy_yScr)*n.vC.mapScaleHeight/n.vC.scaleHeight),t?(t.x=e,t.y=r,t):{x:e,y:r}};get isCullable(){return this._vy_isCullable}set isCullable(t){this._vy_isCullable=t}show=function(){this._vy_map?._vy_mapView&&this._vy_map._vy_mapView._vy_addToScreen(this)};hide=function(){this._vy_map?._vy_mapView&&this._vy_map._vy_mapView._vy_removeFromScreen(this)}}class l{_vy_isDiobScale=!0;_vy_x=1;_vy_y=1;_vy_parent=null;constructor(t){this._vy_parent=t,(t._vy_scale||0===t._vy_scale)&&("number"!=typeof t._vy_scale||isNaN(t._vy_scale)?"object"==typeof t._vy_scale&&(this._vy_x=t._vy_scale.width??t._vy_scale.x,this._vy_y=t._vy_scale.height??t._vy_scale.y):(this._vy_x=t._vy_scale,this._vy_y=t._vy_scale))}get x(){return this._vy_x}set x(t){this._vy_parent.setScale(t,this._vy_y)}get y(){return this._vy_y}set y(t){this._vy_parent.setScale(this._vy_x,t)}}class _{_vy_isDiobAnchor=!0;_vy_x=.5;_vy_y=.5;_vy_parent=null;constructor(t){this._vy_parent=t,(t._vy_anchor||0===t._vy_anchor)&&("number"!=typeof t._vy_anchor||isNaN(t._vy_anchor)?"object"==typeof t._vy_anchor&&(this._vy_x=t._vy_anchor.x,this._vy_y=t._vy_anchor.y):(this._vy_x=t._vy_anchor,this._vy_y=t._vy_anchor))}get x(){return this._vy_x}set x(t){this._vy_parent.setAnchor(t,this._vy_y)}get y(){return this._vy_y}set y(t){this._vy_parent.setAnchor(this._vy_x,t)}}},758:(t,e,r)=>{"use strict";r.d(e,{T:()=>s});r(518);var n=r(181),i=r(140);class s extends n.c{_vy_isMovable=!0;_vy_plane=1;_vy_layer=2;_vy_dir="south";_vy_moving=!1;_vy_movingX=null;_vy_movingY=null;_vy_xMov=0;_vy_xMovS=0;_vy_yMov=0;_vy_yMovS=0;_vy_tMov=0;_vy_moveSet=null;_vy_stepSize=2;constructor(){super()}_vy_stepPos=function(t,e,r,n,i){if(this._vy_mapN&&void 0!==t&&(void 0===e&&(e=t),n||(n=e>0?"south":e<0?"north":"",t>0?n+="east":t<0&&(n+="west"),this._vy_moveSet?.stepCard&&n.length>5&&(n=Math.abs(e)>Math.abs(t)?n.substring(0,5):n.substring(5))),!this.onMove||this.onMove(t,e,n))){n&&!i&&this._vy_setDir(n);const s=this._vy_x,o=this._vy_y;let a=this._vy_stepPos_(t,e,r,n);1===a.length&&this._vy_moveSet?.stepGlide&&(a=a.concat(this._vy_stepGlideFunc(a[0],n,t,e)));const l=this._vy_x-s,_=this._vy_y-o;if((l||_)&&(this._vy_setPos(this._vy_x,this._vy_y,!0),this.onMoved?.(l,_,n),this.onRelocated?.(s,o,this._vy_mapN,!0)),a.length)for(let t=a.length;t--;){const e=a[t];e&&(this.onBump?.(e),e.onBumped?.(this))}if(l||_)return!0}};_vy_stepPos_=function(t,e,r,n){const s=this._vy_map,o=[];let a;(this._vy_x+this._vy_xOr+t<0||this._vy_x+this._vy_xOr+t>s._vy_width-this._vy_w)&&(this._vy_x+this._vy_xOr+t<0?this._vy_x=0-this._vy_xOr:this._vy_x=s._vy_width-this._vy_w-this._vy_xOr,t=0,a=1),(this._vy_y+this._vy_yOr+e<0||this._vy_y+this._vy_yOr+e>s._vy_height-this._vy_h)&&(this._vy_y+this._vy_yOr+e<0?this._vy_y=0-this._vy_yOr:this._vy_y=s._vy_height-this._vy_h-this._vy_yOr,e=0,a=1);let l=Math.ceil((this._vy_x+this._vy_xOr)/s._vy_tileW),_=Math.ceil((this._vy_y+this._vy_yOr)/s._vy_tileH),u=l+this._vy_xTiles,c=_+this._vy_yTiles;t>0?u+=Math.ceil(Math.abs(t)/s._vy_tileW):t<0&&(l-=Math.ceil(Math.abs(t)/s._vy_tileW)),e>0?c+=Math.ceil(Math.abs(e)/s._vy_tileH):e<0&&(_-=Math.ceil(Math.abs(e)/s._vy_tileH));for(let r=_;r<=c;r++)for(let i=l;i<=u;i++){const a=s._vy_tiles[i+s._vy_xMax*r];if(a){if(this._vy_stepPosCheckCollide(a,t,e)&&!this._vy_locs.includes(a))if(a._vy_density&&this._vy_density&&(a._vy_density>this._vy_density||a._vy_density==this._vy_density&&!a.allowDensityCross))o.includes(a)||o.push(a);else if(a.onEnter&&!o.includes(a)&&(a.onEnter(this,n)||o.push(a),this._vy_mapN!==s._vy_mapN))return[[]];if(a._vy_conts)for(let r=a._vy_conts.length;r--;){const n=a._vy_conts[r];if(n&&this!==n){if((this.onCross||n.onCross)&&this._vy_stepPosCheckCollide(n,t,e,this._vy_crossed)){if((!this.onCross||this.onCross(n)||o.includes(n))&&(!n.onCross||o.includes(n)||n.onCross(this,!0))||o.push(n),this._vy_mapN!==s._vy_mapN)return[[]];if(!n._vy_type)continue}this._vy_density&&n._vy_density&&!this._vy_stepPosCheckCollide(n,0,0)&&(n._vy_density>this._vy_density||n._vy_density==this._vy_density&&!n.allowDensityCross)&&this._vy_stepPosCheckCollide(n,t,e,o)&&o.push(n)}}}}if(o.length){let n,i;for(let r=o.length;r--;){const s=o[r];s&&(t&&this._vy_stepPosCheckCollide(s,t,0)&&(t>0&&(!n||s._vy_x+s._vy_xOr<n._vy_x+n._vy_xOr)||t<0&&(!n||s._vy_x+s._vy_xOr>n._vy_x+n._vy_xOr))&&(n=s),e&&this._vy_stepPosCheckCollide(s,0,e)&&(e>0&&(!i||s._vy_y+s._vy_yOr<i._vy_y+i._vy_yOr)||e<0&&(!i||s._vy_y+s._vy_yOr>i._vy_y+i._vy_yOr))&&(i=s))}const s=!!(r&&t>0&&e>0);(n||i)&&(n?i&&!s||(t>0?this._vy_x=n._vy_x+n._vy_xOr-this._vy_xOr-this._vy_w:t<0&&(this._vy_x=n._vy_x+n._vy_xOr+n._vy_w-this._vy_xOr)):this._vy_x+=t,i?n&&!s||(e>0?this._vy_y=i._vy_y+i._vy_yOr-this._vy_yOr-this._vy_h:e<0&&(this._vy_y=i._vy_y+i._vy_yOr+i._vy_h-this._vy_yOr)):this._vy_y+=e)}else this._vy_x+=t,this._vy_y+=e;return a&&o.unshift(i.P.voidTile),o};_vy_stepPosCheckCollide=function(t,e,r,n){if(!(n&&n.includes(t)||this._vy_x+this._vy_xOr+this._vy_w+e<=t._vy_x+t._vy_xOr||this._vy_x+this._vy_xOr+e>=t._vy_x+t._vy_xOr+t._vy_w||this._vy_y+this._vy_yOr+this._vy_h+r<=t._vy_y+t._vy_yOr||this._vy_y+this._vy_yOr+r>=t._vy_y+t._vy_yOr+t._vy_h))return!0};_vy_stepGlideFunc=function(t,e,r,n){if("north"===e||"south"===e){const e=this._vy_x+this._vy_xOr+this._vy_wH,i=isNaN(this._vy_moveSet?.stepGlide)?0:this._vy_moveSet.stepGlide,s=this._vy_x+this._vy_xOr+this._vy_w-(t._vy_x+t._vy_xOr);if(r||(r=Math.abs(n)),s<r&&(r=s),e-i<=t._vy_x+t._vy_xOr&&(!i||e+i<t._vy_x+t._vy_xOr+t._vy_w||t._vy_x+t._vy_xOr-(e-i)>=e+i-(t._vy_x+t._vy_xOr+t._vy_w)))return this._vy_stepPos_(-r,0);if(e+i>=t._vy_x+t._vy_xOr+t._vy_w)return this._vy_stepPos_(r,0)}else if("east"===e||"west"===e){const e=this._vy_y+this._vy_yOr+this._vy_hH,i=isNaN(this._vy_moveSet?.stepGlide)?0:this._vy_moveSet.stepGlide,s=this._vy_y+this._vy_yOr+this._vy_h-(t._vy_y+t._vy_yOr);if(n||(n=Math.abs(r)),s<n&&(n=s),e-i<=t._vy_y+t._vy_yOr&&(!i||e+i<t._vy_y+t._vy_yOr+t._vy_h||t._vy_y+t._vy_yOr-(e-i)>=e+i-(t._vy_y+t._vy_yOr+t._vy_h)))return this._vy_stepPos_(0,-n);if(e+i>=t._vy_y+t._vy_yOr+t._vy_h)return this._vy_stepPos_(0,n)}};_vy_setMoveSettings=function(){this._vy_moveSet=new o(this)};get isMovable(){return this._vy_isMovable}set isMovable(t){}get isMoving(){return this._vy_moving}set isMoving(t){!t&&this._vy_moving&&i.P.removeMovementObj(this)}get stepSize(){return this._vy_stepSize}set stepSize(t){this._vy_moveSet&&(this._vy_moveSet._vy_stepSize=t),this._vy_stepSize=t}get moveSettings(){return this._vy_moveSet||this._vy_setMoveSettings(),this._vy_moveSet}set moveSettings(t){if(t._vy_isMoveSettings)this._vy_moveSet=t;else{this._vy_moveSet||this._vy_setMoveSettings();for(const e in t)this._vy_moveSet[e]=t[e]}}get preventScreenRelayer(){return this._vy_preventScreenRelayer}set preventScreenRelayer(t){this._vy_preventScreenRelayer=t}step=function(t,e,r){if("number"==typeof t)return this._vy_stepPos(t,e,r);{const n=void 0!==e?e:this._vy_stepSize;return this._vy_stepPos(i.P.dirPosX[t]*n,i.P.dirPosY[t]*n,!0,t,r)}};stepDir=function(t,e,r){const n=void 0!==e?e:this._vy_stepSize;return"number"==typeof t&&(t=i.P.dirNum[t]),this._vy_stepPos(i.P.dirPosX[t]*n,i.P.dirPosY[t]*n,!0,t,r)};stepPos=function(t,e,r,n){return this._vy_stepPos(t,e,r,0,n)};move=function(t,e){t?("number"!=typeof t?(this._vy_movingX=i.P.dirPosX[t]*this._vy_stepSize,this._vy_movingY=i.P.dirPosY[t]*this._vy_stepSize):(this._vy_movingX=t,this._vy_movingY=e),i.P.addMovementObj(this)):i.P.removeMovementObj(this)};moveDir=function(t){t?("number"==typeof t&&(t=i.P.dirNum[t]),this._vy_movingX=i.P.dirPosX[t],this._vy_movingY=i.P.dirPosY[t],i.P.addMovementObj(this)):i.P.removeMovementObj(this)};movePos=function(t,e){if(!t){if(!e)return void i.P.removeMovementObj(this);t=0}this._vy_movingX=t,this._vy_movingY=e,i.P.addMovementObj(this)}}class o{_vy_isMoveSettings=!0;_vy_stepSize=2;_vy_stepGlide=!0;_vy_stepSlide=!1;_vy_stepTick=16.6667;_vy_parent=null;constructor(t){this._vy_parent=t}get stepSize(){return this._vy_stepSize}set stepSize(t){this._vy_stepSize=t,this._vy_parent&&(this._vy_parent._vy_stepSize=t)}get stepGlide(){return this._vy_stepGlide}set stepGlide(t){this._vy_stepGlide=t}get stepSlide(){return this._vy_stepSlide}set stepSlide(t){this._vy_stepSlide=t}get stepTick(){return this._vy_stepTick}set stepTick(t){this._vy_stepTick=t}}},681:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{a:()=>ObjectType});var _managers_main_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(518),_managers_object_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(140),_VyObject_ts__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(708),_Diob_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(428),_MapObject_ts__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(181),_Movable_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(758),_Mob_ts__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(602),_Overlay_ts__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(532),_Tile_js__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(542),_Region_ts__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(585),_Client_js__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(461),_World_js__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(700),_interface_Interface_js__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(27),_interface_WebBox_js__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__(725),_interface_TextInput_ts__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__(145),_interface_MapView_js__WEBPACK_IMPORTED_MODULE_15__=__webpack_require__(871),_interface_InterfacePane_ts__WEBPACK_IMPORTED_MODULE_16__=__webpack_require__(917),_Particle_ts__WEBPACK_IMPORTED_MODULE_17__=__webpack_require__(960),_Sound_js__WEBPACK_IMPORTED_MODULE_18__=__webpack_require__(999),_map_Map_js__WEBPACK_IMPORTED_MODULE_19__=__webpack_require__(983),_map_TileMap_js__WEBPACK_IMPORTED_MODULE_20__=__webpack_require__(571);class ObjectType{_vy_isObjectType=!0;_vy_type=null;_vy_baseType=null;_vy_object=null;_vy_vars={};_vy_ownVars={};_vy_obVars=null;_vy_children=[];_vy_parents=[];_vy_typeParent=null;_vy_inherits=[];_vy_inheritsT=[];_vy_ownFuncs={};_vy_overrideFuncs=[];_vy_retValFuncs=[];_vy_staticVars=null;_vy_vyrVars=null;_vy_baseClass="VyObject";_vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createVyObject;constructor(t,e,r){this._vy_type=t,_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.baseClasses.includes(t)&&(this._vy_baseClass=t);t.indexOf("/"),t.lastIndexOf("/");const n=t.split("/");if(n.length>1){let t=n[0];if(this._vy_baseType=this._vy_addParent(t),n.length>2){for(let e=1,r=n.length-1;e<r;e++)t+=`/${n[e]}`,this._vy_addParent(t);this._vy_setRootParent(_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.objectTypes[t])}else this._vy_setRootParent(this._vy_baseType)}else this._vy_baseType=this;if(r)for(let t=0,e=r.length;t<e;t++)this.addInherit(r[t]);this._vy_initiate(e)}_vy_initiate=function(t){let e,r,n,i=null;if(_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.baseClasses.includes(this._vy_baseClass))switch(this._vy_baseClass){case"MapObject":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createDiob,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropMapObject,e=new _MapObject_ts__WEBPACK_IMPORTED_MODULE_4__.c;break;case"Tile":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createTile,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropTile,e=new _Tile_js__WEBPACK_IMPORTED_MODULE_8__.F;break;case"Region":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createDiob,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropRegion,e=new _Region_ts__WEBPACK_IMPORTED_MODULE_9__.T,r=!0;break;case"Overlay":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createDiob,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropOverlay,e=new _Overlay_ts__WEBPACK_IMPORTED_MODULE_7__.h;break;case"Client":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createClient,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropClient,e=new _Client_js__WEBPACK_IMPORTED_MODULE_10__.K;break;case"World":i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropWorld,e=new _World_js__WEBPACK_IMPORTED_MODULE_11__.H;break;case"Mob":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createDiob,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropMob,e=new _Mob_ts__WEBPACK_IMPORTED_MODULE_6__.B;break;case"Particle":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createDiob,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropParticle,e=new _Particle_ts__WEBPACK_IMPORTED_MODULE_17__.J;break;case"Interface":const n=t?.interfaceType||this._vy_vars.interfaceType;if(n)switch(t||(t={}),void 0===t.preventAutoScale&&void 0===this._vy_vars.preventAutoScale&&(t.preventAutoScale=!1),n){case"WebBox":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createWebBox,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropWebBox,e=new _interface_WebBox_js__WEBPACK_IMPORTED_MODULE_13__.U;break;case"TextInput":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createWebBox,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropTextInput,e=new _interface_TextInput_ts__WEBPACK_IMPORTED_MODULE_14__.k;break;case"PassInput":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createWebBox,t.isPasswordInput=!0,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropTextInput,e=new _interface_TextInput_ts__WEBPACK_IMPORTED_MODULE_14__.k;break;case"CommandInput":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createWebBox,t.isCommandInput=!0,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropTextInput,e=new _interface_TextInput_ts__WEBPACK_IMPORTED_MODULE_14__.k;break;case"TextArea":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createWebBox,t.isMultiline=!0,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropTextInput,e=new _interface_TextInput_ts__WEBPACK_IMPORTED_MODULE_14__.k;break;default:this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createInterface,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropInterface,e=new _interface_Interface_js__WEBPACK_IMPORTED_MODULE_12__.K}else this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createInterface,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropInterface,e=new _interface_Interface_js__WEBPACK_IMPORTED_MODULE_12__.K;break;case"WebBox":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createWebBox,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropWebBox,e=new _interface_WebBox_js__WEBPACK_IMPORTED_MODULE_13__.U;break;case"TextInput":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createWebBox,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropTextInput,e=new _interface_TextInput_ts__WEBPACK_IMPORTED_MODULE_14__.k;break;case"MapView":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createWebBox,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropMapView,e=new _interface_MapView_js__WEBPACK_IMPORTED_MODULE_15__.K;break;case"InterfacePane":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createInterfacePane,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropInterfacePane,e=new _interface_InterfacePane_ts__WEBPACK_IMPORTED_MODULE_16__.M;break;case"Map":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createMap,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropMap,e=new _map_Map_js__WEBPACK_IMPORTED_MODULE_19__.o;break;case"TileMap":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createMap,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropMap,e=new _map_TileMap_js__WEBPACK_IMPORTED_MODULE_20__.B;break;case"Sound":i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropSound,e=new _Sound_js__WEBPACK_IMPORTED_MODULE_18__.A;break;case"Movable":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createDiob,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropMovable,e=new _Movable_js__WEBPACK_IMPORTED_MODULE_5__.T;break;case"Diob":this._vy_constructor=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createDiob,i=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.defPropDiob,e=new _Diob_js__WEBPACK_IMPORTED_MODULE_3__.jG;break;default:e=new _VyObject_ts__WEBPACK_IMPORTED_MODULE_2__.z}if(this._vy_object?this._vy_vyrVars!==i&&(this._vy_vyrVars=i,n=!0):i&&(this._vy_vyrVars=i),t&&this.setVars(t),this._vy_createObject(e),r&&(_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.regions[this._vy_type]=this._vy_object),n&&this._vy_children.length)for(let t=this._vy_children.length;t--;)this._vy_children[t]._vy_initiate()};_vy_setRootParent=function(t){this._vy_parentType=t,t._vy_addChild(this)};_vy_addParent=function(t,e){let r=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.objectTypes[t];if(r||(r=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createObjectType(t)),this._vy_parents.includes(r))return r;this._vy_parents.push(r),e||(this._vy_typeParent=r);for(const t in r._vy_vars)void 0===this._vy_ownVars[t]&&this._vy_setVar(t,r._vy_vars[t],!0);if(r._vy_obVars)for(const t in r._vy_obVars)void 0===this._vy_ownVars[t]&&this._vy_setVar(t,r._vy_obVars[t],!0);return _managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.baseClasses.indexOf(r._vy_baseClass)>_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.baseClasses.indexOf(this._vy_baseClass)&&(this._vy_baseClass=r._vy_baseClass,this._vy_initiate()),r};_vy_addChild=function(t){this._vy_children.includes(t)||this._vy_children.push(t)};_vy_removeChild=function(t){const e=this._vy_children.indexOf(t);-1!==e&&this._vy_children.splice(e,1)};_vy_setVar=function(t,e,r){if(this._vy_vars[t]!==e){if(this._vy_vars[t]=e,this._vy_ownFuncs[t]&&!_managers_main_js__WEBPACK_IMPORTED_MODULE_0__.j3.Util.isFunction(e)&&(delete this._vy_ownFuncs[t],this._vy_rebuildFunction(t)),"object"==typeof e&&null!==e||Array.isArray(e))this._vy_obVars||(this._vy_obVars={}),r&&(e=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P._copyObjectVars(Array.isArray(e)?[]:{},e,0,0,1)),this._vy_obVars[t]=e,delete this._vy_vars[t],this._vy_object&&(this._vy_object[this._vy_vyrVars?.[t]||t]=e);else{if(this._vy_obVars?.[t]&&delete this._vy_obVars[t],_managers_main_js__WEBPACK_IMPORTED_MODULE_0__.j3.Util.isFunction(e))return r||(this._vy_ownFuncs[t]=e),void this._vy_rebuildFunction(t);this._vy_object&&(this._vy_object[this._vy_vyrVars?.[t]||t]=e)}if(this._vy_children.length)for(let r=this._vy_children.length;r--;){const n=this._vy_children[r];void 0===n._vy_ownVars[t]&&n._vy_setVar(t,e,!0)}}};_vy_createObject=function(t){for(const e in this._vy_vars)t[this._vy_vyrVars?.[e]||e]=this._vy_vars[e];if(null===t._vy_name){const e=this._vy_type.lastIndexOf("/");t._vy_name=-1!==e?this._vy_type.substring(e+1).replace(/_/g," "):this._vy_type.replace(/_/g," ")}t._vy_type=this._vy_type,t._vy_parentT=this,this._vy_object=t};_vy_rebuildFunction=function(pName){if(this._vy_retValFuncs.includes(pName)){let func="var retVal;";for(let t=this._vy_parents.length;t--;)func+=this._vy_parents[t]._vy_parseRetValFunc(pName);func+=this._vy_parseRetValFunc(pName),eval(`this._vy_vars[pName] = function(){${func}return retVal;};`)}else{let t=this._vy_ownFuncs[pName],e=t;if(this._vy_inherits.length&&!this._vy_overrideFuncs.includes(pName)){const r=[];for(const t of this._vy_inherits){const e=t._vy_vars[pName];e&&r.push(e)}if(r.length)if(t)if(r.length>1)e=function(){let e;for(const t of r)e=t.apply(this,arguments)??e;return t.apply(this,arguments)??e};else{let n=r[0];e=function(){const e=n.apply(this,arguments);return t.apply(this,arguments)??e}}else e=r.length>1?function(){let t;for(const e of r)t=e.apply(this,arguments)??t;return t}:r[0]}if(this._vy_parents.length&&this._vy_typeParent?._vy_vars[pName]&&!this._vy_overrideFuncs.includes(pName)){const t=this._vy_typeParent._vy_vars[pName];this._vy_vars[pName]=e?function(){const r=t.apply(this,arguments);return e.apply(this,arguments)??r}:t}else this._vy_vars[pName]=e}if(this._vy_object&&(this._vy_object[pName]=this._vy_vars[pName]),this._vy_children.length)for(let t=this._vy_children.length;t--;){const e=this._vy_children[t];e._vy_rebuildFunction(pName)}};_vy_parseRetValFunc=function(t){let e="";if(this._vy_inherits.length)for(let r=this._vy_inherits.length;r--;)e+=this._vy_inherits[r]._vy_parseRetValFunc(t);return this._vy_ownFuncs[t]&&(e+=`retVal=${this._vy_ownFuncs[t].toString()}.apply(this,arguments);`),e};destroy=function(){if(this._vy_parents.length)for(let t=this._vy_parents.length;t--;)this._vy_parents[t]._vy_removeChild(this);delete _managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.objectTypes[this._vy_type]};addInherit=function(t){let e=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.objectTypes[t];return e||(e=_managers_object_js__WEBPACK_IMPORTED_MODULE_1__.P.createObjectType(t)),this._vy_inherits.includes(e)||(this._vy_inherits.push(e),this._vy_inheritsT.includes(e._vy_type)||this._vy_inheritsT.push(e._vy_type),this._vy_addParent(t,!0),e._vy_addChild(this)),e};removeInherit=function(t){};setVars=function(t){if(t._vy_fOverrides&&(this._vy_overrideFuncs=t._vy_fOverrides,delete t._vy_fOverrides),t._vy_fRetVals&&(this._vy_retValFuncs=t._vy_fRetVals,delete t._vy_fRetVals),t._vy_preCommands){this._vy_com||(this._vy_com={});for(const e in t._vy_preCommands)this._vy_com[e]=t._vy_preCommands[e];delete t._vy_preCommands}for(const e in t)this.setVar(e,t[e])};setVar=function(t,e){this._vy_ownVars[t]=e,this._vy_setVar(t,e)};getVar=function(t,e){if(!e||this._vy_ownVars[t])return this._vy_obVars?.[t]?this._vy_obVars[t]:this._vy_object[t]};getVars=function(t){};delVar=function(t){if(delete this._vy_ownVars[t],delete this._vy_vars[t],this._vy_obVars&&delete this._vy_obVars[t],this._vy_object&&delete this._vy_object[t],this._vy_children.length)for(let e=this._vy_children.length;e--;){const r=this._vy_children[e];r._vy_ownVars[t]||r.delVar(t)}};setStaticVar=function(t,e){this._vy_staticVars||(this._vy_staticVars={}),this._vy_staticVars[t]=e};getStaticVar=function(t){return this._vy_staticVars?.[t]};get staticVars(){return this._vy_staticVars}set staticVars(t){}get inherits(){return this._vy_inheritsT.slice()}set inherits(t){}setFunc=function(t,e,r){if(r)this._vy_overrideFuncs.includes(t)||this._vy_overrideFuncs.push(t);else if(!1===r){const e=this._vy_overrideFuncs.indexOf(t);-1!==e&&this._vy_overrideFuncs.splice(e,1)}this.setVar(t,e)};getFunc=function(t,e){return e?this._vy_ownFuncs[t]:this._vy_vars[t]}}},999:(t,e,r)=>{"use strict";r.d(e,{A:()=>o});var n=r(518),i=r(708),s=r(868);class o extends i.z{_vy_isSound=!0;_vy_source=null;_vy_gain=null;_vy_isStopped=!1;_vy_isPaused=!1;_vy_volume=100;_vy_fader=null;_vy_faderT=null;constructor(){super()}get isSound(){return!0}set isSound(t){}play=function(t,e){n.R5.playSound(this,t,e)};stop=function(){!this._vy_isStopped&&this._vy_source&&(this._vy_isStopped=!0,this._vy_source.stop(0),this.onStopped?.())};pause=function(){!this._vy_isPaused&&this._vy_source&&(this._vy_isPaused=!0,this._vy_source.context.suspend(),this.onPaused?.())};resume=function(){this._vy_source&&(this._vy_isPaused=!1,this._vy_source.context.resume(),this.onResumed?.())};fade=function(t,e){this._vy_source&&(this._vy_gain||n.R5.createGain(this),this._vy_fader&&clearInterval(this._vy_fader),this._vy_faderT=Math.abs(t-this._vy_volume)/(1e3*e),t>this._vy_volume?this._vy_fader=setInterval(function(){this._vy_isStopped||(this._vy_volume+=50*this._vy_faderT,this._vy_volume>=t&&(this._vy_volume=t,clearInterval(this._vy_fader),this._vy_fader=null),this.volume=this._vy_volume)}.bind(this),50):this._vy_fader=setInterval(function(){this._vy_isStopped||(this._vy_volume-=50*this._vy_faderT,this._vy_volume<=t&&(this._vy_volume=t,clearInterval(this._vy_fader),this._vy_fader=null),this.volume=this._vy_volume)}.bind(this),50))};setVolume=function(t){this._vy_volume=t,this._vy_source&&(this._vy_gain||n.R5.createGain(this),this._vy_gain.gain.value=n.um._vy_volume/100*(t/100))};get volume(){return this._vy_volume}set volume(t){this.setVolume(t)}setLoop=function(t){this._vy_source&&(void 0===t&&(t=!this.loop),this.loop=t,this._vy_source.loop=t)};setPlaybackRate=function(t){this._vy_source&&(this._vy_source.playbackRate.value=t)};getRawData=function(){return s.Q.loadedSounds[this.soundName]?.data};getContext=function(){if(this._vy_source)return this._vy_source.context};getBuffer=function(){if(this._vy_source)return this._vy_source.buffer};getSource=function(){return this._vy_source};getPanner=function(){return this._vy_panner||n.R5.createPanner(this),this._vy_panner};get isPaused(){return this._vy_isPaused}set isPaused(t){}get isStopped(){return this._vy_isStopped}set isStopped(t){}get currentTime(){return this._vy_source?this._vy_source.context.currentTime-this._vy_source.startTime:0}set currentTime(t){}}},542:(t,e,r)=>{"use strict";r.d(e,{F:()=>o});var n=r(518),i=r(181),s=r(140);class o extends i.c{_vy_isLoc=!0;_vy_mouseOp=0;_vy_onChunkScr=!1;_vy_scrPrev=null;_vy_scrNext=null;onEnter=null;onExit=null;onEntered=null;onExited=null;constructor(){super()}_vy_addToContents=function(t){if(t._vy_locs||(t._vy_locs=[]),!t._vy_locs.includes(this))return this._vy_conts||(this._vy_conts=[]),this._vy_conts.push(t),this._vy_onScr?._vy_addToScreen(t),t._vy_locs.push(this),(t.onCrossed||t.onUncrossed||t.onCrossedRelocated)&&(this._vy_hasCrossed?this._vy_hasCrossed++:this._vy_hasCrossed=1),t._vy_isMovable&&(this.onEntered?.(t),this._vy_region&&t._vy_type&&(t._vy_inRegion||(t._vy_inRegion=[]),t._vy_inRegion.includes(this._vy_region)||(t._vy_inRegion.push(this._vy_region),this._vy_region.onEntered?.(t)))),n.vC.serSocket&&(t._vy_chunks||(t._vy_chunks=[]),this._vy_chunk&&!t._vy_chunks.includes(this._vy_chunk)&&(t._vy_hasUpdatedChunk&&!this._vy_chunk.u.includes(t)&&this._vy_chunk.u.push(t),t._vy_chunks.push(this._vy_chunk),t.preventInterest||t._vy_clientC||!t._vy_id||!t._vy_id.startsWith("r")||this._vy_chunk.c.includes(t)||this._vy_chunk.c.push(t))),!0};_vy_removeFromContents=function(t,e){if(!this._vy_conts)return;let r=this._vy_conts.indexOf(t);if(-1!==r){if(this._vy_conts.splice(r,1),t._vy_locs&&(r=t._vy_locs.indexOf(this),-1!==r&&t._vy_locs.splice(r,1)),(t.onCrossed||t.onUncrossed||t.onCrossedRelocated)&&this._vy_hasCrossed&&this._vy_hasCrossed--,t._vy_isMovable&&(this.onExited?.(t),this._vy_region&&t._vy_inRegion&&(r=t._vy_inRegion.indexOf(this._vy_region),-1!==r))){let e;for(const r of t._vy_locs)if(r._vy_region===this._vy_region){e=1;break}e||(t._vy_inRegion.splice(r,1),this._vy_region.onExited?.(t))}n.vC.serSocket&&this._vy_chunk&&(e||!t._vy_mapN||(this._vy_chunk.xC+this._vy_chunk.wC)*this._vy_map._vy_tileW<t._vy_x+t._vy_xOr||(this._vy_chunk.xC-1)*this._vy_map._vy_tileW>t._vy_x+t._vy_xOr+t._vy_w||(this._vy_chunk.yC+this._vy_chunk.hC)*this._vy_map._vy_tileH<t._vy_y+t._vy_yOr||(this._vy_chunk.yC-1)*this._vy_map._vy_tileH>t._vy_y+t._vy_yOr+t._vy_h)&&t._vy_removeFromChunk(this._vy_chunk)}};_vy_clearContents=function(){if(this._vy_conts)for(let t=this._vy_conts.length;t--;)this._vy_removeFromContents(this._vy_conts[t])};get isTile(){return!0}set isTile(t){}setOrigin=function(t,e){};set xOrigin(t){}get xOrigin(){return this._vy_xOr}set yOrigin(t){}get yOrigin(){return this._vy_yOr}setPos=function(t,e,r){};get x(){return this._vy_x}set x(t){}get xPos(){return this._vy_x}set xPos(t){}get y(){return this._vy_y}set y(t){}get yPos(){return this._vy_y}setLoc=function(t,e,r){};getLoc=function(){return this};getLocs=function(){return[this]};get loc(){return this}set loc(t){}setCoords=function(t,e,r){};set xCoord(t){}get xCoord(){return Math.floor(this._vy_x/this._vy_map._vy_tileW)+1}set yCoord(t){}get yCoord(){return Math.floor(this._vy_y/this._vy_map._vy_tileH)+1}setCoordOffsets=null;setIconOffsets=function(t,e){};getRegion=function(){return this._vy_region||s.P.regions.Region};setSize=function(t,e){};set width(t){}get width(){return this._vy_map?this._vy_map._vy_tileW:32}set height(t){}get height(){return this._vy_map?this._vy_map._vy_tileH:32}set mouseOpacity(t){if(this._vy_mouseOp=t,this._vy_onScr)if(this._vy_mouseOp)this._vy_onScr._vy_scrTilesMouseEvents.includes(this)||this._vy_onScr._vy_scrTilesMouseEvents.push(this);else{const t=this._vy_onScr._vy_scrTilesMouseEvents.indexOf(this);-1!==t&&this._vy_onScr._vy_scrTilesMouseEvents.splice(t,1)}}get mouseOpacity(){return this._vy_mouseOp}getTileByDir=function(t){if(!t)return;let e=0;t.includes("east")?e=1:t.includes("west")&&(e=-1);let r=0;t.includes("south")?r=1:t.includes("north")&&(r=-1);const i=n.j3.Map.getLoc(this.xCoord+e,this.yCoord+r,this._vy_mapN);return i||s.P.voidTile}}},700:(t,e,r)=>{"use strict";r.d(e,{H:()=>a});var n=r(518),i=r(140),s=r(708),o=r(868);class a extends s.z{_vy_maxPostSize=5e6;_vy_maxUploadFilesize=5e6;constructor(){super()}get maxPostSize(){return this._vy_maxPostSize}set maxPostSize(t){this._vy_maxPostSize=t}get maxUploadFilesize(){return this._vy_maxUploadFilesize}set maxUploadFilesize(t){this._vy_maxUploadFilesize=t}evalWebScript=function(t){return eval.call(null,t)};getGameSize=function(){return{width:n.a$.gameWidth,height:n.a$.gameHeight}};getGameVersion=function(){return n.a$.gameVersion};getPlayerMode=function(){return n.a$.playerMode};getHostAddress=function(){return"localhost"};getServerAddress=function(){return n.vC.serSocket?n.U3.serverPath:"localhost"};sendMessage=function(t,e,r){const n=new XMLHttpRequest,i=0!==t.indexOf("http")?"https://":"";n.open("GET",i+t+"/api?type=message&text="+encodeURIComponent(e),!0),r&&(n.onreadystatechange=function(){4==n.readyState&&r(0,n.responseText)}),n.send()};sendNotification=function(t,e,r){r&&n.vC._callback(r,[!1,"World.sendNotification only works in server code."])};checkSub=function(t,e){e&&n.vC._callback(e,[!1,"World.checkSub only works in server code."])};getCodeType=function(){return n.vC.serSocket?"client":"local"};getTileSize=function(){return{width:n.Me,height:n.Ze}};getClients=function(){return[n.um]};getServers=function(t){const e=[],r=new XMLHttpRequest;r.open("GET","https://www.vylocity.com/api/?a=getServerList&gameID="+encodeURIComponent(n.a$.gameID)+"&trial="+encodeURIComponent(n.a$.trial),!0),r.onreadystatechange=function(){if(4==r.readyState){if(200===r.status){const t=r.responseText.split(";");for(let r=0,n=t.length;r<n;r++){const n=t[r];if(!n)continue;const i=n.split("+");e.push({name:decodeURIComponent(i[1]),address:i[0],players:parseInt(i[2]),guests:parseInt(i[3])})}}t&&t(e)}},r.send()};getWebContent=function(t,e,r){const n=new XMLHttpRequest;n.open("GET",t,!0),r&&n.overrideMimeType(r),n.onreadystatechange=function(){4==n.readyState&&(200===n.status?e(n.responseText):e&&e(""))},n.send()};sendWebRequest=async function(t,e){return await fetch(t,e)};kickClient=location.reload;shutdown=location.reload;reboot=location.reload;outputText=function(t,e,r){n.um.outputText(t,e,r)};playSound=function(t,e,r,i){if(!e||-1!==e.indexOf(n.um._vy_playerMob))return n.R5.playSound(t,r,i)};log=function(...t){console.log(...t)};getDiobs=function(t,e){const r=[];for(const n of i.P.objects.values())n&&(t&&!i.P.isType(n._vy_type,t,e)||r.push(n));return r};getDiobByID=function(t){let e=i.P.objects.get(t);if(!e&&t&&n.vC.serSocket&&t.constructor===String&&t.startsWith("m_")){const r=t.split("_");r.shift();const n=r.pop().split("x"),i=o.Q.maps[r.join("_")];i&&(e=i._vy_tiles[parseInt(n[0])+i._vy_xMax*parseInt(n[1])])}return e};getDiobsByTag=function(t){return i.P.tags[t]?.slice()||[]};getDiobsFromArray=function(t,e,r){return this.getObjectsFromArray(t,e,r)};getObjectsFromArray=function(t,e,r){if(!t)return[];const n=[];for(let s=0;s<t.length;s++){const o=t[s];o&&(e&&!i.P.isType(o._vy_type,e,r)||n.push(o))}return n};openSteamAPI=function(){if(_vy_exe)return _vy_exe.steamAPI.init()};openWebSocket=function(t,e,r){n.U3.remSockets[t]&&n.U3.remSockets[t].connected||function(){const i={address:t,addEvent:function(t,e){n.U3.remConnections[this.address]&&"connect"!==t.toLowerCase()&&"disconnect"!==t.toLowerCase()&&n.U3.remConnections[this.address].on(t,e)},send:function(t,e){n.U3.remConnections[this.address].emit(t,e)},close:function(){n.U3.remConnections[this.address]&&(this.connected=!1,n.U3.remConnections[this.address].disconnect(),n.U3.remConnections[this.address]=void 0,n.U3.remSockets[this.address]=void 0)}};n.vC.io=io,setTimeout((function(){r&&r.secure?n.U3.remConnections[t]=n.vC.io.connect("https://"+t,{secure:!0,"force new connection":!0}):n.U3.remConnections[t]=n.vC.io.connect(t,{"force new connection":!0}),n.U3.remSockets[t]=i,e(i),n.U3.remConnections[t].on("connect",(function(){i.connected=!0,i.onConnect?.()})),n.U3.remConnections[t].on("disconnect",(function(){i.connected=!1,i.onDisconnect?.()})),n.U3.remConnections[t].on("error",(function(t){i.onError?.(t)}))}),1)}()};hostWebSocket=function(t,e){const r={port:t,addEvent:function(t,e){},send:function(t,e){},clientSend:function(t,e,r){},clientClose:function(t){},getClients:function(){},close:function(){}};e(r)};openMySQL=function(t){};getAddress=function(){return"localhost"};sendDiob=function(t,e){};global=globalThis._vy_global;getIcon=n.j3.getIcon;getIconAtlas=n.j3.getIconAtlas;newIconAtlas=n.j3.newIconAtlas;newIcon=n.j3.newIcon;newIconFromURL=n.j3.newIconFromURL;setType=n.j3.setType;getType=n.j3.getType;getMap=function(t){return o.Q.maps[t]};getResource=function(t,e){return o.Q.resources[`${t.substr(0,3)}_${e}`]}}},27:(t,e,r)=>{"use strict";r.d(e,{K:()=>s});var n=r(518),i=r(428);class s extends i.jG{_vy_gui=!0;_vy_x=0;_vy_y=0;_vy_anchor=0;_vy_plane=1;_vy_intID=null;_vy_dom=null;_vy_pane=null;_vy_outputs=null;_vy_client=null;_vy_edgeLock=null;isHidden=!1;preventAutoScale=!1;constructor(){super()}_vy_setPos=function(t,e){const r=this._vy_x,i=this._vy_y;if(t!==r||e!==i){if(this._vy_x=t,this._vy_y=e,this._vy_onScr&&(this._vy_updateScreenSpritePos(),n.up.refreshInt=!0,this._vy_over))for(let t=this._vy_over.length;t--;){this._vy_over[t]._vy_updateScreenSpritePos()}this.onRelocated?.(r,i)}};_vy_setEdgeLock=function(){void 0===this._vy_xPoL&&(this._vy_xPoL=this._vy_x),void 0===this._vy_yPoL&&(this._vy_yPoL=this._vy_y),this._vy_edgeLock&&(this._vy_edgeLock.includes("bottom")&&(this.preventAutoScale?this._vy_y=this._vy_yPoL+(n.um.screenView.height-n.a$.origHeight):this._vy_y=this._vy_yPoL+(n.um.screenView.height/n.vC.scaleHeight-n.a$.origHeight)),this._vy_edgeLock.includes("right")&&(this.preventAutoScale?this._vy_x=this._vy_xPoL+(n.um.screenView.width-n.a$.origWidth):this._vy_x=this._vy_xPoL+(n.um.screenView.width/n.vC.scaleWidth-n.a$.origWidth))),this._vy_updateScreenSpritePos(),n.up.refreshInt=!0};get isInterface(){return!0}set isInterface(t){}get intID(){return this._vy_intID}set intID(t){this._vy_intID=t}get pane(){return this._vy_pane}set pane(t){const e=t._vy_isIntPane?t:this._vy_client._vy_interfaces[t];e?.addContents(this)}setPos=function(t,e){this._vy_setPos(t,e)};set x(t){this._vy_setPos(t,this._vy_y)}get x(){return this._vy_x}set xPos(t){this._vy_setPos(t,this._vy_y)}get xPos(){return this._vy_x}set y(t){this._vy_setPos(this._vy_x,t)}get y(){return this._vy_y}set yPos(t){this._vy_setPos(this._vy_x,t)}get yPos(){return this._vy_y}setPlane=function(t){t||(t=0),this._vy_onScr?(n.up.removeFromInterface(this),this._vy_plane=t,this._vy_dom&&(this._vy_dom.style.zIndex=this._vy_plane),n.up.addToInterface(this)):this._vy_plane=t};setSize=function(t,e){const r=this._vy_w,i=this._vy_h;this._vy_w=t,this._vy_wH=Math.round(this._vy_w/2),this._vy_h=e,this._vy_hH=Math.round(this._vy_h/2),this._vy_solidColor&&(this._vy_pixS.width=this._vy_w,this._vy_pixS.height=this._vy_h,this._vy_setIconSize()),this._vy_onScr&&(n.up.refreshInt=!0),this.onResized?.(r,i)};setAlpha=function(t){this._vy_alpha=t,this._vy_alpha<0?this._vy_alpha=0:this._vy_alpha>1&&(this._vy_alpha=1),this._vy_checkScreenTrans(),this._vy_checkDrawModified(this)};get mouseOpacity(){return this._vy_mouseOp}set mouseOpacity(t){this._vy_mouseOp=t}get client(){return n.um}set client(t){}getClient=function(){return n.um};hide=function(){this._vy_pane&&n.um.hideInterface(this._vy_pane._vy_name,this._vy_name)};show=function(){this._vy_pane&&n.um.showInterface(this._vy_pane._vy_name,this._vy_name)};getInterfaceName=function(){return this._vy_pane?this._vy_pane._vy_name:""};setText=function(t){if(t||0===t||(t=""),this._vy_text=t.toString(),this._vy_onScr)if(this._vy_pixT)this._vy_textSty&&this._vy_textSty.bitmap?this._vy_setText_bitmap(t):(this._vy_pixT.text=this._vy_text,n.up.refreshInt=!0);else{this._vy_setScreenSpriteText(),this._vy_updateScreenSprite();this._vy_isOverlay&&this._vy_appMask?this._vy_isOverlay._vy_plane:this._vy_plane;this.preventAutoScale?n.up.intApp.stage.addChildAt(this._vy_pixT,n.up.intApp.stage.children.indexOf(this._vy_pixS)+1):n.up.intApp.stageScale.addChildAt(this._vy_pixT,n.up.intApp.stageScale.children.indexOf(this._vy_pixS)+1),n.up.refreshInt=!0}return this._vy_text};execute=function(t){this.onExecute?.(t)};get edgeLock(){return this._vy_edgeLock}set edgeLock(t){this._vy_edgeLock=t,this._vy_onScr&&this._vy_setEdgeLock()}get isShown(){return!(!this._vy_pane?._vy_isShown||this.isHidden)}set isShown(t){}}},871:(t,e,r)=>{"use strict";r.d(e,{K:()=>a});var n=r(518),i=r(725),s=r(140),o=r(868);class a extends i.U{_vy_isMapView=!0;_vy_eye=null;_vy_eyeCache=null;_vy_plane=0;_vy_zoom=null;_vy_maxZoom=null;_vy_minZoom=null;_vy_xAutoZoom=null;_vy_yAutoZoom=null;_vy_autoZoomMulti=null;_vy_maxView=null;_vy_renderApp=null;_vy_renderer=null;_vy_canvas=null;_vy_resizeObserver=null;_vy_map=null;_vy_mapWidth=0;_vy_mapHeight=0;_vy_mapWidthHalf=0;_vy_mapHeightHalf=0;_vy_mapCont=null;_vy_viewChunks=[];_vy_cacheSprite=null;_vy_clearCacheSprite=null;_vy_tileW=0;_vy_tileH=0;_vy_xCoord=0;_vy_yCoord=0;_vy_firstScreenTile=null;_vy_lastScreenTile=null;_vy_scrTilesMouseEvents=[];_vy_tileContainer=null;_vy_xMap=0;_vy_yMap=0;_vy_xScr=0;_vy_yScr=0;_vy_xEye=0;_vy_yEye=0;_vy_xEyeOffset=0;_vy_yEyeOffset=0;_vy_xEdgeLimit=null;_vy_yEdgeLimit=null;_vy_hasEdgeLimit=!1;_vy_lastDisX=0;_vy_lastDisY=0;_vy_lastDisS=0;_vy_xScrExtra=0;_vy_yScrExtra=0;_vy_planes={};_vy_planesArr=[];preventAutoScale=!1;preventAutoResize=!1;onAutoZoom=null;constructor(){super()}_vy_initiate=function(t){this._vy_client=t;let e=document.createElement("div");e.classList.add("web_box"),e.classList.add("map_view"),this._vy_canvas=document.createElement("canvas"),e.appendChild(this._vy_canvas),this._vy_pane&&!this._vy_domID&&(e.id="wb_"+this._vy_pane._vy_name.replace(/ /g,"")+"_"+this._vy_name),e.style.zIndex=this._vy_plane,this._vy_dom=e,e._vy_parent=this,this._vy_renderApp=new PIXI.Application,this._vy_mapCont=new PIXI.Container,this._vy_tileContainer=new PIXI.Container,this._vy_mapCont.addChild(this._vy_tileContainer),this._vy_cacheSprite=new PIXI.Sprite,this._vy_clearCacheSprite=new PIXI.Sprite(PIXI.Texture.WHITE),this._vy_clearCacheSprite.tint=0,this._vy_setPlane(0),(async()=>{const e={backgroundAlpha:0,view:this._vy_canvas,sharedTicker:!0};if(t._vy_renderOptions)for(const r in t._vy_renderOptions)"view"!==r&&"sharedTicker"!==r&&(e[r]=t._vy_renderOptions[r]);await this._vy_renderApp.init(e),this._vy_renderer=this._vy_renderApp.renderer,this._vy_renderer.resolution=n.um.screenView.resolution,this._vy_renderApp.stage.addChild(this._vy_mapCont),this._vy_scaleWebBox(),this._vy_eyeCache&&(this.eye=this._vy_eyeCache,this._vy_eyeCache=null),PIXI.Ticker.shared.add(n.up.refreshScreenBind),PIXI.Ticker.shared.maxFPS=n.um._vy_maxFPS})(),n.up.pixiApp||(n.up.pixiApp=this._vy_renderApp),this._vy_name="map_view",this.domID="game_canvas",n.vC.gameCanvasControl=e};_vy_scaleWebBox=function(){const t=this._vy_dom;let e=this._vy_x,r=this._vy_y,i=this._vy_w??n.a$.gameWidth,s=this._vy_h??n.a$.gameHeight;if(this.preventAutoScale){if(!this.preventAutoResize){let t=this._vy_client.screenView.width,e=this._vy_client.screenView.height;this._vy_parent&&(t=this._vy_parent._vy_dom.clientWidth,e=this._vy_parent._vy_dom.clientHeight),this._vy_edgeLock&&this._vy_edgeLock.includes("right")||(i=i*(t/i)-(n.a$.gameWidth-i)),this._vy_edgeLock&&this._vy_edgeLock.includes("bottom")||(s=s*(e/s)-(n.a$.gameHeight-s))}this._vy_w||(i-=this._vy_x,this._vy_margin&&(i-=this._vy_margin._vy_left+this._vy_margin._vy_right)),this._vy_h||(s-=this._vy_y,this._vy_margin&&(s-=this._vy_margin._vy_top+this._vy_margin._vy_bottom)),t.style.width=`${i}px`,t.style.height=`${s}px`,i%2&&i++,s%2&&s++,this._vy_canvas.style.width=`${i}px`,this._vy_canvas.style.height=`${s}px`,this._vy_renderer?.resize(i,s)}else{r*=n.vC.scaleHeight,e*=n.vC.scaleWidth;let o=0,a=0;this._vy_w||(i-=this._vy_x,this._vy_margin&&(o+=this._vy_margin._vy_left+this._vy_margin._vy_right)),this._vy_h||(s-=this._vy_y,this._vy_margin&&(a+=this._vy_margin._vy_top+this._vy_margin._vy_bottom)),t.style.width=i*n.vC.scaleWidth-o+"px",t.style.height=s*n.vC.scaleHeight-a+"px",this._vy_canvas.style.width=t.style.width,this._vy_canvas.style.height=t.style.height,this._vy_renderer?.resize(i-o,s-a)}this._vy_scale&&(t.style.transformOrigin=`${100*this._vy_anchor}% ${100*this._vy_anchor}%`,t.style.transform=`scale(${this._vy_scale._vy_x}, ${this._vy_scale._vy_y})`),this._vy_setBoxPos(e,r),this._vy_eye&&this._vy_updateScreen()};_vy_updateScreen=function(){this._vy_mapWidth=this._vy_renderer.width,this._vy_mapHeight=this._vy_renderer.height;let t=1,e=1,r=1,i=1,s=this._vy_xAutoZoom,o=this._vy_yAutoZoom;if(this._vy_minView){if(this._vy_minView._vy_w&&this._vy_minView._vy_w>this._vy_mapWidth)if(this._vy_autoZoomMulti){const t=this._vy_minView._vy_w/this._vy_autoZoomMulti;r=Math.floor(this._vy_mapWidth/t)*t/this._vy_minView._vy_w,r||(r=1/this._vy_autoZoomMulti)}else r=this._vy_mapWidth/this._vy_minView._vy_w;if(this._vy_minView._vy_h&&this._vy_minView._vy_h>this._vy_mapHeight)if(this._vy_autoZoomMulti){const t=this._vy_minView._vy_h/this._vy_autoZoomMulti;i=Math.floor(this._vy_mapHeight/t)*t/this._vy_minView._vy_h,i||(i=1/this._vy_autoZoomMulti)}else i=this._vy_mapHeight/this._vy_minView._vy_h;this._vy_autoZoomMulti&&(i=r=Math.min(r,i))}if(this._vy_maxView){if(this._vy_maxView._vy_w&&this._vy_maxView._vy_w<this._vy_mapWidth)if(this._vy_autoZoomMulti){const t=this._vy_maxView._vy_w*this._vy_autoZoomMulti;r=Math.ceil(this._vy_mapWidth/t)*t/this._vy_maxView._vy_w}else r=this._vy_mapWidth/this._vy_maxView._vy_w;if(this._vy_maxView._vy_h&&this._vy_maxView._vy_h<this._vy_mapHeight)if(this._vy_autoZoomMulti){const t=this._vy_maxView._vy_h*this._vy_autoZoomMulti;i=Math.ceil(this._vy_mapHeight/t)*t/this._vy_maxView._vy_h}else i=this._vy_mapHeight/this._vy_maxView._vy_h;this._vy_autoZoomMulti&&(i=r=Math.max(r,i))}1!==r?t=this._vy_xAutoZoom=r:this._vy_xAutoZoom&&(this._vy_xAutoZoom=null),1!==i?e=this._vy_yAutoZoom=i:this._vy_yAutoZoom&&(this._vy_yAutoZoom=null),!this.onAutoZoom||s===this._vy_xAutoZoom&&o===this._vy_yAutoZoom||this.onAutoZoom(s,o),this._vy_zoom&&(t*=this._vy_zoom._vy_x,e*=this._vy_zoom._vy_y),this._vy_mapWidth/=t,this._vy_mapHeight/=e,this._vy_renderApp.stage.scale.x=t,this._vy_renderApp.stage.scale.y=e,this._vy_mapWidthHalf=this._vy_mapWidth/2,this._vy_mapHeightHalf=this._vy_mapHeight/2,n.vC.mapScaleWidth=this._vy_dom.offsetWidth/this._vy_mapWidth,n.vC.mapScaleHeight=this._vy_dom.offsetHeight/this._vy_mapHeight,this._vy_scale&&(n.vC.mapScaleWidth*=this._vy_scale._vy_x,n.vC.mapScaleHeight*=this._vy_scale._vy_y),this._vy_xMap=Math.ceil(this._vy_mapWidth/this._vy_tileW),this._vy_yMap=Math.ceil(this._vy_mapHeight/this._vy_tileH),this._vy_eye&&this._vy_updateEye(),this._vy_renderApp.render()};_vy_setMap=function(t=""){if(this._vy_clearScreen(),this._vy_map){for(let t=this._vy_map._vy_particles.length;t--;)this._vy_removeFromScreen(this._vy_map._vy_particles[t]);this._vy_map._vy_mapView=null}if(this._vy_map=o.Q.maps[t],this._vy_map||(this._vy_map=o.Q.maps[""]),this._vy_map._vy_mapView=this,this._vy_tileW=this._vy_map._vy_tileW,this._vy_tileH=this._vy_map._vy_tileH,this._vy_xScrExtra=2*this._vy_tileW,this._vy_yScrExtra=2*this._vy_tileH,n.um.preventScreenCulling)for(const t in this._vy_map._vy_tiles){const e=this._vy_map._vy_tiles[t];e&&e._vy_type&&!e._vy_preventAutoDisplay&&this._vy_addToScreen(e)}for(let t=this._vy_map._vy_particles.length;t--;)this._vy_addToScreen(this._vy_map._vy_particles[t]);this._vy_updateScreen()};_vy_updateEye=function(){this._vy_xEye=this._vy_mapWidthHalf-(this._vy_eye._vy_xOr+this._vy_eye._vy_w/2)-this._vy_xEyeOffset,this._vy_yEye=this._vy_mapHeightHalf-(this._vy_eye._vy_yOr+this._vy_eye._vy_h/2)-this._vy_yEyeOffset,this._vy_lastDisS=0,n.up.pauseDraw||this._vy_setViewFromPos(this._vy_eye._vy_x,this._vy_eye._vy_y,!0)};_vy_setViewFromPos=function(t,e,r){const i=this._vy_xScr,s=this._vy_yScr;if(this._vy_xScr=t-this._vy_xEye,this._vy_yScr=e-this._vy_yEye,this._vy_hasEdgeLimit&&(this._vy_yScr-this._vy_yEyeOffset<0-this._vy_yEdgeLimit?(this._vy_yScr=0-this._vy_yEdgeLimit,this._vy_yEyeOffset>0&&(this._vy_yScr+=this._vy_yEyeOffset),this._vy_yCoord=Math.ceil(this._vy_yScr/this._vy_tileH)):this._vy_yScr-this._vy_yEyeOffset+this._vy_mapHeight>this._vy_map._vy_height+this._vy_yEdgeLimit&&(this._vy_yScr=this._vy_map._vy_height+this._vy_yEdgeLimit-this._vy_mapHeight,this._vy_yEyeOffset<0&&(this._vy_yScr+=this._vy_yEyeOffset),this._vy_yCoord=Math.ceil(this._vy_yScr/this._vy_tileH)),this._vy_xScr-this._vy_xEyeOffset<0-this._vy_xEdgeLimit?(this._vy_xScr=0-this._vy_xEdgeLimit,this._vy_xEyeOffset>0&&(this._vy_xScr+=this._vy_xEyeOffset),this._vy_xCoord=Math.ceil(this._vy_xScr/this._vy_tileW)):this._vy_xScr-this._vy_xEyeOffset+this._vy_mapWidth>this._vy_map._vy_width+this._vy_xEdgeLimit&&(this._vy_xScr=this._vy_map._vy_width+this._vy_xEdgeLimit-this._vy_mapWidth,this._vy_xEyeOffset<0&&(this._vy_xScr+=this._vy_xEyeOffset),this._vy_xCoord=Math.ceil(this._vy_xScr/this._vy_tileW))),this._vy_xCoord=Math.floor(this._vy_xScr/this._vy_tileW)+1,this._vy_yCoord=Math.floor(this._vy_yScr/this._vy_tileH)+1,r&&!n.um.preventScreenCulling){for(let t=this._vy_planesArr.length;t--;){const e=this._vy_planesArr[t];for(let t=e._vy_planeDis.length;t--;){const r=e._vy_planeDis[t];if(r){if((!r.loc||!r._vy_loc._vy_onScr)&&r._vy_isCullable)if(!r._vy_scale||1===r.scale._vy_x&&1===r._vy_scale._vy_y){if(r._vy_x+r._vy_xIcoOff+r._vy_icoW<this._vy_xScr-this._vy_tileW&&r._vy_x+r._vy_xOr+r._vy_w<this._vy_xScr-this._vy_tileW||r._vy_x+r._vy_xIcoOff>this._vy_xScr+this._vy_mapWidth+this._vy_tileW&&r._vy_x>this._vy_xScr+this._vy_mapWidth+this._vy_tileW||r._vy_y+r._vy_yIcoOff+r._vy_icoH<this._vy_yScr-this._vy_tileH&&r._vy_y+r._vy_yOr+r._vy_h<this._vy_yScr-this._vy_tileH||r._vy_y+r._vy_yIcoOff>this._vy_yScr+this._vy_mapHeight+this._vy_tileH&&r._vy_y>this._vy_yScr+this._vy_mapHeight+this._vy_tileH){this._vy_removeFromScreen(r,1);continue}}else{let t=0,e=r._vy_icoW,n=0,i=r._vy_icoH;if(r._vy_scale._vy_x&&(t=-r._vy_icoW*(r._vy_scale._vy_x-1)*r.anchor._vy_x,e=r._vy_icoW*r._vy_scale._vy_x),r._vy_scale._vy_y&&(n=-r._vy_icoH*(r._vy_scale._vy_y-1)*r.anchor._vy_y,i=r._vy_icoH*r._vy_scale._vy_y),r._vy_x+r._vy_xIcoOff+t+e<this._vy_xScr-this._vy_tileW&&r._vy_x+r._vy_xOr+r._vy_w<this._vy_xScr-this._vy_tileW||r._vy_x+r._vy_xIcoOff+t>this._vy_xScr+this._vy_mapWidth+this._vy_tileW&&r._vy_x>this._vy_xScr+this._vy_mapWidth+this._vy_tileW||r._vy_y+r._vy_yIcoOff+n+i<this._vy_yScr-this._vy_tileH&&r._vy_y+r._vy_yOr+r._vy_h<this._vy_yScr-this._vy_tileH||r._vy_y+r._vy_yIcoOff+n>this._vy_yScr+this._vy_mapHeight+this._vy_tileH&&r._vy_y>this._vy_yScr+this._vy_mapHeight+this._vy_tileH){this._vy_removeFromScreen(r,1);continue}}}else e._vy_planeDis.splice(t,1)}}const t=this._vy_map._vy_tiles,e=Math.abs(this._vy_lastDisY-this._vy_yCoord),r=Math.abs(this._vy_lastDisX-this._vy_xCoord);if(!this._vy_lastDisS||r>this._vy_xMap||e>this._vy_yMap){let e=this._vy_firstScreenTile;for(;e;){const t=e._vy_scrNext;(e._vy_x+this._vy_tileW+this._vy_xScrExtra<this._vy_xScr||e._vy_x>this._vy_xScr+this._vy_mapWidth+this._vy_xScrExtra||e._vy_y+this._vy_tileH+this._vy_yScrExtra<this._vy_yScr||e._vy_y>this._vy_yScr+this._vy_mapHeight+this._vy_yScrExtra)&&this._vy_removeFromScreen(e,1),e=t}for(let e=Math.max(this._vy_yCoord-1,1),r=Math.min(this._vy_yCoord+this._vy_yMap+1,this._vy_map._vy_yMax);e<=r;e++)for(let r=Math.max(this._vy_xCoord-1,1),n=Math.min(this._vy_xCoord+this._vy_xMap+1,this._vy_map._vy_xMax);r<=n;r++)this._vy_addToScreen(t[r+this._vy_map._vy_xMax*e]);this._vy_lastDisX=this._vy_xCoord,this._vy_lastDisY=this._vy_yCoord,this._vy_lastDisS=1}else{if(r){for(let e=Math.max(this._vy_yCoord-1,1),n=Math.min(this._vy_yCoord+this._vy_yMap+1,this._vy_map._vy_yMax);e<=n;e++){for(let n=this._vy_lastDisX<this._vy_xCoord?Math.max(this._vy_lastDisX-1-1,1):Math.min(this._vy_xCoord+this._vy_xMap+1+1,this._vy_map._vy_xMax),i=n+r;n<=i;n++){const r=t[n+this._vy_map._vy_xMax*e];r&&(r._vy_x+this._vy_tileW+this._vy_xScrExtra<this._vy_xScr||r._vy_x>this._vy_xScr+this._vy_mapWidth+this._vy_xScrExtra||r._vy_y+this._vy_tileH+this._vy_yScrExtra<this._vy_yScr||r._vy_y>this._vy_yScr+this._vy_mapHeight+this._vy_yScrExtra)&&this._vy_removeFromScreen(r,1)}for(let n=this._vy_lastDisX>this._vy_xCoord?Math.max(this._vy_xCoord-1,1):Math.min(this._vy_lastDisX+this._vy_xMap+1,this._vy_map._vy_xMax),i=n+r;n<=i;n++)this._vy_addToScreen(t[n+this._vy_map._vy_xMax*e])}this._vy_lastDisX=this._vy_xCoord}if(e){for(let r=this._vy_lastDisY<this._vy_yCoord?Math.max(this._vy_lastDisY-1-1,1):Math.min(this._vy_yCoord+this._vy_yMap+1+1,this._vy_map._vy_yMax),n=r+e;r<=n;r++)for(let e=Math.max(this._vy_xCoord-1,1),n=Math.min(this._vy_xCoord+this._vy_xMap+1,this._vy_map._vy_xMax);e<=n;e++){const n=t[e+this._vy_map._vy_xMax*r];n&&(n._vy_x+this._vy_tileW+this._vy_xScrExtra<this._vy_xScr||n._vy_x>this._vy_xScr+this._vy_mapWidth+this._vy_xScrExtra||n._vy_y+this._vy_tileH+this._vy_yScrExtra<this._vy_yScr||n._vy_y>this._vy_yScr+this._vy_mapHeight+this._vy_yScrExtra)&&this._vy_removeFromScreen(n,1)}for(let r=this._vy_lastDisY>this._vy_yCoord?Math.max(1,this._vy_yCoord-1):Math.min(this._vy_lastDisY+this._vy_yMap+1,this._vy_map._vy_yMax),n=r+e;r<=n;r++)for(let e=Math.max(this._vy_xCoord-1,1),n=Math.min(this._vy_xCoord+this._vy_xMap+1,this._vy_map._vy_xMax);e<=n;e++)this._vy_addToScreen(t[e+this._vy_map._vy_xMax*r]);this._vy_lastDisY=this._vy_yCoord}}}if(this._vy_mapCont.position.set(-this._vy_xScr,-this._vy_yScr),n.um._vy_over.length)for(let t=n.um._vy_over.length;t--;)n.um._vy_over[t]._vy_updateScreenSpritePos();!n.um.onScreenMoved||this._vy_xScr===i&&this._vy_yScr===s||n.um.onScreenMoved?.(this._vy_xScr,this._vy_yScr,i,s)};_vy_addToScreen=function(t,e,r){if(t&&!t._vy_onScr)if(t._vy_invisibility&&n.um._vy_playerMob&&n.um._vy_playerMob._vy_visibility<t._vy_invisibility&&!t._vy_viewers?.includes(n.um._vy_playerMob)){if(t._vy_isLoc&&t._vy_conts)for(let e=t._vy_conts.length;e--;)this._vy_addToScreen(t._vy_conts[e])}else{if(t._vy_onScr=this,t._vy_atlas?t._vy_ico||t._vy_setIconCheck():t._vy_text&&t._vy_setIconSize(),t._vy_recheckState&&o.Q.loadedAtlases.hasOwnProperty(t._vy_atlas)&&!o.Q.loadedAtlases[t._vy_atlas].loading&&t._vy_setIconState(t._vy_recheckState,t._vy_recheckStateM,0,!0),t._vy_isLoc){t._vy_anim&&(t._vy_ico&&t._vy_ico._vy_parent._vy_frames||t._vy_anim.playAnim)&&n.up.addScreenAnimation(t);const e=t._vy_chunk;if(e&&(e._vy_onScr||(e._vy_onScr=this,e._vy_pixS||n.um.preventTilemapRender||(e._vy_pixS=new PIXI.Sprite,e._vy_pixS.position.set((e.xC-1)*e.map._vy_tileW,(e.yC-1)*e.map._vy_tileH),e._vy_pixS.texture=PIXI.RenderTexture.create({width:(e.wC+1)*e.map._vy_tileW,height:(e.hC+1)*e.map._vy_tileH})),e._vy_pixS&&this._vy_tileContainer.addChild(e._vy_pixS),n.vC.serSocket&&this._vy_addViewChunk(e)),t._vy_onChunkScr||(t._vy_onChunkScr=!0,this._vy_cacheChunk(t,e))),this._vy_firstScreenTile||(this._vy_firstScreenTile=t),this._vy_lastScreenTile&&(this._vy_lastScreenTile._vy_scrNext=t,t._vy_scrPrev=this._vy_lastScreenTile),this._vy_lastScreenTile=t,t._vy_conts)for(let e=t._vy_conts.length;e--;)this._vy_addToScreen(t._vy_conts[e]);t._vy_region&&t._vy_region._vy_ico&&(t._vy_regionI||(t._vy_regionI=s.P.createObject("Diob"),t._vy_regionI._vy_mapN=t._vy_mapN,t._vy_regionI._vy_loc=t,t._vy_regionI._vy_x=t._vy_x,t._vy_regionI._vy_y=t._vy_y),t._vy_regionI.setAppearance(t._vy_region),this._vy_addToScreen(t._vy_regionI)),t._vy_mouseOp&&this._vy_scrTilesMouseEvents.push(t)}else t._vy_setScreenSprite(),t._vy_updateScreenSprite(),this._vy_setDisplayOrder(t,r),t._vy_anim&&(t._vy_ico&&t._vy_ico._vy_parent._vy_frames||t._vy_anim.playAnim)&&n.up.addScreenAnimation(t);if(t._vy_over)for(let i=t._vy_over.length;i--;){const s=t._vy_over[i];s._vy_appMask?(s._vy_onScr=t._vy_onScr,!s._vy_ico&&s._vy_atlas&&s._vy_setIconCheck(t),t._vy_isLoc||(s._vy_setScreenSprite(),s._vy_updateScreenSprite()),s._vy_appMask.ownAnim?s._vy_anim&&(s._vy_ico&&s._vy_ico._vy_parent._vy_frames||s._vy_anim.playAnim)&&n.up.addScreenAnimation(s):t._vy_onScrAnim&&(s._vy_onScrAnim=!0)):this._vy_addToScreen(s,e,r)}t._vy_recacheChunk&&(t._vy_recacheChunk=!1,this._vy_cacheChunk(t,t._vy_chunk)),t.onScreenShow&&!e&&t.onScreenShow(n.um)}};_vy_removeFromScreen=function(t,e,r,i){if(t._vy_onScr){if(t._vy_onScr=null,t.onScreenHide&&!i&&t.onScreenHide(n.um),t._vy_isLoc){t._vy_onScrAnim&&n.up.removeScreenSprite(t,this._vy_tileContainer);const s=t._vy_chunk;if(s&&s._vy_onScr&&((s.xC+s.wC+1)*this._vy_tileW<this._vy_xScr-this._vy_tileW||(s.xC-1)*this._vy_tileW>this._vy_xScr+this._vy_mapWidth+this._vy_tileW||(s.yC+s.hC+1)*this._vy_tileH<this._vy_yScr-this._vy_tileH||(s.yC-1)*this._vy_tileH>this._vy_yScr+this._vy_mapHeight+this._vy_tileH)&&(s._vy_onScr=null,s._vy_pixS&&this._vy_tileContainer.removeChild(s._vy_pixS),n.vC.serSocket&&this._vy_removeViewChunk(s)),t._vy_scrPrev?t._vy_scrPrev._vy_scrNext=t._vy_scrNext:this._vy_firstScreenTile===t&&(this._vy_firstScreenTile=t._vy_scrNext),t._vy_scrNext?t._vy_scrNext._vy_scrPrev=t._vy_scrPrev:this._vy_lastScreenTile===t&&(this._vy_lastScreenTile=t._vy_scrPrev),t._vy_scrPrev=null,t._vy_scrNext=null,!e&&t._vy_conts)for(let n=t._vy_conts.length;n--;){const s=t._vy_conts[n];if(s){if(!r&&s._vy_locs.length>1){let t=!1;for(let e=s._vy_locs.length;e--;)if(s._vy_locs[e]._vy_onScr){t=!0;break}if(t)continue}this._vy_removeFromScreen(s,e,r,i)}}if(t._vy_regionI&&this._vy_removeFromScreen(t._vy_regionI,e,r,i),t._vy_mouseOp){const e=this._vy_scrTilesMouseEvents.indexOf(t);-1!==e&&this._vy_scrTilesMouseEvents.splice(e,1)}}else if(this._vy_clearDisplayOrder(t),t._vy_onScrRelayer){const e=n.up.relayerRefresh.indexOf(t);-1!==e&&n.up.relayerRefresh.splice(e,1),t._vy_onScrRelayer=!1}if(t._vy_over)for(let s=t._vy_over.length;s--;){const o=t._vy_over[s];if(o._vy_appMask){if(o._vy_onScr=null,o._vy_onScrAnim){if(o._vy_appMask.ownAnim){const t=n.up.screenAnimations.indexOf(o);-1!==t&&n.up.screenAnimations.splice(t,1)}o._vy_onScrAnim=!1}}else this._vy_removeFromScreen(o,e,r,i)}if(t._vy_onScrAnim){t._vy_onScrAnim=!1;const e=n.up.screenAnimations.indexOf(t);-1!==e&&n.up.screenAnimations.splice(e,1)}}};_vy_readdToScreen=function(t,e){if(t._vy_onScr&&!t._vy_isLoc&&(this._vy_clearDisplayOrder(t),this._vy_setDisplayOrder(t,!0),t._vy_over&&!e))for(let e=t._vy_over.length;e--;){const r=t._vy_over[e];r._vy_onScr&&!r._vy_appMask&&(this._vy_clearDisplayOrder(r),this._vy_setDisplayOrder(r,!0))}};_vy_clearScreen=function(t){for(let t=this._vy_planesArr.length;t--;){const e=this._vy_planesArr[t];for(let t=e._vy_planeDis.length;t--;){const r=e._vy_planeDis[t];r?this._vy_removeFromScreen(r,null,!0):e._vy_planeDis.splice(t,1)}}let e=this._vy_firstScreenTile;for(;e;){const t=e._vy_scrNext;this._vy_removeFromScreen(e,!0,!0),e=t}if(this._vy_firstScreenTile=null,this._vy_lastScreenTile=null,this._vy_map?._vy_chunks)for(let t=this._vy_map._vy_chunks.length;t--;){const e=this._vy_map._vy_chunks[t];e&&e._vy_onScr&&(e._vy_onScr=null,this._vy_tileContainer.removeChild(e._vy_pixS),n.vC.serSocket&&this._vy_removeViewChunk(e))}if(!t&&n.um._vy_over)for(const t of n.um._vy_over)this._vy_addToScreen(t)};_vy_setDisplayOrder=function(t,e){if(!e&&t._vy_anim&&t._vy_anim.lastCheck&&!t._vy_anim.sync){let e=performance.now()-t._vy_anim.lastCheck;t._vy_ico&&t._vy_ico._vy_parent._vy_frames&&e>t._vy_ico._vy_parent._vy_frames.length*t._vy_anim.delay&&(e-=Math.floor(e/(t._vy_ico._vy_parent._vy_frames.length*t._vy_anim.delay))*(t._vy_ico._vy_parent._vy_frames.length*t._vy_anim.delay)),t._vy_anim.lastCheck=performance.now(),t._vy_anim.timer=e}let r=this._vy_planes[t._vy_plane];r||(r=n.um._vy_mapView._vy_setPlane(t._vy_plane));const i=t._vy_isOverlay?t._vy_isOverlay:t;if(!t._vy_isParticle){if(t._vy_mouseOp&&!r._vy_mouseEventDiobs.includes(t)){let e=!1;for(let n=0,s=r._vy_mouseEventDiobs.length;n<s;n++){const s=r._vy_mouseEventDiobs[n];if(s._vy_layer>=t._vy_layer&&(s._vy_layer!==t._vy_layer||i._vy_y+i._vy_rrelayerH+i._vy_yIcoOff<=s._vy_y+s._vy_rrelayerH+s._vy_yIcoOff)){r._vy_mouseEventDiobs.splice(n,0,t),e=!0;break}}e||r._vy_mouseEventDiobs.push(t)}if(t._vy_isOverlay&&t._vy_layer===t._vy_isOverlay._vy_layer){let e=r._vy_planeDis.indexOf(t._vy_isOverlay);if(-1!==e)return e<r._vy_planeDis.length-1?r._vy_planeDis.splice(e+1,0,t):r._vy_planeDis.push(t),e=t._vy_isOverlay._vy_overApp?.length?r._vy_pixS.children.indexOf(t._vy_isOverlay._vy_overApp[t._vy_isOverlay._vy_overApp.length-1]):r._vy_pixS.children.indexOf(t._vy_isOverlay._vy_pixS),void n.up.addScreenSprite(t,r._vy_pixS,e+1)}for(let e=0,s=r._vy_planeDis.length;e<s;e++){const s=r._vy_planeDis[e];if(s._vy_layer>=t._vy_layer&&(s._vy_layer!==t._vy_layer||i._vy_y+i._vy_rrelayerH+i._vy_yIcoOff<=s._vy_y+s._vy_rrelayerH+s._vy_yIcoOff))return r._vy_planeDis.splice(e,0,t),void n.up.addScreenSprite(t,r._vy_pixS,s._vy_underApp?.length?r._vy_pixS.children.indexOf(s._vy_underApp[0]._vy_pixS):r._vy_pixS.children.indexOf(s._vy_pixS))}}r._vy_planeDis.push(t),n.up.addScreenSprite(t,r._vy_pixS)};_vy_clearDisplayOrder=function(t){const e=this._vy_planes[t._vy_plane];if(!e)return;let r=e._vy_planeDis.indexOf(t);-1!==r&&e._vy_planeDis.splice(r,1),n.up.removeScreenSprite(t,e._vy_pixS),t._vy_mouseOp&&(r=e._vy_mouseEventDiobs.indexOf(t),-1!==r&&e._vy_mouseEventDiobs.splice(r,1))};_vy_addViewChunk=function(t){this._vy_viewChunks.includes(t)||(this._vy_viewChunks.push(t),n.vC.serSocket.sendPacket([6,t.map._vy_mapN,t.i]),n.um.onChunkShow?.(t))};_vy_removeViewChunk=function(t){const e=this._vy_viewChunks.indexOf(t);-1!==e&&(this._vy_viewChunks.splice(e,1),n.vC.serSocket.sendPacket([7,t.map._vy_mapN,t.i]),n.um.onChunkHide?.(t))};_vy_cacheChunk=function(t,e){if(e&&!n.um.preventTilemapRender){if(this._vy_removeCacheChunk(t,e),t._vy_underApp?.length)for(const r of t._vy_underApp)r._vy_ico&&(this._vy_cacheSprite.texture=r._vy_ico._vy_texture,this._vy_cacheSprite.position.set(t._vy_x-(e.xC-1)*e.map._vy_tileW,t._vy_y-(e.yC-1)*e.map._vy_tileH),this._vy_renderer.render({container:this._vy_cacheSprite,target:e._vy_pixS.texture,clear:!1}));if(t._vy_ico&&(this._vy_cacheSprite.texture=t._vy_ico._vy_texture,this._vy_cacheSprite.position.set(t._vy_x-(e.xC-1)*e.map._vy_tileW,t._vy_y-(e.yC-1)*e.map._vy_tileH),this._vy_renderer.render({container:this._vy_cacheSprite,target:e._vy_pixS.texture,clear:!1})),t._vy_overApp?.length)for(const r of t._vy_overApp)r._vy_ico&&(this._vy_cacheSprite.texture=r._vy_ico._vy_texture,this._vy_cacheSprite.position.set(t._vy_x-(e.xC-1)*e.map._vy_tileW,t._vy_y-(e.yC-1)*e.map._vy_tileH),this._vy_renderer.render({container:this._vy_cacheSprite,target:e._vy_pixS.texture,clear:!1}))}};_vy_removeCacheChunk=function(t,e){this._vy_clearCacheSprite.width=e.map._vy_tileW,this._vy_clearCacheSprite.height=e.map._vy_tileH,this._vy_clearCacheSprite.position.set(t._vy_x-(e.xC-1)*e.map._vy_tileW,t._vy_y-(e.yC-1)*e.map._vy_tileH),this._vy_renderer.render({container:this._vy_clearCacheSprite,target:e._vy_pixS.texture,clear:!1})};_vy_findMouseOver=function(t,e){let r=this._vy_dom.offsetLeft,i=this._vy_dom.offsetTop;this._vy_parent&&(r+=this._vy_parent._vy_dom.offsetLeft,i+=this._vy_parent._vy_dom.offsetTop);const s=(t-r)/n.vC.mapScaleWidth+this._vy_xScr,o=(e-i)/n.vC.mapScaleHeight+this._vy_yScr;n.um._vy_mouseEvent.dX=s,n.um._vy_mouseEvent.dY=o;for(let t=this._vy_planesArr.length;t--;){const e=this._vy_planesArr[t];for(let t=e._vy_mouseEventDiobs.length;t--;){const r=e._vy_mouseEventDiobs[t];if(r._vy_mouseOp>0){let t=r._vy_isOverlay?r._vy_isOverlay:r,e=r._vy_isOverlay?r._vy_x:0,n=r._vy_isOverlay?r._vy_y:0,i=r._vy_w,a=r._vy_h;if(1===r._vy_mouseOp?(i=r._vy_ico?r._vy_icoW:0,a=r._vy_ico?r._vy_icoH:0,e=t._vy_x+e+r._vy_xIcoOff,n=t._vy_y+n+r._vy_yIcoOff):(e=t._vy_x+t._vy_xOr+e,n=t._vy_y+t._vy_yOr+n),e<=s&&e+i>=s&&n<=o&&n+a>=o)return r}}}for(const r of this._vy_scrTilesMouseEvents)if((r._vy_x-this._vy_xScr)*n.vC.mapScaleWidth<=t&&(r._vy_x-this._vy_xScr+this._vy_tileW)*n.vC.mapScaleWidth>t&&(r._vy_y-this._vy_yScr)*n.vC.mapScaleHeight<=e&&(r._vy_y-this._vy_yScr+this._vy_tileH)*n.vC.mapScaleHeight>e)return r};_vy_setPlane=function(t){if(!this._vy_planes[t]&&this._vy_renderApp){this._vy_planes[t]=1;const e=s.P.createDiob("Diob");e._vy_isPlane=!0,e._vy_plane=t,e._vy_planeDis=[],e._vy_mouseEventDiobs=[];let r=this._vy_planesArr.length;for(let e=0,n=r;e<n;e++){if(this._vy_planesArr[e]._vy_plane>t){r=e;break}}return r===this._vy_planesArr.length?this._vy_planesArr.push(e):this._vy_planesArr.splice(r,0,e),this._vy_planes[t]=e,e._vy_pixS=new PIXI.Container,e._vy_setScreenSprite(),this._vy_mapCont.addChildAt(e._vy_pixS,r+1),e}};get isMapView(){return!0}set isMapView(t){}get eye(){return this._vy_eye}set eye(t){if(!this._vy_renderer)return void(this._vy_eyeCache=t);const e=this._vy_eye;this._vy_eye&&delete this._vy_eye._vy_isViewEye,this._vy_eye=t,t?(t._vy_isViewEye=this,this._vy_xEye=this._vy_mapWidthHalf-(t._vy_xOr+t._vy_w/2)-this._vy_xEyeOffset,this._vy_yEye=this._vy_mapHeightHalf-(t._vy_yOr+t._vy_h/2)-this._vy_yEyeOffset,e&&t._vy_mapN===e._vy_mapN||this._vy_setMap(t._vy_mapN),t._vy_map&&this._vy_setViewFromPos(t._vy_x,t._vy_y,!0)):this._vy_setMap()}setEyeOffsets=function(t,e){this._vy_xEyeOffset=t,this._vy_yEyeOffset=e,this._vy_eye&&this._vy_updateEye()};get xEyeOffset(){return this._vy_xEyeOffset}set xEyeOffset(t){this.setEyeOffsets(t,this._vy_yEyeOffset)}get yEyeOffset(){return this._vy_yEyeOffset}set yEyeOffset(t){this.setEyeOffsets(this._vy_xEyeOffset,t)}get xView(){return this._vy_xScr}set xView(t){}get yView(){return this._vy_yScr}set yView(t){}setEdgeLimit=function(t,e){this._vy_xEdgeLimit=t,this._vy_yEdgeLimit=e,!this._vy_xEdgeLimit&&0!==this._vy_xEdgeLimit||!this._vy_yEdgeLimit&&0!==this._vy_yEdgeLimit?this._vy_hasEdgeLimit=!1:this._vy_hasEdgeLimit=!0,this._vy_eye&&this._vy_setViewFromPos(this._vy_eye._vy_x,this._vy_eye._vy_y)};get xEdgeLimit(){return this._vy_xEdgeLimit}set xEdgeLimit(t){this.setEdgeLimit(t,this._vy_yEdgeLimit)}get yEdgeLimit(){return this._vy_yEdgeLimit}set yEdgeLimit(t){this.setEdgeLimit(this._vy_xEdgeLimit,t)}setZoom=function(t,e){this._vy_zoom?._vy_isMapViewZoom||(this._vy_zoom=new l(this,this._vy_zoom)),this._vy_minZoom&&(this._vy_minZoom._vy_x&&(t=Math.max(t,this._vy_minZoom._vy_x)),this._vy_minZoom._vy_y&&(e=Math.max(e,this._vy_minZoom._vy_y))),this._vy_maxZoom&&(this._vy_maxZoom._vy_x&&(t=Math.min(t,this._vy_maxZoom._vy_x)),this._vy_maxZoom._vy_y&&(e=Math.min(e,this._vy_maxZoom._vy_y))),this._vy_zoom._vy_x=t,this._vy_zoom._vy_y=e,this._vy_eye&&this._vy_updateScreen()};get zoom(){return this._vy_zoom?._vy_isMapViewZoom||(this._vy_zoom=new l(this,this._vy_zoom)),this._vy_zoom}set zoom(t){if(n.j3.Util.isObject(t)){if(t._vy_isMapViewZoom&&t._vy_parent===this)return;this._vy_zoom=new l(this);for(const e in t)this._vy_zoom[e]=t[e]}else this.setZoom(t,t)}setMaxZoom=function(t,e){this._vy_maxZoom?._vy_isMapViewMaxZoom||(this._vy_maxZoom=new _(this,this._vy_maxZoom)),this._vy_maxZoom._vy_x=t,this._vy_maxZoom._vy_y=e,this._vy_zoom||this.setZoom(1,1),this._vy_zoom._vy_isMapViewZoom?this.setZoom(this._vy_zoom._vy_x,this._vy_zoom._vy_y):this.zoom=this._vy_zoom};get maxZoom(){return this._vy_maxZoom?._vy_isMapViewMaxZoom||(this._vy_maxZoom=new _(this,this._vy_maxZoom)),this._vy_maxZoom}set maxZoom(t){if(n.j3.Util.isObject(t)){if(t._vy_isMapViewMaxZoom&&t._vy_parent===this)return;this._vy_maxZoom=new _(this);for(const e in t)this._vy_maxZoom[e]=t[e]}else this.setMaxZoom(t,t)}setMinZoom=function(t,e){this._vy_minZoom?._vy_isMapViewMinZoom||(this._vy_minZoom=new u(this,this._vy_minZoom)),this._vy_minZoom._vy_x=t,this._vy_minZoom._vy_y=e,this._vy_zoom||this.setZoom(1,1),this._vy_zoom._vy_isMapViewZoom?this.setZoom(this._vy_zoom._vy_x,this._vy_zoom._vy_y):this.zoom=this._vy_zoom};get minZoom(){return this._vy_minZoom?._vy_isMapViewMinZoom||(this._vy_minZoom=new u(this,this._vy_minZoom)),this._vy_minZoom}set minZoom(t){if(n.j3.Util.isObject(t)){if(t._vy_isMapViewMinZoom&&t._vy_parent===this)return;this._vy_minZoom=new u(this);for(const e in t)this._vy_minZoom[e]=t[e]}else this.setMinZoom(t,t)}setMaxView=function(t,e){this._vy_maxView?._vy_isMapViewMaxView||(this._vy_maxView=new c(this,this._vy_maxView)),this._vy_maxView._vy_w=t,this._vy_maxView._vy_h=e,this._vy_eye&&this._vy_updateScreen()};get maxView(){return this._vy_maxView?._vy_isMapViewMaxView||(this._vy_maxView=new c(this,this._vy_maxView)),this._vy_maxView}set maxView(t){if(n.j3.Util.isObject(t)){if(t._vy_isMapViewMaxView&&t._vy_parent===this)return;this._vy_maxView=new c(this);for(const e in t)this._vy_maxView[e]=t[e]}else this.setMaxView(t,t)}setMinView=function(t,e){this._vy_minView?._vy_isMapViewMinView||(this._vy_minView=new h(this,this._vy_minView)),this._vy_minView._vy_w=t,this._vy_minView._vy_h=e,this._vy_eye&&this._vy_updateScreen()};get minView(){return this._vy_minView?._vy_isMapViewMinView||(this._vy_minView=new h(this,this._vy_minView)),this._vy_minView}set minView(t){if(n.j3.Util.isObject(t)){if(t._vy_isMapViewMinView&&t._vy_parent===this)return;this._vy_minView=new h(this);for(const e in t)this._vy_minView[e]=t[e]}else this.setMinView(t,t)}get autoZoomMulti(){return this._vy_autoZoomMulti}set autoZoomMulti(t){this._vy_autoZoomMulti=t,this._vy_eye&&this._vy_updateScreen()}get xAutoZoom(){return this._vy_xAutoZoom||1}set xAutoZoom(t){}get yAutoZoom(){return this._vy_yAutoZoom||1}set yAutoZoom(t){}get padding(){return this._vy_padding?._vy_isWebBoxPaddingSty||(this._vy_padding=new d(this)),this._vy_padding}set padding(t){this._vy_padding?._vy_isWebBoxPaddingSty||(this._vy_padding=new d(this)),this._vy_padding.setStyle(t,!0)}get renderApp(){return this._vy_renderApp}set renderApp(t){}getMapPosXFromScreen=function(t){return(t*n.vC.scaleWidth-this._vy_dom.offsetLeft)/n.vC.mapScaleWidth+this._vy_xScr};getMapPosYFromScreen=function(t){return(t*n.vC.scaleHeight-this._vy_dom.offsetTop)/n.vC.mapScaleHeight+this._vy_yScr};getDiobs=function(t,e,r){const n=[];for(let r=0,i=this._vy_planesArr.length;r<i;r++){const i=this._vy_planesArr[r];for(let r=i._vy_planeDis.length;r--;){const o=i._vy_planeDis[r];t&&!s.P.isType(o._vy_type,t,e)||n.push(o)}}if(r){let r=this._vy_firstScreenTile;for(;r;){const i=r._vy_scrNext;t&&!s.P.isType(r._vy_type,t,e)||n.push(r),t&&!s.P.isType(r._vy_region._vy_type,t,e)||n.includes(r._vy_region)||n.push(r._vy_region),r=i}}return n}}class l{_vy_isMapViewZoom=!0;_vy_x=1;_vy_y=1;_vy_parent=null;constructor(t,e){this._vy_parent=t,e&&(this._vy_x=e,this._vy_y=e)}get isMapViewZoom(){return!0}set isMapViewZoom(t){}get x(){return this._vy_x}set x(t){this._vy_parent.setZoom(t,this._vy_y)}get y(){return this._vy_y}set y(t){this._vy_parent.setZoom(this._vy_x,t)}}class _{_vy_isMapViewMaxZoom=!0;_vy_x=null;_vy_y=null;_vy_parent=null;constructor(t,e){this._vy_parent=t,e&&(this._vy_x=e,this._vy_y=e)}get isMapViewMaxZoom(){return!0}set isMapViewMaxZoom(t){}get x(){return this._vy_x}set x(t){this._vy_parent.setMaxZoom(t,this._vy_y)}get y(){return this._vy_y}set y(t){this._vy_parent.setMaxZoom(this._vy_x,t)}}class u{_vy_isMapViewMinZoom=!0;_vy_x=null;_vy_y=null;_vy_parent=null;constructor(t,e){this._vy_parent=t,e&&(this._vy_x=e,this._vy_y=e)}get isMapViewMinZoom(){return!0}set isMapViewMinZoom(t){}get x(){return this._vy_x}set x(t){this._vy_parent.setMinZoom(t,this._vy_y)}get y(){return this._vy_y}set y(t){this._vy_parent.setMinZoom(this._vy_x,t)}}class c{_vy_isMapViewMaxView=!0;_vy_w=null;_vy_h=null;_vy_parent=null;constructor(t,e){this._vy_parent=t,e&&(this._vy_w=e,this._vy_h=e)}get isMapViewMaxView(){return!0}set isMapViewMaxView(t){}get width(){return this._vy_w}set width(t){this._vy_parent.setMaxView(t,this._vy_h)}get height(){return this._vy_h}set height(t){this._vy_parent.setMaxView(this._vy_w,t)}}class h{_vy_isMapViewMinView=!0;_vy_w=null;_vy_h=null;_vy_parent=null;constructor(t,e){this._vy_parent=t,e&&(this._vy_w=pMaxView,this._vy_h=pMaxView)}get isMapViewMinView(){return!0}set isMapViewMinView(t){}get width(){return this._vy_w}set width(t){this._vy_parent.setMinView(t,this._vy_h)}get height(){return this._vy_h}set height(t){this._vy_parent.setMinView(this._vy_w,t)}}class d{_vy_isMapViewPaddingSty=!0;_vy_parent=null;_vy_parentSty=null;_vy_top=0;_vy_left=0;_vy_right=0;_vy_bottom=0;constructor(t){this._vy_parent=t,this._vy_parentSty=t._vy_dom.style}_vy_setAll=function(t,e,r,n){this.top=t,this.left=n??e??t,this.right=e??t,this.bottom=r??t};setStyle=function(t,e){if(n.j3.Util.isObject(t)){if(t===this)return;e&&(this._vy_parentSty.paddingTop&&(this.top=0),this._vy_parentSty.paddingLeft&&(this.left=0),this._vy_parentSty.paddingBottom&&(this.bottom=0),this._vy_parentSty.paddingRight&&(this.right=0));for(const e in t)t.hasOwnProperty(e)&&(this[e]=t[e])}else n.j3.Util.isString(t)?this._vy_setAll(...t.split(" ")):n.j3.Util.isNumber(t)&&this._vy_setAll(t)};get top(){return this._vy_top}set top(t){"string"==typeof t?t.endsWith("px")&&(this._vy_top=parseFloat(t.slice(0,-2))):this._vy_top=t}get left(){return this._vy_left}set left(t){"string"==typeof t?t.endsWith("px")&&(this._vy_left=parseFloat(t.slice(0,-2))):this._vy_left=t}get right(){return this._vy_right}set right(t){"string"==typeof t?t.endsWith("px")&&(this._vy_right=parseFloat(t.slice(0,-2))):this._vy_right=t}get bottom(){return this._vy_bottom}set bottom(t){"string"==typeof t?t.endsWith("px")&&(this._vy_bottom=parseFloat(t.slice(0,-2))):this._vy_bottom=t}}},725:(t,e,r)=>{"use strict";r.d(e,{U:()=>a});var n=r(518),i=r(868),s=r(428),o=r(27);class a extends o.K{_vy_isWebBox=!0;_vy_plane=1;_vy_w=null;_vy_h=null;_vy_dom=null;_vy_domID=null;_vy_display=null;_vy_boxShadow=null;_vy_boxSizing=null;_vy_clip=null;_vy_cursor=null;_vy_maxHeight=null;_vy_minHeight=null;_vy_maxWidth=null;_vy_minWidth=null;_vy_padding=null;_vy_margin=null;_vy_overflow=null;_vy_float=null;_vy_style=null;_vy_styleClass=null;_vy_isDraggable=!1;_vy_isResizable=!1;_vy_dragEvent=null;_vy_resizeOb=null;_vy_parent=null;_vy_children=null;preventAutoScale=!0;constructor(){super()}_vy_initiate=function(){let t=document.createElement("div");if(t.className="web_box",this._vy_pane&&!this._vy_domID&&(t.id="wb_"+this._vy_pane._vy_name.replace(/ /g,"")+"_"+this._vy_name),this._vy_text)if(this._vy_outputs){let e="";for(let t=0,r=this._vy_outputs.length;t<r;t++)e+='<div class="web_box_div" style="margin-bottom: '+(this._vy_textSty&&this._vy_textSty.lineSpace?this._vy_textSty.lineSpace:n.up.defaultText.lineSpace)+'px">'+n.vC.getWebText(this._vy_outputs[t])+"</div>";t.innerHTML=e,this._vy_outputs=null}else t.innerHTML=n.vC.getWebText(this._vy_text);this._vy_atlas&&!t.style.backgroundRepeat&&(t.style.backgroundRepeat="no-repeat"),!this._vy_xIcoOff&&!this._vy_yIcoOff||t.style.backgroundPosition||(t.style.backgroundPosition=`${this._vy_xIcoOff}px ${this._vy_yIcoOff}px`),t.style.zIndex=this._vy_plane,this._vy_dom=t,t._vy_parent=this};_vy_scaleWebBox=function(){const t=this._vy_dom;let e=this._vy_x,r=this._vy_y;this.preventAutoScale?this._vy_scale&&(this._vy_anchor?t.style.transformOrigin=`${100*this._vy_anchor._vy_x}% ${100*this._vy_anchor._vy_y}%`:t.style.transformOrigin="0% 0%",t.style.transform=`scale(${this._vy_scale._vy_x}, ${this._vy_scale._vy_y})`):(r*=n.vC.scaleHeight,e*=n.vC.scaleWidth,this._vy_anchor?t.style.transformOrigin=`${100*this._vy_anchor._vy_x}% ${100*this._vy_anchor._vy_y}%`:t.style.transformOrigin="0% 0%",this._vy_scale?t.style.transform=`scale(${n.vC.scaleWidth+this._vy_scale._vy_x}, ${n.vC.scaleHeight+this._vy_scale._vy_y})`:t.style.transform=`scale(${n.vC.scaleWidth}, ${n.vC.scaleHeight})`),this._vy_setBoxPos(e,r)};_vy_setBoxPos=function(t,e){const r=this._vy_dom;this._vy_edgeLock?(this._vy_edgeLock.includes("bottom")?(r.style.bottom=`${e}px`,r.style.top="initial"):(r.style.top=`${e}px`,r.style.bottom="initial"),this._vy_edgeLock.includes("right")?(r.style.right=`${t}px`,r.style.left="initial"):(r.style.left=`${t}px`,r.style.right="initial")):(r.style.top=`${e}px`,r.style.left=`${t}px`,r.style.bottom="initial",r.style.right="initial")};_vy_makeDraggable=function(){let t=0,e=0,r=0,n=0,i=this,s=this._vy_dom;function o(o){o=o||window.event,t=r-o.clientX,e=n-o.clientY,r=o.clientX,n=o.clientY,i.setPos(s.offsetLeft-t,s.offsetTop-e)}function a(){document.removeEventListener("mouseup",a),document.removeEventListener("mousemove",o)}this._vy_dragEvent=function(t){t=t||window.event,r=t.clientX,n=t.clientY,(!s.style.resize||r-i._vy_x<i._vy_w-18||n-i._vy_y<i._vy_h-18)&&(document.addEventListener("mouseup",a),document.addEventListener("mousemove",o))},s.addEventListener("mousedown",this._vy_dragEvent)};_vy_setIcon=function(t){this._vy_ico=t;const e=n.j3.Icon.getDataURL(this._vy_atlas,this._vy_icoName,this._vy_icoState);e?this._vy_dom.style.backgroundImage=`url("${e}")`:this._vy_dom.style.backgroundImage&&(this._vy_dom.style.backgroundImage="")};_vy_setIconCheck=function(t){if(this._vy_atlas){if(!i.Q.loadedAtlases.hasOwnProperty(this._vy_atlas)||i.Q.loadedAtlases[this._vy_atlas].loading)return void(t||i.Q.loadAtlas(this._vy_atlas,this._vy_setIconCheck.bind(this,!0)));this._vy_setIcon(i.Q.iconsO[this._vy_atlas][this._vy_icoName]?.[this._vy_icoState])}else this._vy_setIcon(null)};_vy_setPos=function(t,e){const r=this._vy_x,n=this._vy_y;this._vy_x=t,this._vy_y=e,this._vy_scaleWebBox(),this._vy_x===r&&this._vy_y===n||this.onRelocated?.(r,n)};get isWebBox(){return!0}set isWebBox(t){}getDOM=function(){return this._vy_dom};get dom(){return this._vy_dom}set dom(t){}get domID(){return this._vy_domID??this._vy_dom.id}set domID(t){this._vy_domID=t,this._vy_dom.id=t}setIcon=function(t,e){this._vy_atlas||!this._vy_dom||this._vy_dom.style.backgroundRepeat||(this._vy_dom.style.backgroundRepeat="no-repeat"),this._vy_atlas=t,this._vy_icoName=e,this._vy_setIconCheck()};get atlasName(){return this._vy_atlas}set atlasName(t){this.setIcon(t,this._vy_icoName)}get iconName(){return this._vy_icoName}set iconName(t){this.setIcon(this.atlasName,t)}setIconState=function(t,e){this._vy_icoState=t,this._vy_setIconCheck()};get iconState(){return this._vy_icoState}set iconState(t){this.setIconState(t)}setFrame=function(t,e,r){};setIconOffsets=function(t,e){this._vy_xIcoOff=t,this._vy_yIcoOff=e,this._vy_dom&&(this._vy_dom.style.backgroundPosition=`${t}px ${e}px`)};get edgeLock(){return this._vy_edgeLock}set edgeLock(t){this._vy_edgeLock=t,this._vy_scaleWebBox()}get styleClass(){return this._vy_styleClass||(this._vy_styleClass=[]),this._vy_styleClass}set styleClass(t){if(this._vy_styleClass)for(const t of this._vy_styleClass)this._vy_dom.classList.remove(t);if(this._vy_styleClass=[],Array.isArray(t))for(const e of t)this._vy_styleClass.push(e),this._vy_dom.classList.add(e);else this._vy_styleClass.push(t),this._vy_dom.classList.add(t)}addStyleClass=function(t){this._vy_styleClass||(this._vy_styleClass=[]),this._vy_styleClass.includes(t)||(this._vy_styleClass.push(t),this._vy_dom.classList.add(t))};removeStyleClass=function(t){if(!this._vy_styleClass?.includes(t))return;const e=this._vy_styleClass.indexOf(t);this._vy_styleClass.splice(e,1),this._vy_dom.classList.remove(t)};addChild=function(t){if(t._vy_isWebBox){if(this._vy_children||(this._vy_children=[]),t._vy_parent){if(t._vy_parent===this)return;this.removeChild(t)}return t._vy_pane!==this._vy_pane&&(t._vy_pane&&t._vy_pane.removeChild(t,!0),this._vy_pane.addChild(t)),t._vy_dom.classList.replace("web_box","web_box_child"),t._vy_parent=this,this._vy_children.push(t),t.isHidden||this._vy_dom.appendChild(t._vy_dom),t}};removeChild=function(t){const e=this._vy_children.indexOf(t);-1!==e&&(this._vy_children.splice(e,1),t._vy_dom.classList.replace("web_box_child","web_box"),t.isHidden||(t._vy_dom.removeChild(t._vy_dom),n.vC.gameBody.appendChild(t._vy_dom)),t._vy_parent=null)};removeChildAt=function(t,e){void 0===e&&(e=t);for(const r=e;r>=t;r--)this.removeChild(this._vy_children[r])};getChildren=function(t,e){if(!this._vy_children)return[];if(t){const r=[];for(const n of this._vy_children)n&&obM.isType(n._vy_type,t,e)&&r.push(n);return r}return this._vy_children.slice()};get children(){return this._vy_children?this._vy_children.slice():[]}set children(t){}get style(){return this._vy_dom.style}set style(t){this._vy_style=t;for(const e in t)this._vy_dom.style[e]=t[e]}setSize=function(t,e){const r=this._vy_w,n=this._vy_h;if("string"==typeof t?(this._vy_dom.style.width=t,t.endsWith("px")&&(this._vy_w=parseFloat(t.slice(0,-2)))):(t||0===t?this._vy_dom.style.width=`${t}px`:(r||0===r)&&(this._vy_dom.style.width=""),this._vy_w=t),"string"==typeof e?(this._vy_dom.style.height=e,e.endsWith("px")&&(this._vy_h=parseFloat(e.slice(0,-2)))):(e||0===e?this._vy_dom.style.height=`${e}px`:(n||0===n)&&(this._vy_dom.style.height=""),this._vy_h=e),this._vy_scaleWebBox(),this.onResized?.(r,n),this._vy_children)for(const t of this._vy_children)t._vy_isMapView&&t._vy_scaleWebBox()};setScale=function(t,e){this._vy_scale?._vy_isDiobScale||(this._vy_scale=new s.Z9(this)),this._vy_scale._vy_x=t,this._vy_scale._vy_y=e,this._vy_scaleWebBox()};get scale(){return this._vy_scale?._vy_isDiobScale||(this._vy_scale=new s.Z9(this)),this._vy_scale}set scale(t){if(this._vy_scale?._vy_isDiobScale||(this._vy_scale=new s.Z9(this)),"string"==typeof t)if((t=t.replace(/\s/g,"")).startsWith("scale(")&&(t=t.substring(6,t.length-1)),t.includes(",")){const e=t.split(",");this.setScale(parseFloat(e[0]),parseFloat(e[1]))}else this.setScale(parseFloat(t),parseFloat(t));else if(n.j3.Util.isObject(t)){if(t._vy_isDiobScale&&t._vy_parent===this)return;for(const e in t)this._vy_scale[e]=t[e];this.setScale(this._vy_scale._vy_x,this._vy_scale._vy_y)}else this.setScale(t,t)}setAnchor=function(t,e){if(this._vy_anchor?._vy_isDiobAnchor||(this._vy_anchor=new s.S7(this)),"object"==typeof t)if(t._vy_isDiobAnchor){if(t._vy_parent===this)return}else e=t.y,t=t.x;void 0===t&&(t=0),void 0===e&&(e=t),this._vy_anchor._vy_x=t,this._vy_anchor._vy_y=e,this._vy_scaleWebBox()};setAlpha=function(t){this._vy_alpha=t,this._vy_alpha<0?this._vy_alpha=0:this._vy_alpha>1&&(this._vy_alpha=1),this._vy_dom.style.opacity=t};get display(){return this._vy_display}set display(t){this._vy_display=t,this._vy_dom.style.display=t}get boxShadow(){return this._vy_boxShadow}set boxShadow(t){this._vy_boxShadow=t,this._vy_dom.style.boxShadow=t}get boxSizing(){return this._vy_boxSizing}set boxSizing(t){this._vy_boxSizing=t,this._vy_dom.style.boxSizing=t}get clip(){return this._vy_clip}set clip(t){this._vy_clip=t,this._vy_dom.style.clipPath=t}get cursor(){return this._vy_cursor}set cursor(t){this._vy_cursor=t,this._vy_dom.style.cursor=t}get maxHeight(){return this._vy_maxHeight}set maxHeight(t){this._vy_maxHeight=t,this._vy_dom.style.maxHeight=t}get minHeight(){return this._vy_minHeight}set minHeight(t){this._vy_minHeight=t,this._vy_dom.style.minHeight=t}get maxWidth(){return this._vy_maxWidth}set maxWidth(t){this._vy_maxWidth=t,this._vy_dom.style.maxWidth=t}get minWidth(){return this._vy_minWidth}set minWidth(t){this._vy_minWidth=t,this._vy_dom.style.minWidth=t}get padding(){return this._vy_padding?._vy_isWebBoxPaddingSty||(this._vy_padding=new c(this)),this._vy_padding}set padding(t){this._vy_padding?._vy_isWebBoxPaddingSty||(this._vy_padding=new c(this)),this._vy_padding.setStyle(t,!0)}get margin(){return this._vy_margin?._vy_isWebBoxMarginSty||(this._vy_margin=new h(this)),this._vy_margin}set margin(t){this._vy_margin?._vy_isWebBoxMarginSty||(this._vy_margin=new h(this)),this._vy_margin.setStyle(t,!0)}get overflow(){return this._vy_overflow?._vy_isWebBoxOverflowSty||(this._vy_overflow=new d(this)),this._vy_overflow}set overflow(t){this._vy_overflow?._vy_isWebBoxOverflowSty||(this._vy_overflow=new d(this)),this._vy_overflow.setStyle(t,!0)}get float(){return this._vy_float}set float(t){this._vy_float=t,this._vy_dom.style.float=t}get transform(){return this._vy_transform}set transform(t){this._vy_transform=t,this._vy_dom.style.transform=t}get composite(){return this._vy_composite}set composite(t){this._vy_composite=t,this._vy_dom.style.composite=t}get background(){return this._vy_background?._vy_isWebBoxBackgroundSty||(this._vy_background=new l(this)),this._vy_background}set background(t){this._vy_background?._vy_isWebBoxBackgroundSty||(this._vy_background=new l(this)),this._vy_background.setStyle(t,!0)}get border(){return this._vy_border?._vy_isWebBoxBorderSty||(this._vy_border=new _(this)),this._vy_border}set border(t){this._vy_border?._vy_isWebBoxBorderSty||(this._vy_border=new _(this)),this._vy_border.setStyle(t,!0)}get outline(){return this._vy_outline?._vy_isWebBoxOutlineSty||(this._vy_outline=new u(this)),this._vy_outline}set outline(t){this._vy_outline?._vy_isWebBoxOutlineSty||(this._vy_outline=new u(this)),this._vy_outline.setStyle(t,!0)}get accentColor(){return this._vy_accentColor}set accentColor(t){this._vy_accentColor=t,this._vy_dom.style.accentColor=t}setText=function(t){return t||0===t||(t=""),this._vy_text=t.toString(),this._vy_dom.classList.contains("text_input")?this._vy_dom.value=t:this._vy_dom.scrollHeight-this._vy_dom.scrollTop-50<=this._vy_dom.clientHeight?(this._vy_dom.innerHTML=n.vC.getWebText(t),this._vy_dom.scrollTop=this._vy_dom.scrollHeight):this._vy_dom.innerHTML=n.vC.getWebText(t),this._vy_text};get textStyle(){return this._vy_textSty?._vy_isWebBoxTextSty||(this._vy_textSty=new p(this)),this._vy_textSty}set textStyle(t){this._vy_textSty?._vy_isWebBoxTextSty||(this._vy_textSty=new p(this)),this._vy_textSty.setStyle(t,!0)}get isResizable(){return this._vy_isResizable}set isResizable(t){t?this._vy_resizeOb=new ResizeObserver((()=>{this.isHidden||this.setSize(this._vy_dom.offsetWidth,this._vy_dom.offsetHeight)})).observe(this._vy_dom):this._vy_dom.style.resize&&(this._vy_resizeOb.disconnect(),this._vy_resizeOb=null),!0===t&&(t="both"),this._vy_dom.style.resize=t,this._vy_isResizable=t}get isDraggable(){return this._vy_isDraggable}set isDraggable(t){t?this._vy_dragEvent||this._vy_makeDraggable():this._vy_dragEvent&&(this._vy_dom.removeEventListener("mousedown",this._vy_dragEvent),this._vy_dragEvent=null),this._vy_isDraggable=t}}class l{_vy_isWebBoxBackgroundSty=!0;_vy_parent=null;_vy_parentSty=null;constructor(t){this._vy_parent=t,this._vy_parentSty=t._vy_dom.style}setStyle=function(t,e){if(n.j3.Util.isObject(t)){if(t===this)return;e&&(this._vy_parentSty.backgroundColor&&(this.color="initial"),this._vy_parentSty.backgroundImage&&(this._vy_parent._vy_ico?this.image=`url("${n.j3.Icon.getDataURL(this._vy_parent._vy_atlas,this._vy_parent._vy_icoName,this._vy_parent._vy_icoState)}")`:this.image="initial"),this._vy_parentSty.backgroundRepeat&&(this._vy_parent._vy_atlas?this.repeat="no-repeat":this.repeat="initial"),this._vy_parentSty.backgroundAttachment&&(this.attachment="initial"),this._vy_parentSty.backgroundBlendMode&&(this.blendMode="initial"),this._vy_parentSty.backgroundPosition&&(this._vy_parent._vy_xIcoOff||this._vy_parent._vy_xIcoOff?this.position=`${this._vy_parent._vy_xIcoOff}px ${this._vy_parent._vy_yIcoOff}px`:this.position="initial"),this._vy_parentSty.backgroundClip&&(this.clip="initial"),this._vy_parentSty.backgroundOrigin&&(this.origin="initial"),this._vy_parentSty.backgroundSize&&(this.size="initial"));for(const e in t)t.hasOwnProperty(e)&&(this[e]=t[e])}else this._vy_parentSty.background=n.vC.getWebStyle(t)};get color(){return this._vy_parentSty.backgroundColor}set color(t){this._vy_parentSty.backgroundColor=t}get image(){return this._vy_parentSty.backgroundImage}set image(t){this._vy_parentSty.backgroundImage=n.vC.getWebStyle(t)}get repeat(){return this._vy_parentSty.backgroundRepeat}set repeat(t){this._vy_parentSty.backgroundRepeat=t}get blendMode(){return this._vy_parentSty.backgroundBlendMode}set blendMode(t){this._vy_parentSty.backgroundBlendMode=t}get attachment(){return this._vy_parentSty.backgroundAttachment}set attachment(t){this._vy_parentSty.backgroundAttachment=t}get position(){return this._vy_parentSty.backgroundPosition}set position(t){this._vy_parentSty.backgroundPosition=t}get clip(){return this._vy_parentSty.backgroundClip}set clip(t){this._vy_parentSty.backgroundClip=t}get origin(){return this._vy_parentSty.backgroundOrigin}set origin(t){this._vy_parentSty.backgroundOrigin=t}get size(){return this._vy_parentSty.backgroundSize}set size(t){this._vy_parentSty.backgroundSize=t}}class _{_vy_isWebBoxBorderSty=!0;_vy_parent=null;_vy_parentSty=null;_vy_width=0;_vy_bottomWidth=0;_vy_topWidth=0;_vy_leftWidth=0;_vy_rightWidth=0;_vy_imageWidth=0;constructor(t){this._vy_parent=t,this._vy_parentSty=t._vy_dom.style}setStyle=function(t,e){if(n.j3.Util.isObject(t)){if(t===this)return;e&&(this._vy_parentSty.borderColor&&(this.color="initial"),this._vy_parentSty.borderImage&&(this.image="initial"),this._vy_parentSty.borderImageOutset&&(this.imageOutset="initial"),this._vy_parentSty.borderImageRepeat&&(this.imageRepeat="initial"),this._vy_parentSty.borderImageSource&&(this.imageSource="initial"),this._vy_parentSty.borderImageSlice&&(this.imageSlice="initial"),this._vy_parentSty.borderImageWidth&&(this.imageWidth=0),this._vy_parentSty.borderBottom&&(this.bottom="initial"),this._vy_parentSty.borderBottomColor&&(this.bottomColor="initial"),this._vy_parentSty.borderBottomLeftRadius&&(this.bottomLeftRadius="initial"),this._vy_parentSty.borderBottomRightRadius&&(this.bottomRightRadius="initial"),this._vy_parentSty.borderBottomStyle&&(this.bottomStyle="initial"),this._vy_parentSty.borderBottomWidth&&(this.bottomWidth=0),this._vy_parentSty.borderTop&&(this.top="initial"),this._vy_parentSty.borderTopColor&&(this.topColor="initial"),this._vy_parentSty.borderTopLeftRadius&&(this.topLeftRadius="initial"),this._vy_parentSty.borderTopRightRadius&&(this.topRightRadius="initial"),this._vy_parentSty.borderTopStyle&&(this.topStyle="initial"),this._vy_parentSty.borderTopWidth&&(this.topWidth=0),this._vy_parentSty.borderRight&&(this.right="initial"),this._vy_parentSty.borderRightColor&&(this.rightColor="initial"),this._vy_parentSty.borderRightStyle&&(this.rightStyle="initial"),this._vy_parentSty.borderRightWidth&&(this.rightWidth=0),this._vy_parentSty.borderLeft&&(this.left="initial"),this._vy_parentSty.borderLeftColor&&(this.leftColor="initial"),this._vy_parentSty.borderLeftStyle&&(this.leftStyle="initial"),this._vy_parentSty.borderLeftWidth&&(this.leftWidth=0),this._vy_parentSty.borderCollapse&&(this.collapse="initial"),this._vy_parentSty.borderRadius&&(this.radius="initial"),this._vy_parentSty.borderSpacing&&(this.spacing="initial"),this._vy_parentSty.borderStyle&&(this.style="initial"),this._vy_parentSty.borderWidth&&(this.width=0));for(const e in t)t.hasOwnProperty(e)&&(this[e]=t[e])}else this._vy_parentSty.border=t};get color(){return this._vy_parentSty.borderColor}set color(t){this._vy_parentSty.borderColor=t}get image(){return this._vy_parentSty.borderImage}set image(t){this._vy_parentSty.borderImage=n.vC.getWebStyle(t)}get imageOutset(){return this._vy_parentSty.borderImageOutset}set imageOutset(t){this._vy_parentSty.borderImageOutset=t}get imageRepeat(){return this._vy_parentSty.borderImageRepeat}set imageRepeat(t){this._vy_parentSty.borderImageRepeat=t}get imageSource(){return this._vy_parentSty.borderImageSource}set imageSource(t){this._vy_parentSty.borderImageSource=t}get imageSlice(){return this._vy_parentSty.borderImageSlice}set imageSlice(t){this._vy_parentSty.borderImageSlice=t}get imageWidth(){return this._vy_imageWidth??this._vy_parentSty.borderImageWidth}set imageWidth(t){"string"==typeof t?(this._vy_parentSty.borderImageWidth=t,t.endsWith("px")&&(this._vy_imageWidth=parseFloat(t.slice(0,-2)))):(this._vy_parentSty.borderImageWidth=`${t}px`,this._vy_imageWidth=t)}get bottom(){return this._vy_parentSty.borderBottom}set bottom(t){this._vy_parentSty.borderBottom=t}get bottomColor(){return this._vy_parentSty.borderBottomColor}set bottomColor(t){this._vy_parentSty.borderBottomColor=t}get bottomLeftRadius(){return this._vy_parentSty.borderBottomLeftRadius}set bottomLeftRadius(t){this._vy_parentSty.borderBottomLeftRadius=t}get bottomRightRadius(){return this._vy_parentSty.borderBottomRightRadius}set bottomRightRadius(t){this._vy_parentSty.borderBottomRightRadius=t}get bottomStyle(){return this._vy_parentSty.borderBottomStyle}set bottomStyle(t){this._vy_parentSty.borderBottomStyle=t}get bottomWidth(){return this._vy_bottomWidth??this._vy_parentSty.borderBottomWidth}set bottomWidth(t){"string"==typeof t?(this._vy_parentSty.borderBottomWidth=t,t.endsWith("px")&&(this._vy_bottomWidth=parseFloat(t.slice(0,-2)))):(this._vy_parentSty.borderBottomWidth=`${t}px`,this._vy_bottomWidth=t)}get collapse(){return this._vy_parentSty.borderCollapse}set collapse(t){this._vy_parentSty.borderCollapse=t}get left(){return this._vy_parentSty.borderLeft}set left(t){this._vy_parentSty.borderLeft=t}get leftColor(){return this._vy_parentSty.borderLeftColor}set leftColor(t){this._vy_parentSty.borderLeftColor=t}get leftStyle(){return this._vy_parentSty.borderLeftStyle}set leftStyle(t){this._vy_parentSty.borderLeftStyle=t}get leftWidth(){return this._vy_leftWidth??this._vy_parentSty.borderLeftWidth}set leftWidth(t){"string"==typeof t?(this._vy_parentSty.borderLeftWidth=t,t.endsWith("px")&&(this._vy_leftWidth=parseFloat(t.slice(0,-2)))):(this._vy_parentSty.borderLeftWidth=`${t}px`,this._vy_leftWidth=t)}get radius(){return this._vy_parentSty.borderRadius}set radius(t){this._vy_parentSty.borderRadius=t}get right(){return this._vy_parentSty.borderRight}set right(t){this._vy_parentSty.borderRight=t}get rightColor(){return this._vy_parentSty.borderRightColor}set rightColor(t){this._vy_parentSty.borderRightColor=t}get rightStyle(){return this._vy_parentSty.borderRightStyle}set rightStyle(t){this._vy_parentSty.borderRightStyle=t}get rightWidth(){return this._vy_rightWidth??this._vy_parentSty.borderRightWidth}set rightWidth(t){"string"==typeof t?(this._vy_parentSty.borderRightWidth=t,t.endsWith("px")&&(this._vy_rightWidth=parseFloat(t.slice(0,-2)))):(this._vy_parentSty.borderRightWidth=`${t}px`,this._vy_rightWidth=t)}get spacing(){return this._vy_parentSty.borderSpacing}set spacing(t){this._vy_parentSty.borderSpacing=t}get style(){return this._vy_parentSty.borderStyle}set style(t){this._vy_parentSty.borderStyle=t}get top(){return this._vy_parentSty.borderTop}set top(t){this._vy_parentSty.borderTop=t}get topColor(){return this._vy_parentSty.borderTopColor}set topColor(t){this._vy_parentSty.borderTopColor=t}get topLeftRadius(){return this._vy_parentSty.borderTopLeftRadius}set topLeftRadius(t){this._vy_parentSty.borderTopLeftRadius=t}get topRightRadius(){return this._vy_parentSty.borderTopRightRadius}set topRightRadius(t){this._vy_parentSty.borderTopRightRadius=t}get topStyle(){return this._vy_parentSty.borderTopStyle}set topStyle(t){this._vy_parentSty.borderTopStyle=t}get topWidth(){return this._vy_topWidth??this._vy_parentSty.borderTopWidth}set topWidth(t){"string"==typeof t?(this._vy_parentSty.borderTopWidth=t,t.endsWith("px")&&(this._vy_topWidth=parseFloat(t.slice(0,-2)))):(this._vy_parentSty.borderTopWidth=`${t}px`,this._vy_topWidth=t)}get width(){return this._vy_width??this._vy_parentSty.borderWidth}set width(t){"string"==typeof t?(this._vy_parentSty.borderWidth=t,t.endsWith("px")&&(this._vy_width=parseFloat(t.slice(0,-2)))):(this._vy_parentSty.borderWidth=`${t}px`,this._vy_width=t)}}class u{_vy_isWebBoxOutlineSty=!0;_vy_parent=null;_vy_parentSty=null;_vy_width=0;constructor(t){this._vy_parent=t,this._vy_parentSty=t._vy_dom.style}setStyle=function(t,e){if(n.j3.Util.isObject(t)){if(t===this)return;e&&(this._vy_parentSty.outlineColor&&(this.color="initial"),this._vy_parentSty.outlineOffset&&(this.offset="initial"),this._vy_parentSty.outlineStyle&&(this.style="initial"),this._vy_parentSty.outlineWidth&&(this.width=0));for(const e in t)t.hasOwnProperty(e)&&(this[e]=t[e])}else this._vy_parentSty.outline=t};get color(){return this._vy_parentSty.outlineColor}set color(t){this._vy_parentSty.outlineColor=t}get offset(){return this._vy_parentSty.outlineOffset}set offset(t){this._vy_parentSty.outlineOffset=t}get style(){return this._vy_parentSty.outlineStyle}set style(t){this._vy_parentSty.outlineStyle=t}get width(){return this._vy_parentSty.outlineWidth}set width(t){"string"==typeof t?(this._vy_parentSty.outlineWidth=t,t.endsWith("px")&&(this._vy_width=parseFloat(t.slice(0,-2)))):(this._vy_parentSty.outlineWidth=`${t}px`,this._vy_width=t)}}class c{_vy_isWebBoxPaddingSty=!0;_vy_parent=null;_vy_parentSty=null;_vy_top=0;_vy_left=0;_vy_right=0;_vy_bottom=0;constructor(t){this._vy_parent=t,this._vy_parentSty=t._vy_dom.style}_vy_setAll=function(t,e,r,n){this.top=t,this.left=n??e??t,this.right=e??t,this.bottom=r??t};setStyle=function(t,e){if(n.j3.Util.isObject(t)){if(t===this)return;e&&(this._vy_parentSty.paddingTop&&(this.top=0),this._vy_parentSty.paddingLeft&&(this.left=0),this._vy_parentSty.paddingBottom&&(this.bottom=0),this._vy_parentSty.paddingRight&&(this.right=0));for(const e in t)t.hasOwnProperty(e)&&(this[e]=t[e])}else n.j3.Util.isString(t)?this._vy_setAll(...t.split(" ")):n.j3.Util.isNumber(t)&&this._vy_setAll(t)};get top(){return this._vy_top}set top(t){"string"==typeof t?(this._vy_parentSty.paddingTop=t,t.endsWith("px")&&(this._vy_top=parseFloat(t.slice(0,-2)))):(this._vy_parentSty.paddingTop=`${t}px`,this._vy_top=t)}get left(){return this._vy_left}set left(t){"string"==typeof t?(this._vy_parentSty.paddingLeft=t,t.endsWith("px")&&(this._vy_left=parseFloat(t.slice(0,-2)))):(this._vy_parentSty.paddingLeft=`${t}px`,this._vy_left=t)}get right(){return this._vy_right}set right(t){"string"==typeof t?(this._vy_parentSty.paddingRight=t,t.endsWith("px")&&(this._vy_right=parseFloat(t.slice(0,-2)))):(this._vy_parentSty.paddingRight=`${t}px`,this._vy_right=t)}get bottom(){return this._vy_bottom}set bottom(t){"string"==typeof t?(this._vy_parentSty.paddingBottom=t,t.endsWith("px")&&(this._vy_bottom=parseFloat(t.slice(0,-2)))):(this._vy_parentSty.paddingBottom=`${t}px`,this._vy_bottom=t)}}class h{_vy_isWebBoxMarginSty=!0;_vy_parent=null;_vy_parentSty=null;_vy_top=0;_vy_left=0;_vy_right=0;_vy_bottom=0;constructor(t){this._vy_parent=t,this._vy_parentSty=t._vy_dom.style}_vy_setAll=function(t,e,r,n){this.top=t,this.left=n??e??t,this.right=e??t,this.bottom=r??t};setStyle=function(t,e){if(n.j3.Util.isObject(t)){if(t===this)return;e&&(this._vy_parentSty.marginTop&&(this.top=0),this._vy_parentSty.marginLeft&&(this.left=0),this._vy_parentSty.marginBottom&&(this.bottom=0),this._vy_parentSty.marginRight&&(this.right=0));for(const e in t)t.hasOwnProperty(e)&&(this[e]=t[e])}else n.j3.Util.isString(t)?this._vy_setAll(...t.split(" ")):n.j3.Util.isNumber(t)&&this._vy_setAll(t)};get top(){return this._vy_top}set top(t){"string"==typeof t?(this._vy_parentSty.marginTop=t,t.endsWith("px")&&(this._vy_top=parseFloat(t.slice(0,-2)))):(this._vy_parentSty.marginTop=`${t}px`,this._vy_top=t)}get left(){return this._vy_left}set left(t){"string"==typeof t?(this._vy_parentSty.marginLeft=t,t.endsWith("px")&&(this._vy_left=parseFloat(t.slice(0,-2)))):(this._vy_parentSty.marginLeft=`${t}px`,this._vy_left=t)}get right(){return this._vy_right}set right(t){"string"==typeof t?(this._vy_parentSty.marginRight=t,t.endsWith("px")&&(this._vy_right=parseFloat(t.slice(0,-2)))):(this._vy_parentSty.marginRight=`${t}px`,this._vy_right=t)}get bottom(){return this._vy_bottom}set bottom(t){"string"==typeof t?(this._vy_parentSty.marginBottom=t,t.endsWith("px")&&(this._vy_bottom=parseFloat(t.slice(0,-2)))):(this._vy_parentSty.marginBottom=`${t}px`,this._vy_bottom=t)}}class d{_vy_isWebBoxOverflowSty=!0;_vy_parent=null;_vy_parentSty=null;_vy_both=null;_vy_x=null;_vy_y=null;constructor(t){this._vy_parent=t,this._vy_parentSty=t._vy_dom.style}setStyle=function(t,e){if(n.j3.Util.isObject(t)){if(t===this)return;e&&(this._vy_parentSty.overflow&&(this.both="initial"),this._vy_parentSty.overflowX&&(this.x="initial"),this._vy_parentSty.overflowY&&(this.y="initial"));for(const e in t)t.hasOwnProperty(e)&&(this[e]=t[e])}else n.j3.Util.isString(t)&&(this.both=t)};get both(){return this._vy_both}set both(t){this._vy_parentSty.overflow=t,this._vy_both=t}get x(){return this._vy_x}set x(t){this._vy_parentSty.overflowX=t,this._vy_x=t}get y(){return this._vy_y}set y(t){this._vy_parentSty.overflowY=t,this._vy_y=t}}class p{_vy_isWebBoxTextSty=!0;_vy_parent=null;_vy_parentSty=null;_vy_fontSize=12;constructor(t){this._vy_parent=t,this._vy_parentSty=t._vy_dom.style}setStyle=function(t,e){if(n.j3.Util.isObject(t)){if(t===this)return;e&&(this._vy_parentSty.caretColor&&(this.caretColor="initial"),this._vy_parentSty.color&&(this.color="initial"),this._vy_parentSty.letterSpacing&&(this.letterSpacing="initial"),this._vy_parentSty.lineHeight&&(this.lineHeight="initial"),this._vy_parentSty.quotes&&(this.quotes="initial"),this._vy_parentSty.tabSize&&(this.tabSize="initial"),this._vy_parentSty.textAlign&&(this.align="initial"),this._vy_parentSty.textAlignLast&&(this.alignLast="initial"),this._vy_parentSty.verticalAlign&&(this.verticalAlign="initial"),this._vy_parentSty.textDecoration&&(this.decoration="initial"),this._vy_parentSty.textDecorationColor&&(this.decorationColor="initial"),this._vy_parentSty.textDecorationLine&&(this.decorationLine="initial"),this._vy_parentSty.textDecorationStyle&&(this.decorationStyle="initial"),this._vy_parentSty.textIndent&&(this.indent="initial"),this._vy_parentSty.textOverflow&&(this.overflow="initial"),this._vy_parentSty.textShadow&&(this.shadow="initial"),this._vy_parentSty.textTransform&&(this.transform="initial"),this._vy_parentSty.userSelect&&(this.isSelectable="initial"),this._vy_parentSty.whiteSpace&&(this.whiteSpace="initial"),this._vy_parentSty.wordBreak&&(this.wordBreak="initial"),this._vy_parentSty.wordSpacing&&(this.wordSpacing="initial"),this._vy_parentSty.wordWrap&&(this.wordWrap="initial"),this._vy_parentSty.fontSize&&(this.fontSize=12),this._vy_parentSty.fontStyle&&(this.fontStyle="initial"),this._vy_parentSty.fontVariant&&(this.fontVariant="initial"),this._vy_parentSty.fontWeight&&(this.fontWeight="initial"),this._vy_parentSty.fontSizeAdjust&&(this.fontSizeAdjust="initial"),this._vy_parentSty.fontStretch&&(this.fontStretch="initial"));for(const e in t)t.hasOwnProperty(e)&&(this[e]=t[e])}};get caretColor(){return this._vy_parentSty.caretColor}set caretColor(t){this._vy_parentSty.caretColor=t}get fill(){return this._vy_parentSty.color}set fill(t){this._vy_parentSty.color=t}get color(){return this._vy_parentSty.color}set color(t){this._vy_parentSty.color=t}get letterSpacing(){return this._vy_parentSty.letterSpacing}set letterSpacing(t){this._vy_parentSty.letterSpacing=t}get lineHeight(){return this._vy_parentSty.lineHeight}set lineHeight(t){this._vy_parentSty.lineHeight=t}get quotes(){return this._vy_parentSty.quotes}set quotes(t){this._vy_parentSty.quotes=t}get tabSize(){return this._vy_parentSty.tabSize}set tabSize(t){this._vy_parentSty.tabSize=t}get align(){return this._vy_parentSty.textAlign}set align(t){this._vy_parentSty.textAlign=t}get alignLast(){return this._vy_parentSty.textAlignLast}set alignLast(t){this._vy_parentSty.textAlignLast=t}get verticalAlign(){return this._vy_parentSty.verticalAlign}set verticalAlign(t){this._vy_parentSty.verticalAlign=t}get decoration(){return this._vy_parentSty.textDecoration}set decoration(t){this._vy_parentSty.textDecoration=t}get decorationColor(){return this._vy_parentSty.textDecorationColor}set decorationColor(t){this._vy_parentSty.textDecorationColor=t}get decorationLine(){return this._vy_parentSty.textDecorationLine}set decorationLine(t){this._vy_parentSty.textDecorationLine=t}get decorationStyle(){return this._vy_parentSty.textDecorationStyle}set decorationStyle(t){this._vy_parentSty.textDecorationStyle=t}get indent(){return this._vy_parentSty.textIndent}set indent(t){this._vy_parentSty.textIndent=t}get overflow(){return this._vy_parentSty.textOverflow}set overflow(t){this._vy_parentSty.textOverflow=t}get shadow(){return this._vy_parentSty.textShadow}set shadow(t){this._vy_parentSty.textShadow=t}get transform(){return this._vy_parentSty.textTransform}set transform(t){this._vy_parentSty.textTransform=t}get isSelectable(){return this._vy_parentSty.userSelect}set isSelectable(t){!0===t&&(t="auto"),this._vy_parentSty.userSelect=t}get whiteSpace(){return this._vy_parentSty.whiteSpace}set whiteSpace(t){this._vy_parentSty.whiteSpace=t}get wordBreak(){return this._vy_parentSty.wordBreak}set wordBreak(t){this._vy_parentSty.wordBreak=t}get wordSpacing(){return this._vy_parentSty.wordSpacing}set wordSpacing(t){this._vy_parentSty.wordSpacing=t}get wordWrap(){return this._vy_parentSty.wordWrap}set wordWrap(t){this._vy_parentSty.wordWrap=t}get fontFamily(){return this._vy_parentSty.fontFamily}set fontFamily(t){this._vy_parentSty.fontFamily=t}get fontSize(){return this._vy_fontSize}set fontSize(t){"string"==typeof t?(this._vy_parentSty.fontSize=t,t.endsWith("px")&&(this._vy_fontSize=parseFloat(t.slice(0,-2)))):(this._vy_parentSty.fontSize=`${t}px`,this._vy_fontSize=t)}get fontStyle(){return this._vy_parentSty.fontStyle}set fontStyle(t){this._vy_parentSty.fontStyle=t}get fontVariant(){return this._vy_parentSty.fontVariant}set fontVariant(t){this._vy_parentSty.fontVariant=t}get fontWeight(){return this._vy_parentSty.fontWeight}set fontWeight(t){this._vy_parentSty.fontWeight=t}get fontSizeAdjust(){return this._vy_parentSty.fontSizeAdjust}set fontSizeAdjust(t){this._vy_parentSty.fontSizeAdjust=t}get fontStretch(){return this._vy_parentSty.fontStretch}set fontStretch(t){this._vy_parentSty.fontStretch=t}}},983:(t,e,r)=>{"use strict";r.d(e,{o:()=>a});var n=r(518),i=r(868),s=r(708),o=r(140);class a extends s.z{_vy_name="";_vy_mapN="";_vy_width=0;_vy_height=0;_vy_deleted=null;_vy_particles=null;_vy_isClone=!1;_vy_file=null;_vy_isLoaded=!1;_vy_isNew=!1;_vy_chunks=null;_vy_chunksI=null;_vy_mapView=null;constructor(){super()}_vy_generateMapChunks=function(){if(!this._vy_xMax)return;let t=n.a$.mapChunk||this._vy_chunkSize;(this._vy_xMax<2*t||this._vy_yMax<2*t)&&(t=this._vy_xMax<2*t&&this._vy_yMax<2*t?Math.max(this._vy_xMax,this._vy_yMax):Math.min(this._vy_xMax,this._vy_yMax));const e=Math.max(Math.ceil(this._vy_xMax/t),1),r=Math.max(Math.ceil(this._vy_yMax/t),1),i=new Array(e+e*r);this._vy_chunksI=[];for(let n=1;n<=r;n++)for(let r=1;r<=e;r++){const s=this._vy_chunks?.[r+e*n]?this._vy_chunks[r+e*n]:{map:this,x:r,y:n,xC:(r-1)*t+1,yC:(n-1)*t+1,wC:t-1,hC:t-1,c:[],u:[]};s.i=this._vy_chunksI.length,s.xC+t>this._vy_xMax&&(s.wC=this._vy_xMax-s.xC),s.yC+t>this._vy_yMax&&(s.hC=this._vy_yMax-s.yC);for(let t=s.yC,e=t+s.hC;t<=e;t++)for(let e=s.xC,r=e+s.wC;e<=r;e++){const r=this._vy_tiles[e+this._vy_xMax*t];r&&(r._vy_onChunkScr=!1,r._vy_chunk=s)}i[r+e*n]=s,this._vy_chunksI.push(s),s._vy_pixS&&(s._vy_pixS=null)}this._vy_chunks=i};get isMap(){return!0}set isMap(t){}get name(){return this._vy_name}set name(t){this._vy_name=t}get mapName(){return this._vy_mapN}set mapName(t){}addClient=function(t){};removeClient=function(t){};getClients=function(){return n.um._vy_playerMob&&n.um._vy_playerMob._vy_mapN===this._vy_mapN?[n.um]:[]};get width(){return this._vy_width}set width(t){}get height(){return this._vy_height}set height(t){}get mapView(){return this._vy_mapView}set mapView(t){}getDiobs=function(t,e,r){const n=[];for(let i=1,s=this._vy_yMax;i<=s;i++)for(let s=1,a=this._vy_xMax;s<=a;s++){const a=this._vy_tiles[s+this._vy_xMax*i];if(a){r&&(t&&!o.P.isType(a._vy_type,t,e)||n.push(a),t&&!o.P.isType(a.region._vy_type,t,e)||!n.includes(a._vy_region)||n.includes(a._vy_region)||n.push(a._vy_region));for(const r in a.contents){const i=a.contents[r];i&&i.loc===a&&(t&&!o.P.isType(i._vy_type,t,e)||n.includes(i)||n.push(i))}}}return n};getDiobsByTag=function(t){const e=[],r=o.P.tags[t];if(!r)return e;for(let t=0,n=r.length;t<n;t++)r[t]._vy_map===this&&e.push(r[t]);return e};getDiobsByRegion=function(t,e,r){const n=[],i="string"==typeof t?o.P.regions[t]:t;if(!i._vy_isRegion)return[];for(let t=1,s=this._vy_yMax;t<=s;t++)for(let s=1,a=this._vy_xMax;s<=a;s++){const l=this._vy_tiles[s+a*t];if(l&&l._vy_region===i){n.push(l);for(const t in l.contents){const i=l.contents[t];i&&i.loc===l&&(e&&!o.P.isType(i._vy_type,e,r)||n.push(i))}}}return n};cloneMap=function(t,e){if(i.Q.maps[t])if(i.Q.maps[t]._vy_isClone||i.Q.maps[t]._vy_xMax)i.Q.clearMap(t);else{const e=i.Q.clearMap(t,1),r=i.Q.loadingResources["map_"+t].diobs;for(let t=e.length;t--;){const n=e[t];r.includes(n)||r.push(n)}}else i.Q.loadingResources["map_"+t]||(i.Q.loadingResources["map_"+t]={type:"map",name:t,diobs:[],loading:!0});return e?i.Q.newMap(t,this._vy_file,this._vy_name,(function(){mainM._callback(e,"loaded")})):i.Q.newMap(t,this._vy_file,this._vy_name)}}},571:(t,e,r)=>{"use strict";r.d(e,{B:()=>s});var n=r(983),i=r(140);class s extends n.o{_vy_xMax=0;_vy_yMax=0;_vy_tileW=32;_vy_tileH=32;_vy_chunkSize=50;_vy_tiles=null;constructor(){super()}get isTileMap(){return!0}set isTileMap(t){}get xMax(){return this._vy_xMax}set xMax(t){}get yMax(){return this._vy_yMax}set yMax(t){}get tileWidth(){return this._vy_tileW}set tileWidth(t){}get tileHeight(){return this._vy_tileH}set tileHeight(t){}setSizeByCoords=function(t=0,e,r="Tile"){void 0===e&&(e=t);const n="m_"+this._vy_mapN+"_",s=this._vy_tiles.slice(),o=this._vy_xMax,a=this._vy_yMax,l=[];if(this._vy_tiles=new Array(t+t*e),this._vy_xMax=t,this._vy_yMax=e,this._vy_width=t*this._vy_tileW,this._vy_height=e*this._vy_tileH,t<o)for(let e=o,r=t+1;e>=r;e--)for(let t=a;t>=1;t--){const r=s[e+o*t];if(r._vy_conts)for(let t=r._vy_conts.length;t--;)i.P.deleteDiob(r._vy_conts[t]);i.P.deleteDiob(r),l.push(r)}else if(t>o)for(let s=o+1,a=t;s<=a;s++)for(let t=1;t<=e;t++)i.P.createObjectNew(r,null,n+s+"x"+t,s,t,this);if(e<a)for(let t=o;t>=1;t--)for(let r=a,n=e+1;r>=n;r--){const e=s[t+o*r];if(e._vy_conts)for(let t=e._vy_conts.length;t--;)i.P.deleteDiob(e._vy_conts[t]);i.P.deleteDiob(e),l.push(e)}else if(e>a)for(let s=1;s<=t;s++)for(let t=o+1,a=e;t<=a;t++)i.P.createObjectNew(r,null,n+s+"x"+t,s,t,this);for(let e=s.length;e--;){const r=s[e];r&&!l.includes(r)&&(this._vy_tiles[Math.floor(r._vy_x/this._vy_tileW)+1+t*(Math.floor(r._vy_y/this._vy_tileH)+1)]=r)}this._vy_mapView&&!scrM.pauseDraw?(this._vy_mapView._vy_clearScreen(),this._vy_generateMapChunks(),this._vy_mapView._vy_updateEye()):this._vy_generateMapChunks()};getTiles=function(t,e,r=0,n=0){const i=[];if(t&&e){const s=r<0?t:t+r,o=n<0?e:e+n;for(let a=r<0?t+r:t;a<=s;a++)for(let t=n<0?e+n:e;t<=o;t++){const e=this._vy_tiles[a+this._vy_xMax*t];e&&i.push(e)}}else for(let t=1,e=this._vy_yMax;t<=e;t++)for(let e=1,r=this._vy_xMax;e<=r;e++)i.push(this._vy_tiles[e+this._vy_xMax*t]);return i}}},979:t=>{t.exports=function t(e,r,n){function i(o,a){if(!r[o]){if(!e[o]){if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var _=r[o]={exports:{}};e[o][0].call(_.exports,(function(t){var r=e[o][1][t];return i(r||t)}),_,_.exports,t,e,r,n)}return r[o].exports}for(var s=void 0,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(t,e,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;r.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])}}return t},r.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var i={arraySet:function(t,e,r,n,i){if(e.subarray&&t.subarray)t.set(e.subarray(r,r+n),i);else for(var s=0;s<n;s++)t[i+s]=e[r+s]},flattenChunks:function(t){var e,r,n,i,s,o;for(n=0,e=0,r=t.length;e<r;e++)n+=t[e].length;for(o=new Uint8Array(n),i=0,e=0,r=t.length;e<r;e++)s=t[e],o.set(s,i),i+=s.length;return o}},s={arraySet:function(t,e,r,n,i){for(var s=0;s<n;s++)t[i+s]=e[r+s]},flattenChunks:function(t){return[].concat.apply([],t)}};r.setTyped=function(t){t?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,i)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,s))},r.setTyped(n)},{}],2:[function(t,e,r){"use strict";function n(t,e){if(e<65537&&(t.subarray&&o||!t.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(t,e));for(var r="",n=0;n<e;n++)r+=String.fromCharCode(t[n]);return r}var i=t("./common"),s=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(t){s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){o=!1}for(var a=new i.Buf8(256),l=0;l<256;l++)a[l]=l>=252?6:l>=248?5:l>=240?4:l>=224?3:l>=192?2:1;a[254]=a[254]=1,r.string2buf=function(t){var e,r,n,s,o,a=t.length,l=0;for(s=0;s<a;s++)55296==(64512&(r=t.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=t.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(n-56320),s++),l+=r<128?1:r<2048?2:r<65536?3:4;for(e=new i.Buf8(l),o=0,s=0;o<l;s++)55296==(64512&(r=t.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=t.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(n-56320),s++),r<128?e[o++]=r:r<2048?(e[o++]=192|r>>>6,e[o++]=128|63&r):r<65536?(e[o++]=224|r>>>12,e[o++]=128|r>>>6&63,e[o++]=128|63&r):(e[o++]=240|r>>>18,e[o++]=128|r>>>12&63,e[o++]=128|r>>>6&63,e[o++]=128|63&r);return e},r.buf2binstring=function(t){return n(t,t.length)},r.binstring2buf=function(t){for(var e=new i.Buf8(t.length),r=0,n=e.length;r<n;r++)e[r]=t.charCodeAt(r);return e},r.buf2string=function(t,e){var r,i,s,o,l=e||t.length,_=new Array(2*l);for(i=0,r=0;r<l;)if((s=t[r++])<128)_[i++]=s;else if((o=a[s])>4)_[i++]=65533,r+=o-1;else{for(s&=2===o?31:3===o?15:7;o>1&&r<l;)s=s<<6|63&t[r++],o--;o>1?_[i++]=65533:s<65536?_[i++]=s:(s-=65536,_[i++]=55296|s>>10&1023,_[i++]=56320|1023&s)}return n(_,i)},r.utf8border=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;r>=0&&128==(192&t[r]);)r--;return r<0||0===r?e:r+a[t[r]]>e?r:e}},{"./common":1}],3:[function(t,e,r){"use strict";function n(t,e,r,n){for(var i=65535&t,s=t>>>16&65535,o=0;0!==r;){r-=o=r>2e3?2e3:r;do{s=s+(i=i+e[n++]|0)|0}while(--o);i%=65521,s%=65521}return i|s<<16}e.exports=n},{}],4:[function(t,e,r){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],5:[function(t,e,r){"use strict";function n(){for(var t,e=[],r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}function i(t,e,r,n){var i=s,o=n+r;t^=-1;for(var a=n;a<o;a++)t=t>>>8^i[255&(t^e[a])];return~t}var s=n();e.exports=i},{}],6:[function(t,e,r){"use strict";function n(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}e.exports=n},{}],7:[function(t,e,r){"use strict";var n=30,i=12;e.exports=function(t,e){var r,s,o,a,l,_,u,c,h,d,p,y,v,f,m,g,x,b,S,T,P,O,M,w,C;r=t.state,s=t.next_in,w=t.input,o=s+(t.avail_in-5),a=t.next_out,C=t.output,l=a-(e-t.avail_out),_=a+(t.avail_out-257),u=r.dmax,c=r.wsize,h=r.whave,d=r.wnext,p=r.window,y=r.hold,v=r.bits,f=r.lencode,m=r.distcode,g=(1<<r.lenbits)-1,x=(1<<r.distbits)-1;t:do{v<15&&(y+=w[s++]<<v,v+=8,y+=w[s++]<<v,v+=8),b=f[y&g];e:for(;;){if(y>>>=S=b>>>24,v-=S,0==(S=b>>>16&255))C[a++]=65535&b;else{if(!(16&S)){if(!(64&S)){b=f[(65535&b)+(y&(1<<S)-1)];continue e}if(32&S){r.mode=i;break t}t.msg="invalid literal/length code",r.mode=n;break t}T=65535&b,(S&=15)&&(v<S&&(y+=w[s++]<<v,v+=8),T+=y&(1<<S)-1,y>>>=S,v-=S),v<15&&(y+=w[s++]<<v,v+=8,y+=w[s++]<<v,v+=8),b=m[y&x];r:for(;;){if(y>>>=S=b>>>24,v-=S,!(16&(S=b>>>16&255))){if(!(64&S)){b=m[(65535&b)+(y&(1<<S)-1)];continue r}t.msg="invalid distance code",r.mode=n;break t}if(P=65535&b,v<(S&=15)&&(y+=w[s++]<<v,(v+=8)<S&&(y+=w[s++]<<v,v+=8)),(P+=y&(1<<S)-1)>u){t.msg="invalid distance too far back",r.mode=n;break t}if(y>>>=S,v-=S,P>(S=a-l)){if((S=P-S)>h&&r.sane){t.msg="invalid distance too far back",r.mode=n;break t}if(O=0,M=p,0===d){if(O+=c-S,S<T){T-=S;do{C[a++]=p[O++]}while(--S);O=a-P,M=C}}else if(d<S){if(O+=c+d-S,(S-=d)<T){T-=S;do{C[a++]=p[O++]}while(--S);if(O=0,d<T){T-=S=d;do{C[a++]=p[O++]}while(--S);O=a-P,M=C}}}else if(O+=d-S,S<T){T-=S;do{C[a++]=p[O++]}while(--S);O=a-P,M=C}for(;T>2;)C[a++]=M[O++],C[a++]=M[O++],C[a++]=M[O++],T-=3;T&&(C[a++]=M[O++],T>1&&(C[a++]=M[O++]))}else{O=a-P;do{C[a++]=C[O++],C[a++]=C[O++],C[a++]=C[O++],T-=3}while(T>2);T&&(C[a++]=C[O++],T>1&&(C[a++]=C[O++]))}break}}break}}while(s<o&&a<_);s-=T=v>>3,y&=(1<<(v-=T<<3))-1,t.next_in=s,t.next_out=a,t.avail_in=s<o?o-s+5:5-(s-o),t.avail_out=a<_?_-a+257:257-(a-_),r.hold=y,r.bits=v}},{}],8:[function(t,e,r){"use strict";function n(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function i(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new m.Buf16(320),this.work=new m.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=F,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new m.Buf32(pt),e.distcode=e.distdyn=new m.Buf32(yt),e.sane=1,e.back=-1,E):I}function o(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,s(t)):I}function a(t,e){var r,n;return t&&t.state?(n=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?I:(null!==n.window&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,o(t))):I}function l(t,e){var r,n;return t?(n=new i,t.state=n,n.window=null,(r=a(t,e))!==E&&(t.state=null),r):I}function _(t){return l(t,vt)}function u(t){if(ft){var e;for(v=new m.Buf32(512),f=new m.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(S(P,t.lens,0,288,v,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;S(O,t.lens,0,32,f,0,t.work,{bits:5}),ft=!1}t.lencode=v,t.lenbits=9,t.distcode=f,t.distbits=5}function c(t,e,r,n){var i,s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new m.Buf8(s.wsize)),n>=s.wsize?(m.arraySet(s.window,e,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):((i=s.wsize-s.wnext)>n&&(i=n),m.arraySet(s.window,e,r-n,i,s.wnext),(n-=i)?(m.arraySet(s.window,e,r-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=i))),0}function h(t,e){var r,i,s,o,a,l,_,h,d,p,y,v,f,pt,yt,vt,ft,mt,gt,xt,bt,St,Tt,Pt,Ot=0,Mt=new m.Buf8(4),wt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!t||!t.state||!t.output||!t.input&&0!==t.avail_in)return I;(r=t.state).mode===Y&&(r.mode=Q),a=t.next_out,s=t.output,_=t.avail_out,o=t.next_in,i=t.input,l=t.avail_in,h=r.hold,d=r.bits,p=l,y=_,St=E;t:for(;;)switch(r.mode){case F:if(0===r.wrap){r.mode=Q;break}for(;d<16;){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}if(2&r.wrap&&35615===h){r.check=0,Mt[0]=255&h,Mt[1]=h>>>8&255,r.check=x(r.check,Mt,2,0),h=0,d=0,r.mode=L;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",r.mode=ht;break}if((15&h)!==U){t.msg="unknown compression method",r.mode=ht;break}if(d-=4,bt=8+(15&(h>>>=4)),0===r.wbits)r.wbits=bt;else if(bt>r.wbits){t.msg="invalid window size",r.mode=ht;break}r.dmax=1<<bt,t.adler=r.check=1,r.mode=512&h?X:Y,h=0,d=0;break;case L:for(;d<16;){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}if(r.flags=h,(255&r.flags)!==U){t.msg="unknown compression method",r.mode=ht;break}if(57344&r.flags){t.msg="unknown header flags set",r.mode=ht;break}r.head&&(r.head.text=h>>8&1),512&r.flags&&(Mt[0]=255&h,Mt[1]=h>>>8&255,r.check=x(r.check,Mt,2,0)),h=0,d=0,r.mode=G;case G:for(;d<32;){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}r.head&&(r.head.time=h),512&r.flags&&(Mt[0]=255&h,Mt[1]=h>>>8&255,Mt[2]=h>>>16&255,Mt[3]=h>>>24&255,r.check=x(r.check,Mt,4,0)),h=0,d=0,r.mode=j;case j:for(;d<16;){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}r.head&&(r.head.xflags=255&h,r.head.os=h>>8),512&r.flags&&(Mt[0]=255&h,Mt[1]=h>>>8&255,r.check=x(r.check,Mt,2,0)),h=0,d=0,r.mode=N;case N:if(1024&r.flags){for(;d<16;){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}r.length=h,r.head&&(r.head.extra_len=h),512&r.flags&&(Mt[0]=255&h,Mt[1]=h>>>8&255,r.check=x(r.check,Mt,2,0)),h=0,d=0}else r.head&&(r.head.extra=null);r.mode=z;case z:if(1024&r.flags&&((v=r.length)>l&&(v=l),v&&(r.head&&(bt=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),m.arraySet(r.head.extra,i,o,v,bt)),512&r.flags&&(r.check=x(r.check,i,v,o)),l-=v,o+=v,r.length-=v),r.length))break t;r.length=0,r.mode=W;case W:if(2048&r.flags){if(0===l)break t;v=0;do{bt=i[o+v++],r.head&&bt&&r.length<65536&&(r.head.name+=String.fromCharCode(bt))}while(bt&&v<l);if(512&r.flags&&(r.check=x(r.check,i,v,o)),l-=v,o+=v,bt)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=V;case V:if(4096&r.flags){if(0===l)break t;v=0;do{bt=i[o+v++],r.head&&bt&&r.length<65536&&(r.head.comment+=String.fromCharCode(bt))}while(bt&&v<l);if(512&r.flags&&(r.check=x(r.check,i,v,o)),l-=v,o+=v,bt)break t}else r.head&&(r.head.comment=null);r.mode=H;case H:if(512&r.flags){for(;d<16;){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}if(h!==(65535&r.check)){t.msg="header crc mismatch",r.mode=ht;break}h=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=Y;break;case X:for(;d<32;){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}t.adler=r.check=n(h),h=0,d=0,r.mode=K;case K:if(0===r.havedict)return t.next_out=a,t.avail_out=_,t.next_in=o,t.avail_in=l,r.hold=h,r.bits=d,R;t.adler=r.check=1,r.mode=Y;case Y:if(e===w||e===C)break t;case Q:if(r.last){h>>>=7&d,d-=7&d,r.mode=_t;break}for(;d<3;){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}switch(r.last=1&h,d-=1,3&(h>>>=1)){case 0:r.mode=$;break;case 1:if(u(r),r.mode=rt,e===C){h>>>=2,d-=2;break t}break;case 2:r.mode=J;break;case 3:t.msg="invalid block type",r.mode=ht}h>>>=2,d-=2;break;case $:for(h>>>=7&d,d-=7&d;d<32;){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}if((65535&h)!=(h>>>16^65535)){t.msg="invalid stored block lengths",r.mode=ht;break}if(r.length=65535&h,h=0,d=0,r.mode=q,e===C)break t;case q:r.mode=Z;case Z:if(v=r.length){if(v>l&&(v=l),v>_&&(v=_),0===v)break t;m.arraySet(s,i,o,v,a),l-=v,o+=v,_-=v,a+=v,r.length-=v;break}r.mode=Y;break;case J:for(;d<14;){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}if(r.nlen=257+(31&h),h>>>=5,d-=5,r.ndist=1+(31&h),h>>>=5,d-=5,r.ncode=4+(15&h),h>>>=4,d-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=ht;break}r.have=0,r.mode=tt;case tt:for(;r.have<r.ncode;){for(;d<3;){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}r.lens[wt[r.have++]]=7&h,h>>>=3,d-=3}for(;r.have<19;)r.lens[wt[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,Tt={bits:r.lenbits},St=S(T,r.lens,0,19,r.lencode,0,r.work,Tt),r.lenbits=Tt.bits,St){t.msg="invalid code lengths set",r.mode=ht;break}r.have=0,r.mode=et;case et:for(;r.have<r.nlen+r.ndist;){for(;vt=(Ot=r.lencode[h&(1<<r.lenbits)-1])>>>16&255,ft=65535&Ot,!((yt=Ot>>>24)<=d);){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}if(ft<16)h>>>=yt,d-=yt,r.lens[r.have++]=ft;else{if(16===ft){for(Pt=yt+2;d<Pt;){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}if(h>>>=yt,d-=yt,0===r.have){t.msg="invalid bit length repeat",r.mode=ht;break}bt=r.lens[r.have-1],v=3+(3&h),h>>>=2,d-=2}else if(17===ft){for(Pt=yt+3;d<Pt;){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}d-=yt,bt=0,v=3+(7&(h>>>=yt)),h>>>=3,d-=3}else{for(Pt=yt+7;d<Pt;){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}d-=yt,bt=0,v=11+(127&(h>>>=yt)),h>>>=7,d-=7}if(r.have+v>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=ht;break}for(;v--;)r.lens[r.have++]=bt}}if(r.mode===ht)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=ht;break}if(r.lenbits=9,Tt={bits:r.lenbits},St=S(P,r.lens,0,r.nlen,r.lencode,0,r.work,Tt),r.lenbits=Tt.bits,St){t.msg="invalid literal/lengths set",r.mode=ht;break}if(r.distbits=6,r.distcode=r.distdyn,Tt={bits:r.distbits},St=S(O,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,Tt),r.distbits=Tt.bits,St){t.msg="invalid distances set",r.mode=ht;break}if(r.mode=rt,e===C)break t;case rt:r.mode=nt;case nt:if(l>=6&&_>=258){t.next_out=a,t.avail_out=_,t.next_in=o,t.avail_in=l,r.hold=h,r.bits=d,b(t,y),a=t.next_out,s=t.output,_=t.avail_out,o=t.next_in,i=t.input,l=t.avail_in,h=r.hold,d=r.bits,r.mode===Y&&(r.back=-1);break}for(r.back=0;vt=(Ot=r.lencode[h&(1<<r.lenbits)-1])>>>16&255,ft=65535&Ot,!((yt=Ot>>>24)<=d);){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}if(vt&&!(240&vt)){for(mt=yt,gt=vt,xt=ft;vt=(Ot=r.lencode[xt+((h&(1<<mt+gt)-1)>>mt)])>>>16&255,ft=65535&Ot,!(mt+(yt=Ot>>>24)<=d);){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}h>>>=mt,d-=mt,r.back+=mt}if(h>>>=yt,d-=yt,r.back+=yt,r.length=ft,0===vt){r.mode=lt;break}if(32&vt){r.back=-1,r.mode=Y;break}if(64&vt){t.msg="invalid literal/length code",r.mode=ht;break}r.extra=15&vt,r.mode=it;case it:if(r.extra){for(Pt=r.extra;d<Pt;){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}r.length+=h&(1<<r.extra)-1,h>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=st;case st:for(;vt=(Ot=r.distcode[h&(1<<r.distbits)-1])>>>16&255,ft=65535&Ot,!((yt=Ot>>>24)<=d);){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}if(!(240&vt)){for(mt=yt,gt=vt,xt=ft;vt=(Ot=r.distcode[xt+((h&(1<<mt+gt)-1)>>mt)])>>>16&255,ft=65535&Ot,!(mt+(yt=Ot>>>24)<=d);){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}h>>>=mt,d-=mt,r.back+=mt}if(h>>>=yt,d-=yt,r.back+=yt,64&vt){t.msg="invalid distance code",r.mode=ht;break}r.offset=ft,r.extra=15&vt,r.mode=ot;case ot:if(r.extra){for(Pt=r.extra;d<Pt;){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}r.offset+=h&(1<<r.extra)-1,h>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=ht;break}r.mode=at;case at:if(0===_)break t;if(v=y-_,r.offset>v){if((v=r.offset-v)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=ht;break}v>r.wnext?(v-=r.wnext,f=r.wsize-v):f=r.wnext-v,v>r.length&&(v=r.length),pt=r.window}else pt=s,f=a-r.offset,v=r.length;v>_&&(v=_),_-=v,r.length-=v;do{s[a++]=pt[f++]}while(--v);0===r.length&&(r.mode=nt);break;case lt:if(0===_)break t;s[a++]=r.length,_--,r.mode=nt;break;case _t:if(r.wrap){for(;d<32;){if(0===l)break t;l--,h|=i[o++]<<d,d+=8}if(y-=_,t.total_out+=y,r.total+=y,y&&(t.adler=r.check=r.flags?x(r.check,s,y,a-y):g(r.check,s,y,a-y)),y=_,(r.flags?h:n(h))!==r.check){t.msg="incorrect data check",r.mode=ht;break}h=0,d=0}r.mode=ut;case ut:if(r.wrap&&r.flags){for(;d<32;){if(0===l)break t;l--,h+=i[o++]<<d,d+=8}if(h!==(4294967295&r.total)){t.msg="incorrect length check",r.mode=ht;break}h=0,d=0}r.mode=ct;case ct:St=A;break t;case ht:St=D;break t;case dt:return B;default:return I}return t.next_out=a,t.avail_out=_,t.next_in=o,t.avail_in=l,r.hold=h,r.bits=d,(r.wsize||y!==t.avail_out&&r.mode<ht&&(r.mode<_t||e!==M))&&c(t,t.output,t.next_out,y-t.avail_out)?(r.mode=dt,B):(p-=t.avail_in,y-=t.avail_out,t.total_in+=p,t.total_out+=y,r.total+=y,r.wrap&&y&&(t.adler=r.check=r.flags?x(r.check,s,y,t.next_out-y):g(r.check,s,y,t.next_out-y)),t.data_type=r.bits+(r.last?64:0)+(r.mode===Y?128:0)+(r.mode===rt||r.mode===q?256:0),(0===p&&0===y||e===M)&&St===E&&(St=k),St)}function d(t){if(!t||!t.state)return I;var e=t.state;return e.window&&(e.window=null),t.state=null,E}function p(t,e){var r;return t&&t.state&&2&(r=t.state).wrap?(r.head=e,e.done=!1,E):I}function y(t,e){var r,n=e.length;return t&&t.state?0!==(r=t.state).wrap&&r.mode!==K?I:r.mode===K&&g(1,e,n,0)!==r.check?D:c(t,e,n,n)?(r.mode=dt,B):(r.havedict=1,E):I}var v,f,m=t("../utils/common"),g=t("./adler32"),x=t("./crc32"),b=t("./inffast"),S=t("./inftrees"),T=0,P=1,O=2,M=4,w=5,C=6,E=0,A=1,R=2,I=-2,D=-3,B=-4,k=-5,U=8,F=1,L=2,G=3,j=4,N=5,z=6,W=7,V=8,H=9,X=10,K=11,Y=12,Q=13,$=14,q=15,Z=16,J=17,tt=18,et=19,rt=20,nt=21,it=22,st=23,ot=24,at=25,lt=26,_t=27,ut=28,ct=29,ht=30,dt=31,pt=852,yt=592,vt=15,ft=!0;r.inflateReset=o,r.inflateReset2=a,r.inflateResetKeep=s,r.inflateInit=_,r.inflateInit2=l,r.inflate=h,r.inflateEnd=d,r.inflateGetHeader=p,r.inflateSetDictionary=y,r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(t,e,r){"use strict";var n=t("../utils/common"),i=15,s=852,o=592,a=0,l=1,_=2,u=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],c=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],h=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],d=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];e.exports=function(t,e,r,p,y,v,f,m){var g,x,b,S,T,P,O,M,w,C=m.bits,E=0,A=0,R=0,I=0,D=0,B=0,k=0,U=0,F=0,L=0,G=null,j=0,N=new n.Buf16(i+1),z=new n.Buf16(i+1),W=null,V=0;for(E=0;E<=i;E++)N[E]=0;for(A=0;A<p;A++)N[e[r+A]]++;for(D=C,I=i;I>=1&&0===N[I];I--);if(D>I&&(D=I),0===I)return y[v++]=20971520,y[v++]=20971520,m.bits=1,0;for(R=1;R<I&&0===N[R];R++);for(D<R&&(D=R),U=1,E=1;E<=i;E++)if(U<<=1,(U-=N[E])<0)return-1;if(U>0&&(t===a||1!==I))return-1;for(z[1]=0,E=1;E<i;E++)z[E+1]=z[E]+N[E];for(A=0;A<p;A++)0!==e[r+A]&&(f[z[e[r+A]]++]=A);if(t===a?(G=W=f,P=19):t===l?(G=u,j-=257,W=c,V-=257,P=256):(G=h,W=d,P=-1),L=0,A=0,E=R,T=v,B=D,k=0,b=-1,S=(F=1<<D)-1,t===l&&F>s||t===_&&F>o)return 1;for(;;){O=E-k,f[A]<P?(M=0,w=f[A]):f[A]>P?(M=W[V+f[A]],w=G[j+f[A]]):(M=96,w=0),g=1<<E-k,R=x=1<<B;do{y[T+(L>>k)+(x-=g)]=O<<24|M<<16|w}while(0!==x);for(g=1<<E-1;L&g;)g>>=1;if(0!==g?(L&=g-1,L+=g):L=0,A++,0==--N[E]){if(E===I)break;E=e[r+f[A]]}if(E>D&&(L&S)!==b){for(0===k&&(k=D),T+=R,U=1<<(B=E-k);B+k<I&&!((U-=N[B+k])<=0);)B++,U<<=1;if(F+=1<<B,t===l&&F>s||t===_&&F>o)return 1;y[b=L&S]=D<<24|B<<16|T-v}}return 0!==L&&(y[T+L]=E-k<<24|64<<16),m.bits=D,0}},{"../utils/common":1}],10:[function(t,e,r){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],11:[function(t,e,r){"use strict";function n(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}e.exports=n},{}],"/lib/inflate.js":[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&!(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var r=o.inflateInit2(this.strm,e.windowBits);if(r!==_.Z_OK)throw new Error(u[r]);this.header=new h,o.inflateGetHeader(this.strm,this.header)}function i(t,e){var r=new n(e);if(r.push(t,!0),r.err)throw r.msg;return r.result}function s(t,e){return(e=e||{}).raw=!0,i(t,e)}var o=t("./zlib/inflate"),a=t("./utils/common"),l=t("./utils/strings"),_=t("./zlib/constants"),u=t("./zlib/messages"),c=t("./zlib/zstream"),h=t("./zlib/gzheader"),d=Object.prototype.toString;n.prototype.push=function(t,e){var r,n,i,s,u,c,h=this.strm,p=this.options.chunkSize,y=this.options.dictionary,v=!1;if(this.ended)return!1;n=e===~~e?e:!0===e?_.Z_FINISH:_.Z_NO_FLUSH,"string"==typeof t?h.input=l.binstring2buf(t):"[object ArrayBuffer]"===d.call(t)?h.input=new Uint8Array(t):h.input=t,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new a.Buf8(p),h.next_out=0,h.avail_out=p),(r=o.inflate(h,_.Z_NO_FLUSH))===_.Z_NEED_DICT&&y&&(c="string"==typeof y?l.string2buf(y):"[object ArrayBuffer]"===d.call(y)?new Uint8Array(y):y,r=o.inflateSetDictionary(this.strm,c)),r===_.Z_BUF_ERROR&&!0===v&&(r=_.Z_OK,v=!1),r!==_.Z_STREAM_END&&r!==_.Z_OK)return this.onEnd(r),this.ended=!0,!1;h.next_out&&(0!==h.avail_out&&r!==_.Z_STREAM_END&&(0!==h.avail_in||n!==_.Z_FINISH&&n!==_.Z_SYNC_FLUSH)||("string"===this.options.to?(i=l.utf8border(h.output,h.next_out),s=h.next_out-i,u=l.buf2string(h.output,i),h.next_out=s,h.avail_out=p-s,s&&a.arraySet(h.output,h.output,i,s,0),this.onData(u)):this.onData(a.shrinkBuf(h.output,h.next_out)))),0===h.avail_in&&0===h.avail_out&&(v=!0)}while((h.avail_in>0||0===h.avail_out)&&r!==_.Z_STREAM_END);return r===_.Z_STREAM_END&&(n=_.Z_FINISH),n===_.Z_FINISH?(r=o.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===_.Z_OK):n!==_.Z_SYNC_FLUSH||(this.onEnd(_.Z_OK),h.avail_out=0,!0)},n.prototype.onData=function(t){this.chunks.push(t)},n.prototype.onEnd=function(t){t===_.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},r.Inflate=n,r.inflate=i,r.inflateRaw=s,r.ungzip=i},{"./utils/common":1,"./utils/strings":2,"./zlib/constants":4,"./zlib/gzheader":6,"./zlib/inflate":8,"./zlib/messages":10,"./zlib/zstream":11}]},{},[])("/lib/inflate.js")},40:(t,e,r)=>{
2
+ /*!
3
+ * pixi-filters - v6.0.4
4
+ * Compiled Wed, 05 Jun 2024 13:48:17 UTC
5
+ *
6
+ * pixi-filters is licensed under the MIT License.
7
+ * http://www.opensource.org/licenses/mit-license
8
+ *
9
+ * Copyright 2024, undefined, All Rights Reserved
10
+ */
11
+ globalThis.PIXI.filters=function(t,e){"use strict";var n="in vec2 aPosition;\n out vec2 vTextureCoord;\n\n uniform vec4 uInputSize;\n uniform vec4 uOutputFrame;\n uniform vec4 uOutputTexture;\n \n vec4 filterVertexPosition( void )\n {\n\t vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n\t \n\t position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n\t position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n \n\t return vec4(position, 0.0, 1.0);\n }\n \n vec2 filterTextureCoord( void )\n {\n\t return aPosition * (uOutputFrame.zw * uInputSize.zw);\n }\n \n void main(void)\n {\n\t gl_Position = filterVertexPosition();\n\t vTextureCoord = filterTextureCoord();\n }\n ",i="struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n struct VSOutput {\n\t @builtin(position) position: vec4<f32>,\n\t @location(0) uv : vec2<f32>\n };\n \n fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n {\n\t var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n \n\t position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n\t position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n \n\t return vec4(position, 0.0, 1.0);\n }\n \n fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n {\n\t return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n }\n \n fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n {\n return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \n }\n \n fn getSize() -> vec2<f32>\n {\n return gfu.uGlobalFrame.zw;\n }\n \n @vertex\n fn mainVertex(\n @location(0) aPosition : vec2<f32>, \n ) -> VSOutput {\n return VSOutput(\n\tfilterVertexPosition(aPosition),\n\tfilterTextureCoord(aPosition)\n );\n }",s=Object.defineProperty,o=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,_=(t,e,r)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,u=(t,e)=>{for(var r in e||(e={}))a.call(e,r)&&_(t,r,e[r]);if(o)for(var r of o(e))l.call(e,r)&&_(t,r,e[r]);return t},c=(t,e,r)=>(_(t,"symbol"!=typeof e?e+"":e,r),r);const h=class t extends e.Filter{constructor(r){r=u(u({},t.DEFAULT_OPTIONS),r);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct AdjustmentUniforms {\n uGamma: f32,\n uContrast: f32,\n uSaturation: f32,\n uBrightness: f32,\n uColor: vec4<f32>,\n };\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> adjustmentUniforms : AdjustmentUniforms;\n \n @fragment\n fn mainFragment(\n @location(0) uv: vec2<f32>,\n @builtin(position) position: vec4<f32>\n ) -> @location(0) vec4<f32> {\n var sample = textureSample(uTexture, uSampler, uv);\n let color = adjustmentUniforms.uColor;\n \n if (sample.a > 0.0) \n {\n\t sample = vec4<f32>(sample.rgb / sample.a, sample.a);\n\t var rgb: vec3<f32> = pow(sample.rgb, vec3<f32>(1. / adjustmentUniforms.uGamma));\n\t rgb = mix(vec3<f32>(.5), mix(vec3<f32>(dot(vec3<f32>(.2125, .7154, .0721), rgb)), rgb, adjustmentUniforms.uSaturation), adjustmentUniforms.uContrast);\n\t rgb.r *= color.r;\n\t rgb.g *= color.g;\n\t rgb.b *= color.b;\n\t sample = vec4<f32>(rgb.rgb * adjustmentUniforms.uBrightness, sample.a);\n\t sample = vec4<f32>(sample.rgb * sample.a, sample.a);\n }\n \n return sample * color.a;\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform float uGamma;\n uniform float uContrast;\n uniform float uSaturation;\n uniform float uBrightness;\n uniform vec4 uColor;\n \n void main()\n {\n\t vec4 c = texture(uTexture, vTextureCoord);\n \n\t if (c.a > 0.0) {\n\t\t c.rgb /= c.a;\n \n\t\t vec3 rgb = pow(c.rgb, vec3(1. / uGamma));\n\t\t rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, uSaturation), uContrast);\n\t\t rgb.r *= uColor.r;\n\t\t rgb.g *= uColor.g;\n\t\t rgb.b *= uColor.b;\n\t\t c.rgb = rgb * uBrightness;\n \n\t\t c.rgb *= c.a;\n\t }\n \n\t finalColor = c * uColor.a;\n }\n ",name:"adjustment-filter"}),resources:{adjustmentUniforms:{uGamma:{value:r.gamma,type:"f32"},uContrast:{value:r.contrast,type:"f32"},uSaturation:{value:r.saturation,type:"f32"},uBrightness:{value:r.brightness,type:"f32"},uColor:{value:[r.red,r.green,r.blue,r.alpha],type:"vec4<f32>"}}}}),c(this,"uniforms"),this.uniforms=this.resources.adjustmentUniforms.uniforms}get gamma(){return this.uniforms.uGamma}set gamma(t){this.uniforms.uGamma=t}get contrast(){return this.uniforms.uContrast}set contrast(t){this.uniforms.uContrast=t}get saturation(){return this.uniforms.uSaturation}set saturation(t){this.uniforms.uSaturation=t}get brightness(){return this.uniforms.uBrightness}set brightness(t){this.uniforms.uBrightness=t}get red(){return this.uniforms.uColor[0]}set red(t){this.uniforms.uColor[0]=t}get green(){return this.uniforms.uColor[1]}set green(t){this.uniforms.uColor[1]=t}get blue(){return this.uniforms.uColor[2]}set blue(t){this.uniforms.uColor[2]=t}get alpha(){return this.uniforms.uColor[3]}set alpha(t){this.uniforms.uColor[3]=t}};c(h,"DEFAULT_OPTIONS",{gamma:1,contrast:1,saturation:1,brightness:1,red:1,green:1,blue:1,alpha:1});let d=h;var p=Object.defineProperty,y=Object.getOwnPropertySymbols,v=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable,m=(t,e,r)=>e in t?p(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,g=(t,e)=>{for(var r in e||(e={}))v.call(e,r)&&m(t,r,e[r]);if(y)for(var r of y(e))f.call(e,r)&&m(t,r,e[r]);return t},x=(t,e,r)=>(m(t,"symbol"!=typeof e?e+"":e,r),r);const b=class t extends e.Filter{constructor(...r){var s,o,a;let l=null!=(s=r[0])?s:{};("number"==typeof l||Array.isArray(l))&&(e.deprecation("6.0.0","KawaseBlurFilter constructor params are now options object. See params: { strength, quality, clamp, pixelSize }"),l={strength:l},void 0!==r[1]&&(l.quality=r[1]),void 0!==r[2]&&(l.clamp=r[2])),l=g(g({},t.DEFAULT_OPTIONS),l);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:null!=l&&l.clamp?"struct KawaseBlurUniforms {\n uOffset:vec2<f32>,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> kawaseBlurUniforms : KawaseBlurUniforms;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n let uOffset = kawaseBlurUniforms.uOffset;\n var color: vec4<f32> = vec4(0.0);\n \n // Sample top left pixel\n color += textureSample(uTexture, uSampler, clamp(vec2<f32>(uv.x - uOffset.x, uv.y + uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n // Sample top right pixel\n color += textureSample(uTexture, uSampler, clamp(vec2<f32>(uv.x + uOffset.x, uv.y + uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n // Sample bottom right pixel\n color += textureSample(uTexture, uSampler, clamp(vec2<f32>(uv.x + uOffset.x, uv.y - uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n // Sample bottom left pixel\n color += textureSample(uTexture, uSampler, clamp(vec2<f32>(uv.x - uOffset.x, uv.y - uOffset.y), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n // Average\n color *= 0.25;\n\t \n return color;\n }":"struct KawaseBlurUniforms {\n uOffset:vec2<f32>,\n };\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> kawaseBlurUniforms : KawaseBlurUniforms;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n let uOffset = kawaseBlurUniforms.uOffset;\n var color: vec4<f32> = vec4<f32>(0.0);\n \n // Sample top left pixel\n color += textureSample(uTexture, uSampler, vec2<f32>(uv.x - uOffset.x, uv.y + uOffset.y));\n // Sample top right pixel\n color += textureSample(uTexture, uSampler, vec2<f32>(uv.x + uOffset.x, uv.y + uOffset.y));\n // Sample bottom right pixel\n color += textureSample(uTexture, uSampler, vec2<f32>(uv.x + uOffset.x, uv.y - uOffset.y));\n // Sample bottom left pixel\n color += textureSample(uTexture, uSampler, vec2<f32>(uv.x - uOffset.x, uv.y - uOffset.y));\n // Average\n color *= 0.25;\n \n return color;\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:null!=l&&l.clamp?"\n precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform vec2 uOffset;\n \n uniform vec4 uInputClamp;\n \n void main(void)\n {\n\t vec4 color = vec4(0.0);\n \n\t // Sample top left pixel\n\t color += texture(uTexture, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), uInputClamp.xy, uInputClamp.zw));\n \n\t // Sample top right pixel\n\t color += texture(uTexture, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), uInputClamp.xy, uInputClamp.zw));\n \n\t // Sample bottom right pixel\n\t color += texture(uTexture, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), uInputClamp.xy, uInputClamp.zw));\n \n\t // Sample bottom left pixel\n\t color += texture(uTexture, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), uInputClamp.xy, uInputClamp.zw));\n \n\t // Average\n\t color *= 0.25;\n \n\t finalColor = color;\n }\n ":"\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform vec2 uOffset;\n \n void main(void)\n {\n\t vec4 color = vec4(0.0);\n \n\t // Sample top left pixel\n\t color += texture(uTexture, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\n \n\t // Sample top right pixel\n\t color += texture(uTexture, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\n \n\t // Sample bottom right pixel\n\t color += texture(uTexture, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\n \n\t // Sample bottom left pixel\n\t color += texture(uTexture, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\n \n\t // Average\n\t color *= 0.25;\n \n\t finalColor = color;\n }",name:"kawase-blur-filter"}),resources:{kawaseBlurUniforms:{uOffset:{value:new Float32Array(2),type:"vec2<f32>"}}}}),x(this,"uniforms"),x(this,"_pixelSize",{x:0,y:0}),x(this,"_clamp"),x(this,"_kernels",[]),x(this,"_blur"),x(this,"_quality"),this.uniforms=this.resources.kawaseBlurUniforms.uniforms,this.pixelSize=null!=(o=l.pixelSize)?o:{x:1,y:1},Array.isArray(l.strength)?this.kernels=l.strength:"number"==typeof l.strength&&(this._blur=l.strength,this.quality=null!=(a=l.quality)?a:3),this._clamp=!!l.clamp}apply(t,r,n,i){const s=this.pixelSizeX/r.source.width,o=this.pixelSizeY/r.source.height;let a;if(1===this._quality||0===this._blur)a=this._kernels[0]+.5,this.uniforms.uOffset[0]=a*s,this.uniforms.uOffset[1]=a*o,t.applyFilter(this,r,n,i);else{const l=e.TexturePool.getSameSizeTexture(r);let _,u=r,c=l;const h=this._quality-1;for(let e=0;e<h;e++)a=this._kernels[e]+.5,this.uniforms.uOffset[0]=a*s,this.uniforms.uOffset[1]=a*o,t.applyFilter(this,u,c,!0),_=u,u=c,c=_;a=this._kernels[h]+.5,this.uniforms.uOffset[0]=a*s,this.uniforms.uOffset[1]=a*o,t.applyFilter(this,u,n,i),e.TexturePool.returnTexture(l)}}get strength(){return this._blur}set strength(t){this._blur=t,this._generateKernels()}get quality(){return this._quality}set quality(t){this._quality=Math.max(1,Math.round(t)),this._generateKernels()}get kernels(){return this._kernels}set kernels(t){Array.isArray(t)&&t.length>0?(this._kernels=t,this._quality=t.length,this._blur=Math.max(...t)):(this._kernels=[0],this._quality=1)}get pixelSize(){return this._pixelSize}set pixelSize(t){if("number"!=typeof t)return Array.isArray(t)?(this.pixelSizeX=t[0],void(this.pixelSizeY=t[1])):void(this._pixelSize=t);this.pixelSizeX=this.pixelSizeY=t}get pixelSizeX(){return this.pixelSize.x}set pixelSizeX(t){this.pixelSize.x=t}get pixelSizeY(){return this.pixelSize.y}set pixelSizeY(t){this.pixelSize.y=t}get clamp(){return this._clamp}_updatePadding(){this.padding=Math.ceil(this._kernels.reduce(((t,e)=>t+e+.5),0))}_generateKernels(){const t=this._blur,e=this._quality,r=[t];if(t>0){let n=t;const i=t/e;for(let t=1;t<e;t++)n-=i,r.push(n)}this._kernels=r,this._updatePadding()}};x(b,"DEFAULT_OPTIONS",{strength:4,quality:3,clamp:!1,pixelSize:{x:1,y:1}});let S=b;var T=Object.defineProperty,P=Object.getOwnPropertySymbols,O=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,w=(t,e,r)=>e in t?T(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,C=(t,e)=>{for(var r in e||(e={}))O.call(e,r)&&w(t,r,e[r]);if(P)for(var r of P(e))M.call(e,r)&&w(t,r,e[r]);return t},E=(t,e,r)=>(w(t,"symbol"!=typeof e?e+"":e,r),r);const A=class t extends e.Filter{constructor(r){r=C(C({},t.DEFAULT_OPTIONS),r);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct ExtractBrightnessUniforms {\n uThreshold: f32,\n };\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> extractBrightnessUniforms : ExtractBrightnessUniforms;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n let color: vec4<f32> = textureSample(uTexture, uSampler, uv);\n \n // A simple & fast algorithm for getting brightness.\n // It's inaccurate, but good enough for this feature.\n let max: f32 = max(max(color.r, color.g), color.b);\n let min: f32 = min(min(color.r, color.g), color.b);\n let brightness: f32 = (max + min) * 0.5;\n \n return select(vec4<f32>(0.), color, brightness > extractBrightnessUniforms.uThreshold);\n }\n ",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform float uThreshold;\n \n void main() {\n\t vec4 color = texture(uTexture, vTextureCoord);\n \n\t // A simple & fast algorithm for getting brightness.\n\t // It's inaccuracy , but good enought for this feature.\n\t float _max = max(max(color.r, color.g), color.b);\n\t float _min = min(min(color.r, color.g), color.b);\n\t float brightness = (_max + _min) * 0.5;\n \n\t if(brightness > uThreshold) {\n\t\t finalColor = color;\n\t } else {\n\t\t finalColor = vec4(0.0, 0.0, 0.0, 0.0);\n\t }\n }\n ",name:"extract-brightness-filter"}),resources:{extractBrightnessUniforms:{uThreshold:{value:r.threshold,type:"f32"}}}}),E(this,"uniforms"),this.uniforms=this.resources.extractBrightnessUniforms.uniforms}get threshold(){return this.uniforms.uThreshold}set threshold(t){this.uniforms.uThreshold=t}};E(A,"DEFAULT_OPTIONS",{threshold:.5});let R=A;var I=Object.defineProperty,D=Object.getOwnPropertySymbols,B=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable,U=(t,e,r)=>e in t?I(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,F=(t,e)=>{for(var r in e||(e={}))B.call(e,r)&&U(t,r,e[r]);if(D)for(var r of D(e))k.call(e,r)&&U(t,r,e[r]);return t},L=(t,e,r)=>(U(t,"symbol"!=typeof e?e+"":e,r),r);const G=class t extends e.Filter{constructor(r){var s;r=F(F({},t.DEFAULT_OPTIONS),r);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct AdvancedBloomUniforms {\n uBloomScale: f32,\n uBrightness: f32,\n };\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> advancedBloomUniforms : AdvancedBloomUniforms;\n @group(1) @binding(1) var uMapTexture: texture_2d<f32>;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n var color = textureSample(uTexture, uSampler, uv);\n color = vec4<f32>(color.rgb * advancedBloomUniforms.uBrightness, color.a);\n \n var bloomColor = vec4<f32>(textureSample(uMapTexture, uSampler, uv).rgb, 0.0);\n bloomColor = vec4<f32>(bloomColor.rgb * advancedBloomUniforms.uBloomScale, bloomColor.a);\n \n return color + bloomColor;\n }\n ",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform sampler2D uMapTexture;\n uniform float uBloomScale;\n uniform float uBrightness;\n \n void main() {\n\t vec4 color = texture(uTexture, vTextureCoord);\n\t color.rgb *= uBrightness;\n\t vec4 bloomColor = vec4(texture(uMapTexture, vTextureCoord).rgb, 0.0);\n\t bloomColor.rgb *= uBloomScale;\n\t finalColor = color + bloomColor;\n }\n ",name:"advanced-bloom-filter"}),resources:{advancedBloomUniforms:{uBloomScale:{value:r.bloomScale,type:"f32"},uBrightness:{value:r.brightness,type:"f32"}},uMapTexture:e.Texture.WHITE}}),L(this,"uniforms"),L(this,"bloomScale",1),L(this,"brightness",1),L(this,"_extractFilter"),L(this,"_blurFilter"),this.uniforms=this.resources.advancedBloomUniforms.uniforms,this._extractFilter=new R({threshold:r.threshold}),this._blurFilter=new S({strength:null!=(s=r.kernels)?s:r.blur,quality:r.kernels?void 0:r.quality}),Object.assign(this,r)}apply(t,r,n,i){const s=e.TexturePool.getSameSizeTexture(r);this._extractFilter.apply(t,r,s,!0);const o=e.TexturePool.getSameSizeTexture(r);this._blurFilter.apply(t,s,o,!0),this.uniforms.uBloomScale=this.bloomScale,this.uniforms.uBrightness=this.brightness,this.resources.uMapTexture=o.source,t.applyFilter(this,r,n,i),e.TexturePool.returnTexture(o),e.TexturePool.returnTexture(s)}get threshold(){return this._extractFilter.threshold}set threshold(t){this._extractFilter.threshold=t}get kernels(){return this._blurFilter.kernels}set kernels(t){this._blurFilter.kernels=t}get blur(){return this._blurFilter.strength}set blur(t){this._blurFilter.strength=t}get quality(){return this._blurFilter.quality}set quality(t){this._blurFilter.quality=t}get pixelSize(){return this._blurFilter.pixelSize}set pixelSize(t){"number"==typeof t&&(t={x:t,y:t}),Array.isArray(t)&&(t={x:t[0],y:t[1]}),this._blurFilter.pixelSize=t}get pixelSizeX(){return this._blurFilter.pixelSizeX}set pixelSizeX(t){this._blurFilter.pixelSizeX=t}get pixelSizeY(){return this._blurFilter.pixelSizeY}set pixelSizeY(t){this._blurFilter.pixelSizeY=t}};L(G,"DEFAULT_OPTIONS",{threshold:.5,bloomScale:1,brightness:1,blur:8,quality:4,pixelSize:{x:1,y:1}});let j=G;var N=Object.defineProperty,z=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,H=(t,e,r)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,X=(t,e)=>{for(var r in e||(e={}))W.call(e,r)&&H(t,r,e[r]);if(z)for(var r of z(e))V.call(e,r)&&H(t,r,e[r]);return t},K=(t,e,r)=>(H(t,"symbol"!=typeof e?e+"":e,r),r);const Y=class t extends e.Filter{constructor(...r){var s,o;let a=null!=(s=r[0])?s:{};"number"==typeof a&&(e.deprecation("6.0.0","AsciiFilter constructor params are now options object. See params: { size, color, replaceColor }"),a={size:a});const l=(null==a?void 0:a.color)&&!1!==a.replaceColor;a=X(X({},t.DEFAULT_OPTIONS),a);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct AsciiUniforms {\n\t uSize: f32,\n\t uColor: vec3<f32>,\n\t uReplaceColor: f32,\n };\n \n struct GlobalFilterUniforms {\n\t uInputSize:vec4<f32>,\n\t uInputPixel:vec4<f32>,\n\t uInputClamp:vec4<f32>,\n\t uOutputFrame:vec4<f32>,\n\t uGlobalFrame:vec4<f32>,\n\t uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> asciiUniforms : AsciiUniforms;\n \n @fragment\n fn mainFragment(\n\t @location(0) uv: vec2<f32>,\n\t @builtin(position) position: vec4<f32>\n ) -> @location(0) vec4<f32> {\n\t let pixelSize: f32 = asciiUniforms.uSize;\n\t let coord: vec2<f32> = mapCoord(uv);\n \n\t // get the rounded color..\n\t var pixCoord: vec2<f32> = pixelate(coord, vec2<f32>(pixelSize));\n\t pixCoord = unmapCoord(pixCoord);\n \n\t var color = textureSample(uTexture, uSampler, pixCoord);\n \n\t // determine the character to use\n\t let gray: f32 = 0.3 * color.r + 0.59 * color.g + 0.11 * color.b;\n\t \n\t var n: f32 = 65536.0; // .\n\t if (gray > 0.2) {\n\t\t n = 65600.0; // :\n\t }\n\t if (gray > 0.3) {\n\t\t n = 332772.0; // *\n\t }\n\t if (gray > 0.4) {\n\t\t n = 15255086.0; // o\n\t }\n\t if (gray > 0.5) {\n\t\t n = 23385164.0; // &\n\t }\n\t if (gray > 0.6) {\n\t\t n = 15252014.0; // 8\n\t }\n\t if (gray > 0.7) {\n\t\t n = 13199452.0; // @\n\t }\n\t if (gray > 0.8) {\n\t\t n = 11512810.0; // #\n\t }\n \n\t // get the mod..\n\t let modd: vec2<f32> = getMod(coord, vec2<f32>(pixelSize));\n\t return select(color, vec4<f32>(asciiUniforms.uColor, 1.), asciiUniforms.uReplaceColor > 0.5) * character(n, vec2<f32>(-1.0) + modd * 2.0);\n }\n \n fn pixelate(coord: vec2<f32>, size: vec2<f32>) -> vec2<f32>\n {\n\t return floor( coord / size ) * size;\n }\n \n fn getMod(coord: vec2<f32>, size: vec2<f32>) -> vec2<f32>\n {\n\t return moduloVec2( coord , size) / size;\n }\n \n fn character(n: f32, p: vec2<f32>) -> f32\n {\n\t var q: vec2<f32> = floor(p*vec2<f32>(4.0, 4.0) + 2.5);\n \n\t if (clamp(q.x, 0.0, 4.0) == q.x)\n\t {\n\t\t if (clamp(q.y, 0.0, 4.0) == q.y)\n\t\t {\n\t\t if (i32(modulo(n/exp2(q.x + 5.0*q.y), 2.0)) == 1)\n\t\t {\n\t\t\t return 1.0;\n\t\t }\n\t\t }\n\t }\n \n\t return 0.0;\n }\n \n fn modulo(x: f32, y: f32) -> f32\n {\n return x - y * floor(x/y);\n }\n \n fn moduloVec2(x: vec2<f32>, y: vec2<f32>) -> vec2<f32>\n {\n return x - y * floor(x/y);\n }\n \n fn mapCoord(coord: vec2<f32> ) -> vec2<f32>\n {\n\t var mappedCoord: vec2<f32> = coord;\n\t mappedCoord *= gfu.uInputSize.xy;\n\t mappedCoord += gfu.uOutputFrame.xy;\n\t return mappedCoord;\n }\n \n fn unmapCoord(coord: vec2<f32> ) -> vec2<f32>\n {\n\t var mappedCoord: vec2<f32> = coord;\n\t mappedCoord -= gfu.uOutputFrame.xy;\n\t mappedCoord /= gfu.uInputSize.xy;\n\t return mappedCoord;\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform float uSize;\n uniform vec3 uColor;\n uniform float uReplaceColor;\n \n uniform vec4 uInputSize;\n \n vec2 mapCoord( vec2 coord )\n {\n\t coord *= uInputSize.xy;\n\t coord += uInputSize.zw;\n \n\t return coord;\n }\n \n vec2 unmapCoord( vec2 coord )\n {\n\t coord -= uInputSize.zw;\n\t coord /= uInputSize.xy;\n \n\t return coord;\n }\n \n vec2 pixelate(vec2 coord, vec2 size)\n {\n\t return floor(coord / size) * size;\n }\n \n vec2 getMod(vec2 coord, vec2 size)\n {\n\t return mod(coord, size) / size;\n }\n \n float character(float n, vec2 p)\n {\n\t p = floor(p*vec2(4.0, 4.0) + 2.5);\n \n\t if (clamp(p.x, 0.0, 4.0) == p.x)\n\t {\n\t\t if (clamp(p.y, 0.0, 4.0) == p.y)\n\t\t {\n\t\t\t if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n\t\t }\n\t }\n\t return 0.0;\n }\n \n void main()\n {\n\t vec2 coord = mapCoord(vTextureCoord);\n \n\t // get the grid position\n\t vec2 pixCoord = pixelate(coord, vec2(uSize));\n\t pixCoord = unmapCoord(pixCoord);\n \n\t // sample the color at grid position\n\t vec4 color = texture(uTexture, pixCoord);\n \n\t // brightness of the color as it's perceived by the human eye\n\t float gray = 0.3 * color.r + 0.59 * color.g + 0.11 * color.b;\n \n\t // determine the character to use\n\t float n = 65536.0; // .\n\t if (gray > 0.2) n = 65600.0; // :\n\t if (gray > 0.3) n = 332772.0; // *\n\t if (gray > 0.4) n = 15255086.0; // o\n\t if (gray > 0.5) n = 23385164.0; // &\n\t if (gray > 0.6) n = 15252014.0; // 8\n\t if (gray > 0.7) n = 13199452.0; // @\n\t if (gray > 0.8) n = 11512810.0; // #\n \n\t // get the mod..\n\t vec2 modd = getMod(coord, vec2(uSize));\n \n\t finalColor = (uReplaceColor > 0.5 ? vec4(uColor, 1.) : color) * character( n, vec2(-1.0) + modd * 2.0);\n }\n ",name:"ascii-filter"}),resources:{asciiUniforms:{uSize:{value:a.size,type:"f32"},uColor:{value:new Float32Array(3),type:"vec3<f32>"},uReplaceColor:{value:Number(l),type:"f32"}}}}),K(this,"uniforms"),K(this,"_color"),this.uniforms=this.resources.asciiUniforms.uniforms,this._color=new e.Color,this.color=null!=(o=a.color)?o:16777215}get size(){return this.uniforms.uSize}set size(t){this.uniforms.uSize=t}get color(){return this._color.value}set color(t){this._color.setValue(t);const[e,r,n]=this._color.toArray();this.uniforms.uColor[0]=e,this.uniforms.uColor[1]=r,this.uniforms.uColor[2]=n}get replaceColor(){return this.uniforms.uReplaceColor>.5}set replaceColor(t){this.uniforms.uReplaceColor=t?1:0}};K(Y,"DEFAULT_OPTIONS",{size:8,color:16777215,replaceColor:!1});let Q=Y;var $=Object.defineProperty,q=(t,e,r)=>(((t,e,r)=>{e in t?$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r})(t,"symbol"!=typeof e?e+"":e,r),r);class Z extends e.BlurFilter{constructor(t){super(t),q(this,"_blendPass"),this.blendRequired=!0,this.padding=0,this._blendPass=new e.Filter({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"@group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var uBackground: texture_2d<f32>; \n \n @fragment\n fn mainFragment(\n\t @builtin(position) position: vec4<f32>,\n\t @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n\t var front: vec4<f32> = textureSample(uTexture, uSampler, uv);\n\t var back: vec4<f32> = textureSample(uBackground, uSampler, uv);\n\t \n\t if (front.a == 0.0) {\n\t\t discard;\n\t }\n \n\t var color: vec3<f32> = mix(back.rgb, front.rgb / front.a, front.a);\n \n\t return vec4<f32>(color, 1.0);\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform sampler2D uBackground;\n \n void main(void){\n\t vec4 front = texture(uTexture, vTextureCoord);\n\t vec4 back = texture(uBackground, vTextureCoord);\n \n\t if (front.a == 0.0) {\n\t\t discard;\n\t }\n\t \n\t vec3 color = mix(back.rgb, front.rgb / front.a, front.a);\n \n\t finalColor = vec4(color, 1.0);\n }",name:"drop-shadow-filter"}),resources:{uBackground:e.Texture.EMPTY}})}apply(t,r,n,i){const s=t._activeFilterData.backTexture,o=e.TexturePool.getSameSizeTexture(r);super.apply(t,s,o,!0),this._blendPass.resources.uBackground=o.source,this._blendPass.apply(t,r,n,i),e.TexturePool.returnTexture(o)}updatePadding(){this.padding=0}}var J=Object.defineProperty,tt=Object.getOwnPropertySymbols,et=Object.prototype.hasOwnProperty,rt=Object.prototype.propertyIsEnumerable,nt=(t,e,r)=>e in t?J(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,it=(t,e)=>{for(var r in e||(e={}))et.call(e,r)&&nt(t,r,e[r]);if(tt)for(var r of tt(e))rt.call(e,r)&&nt(t,r,e[r]);return t},st=(t,e,r)=>(nt(t,"symbol"!=typeof e?e+"":e,r),r);const ot=class t extends e.Filter{constructor(r){var s,o;r=it(it({},t.DEFAULT_OPTIONS),r);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct BevelUniforms {\n uLightColor: vec3<f32>,\n uLightAlpha: f32,\n uShadowColor: vec3<f32>,\n uShadowAlpha: f32,\n uTransform: vec2<f32>,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> bevelUniforms : BevelUniforms;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n let transform = vec2<f32>(1.0 / gfu.uInputSize.xy) * vec2<f32>(bevelUniforms.uTransform.x, bevelUniforms.uTransform.y);\n var color: vec4<f32> = textureSample(uTexture, uSampler, uv);\n let lightSample: f32 = textureSample(uTexture, uSampler, uv - transform).a;\n let shadowSample: f32 = textureSample(uTexture, uSampler, uv + transform).a;\n \n let light = vec4<f32>(bevelUniforms.uLightColor, bevelUniforms.uLightAlpha);\n let shadow = vec4<f32>(bevelUniforms.uShadowColor, bevelUniforms.uShadowAlpha);\n \n color = vec4<f32>(mix(color.rgb, light.rgb, clamp((color.a - lightSample) * light.a, 0.0, 1.0)), color.a);\n color = vec4<f32>(mix(color.rgb, shadow.rgb, clamp((color.a - shadowSample) * shadow.a, 0.0, 1.0)), color.a);\n \n return vec4<f32>(color.rgb * color.a, color.a);\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform vec2 uTransform;\n uniform vec3 uLightColor;\n uniform float uLightAlpha;\n uniform vec3 uShadowColor;\n uniform float uShadowAlpha;\n \n uniform vec4 uInputSize;\n \n void main(void) {\n\t vec2 transform = vec2(1.0 / uInputSize) * vec2(uTransform.x, uTransform.y);\n\t vec4 color = texture(uTexture, vTextureCoord);\n\t float light = texture(uTexture, vTextureCoord - transform).a;\n\t float shadow = texture(uTexture, vTextureCoord + transform).a;\n \n\t color.rgb = mix(color.rgb, uLightColor, clamp((color.a - light) * uLightAlpha, 0.0, 1.0));\n\t color.rgb = mix(color.rgb, uShadowColor, clamp((color.a - shadow) * uShadowAlpha, 0.0, 1.0));\n\t finalColor = vec4(color.rgb * color.a, color.a);\n }\n ",name:"bevel-filter"}),resources:{bevelUniforms:{uLightColor:{value:new Float32Array(3),type:"vec3<f32>"},uLightAlpha:{value:r.lightAlpha,type:"f32"},uShadowColor:{value:new Float32Array(3),type:"vec3<f32>"},uShadowAlpha:{value:r.shadowAlpha,type:"f32"},uTransform:{value:new Float32Array(2),type:"vec2<f32>"}}},padding:1}),st(this,"uniforms"),st(this,"_thickness"),st(this,"_rotation"),st(this,"_lightColor"),st(this,"_shadowColor"),this.uniforms=this.resources.bevelUniforms.uniforms,this._lightColor=new e.Color,this._shadowColor=new e.Color,this.lightColor=null!=(s=r.lightColor)?s:16777215,this.shadowColor=null!=(o=r.shadowColor)?o:0,Object.assign(this,r)}get rotation(){return this._rotation/e.DEG_TO_RAD}set rotation(t){this._rotation=t*e.DEG_TO_RAD,this._updateTransform()}get thickness(){return this._thickness}set thickness(t){this._thickness=t,this._updateTransform()}get lightColor(){return this._lightColor.value}set lightColor(t){this._lightColor.setValue(t);const[e,r,n]=this._lightColor.toArray();this.uniforms.uLightColor[0]=e,this.uniforms.uLightColor[1]=r,this.uniforms.uLightColor[2]=n}get lightAlpha(){return this.uniforms.uLightAlpha}set lightAlpha(t){this.uniforms.uLightAlpha=t}get shadowColor(){return this._shadowColor.value}set shadowColor(t){this._shadowColor.setValue(t);const[e,r,n]=this._shadowColor.toArray();this.uniforms.uShadowColor[0]=e,this.uniforms.uShadowColor[1]=r,this.uniforms.uShadowColor[2]=n}get shadowAlpha(){return this.uniforms.uShadowAlpha}set shadowAlpha(t){this.uniforms.uShadowAlpha=t}_updateTransform(){this.uniforms.uTransform[0]=this.thickness*Math.cos(this._rotation),this.uniforms.uTransform[1]=this.thickness*Math.sin(this._rotation)}};st(ot,"DEFAULT_OPTIONS",{rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7});let at=ot;var lt=Object.defineProperty,_t=Object.defineProperties,ut=Object.getOwnPropertyDescriptors,ct=Object.getOwnPropertySymbols,ht=Object.prototype.hasOwnProperty,dt=Object.prototype.propertyIsEnumerable,pt=(t,e,r)=>e in t?lt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,yt=(t,e)=>{for(var r in e||(e={}))ht.call(e,r)&&pt(t,r,e[r]);if(ct)for(var r of ct(e))dt.call(e,r)&&pt(t,r,e[r]);return t},vt=(t,e)=>_t(t,ut(e)),ft=(t,e,r)=>(pt(t,"symbol"!=typeof e?e+"":e,r),r);const mt=class t extends e.AlphaFilter{constructor(...r){var n;let i=null!=(n=r[0])?n:{};if("number"==typeof i||Array.isArray(i)||"x"in i&&"y"in i){e.deprecation("6.0.0","BloomFilter constructor params are now options object. See params: { strength, quality, resolution, kernelSize }");let t=i;Array.isArray(t)&&(t={x:t[0],y:t[1]}),i={strength:t},void 0!==r[1]&&(i.quality=r[1]),void 0!==r[2]&&(i.resolution=r[2]),void 0!==r[3]&&(i.kernelSize=r[3])}i=yt(yt({},t.DEFAULT_OPTIONS),i),super(),ft(this,"_blurXFilter"),ft(this,"_blurYFilter"),ft(this,"_strength"),this._strength={x:2,y:2},i.strength&&("number"==typeof i.strength?(this._strength.x=i.strength,this._strength.y=i.strength):(this._strength.x=i.strength.x,this._strength.y=i.strength.y)),this._blurXFilter=new e.BlurFilterPass(vt(yt({},i),{horizontal:!0,strength:this.strengthX})),this._blurYFilter=new e.BlurFilterPass(vt(yt({},i),{horizontal:!1,strength:this.strengthY})),this._blurYFilter.blendMode="screen",Object.assign(this,i)}apply(t,r,n,i){const s=e.TexturePool.getSameSizeTexture(r);t.applyFilter(this,r,n,i),this._blurXFilter.apply(t,r,s,!0),this._blurYFilter.apply(t,s,n,!1),e.TexturePool.returnTexture(s)}get strength(){return this._strength}set strength(t){this._strength="number"==typeof t?{x:t,y:t}:t,this._updateStrength()}get strengthX(){return this.strength.x}set strengthX(t){this.strength.x=t,this._updateStrength()}get strengthY(){return this.strength.y}set strengthY(t){this.strength.y=t,this._updateStrength()}_updateStrength(){this._blurXFilter.blur=this.strengthX,this._blurYFilter.blur=this.strengthY}get blur(){return e.deprecation("6.0.0","BloomFilter.blur is deprecated, please use BloomFilter.strength instead"),this.strengthX}set blur(t){e.deprecation("6.0.0","BloomFilter.blur is deprecated, please use BloomFilter.strength instead"),this.strength=t}get blurX(){return e.deprecation("6.0.0","BloomFilter.blurX is deprecated, please use BloomFilter.strengthX instead"),this.strengthX}set blurX(t){e.deprecation("6.0.0","BloomFilter.blurX is deprecated, please use BloomFilter.strengthX instead"),this.strengthX=t}get blurY(){return e.deprecation("6.0.0","BloomFilter.blurY is deprecated, please use BloomFilter.strengthY instead"),this.strengthY}set blurY(t){e.deprecation("6.0.0","BloomFilter.blurY is deprecated, please use BloomFilter.strengthY instead"),this.strengthY=t}};ft(mt,"DEFAULT_OPTIONS",{strength:{x:2,y:2},quality:4,resolution:1,kernelSize:5});let gt=mt;var xt=Object.defineProperty,bt=Object.getOwnPropertySymbols,St=Object.prototype.hasOwnProperty,Tt=Object.prototype.propertyIsEnumerable,Pt=(t,e,r)=>e in t?xt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ot=(t,e)=>{for(var r in e||(e={}))St.call(e,r)&&Pt(t,r,e[r]);if(bt)for(var r of bt(e))Tt.call(e,r)&&Pt(t,r,e[r]);return t},Mt=(t,e,r)=>(Pt(t,"symbol"!=typeof e?e+"":e,r),r);const wt=class t extends e.Filter{constructor(r){r=Ot(Ot({},t.DEFAULT_OPTIONS),r);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct BulgePinchUniforms {\n uDimensions: vec2<f32>,\n uCenter: vec2<f32>,\n uRadius: f32,\n uStrength: f32,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> bulgePinchUniforms : BulgePinchUniforms;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n let dimensions: vec2<f32> = bulgePinchUniforms.uDimensions;\n let center: vec2<f32> = bulgePinchUniforms.uCenter;\n let radius: f32 = bulgePinchUniforms.uRadius;\n let strength: f32 = bulgePinchUniforms.uStrength;\n var coord: vec2<f32> = (uv * gfu.uInputSize.xy) - center * dimensions.xy;\n \n let distance: f32 = length(coord);\n \n if (distance < radius) {\n\t let percent: f32 = distance / radius;\n\t if (strength > 0.0) {\n\t\t coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n\t } else {\n\t\t coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n\t }\n }\n\t coord += (center * dimensions.xy);\n\t coord /= gfu.uInputSize.xy;\n \n\t let clampedCoord: vec2<f32> = clamp(coord, gfu.uInputClamp.xy, gfu.uInputClamp.zw);\n\t var color: vec4<f32> = textureSample(uTexture, uSampler, clampedCoord);\n\t if (coord.x != clampedCoord.x && coord.y != clampedCoord.y) {\n\t\t color *= max(0.0, 1.0 - length(coord - clampedCoord));\n\t }\n \n\t return color;\n }\n \n fn compareVec2(x: vec2<f32>, y: vec2<f32>) -> bool\n {\n if (x.x == y.x && x.y == y.y)\n {\n\t return true;\n }\n \n return false;\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform vec2 uDimensions;\n uniform vec2 uCenter;\n uniform float uRadius;\n uniform float uStrength;\n \n uniform vec4 uInputSize;\n uniform vec4 uInputClamp;\n \n void main()\n {\n\t vec2 coord = vTextureCoord * uInputSize.xy;\n\t coord -= uCenter * uDimensions.xy;\n\t float distance = length(coord);\n \n\t if (distance < uRadius) {\n\t\t float percent = distance / uRadius;\n\t\t if (uStrength > 0.0) {\n\t\t\t coord *= mix(1.0, smoothstep(0.0, uRadius / distance, percent), uStrength * 0.75);\n\t\t } else {\n\t\t\t coord *= mix(1.0, pow(percent, 1.0 + uStrength * 0.75) * uRadius / distance, 1.0 - percent);\n\t\t }\n\t }\n \n\t coord += uCenter * uDimensions.xy;\n\t coord /= uInputSize.xy;\n\t vec2 clampedCoord = clamp(coord, uInputClamp.xy, uInputClamp.zw);\n\t vec4 color = texture(uTexture, clampedCoord);\n \n\t if (coord != clampedCoord) {\n\t\t color *= max(0.0, 1.0 - length(coord - clampedCoord));\n\t }\n \n\t finalColor = color;\n }\n ",name:"bulge-pinch-filter"}),resources:{bulgePinchUniforms:{uDimensions:{value:[0,0],type:"vec2<f32>"},uCenter:{value:r.center,type:"vec2<f32>"},uRadius:{value:r.radius,type:"f32"},uStrength:{value:r.strength,type:"f32"}}}}),Mt(this,"uniforms"),this.uniforms=this.resources.bulgePinchUniforms.uniforms,Object.assign(this,r)}apply(t,e,r,n){this.uniforms.uDimensions[0]=e.frame.width,this.uniforms.uDimensions[1]=e.frame.height,t.applyFilter(this,e,r,n)}get center(){return this.uniforms.uCenter}set center(t){"number"==typeof t&&(t={x:t,y:t}),Array.isArray(t)&&(t={x:t[0],y:t[1]}),this.uniforms.uCenter=t}get centerX(){return this.uniforms.uCenter.x}set centerX(t){this.uniforms.uCenter.x=t}get centerY(){return this.uniforms.uCenter.y}set centerY(t){this.uniforms.uCenter.y=t}get radius(){return this.uniforms.uRadius}set radius(t){this.uniforms.uRadius=t}get strength(){return this.uniforms.uStrength}set strength(t){this.uniforms.uStrength=t}};Mt(wt,"DEFAULT_OPTIONS",{center:{x:.5,y:.5},radius:100,strength:1});let Ct=wt;var Et="struct BaseUniforms {\n uOptions: vec4<f32>,\n uCounts: vec2<f32>,\n };\n \n struct StopsUniforms {\n uColors: array<vec3<f32>, MAX_STOPS>,\n uStops: array<vec4<f32>, MAX_STOPS>,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> baseUniforms : BaseUniforms;\n @group(1) @binding(1) var<uniform> stopsUniforms : StopsUniforms;\n \n struct VSOutput {\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>,\n @location(1) coord : vec2<f32>\n };\n \n fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n {\n\t var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n \n\t position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n\t position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n \n\t return vec4(position, 0.0, 1.0);\n }\n \n fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n {\n\t return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n }\n \n fn filterCoord( vTextureCoord:vec2<f32> ) -> vec2<f32>\n {\n\t return vTextureCoord * gfu.uInputSize.xy / gfu.uOutputFrame.zw;\n }\n \n fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n {\n return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \n }\n \n fn getSize() -> vec2<f32>\n {\n return gfu.uGlobalFrame.zw;\n }\n \n @vertex\n fn mainVertex(\n @location(0) aPosition : vec2<f32>, \n ) -> VSOutput {\n let vTextureCoord: vec2<f32> = filterTextureCoord(aPosition);\n return VSOutput(\n\tfilterVertexPosition(aPosition),\n\tvTextureCoord,\n\tfilterCoord(vTextureCoord),\n );\n }\n \n struct ColorStop {\n offset: f32,\n color: vec3<f32>,\n alpha: f32,\n };\n \n fn rotate2d(angle: f32) -> mat2x2<f32>{\n return mat2x2(cos(angle), -sin(angle),\n sin(angle), cos(angle));\n }\n \n fn projectLinearPosition(pos: vec2<f32>, angle: f32) -> f32 {\n var center: vec2<f32> = vec2<f32>(0.5);\n var result: vec2<f32> = pos - center;\n result = rotate2d(angle) * result;\n result = result + center;\n return clamp(result.x, 0.0, 1.0);\n }\n \n fn projectRadialPosition(pos: vec2<f32>) -> f32 {\n var r: f32 = distance(pos, vec2<f32>(0.5));\n return clamp(2.0 * r, 0.0, 1.0);\n }\n \n fn projectAnglePosition(pos: vec2<f32>, angle: f32) -> f32 {\n var center: vec2<f32> = pos - vec2<f32>(0.5, 0.5);\n var polarAngle: f32 = atan2(-center.y, center.x);\n return ((polarAngle + angle) % PI_2) / PI_2;\n }\n \n fn projectPosition(pos: vec2<f32>, gradientType: i32, angle: f32) -> f32 {\n if (gradientType == TYPE_LINEAR) {\n\t return projectLinearPosition(pos, angle);\n } else if (gradientType == TYPE_RADIAL) {\n\t return projectRadialPosition(pos);\n } else if (gradientType == TYPE_CONIC) {\n\t return projectAnglePosition(pos, angle);\n }\n \n return pos.y;\n }\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>,\n @location(1) coord : vec2<f32>\n ) -> @location(0) vec4<f32> {\n let uType: i32 = i32(baseUniforms.uOptions[0]);\n let uAngle: f32 = baseUniforms.uOptions[1];\n let uAlpha: f32 = baseUniforms.uOptions[2];\n let uReplace: f32 = baseUniforms.uOptions[3];\n \n let uNumStops: i32 = i32(baseUniforms.uCounts[0]);\n let uMaxColors: f32 = baseUniforms.uCounts[1];\n \n // current/original color\n var currentColor: vec4<f32> = textureSample(uTexture, uSampler, uv);\n \n // skip calculations if gradient alpha is 0\n if (uAlpha == 0.0) { return currentColor; }\n \n // project position\n var y: f32 = projectPosition(coord, uType, radians(uAngle));\n \n // check gradient bounds\n var offsetMin: f32 = stopsUniforms.uStops[0][0];\n var offsetMax: f32 = 0.0;\n \n let numStops: i32 = uNumStops;\n \n for (var i: i32 = 0; i < MAX_STOPS; i = i + 1) {\n\t if (i == numStops - 1) { // last index\n\t\t offsetMax = stopsUniforms.uStops[i][0];\n\t }\n }\n \n if (y < offsetMin || y > offsetMax) { return currentColor; }\n \n // limit colors\n if (uMaxColors > 0.0) {\n\t var stepSize: f32 = 1.0 / uMaxColors;\n\t var stepNumber: f32 = floor(y / stepSize);\n\t y = stepSize * (stepNumber + 0.5); // offset by 0.5 to use color from middle of segment\n }\n \n // find color stops\n var stopFrom: ColorStop;\n var stopTo: ColorStop;\n \n for (var i: i32 = 0; i < MAX_STOPS; i = i + 1) {\n\t if (y >= stopsUniforms.uStops[i][0]) {\n\t\t stopFrom = ColorStop(stopsUniforms.uStops[i][0], stopsUniforms.uColors[i], stopsUniforms.uStops[i][1]);\n\t\t stopTo = ColorStop(stopsUniforms.uStops[i + 1][0], stopsUniforms.uColors[i + 1], stopsUniforms.uStops[i + 1][1]);\n\t }\n \n\t if (i == numStops - 1) { // last index\n\t\t break;\n\t }\n }\n \n // mix colors from stops\n var colorFrom: vec4<f32> = vec4<f32>(stopFrom.color * stopFrom.alpha, stopFrom.alpha);\n var colorTo: vec4<f32> = vec4<f32>(stopTo.color * stopTo.alpha, stopTo.alpha);\n \n var segmentHeight: f32 = stopTo.offset - stopFrom.offset;\n var relativePos: f32 = y - stopFrom.offset; // position from 0 to [segmentHeight]\n var relativePercent: f32 = relativePos / segmentHeight; // position in percent between [from.offset] and [to.offset].\n \n var gradientAlpha: f32 = uAlpha * currentColor.a;\n var gradientColor: vec4<f32> = mix(colorFrom, colorTo, relativePercent) * gradientAlpha;\n \n if (uReplace < 0.5) {\n\t // mix resulting color with current color\n\t return gradientColor + currentColor * (1.0 - gradientColor.a);\n } else {\n\t // replace with gradient color\n\t return gradientColor;\n }\n }\n \n const PI: f32 = 3.14159265358979323846264;\n const PI_2: f32 = PI * 2.0;\n \n const TYPE_LINEAR: i32 = 0;\n const TYPE_RADIAL: i32 = 1;\n const TYPE_CONIC: i32 = 2;\n const MAX_STOPS: i32 = 32;";"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self&&self;var At,Rt,It={};(Rt=Rt||{}).stringify=(At={"visit_linear-gradient":function(t){return At.visit_gradient(t)},"visit_repeating-linear-gradient":function(t){return At.visit_gradient(t)},"visit_radial-gradient":function(t){return At.visit_gradient(t)},"visit_repeating-radial-gradient":function(t){return At.visit_gradient(t)},visit_gradient:function(t){var e=At.visit(t.orientation);return e&&(e+=", "),t.type+"("+e+At.visit(t.colorStops)+")"},visit_shape:function(t){var e=t.value,r=At.visit(t.at),n=At.visit(t.style);return n&&(e+=" "+n),r&&(e+=" at "+r),e},"visit_default-radial":function(t){var e="",r=At.visit(t.at);return r&&(e+=r),e},"visit_extent-keyword":function(t){var e=t.value,r=At.visit(t.at);return r&&(e+=" at "+r),e},"visit_position-keyword":function(t){return t.value},visit_position:function(t){return At.visit(t.value.x)+" "+At.visit(t.value.y)},"visit_%":function(t){return t.value+"%"},visit_em:function(t){return t.value+"em"},visit_px:function(t){return t.value+"px"},visit_literal:function(t){return At.visit_color(t.value,t)},visit_hex:function(t){return At.visit_color("#"+t.value,t)},visit_rgb:function(t){return At.visit_color("rgb("+t.value.join(", ")+")",t)},visit_rgba:function(t){return At.visit_color("rgba("+t.value.join(", ")+")",t)},visit_color:function(t,e){var r=t,n=At.visit(e.length);return n&&(r+=" "+n),r},visit_angular:function(t){return t.value+"deg"},visit_directional:function(t){return"to "+t.value},visit_array:function(t){var e="",r=t.length;return t.forEach((function(t,n){e+=At.visit(t),n<r-1&&(e+=", ")})),e},visit:function(t){if(!t)return"";if(t instanceof Array)return At.visit_array(t,"");if(t.type){var e=At["visit_"+t.type];if(e)return e(t);throw Error("Missing visitor visit_"+t.type)}throw Error("Invalid node.")}},function(t){return At.visit(t)}),(Rt=Rt||{}).parse=function(){var t=/^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,e=/^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,r=/^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,n=/^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,i=/^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,s=/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,o=/^(left|center|right|top|bottom)/i,a=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,l=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,_=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,u=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,c=/^\(/,h=/^\)/,d=/^,/,p=/^\#([0-9a-fA-F]+)/,y=/^([a-zA-Z]+)/,v=/^rgb/i,f=/^rgba/i,m=/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/,g="";function x(t){var e=new Error(g+": "+t);throw e.source=g,e}function b(){var t=R(S);return g.length>0&&x("Invalid input not EOF"),t}function S(){return T("linear-gradient",t,O)||T("repeating-linear-gradient",e,O)||T("radial-gradient",r,M)||T("repeating-radial-gradient",n,M)}function T(t,e,r){return P(e,(function(e){var n=r();return n&&(F(d)||x("Missing comma before color stops")),{type:t,orientation:n,colorStops:R(I)}}))}function P(t,e){var r=F(t);if(r){F(c)||x("Missing (");var n=e(r);return F(h)||x("Missing )"),n}}function O(){return U("directional",i,1)||U("angular",u,1)}function M(){var t,e,r=w();return r&&((t=[]).push(r),e=g,F(d)&&((r=w())?t.push(r):g=e)),t}function w(){var t=function(){var t=U("shape",/^(circle)/i,0);return t&&(t.style=k()||C()),t}()||function(){var t=U("shape",/^(ellipse)/i,0);return t&&(t.style=B()||C()),t}();if(t)t.at=E();else{var e=C();if(e){t=e;var r=E();r&&(t.at=r)}else{var n=A();n&&(t={type:"default-radial",at:n})}}return t}function C(){return U("extent-keyword",s,1)}function E(){if(U("position",/^at/,0)){var t=A();return t||x("Missing positioning value"),t}}function A(){var t={x:B(),y:B()};if(t.x||t.y)return{type:"position",value:t}}function R(t){var e=t(),r=[];if(e)for(r.push(e);F(d);)(e=t())?r.push(e):x("One extra comma");return r}function I(){var t=U("hex",p,1)||P(f,(function(){return{type:"rgba",value:R(D)}}))||P(v,(function(){return{type:"rgb",value:R(D)}}))||U("literal",y,0);return t||x("Expected color definition"),t.length=B(),t}function D(){return F(m)[1]}function B(){return U("%",l,1)||U("position-keyword",o,1)||k()}function k(){return U("px",a,1)||U("em",_,1)}function U(t,e,r){var n=F(e);if(n)return{type:t,value:n[r]}}function F(t){var e,r;return(r=/^[\n\r\t\s]+/.exec(g))&&L(r[0].length),(e=t.exec(g))&&L(e[0].length),e}function L(t){g=g.substr(t)}return function(t){return g=t.toString(),b()}}();var Dt=It.parse=Rt.parse;It.stringify=Rt.stringify;function Bt(t){const e=Dt(zt(t));if(0===e.length)throw new Error("Invalid CSS gradient.");if(1!==e.length)throw new Error("Unsupported CSS gradient (multiple gradients is not supported).");const r=e[0];return{type:kt(r.type),stops:Ut(r.colorStops),angle:jt(r.orientation)}}function kt(t){const e={"linear-gradient":0,"radial-gradient":1};if(!(t in e))throw new Error(`Unsupported gradient type "${t}"`);return e[t]}function Ut(t){const r=Lt(t),n=[],i=new e.Color;for(let e=0;e<t.length;e++){const s=Ft(t[e]),o=i.setValue(s).toArray();n.push({offset:r[e],color:o.slice(0,3),alpha:o[3]})}return n}function Ft(t){switch(t.type){case"hex":return`#${t.value}`;case"literal":return t.value;default:return`${t.type}(${t.value.join(",")})`}}function Lt(t){const e=[];for(let r=0;r<t.length;r++){const n=t[r];let i=-1;"literal"===n.type&&n.length&&"type"in n.length&&"%"===n.length.type&&"value"in n.length&&(i=parseFloat(n.length.value)/100),e.push(i)}const r=t=>{for(let r=t;r<e.length;r++)if(-1!==e[r])return{indexDelta:r-t,offset:e[r]};return{indexDelta:e.length-1-t,offset:1}};let n=0;for(let t=0;t<e.length;t++){const i=e[t];if(-1!==i)n=i;else if(0===t)e[t]=0;else if(t+1===e.length)e[t]=1;else{const i=r(t),s=(i.offset-n)/(1+i.indexDelta);for(let r=0;r<=i.indexDelta;r++)e[t+r]=n+(r+1)*s;t+=i.indexDelta,n=e[t]}}return e.map(Gt)}function Gt(t){return t.toString().length>6?parseFloat(t.toString().substring(0,6)):t}function jt(t){if(void 0===t)return 0;if("type"in t&&"value"in t)switch(t.type){case"angular":return parseFloat(t.value);case"directional":return Nt(t.value)}return 0}function Nt(t){const e={left:270,top:0,bottom:180,right:90,"left top":315,"top left":315,"left bottom":225,"bottom left":225,"right top":45,"top right":45,"right bottom":135,"bottom right":135};if(!(t in e))throw new Error(`Unsupported directional value "${t}"`);return e[t]}function zt(t){let e=t.replace(/\s{2,}/gu," ");return e=e.replace(/;/g,""),e=e.replace(/ ,/g,","),e=e.replace(/\( /g,"("),e=e.replace(/ \)/g,")"),e.trim()}var Wt=Object.defineProperty,Vt=Object.defineProperties,Ht=Object.getOwnPropertyDescriptors,Xt=Object.getOwnPropertySymbols,Kt=Object.prototype.hasOwnProperty,Yt=Object.prototype.propertyIsEnumerable,Qt=(t,e,r)=>e in t?Wt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$t=(t,e)=>{for(var r in e||(e={}))Kt.call(e,r)&&Qt(t,r,e[r]);if(Xt)for(var r of Xt(e))Yt.call(e,r)&&Qt(t,r,e[r]);return t},qt=(t,e,r)=>(Qt(t,"symbol"!=typeof e?e+"":e,r),r);const Zt=class t extends e.Filter{constructor(r){var n,i,s;if(r=r&&"css"in r?((t,e)=>Vt(t,Ht(e)))($t({},Bt(r.css||"")),{alpha:null!=(n=r.alpha)?n:t.defaults.alpha,maxColors:null!=(i=r.maxColors)?i:t.defaults.maxColors}):$t($t({},t.defaults),r),!r.stops||r.stops.length<2)throw new Error("ColorGradientFilter requires at least 2 color stops.");super({gpuProgram:e.GpuProgram.from({vertex:{source:Et,entryPoint:"mainVertex"},fragment:{source:Et,entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:"in vec2 aPosition;\n out vec2 vTextureCoord;\n out vec2 vFilterCoord;\n \n uniform vec4 uInputSize;\n uniform vec4 uOutputFrame;\n uniform vec4 uOutputTexture;\n \n vec4 filterVertexPosition( void )\n {\n\t vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n\t \n\t position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n\t position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n \n\t return vec4(position, 0.0, 1.0);\n }\n \n vec2 filterTextureCoord( void )\n {\n\t return aPosition * (uOutputFrame.zw * uInputSize.zw);\n }\n \n void main(void)\n {\n\t gl_Position = filterVertexPosition();\n\t vTextureCoord = filterTextureCoord();\n\t vFilterCoord = vTextureCoord * uInputSize.xy / uOutputFrame.zw;\n }\n ",fragment:"precision highp float;\n in vec2 vTextureCoord;\n in vec2 vFilterCoord;\n out vec4 finalColor;\n \n const int TYPE_LINEAR = 0;\n const int TYPE_RADIAL = 1;\n const int TYPE_CONIC = 2;\n const int MAX_STOPS = 32;\n \n uniform sampler2D uTexture;\n uniform vec4 uOptions;\n uniform vec2 uCounts;\n uniform vec3 uColors[MAX_STOPS];\n uniform vec4 uStops[MAX_STOPS];\n \n const float PI = 3.1415926538;\n const float PI_2 = PI*2.;\n \n struct ColorStop {\n\t float offset;\n\t vec3 color;\n\t float alpha;\n };\n \n mat2 rotate2d(float angle){\n\t return mat2(cos(angle), -sin(angle),\n\t sin(angle), cos(angle));\n }\n \n float projectLinearPosition(vec2 pos, float angle){\n\t vec2 center = vec2(0.5);\n\t vec2 result = pos - center;\n\t result = rotate2d(angle) * result;\n\t result = result + center;\n\t return clamp(result.x, 0., 1.);\n }\n \n float projectRadialPosition(vec2 pos) {\n\t float r = distance(pos, vec2(0.5));\n\t return clamp(2.*r, 0., 1.);\n }\n \n float projectAnglePosition(vec2 pos, float angle) {\n\t vec2 center = pos - vec2(0.5);\n\t float polarAngle=atan(-center.y, center.x);\n\t return mod(polarAngle + angle, PI_2) / PI_2;\n }\n \n float projectPosition(vec2 pos, int type, float angle) {\n\t if (type == TYPE_LINEAR) {\n\t\t return projectLinearPosition(pos, angle);\n\t } else if (type == TYPE_RADIAL) {\n\t\t return projectRadialPosition(pos);\n\t } else if (type == TYPE_CONIC) {\n\t\t return projectAnglePosition(pos, angle);\n\t }\n \n\t return pos.y;\n }\n \n void main(void) {\n\t int uType = int(uOptions[0]);\n\t float uAngle = uOptions[1];\n\t float uAlpha = uOptions[2];\n\t float uReplace = uOptions[3];\n \n\t int uNumStops = int(uCounts[0]);\n\t float uMaxColors = uCounts[1];\n \n\t // current/original color\n\t vec4 currentColor = texture(uTexture, vTextureCoord);\n \n\t // skip calculations if gradient alpha is 0\n\t if (0.0 == uAlpha) {\n\t\t finalColor = currentColor;\n\t\t return;\n\t }\n \n\t // project position\n\t float y = projectPosition(vFilterCoord, int(uType), radians(uAngle));\n \n\t // check gradient bounds\n\t float offsetMin = uStops[0][0];\n\t float offsetMax = 0.0;\n \n\t int numStops = int(uNumStops);\n \n\t for (int i = 0; i < MAX_STOPS; i++) {\n\t\t if (i == numStops-1){ // last index\n\t\t\t offsetMax = uStops[i][0];\n\t\t }\n\t }\n \n\t if (y < offsetMin || y > offsetMax) {\n\t\t finalColor = currentColor;\n\t\t return;\n\t }\n \n\t // limit colors\n\t if (uMaxColors > 0.) {\n\t\t float stepSize = 1./uMaxColors;\n\t\t float stepNumber = float(floor(y/stepSize));\n\t\t y = stepSize * (stepNumber + 0.5);// offset by 0.5 to use color from middle of segment\n\t }\n \n\t // find color stops\n\t ColorStop from;\n\t ColorStop to;\n \n\t for (int i = 0; i < MAX_STOPS; i++) {\n\t\t if (y >= uStops[i][0]) {\n\t\t\t from = ColorStop(uStops[i][0], uColors[i], uStops[i][1]);\n\t\t\t to = ColorStop(uStops[i+1][0], uColors[i+1], uStops[i+1][1]);\n\t\t }\n \n\t\t if (i == numStops-1){ // last index\n\t\t\t break;\n\t\t }\n\t }\n \n\t // mix colors from stops\n\t vec4 colorFrom = vec4(from.color * from.alpha, from.alpha);\n\t vec4 colorTo = vec4(to.color * to.alpha, to.alpha);\n \n\t float segmentHeight = to.offset - from.offset;\n\t float relativePos = y - from.offset;// position from 0 to [segmentHeight]\n\t float relativePercent = relativePos / segmentHeight;// position in percent between [from.offset] and [to.offset].\n \n\t float gradientAlpha = uAlpha * currentColor.a;\n\t vec4 gradientColor = mix(colorFrom, colorTo, relativePercent) * gradientAlpha;\n \n\t if (uReplace < 0.5) {\n\t\t // mix resulting color with current color\n\t\t finalColor = gradientColor + currentColor*(1.-gradientColor.a);\n\t } else {\n\t\t // replace with gradient color\n\t\t finalColor = gradientColor;\n\t }\n }\n ",name:"color-gradient-filter"}),resources:{baseUniforms:{uOptions:{value:[r.type,null!=(s=r.angle)?s:90,r.alpha,r.replace?1:0],type:"vec4<f32>"},uCounts:{value:[r.stops.length,r.maxColors],type:"vec2<f32>"}},stopsUniforms:{uColors:{value:new Float32Array(96),type:"vec3<f32>",size:32},uStops:{value:new Float32Array(128),type:"vec4<f32>",size:32}}}}),qt(this,"baseUniforms"),qt(this,"stopsUniforms"),qt(this,"_stops",[]),this.baseUniforms=this.resources.baseUniforms.uniforms,this.stopsUniforms=this.resources.stopsUniforms.uniforms,Object.assign(this,r)}get stops(){return this._stops}set stops(t){const r=function(t){return[...t].sort(((t,e)=>t.offset-e.offset))}(t),n=new e.Color;let i,s,o;for(let t=0;t<r.length;t++){n.setValue(r[t].color);const e=3*t;[i,s,o]=n.toArray(),this.stopsUniforms.uColors[e]=i,this.stopsUniforms.uColors[e+1]=s,this.stopsUniforms.uColors[e+2]=o,this.stopsUniforms.uStops[4*t]=r[t].offset,this.stopsUniforms.uStops[4*t+1]=r[t].alpha}this.baseUniforms.uCounts[0]=r.length,this._stops=r}get type(){return this.baseUniforms.uOptions[0]}set type(t){this.baseUniforms.uOptions[0]=t}get angle(){return this.baseUniforms.uOptions[1]+90}set angle(t){this.baseUniforms.uOptions[1]=t-90}get alpha(){return this.baseUniforms.uOptions[2]}set alpha(t){this.baseUniforms.uOptions[2]=t}get maxColors(){return this.baseUniforms.uCounts[1]}set maxColors(t){this.baseUniforms.uCounts[1]=t}get replace(){return this.baseUniforms.uOptions[3]>.5}set replace(t){this.baseUniforms.uOptions[3]=t?1:0}};qt(Zt,"LINEAR",0),qt(Zt,"RADIAL",1),qt(Zt,"CONIC",2),qt(Zt,"defaults",{type:Zt.LINEAR,stops:[{offset:0,color:16711680,alpha:1},{offset:1,color:255,alpha:1}],alpha:1,angle:90,maxColors:0,replace:!1});let Jt=Zt;var te=Object.defineProperty,ee=Object.getOwnPropertySymbols,re=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable,ie=(t,e,r)=>e in t?te(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,se=(t,e)=>{for(var r in e||(e={}))re.call(e,r)&&ie(t,r,e[r]);if(ee)for(var r of ee(e))ne.call(e,r)&&ie(t,r,e[r]);return t},oe=(t,e,r)=>(ie(t,"symbol"!=typeof e?e+"":e,r),r);const ae=class t extends e.Filter{constructor(...r){var s;let o=null!=(s=r[0])?s:{};if((o instanceof e.Texture||o instanceof e.TextureSource)&&(e.deprecation("6.0.0","ColorMapFilter constructor params are now options object. See params: { colorMap, nearest, mix }"),o={colorMap:o},void 0!==r[1]&&(o.nearest=r[1]),void 0!==r[2]&&(o.mix=r[2])),o=se(se({},t.DEFAULT_OPTIONS),o),!o.colorMap)throw Error("No color map texture source was provided to ColorMapFilter");super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct ColorMapUniforms {\n uMix: f32,\n uSize: f32,\n uSliceSize: f32,\n uSlicePixelSize: f32,\n uSliceInnerSize: f32,\n };\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> colorMapUniforms : ColorMapUniforms;\n @group(1) @binding(1) var uMapTexture: texture_2d<f32>;\n @group(1) @binding(2) var uMapSampler: sampler;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n var color:vec4<f32> = textureSample(uTexture, uSampler, uv);\n \n var adjusted: vec4<f32>;\n \n var altColor: vec4<f32> = vec4<f32>(color.rgb / color.a, color.a);\n let innerWidth: f32 = colorMapUniforms.uSize - 1.0;\n let zSlice0: f32 = min(floor(color.b * innerWidth), innerWidth);\n let zSlice1: f32 = min(zSlice0 + 1.0, innerWidth);\n let xOffset: f32 = colorMapUniforms.uSlicePixelSize * 0.5 + color.r * colorMapUniforms.uSliceInnerSize;\n let s0: f32 = xOffset + (zSlice0 * colorMapUniforms.uSliceSize);\n let s1: f32 = xOffset + (zSlice1 * colorMapUniforms.uSliceSize);\n let yOffset: f32 = colorMapUniforms.uSliceSize * 0.5 + color.g * (1.0 - colorMapUniforms.uSliceSize);\n let slice0Color: vec4<f32> = textureSample(uMapTexture, uMapSampler, vec2(s0,yOffset));\n let slice1Color: vec4<f32> = textureSample(uMapTexture, uMapSampler, vec2(s1,yOffset));\n let zOffset: f32 = fract(color.b * innerWidth);\n adjusted = mix(slice0Color, slice1Color, zOffset);\n altColor = vec4<f32>(color.rgb * color.a, color.a);\n \n let realColor: vec4<f32> = select(color, altColor, color.a > 0.0);\n \n return vec4<f32>(mix(realColor, adjusted, colorMapUniforms.uMix).rgb, realColor.a);\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform sampler2D uMapTexture;\n uniform float uMix;\n uniform float uSize;\n uniform float uSliceSize;\n uniform float uSlicePixelSize;\n uniform float uSliceInnerSize;\n \n void main() {\n\t vec4 color = texture(uTexture, vTextureCoord.xy);\n\t vec4 adjusted;\n \n\t if (color.a > 0.0) {\n\t\t color.rgb /= color.a;\n\t\t float innerWidth = uSize - 1.0;\n\t\t float zSlice0 = min(floor(color.b * innerWidth), innerWidth);\n\t\t float zSlice1 = min(zSlice0 + 1.0, innerWidth);\n\t\t float xOffset = uSlicePixelSize * 0.5 + color.r * uSliceInnerSize;\n\t\t float s0 = xOffset + (zSlice0 * uSliceSize);\n\t\t float s1 = xOffset + (zSlice1 * uSliceSize);\n\t\t float yOffset = uSliceSize * 0.5 + color.g * (1.0 - uSliceSize);\n\t\t vec4 slice0Color = texture(uMapTexture, vec2(s0,yOffset));\n\t\t vec4 slice1Color = texture(uMapTexture, vec2(s1,yOffset));\n\t\t float zOffset = fract(color.b * innerWidth);\n\t\t adjusted = mix(slice0Color, slice1Color, zOffset);\n \n\t\t color.rgb *= color.a;\n\t }\n \n\t finalColor = vec4(mix(color, adjusted, uMix).rgb, color.a);\n \n }",name:"color-map-filter"}),resources:{colorMapUniforms:{uMix:{value:o.mix,type:"f32"},uSize:{value:0,type:"f32"},uSliceSize:{value:0,type:"f32"},uSlicePixelSize:{value:0,type:"f32"},uSliceInnerSize:{value:0,type:"f32"}},uMapTexture:o.colorMap.source,uMapSampler:o.colorMap.source.style}}),oe(this,"uniforms"),oe(this,"_size",0),oe(this,"_sliceSize",0),oe(this,"_slicePixelSize",0),oe(this,"_sliceInnerSize",0),oe(this,"_nearest",!1),oe(this,"_scaleMode","linear"),oe(this,"_colorMap"),this.uniforms=this.resources.colorMapUniforms.uniforms,Object.assign(this,o)}get mix(){return this.uniforms.uMix}set mix(t){this.uniforms.uMix=t}get colorSize(){return this._size}get colorMap(){return this._colorMap}set colorMap(t){if(!t||t===this.colorMap)return;const r=t instanceof e.Texture?t.source:t;r.style.scaleMode=this._scaleMode,r.autoGenerateMipmaps=!1,this._size=r.height,this._sliceSize=1/this._size,this._slicePixelSize=this._sliceSize/this._size,this._sliceInnerSize=this._slicePixelSize*(this._size-1),this.uniforms.uSize=this._size,this.uniforms.uSliceSize=this._sliceSize,this.uniforms.uSlicePixelSize=this._slicePixelSize,this.uniforms.uSliceInnerSize=this._sliceInnerSize,this.resources.uMapTexture=r,this._colorMap=t}get nearest(){return this._nearest}set nearest(t){this._nearest=t,this._scaleMode=t?"nearest":"linear";const e=this._colorMap;e&&e.source&&(e.source.scaleMode=this._scaleMode,e.source.autoGenerateMipmaps=!1,e.source.style.update(),e.source.update())}updateColorMap(){const t=this._colorMap;null!=t&&t.source&&(t.source.update(),this.colorMap=t)}destroy(){var t;null==(t=this._colorMap)||t.destroy(),super.destroy()}};oe(ae,"DEFAULT_OPTIONS",{colorMap:e.Texture.WHITE,nearest:!1,mix:1});let le=ae;var _e=Object.defineProperty,ue=Object.getOwnPropertySymbols,ce=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable,de=(t,e,r)=>e in t?_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pe=(t,e)=>{for(var r in e||(e={}))ce.call(e,r)&&de(t,r,e[r]);if(ue)for(var r of ue(e))he.call(e,r)&&de(t,r,e[r]);return t},ye=(t,e,r)=>(de(t,"symbol"!=typeof e?e+"":e,r),r);const ve=class t extends e.Filter{constructor(...r){var s,o;let a=null!=(s=r[0])?s:{};("number"==typeof a||Array.isArray(a)||a instanceof Float32Array)&&(e.deprecation("6.0.0","ColorOverlayFilter constructor params are now options object. See params: { color, alpha }"),a={color:a},void 0!==r[1]&&(a.alpha=r[1])),a=pe(pe({},t.DEFAULT_OPTIONS),a);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct ColorOverlayUniforms {\n\t uColor: vec3<f32>,\n\t uAlpha: f32,\n };\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> colorOverlayUniforms : ColorOverlayUniforms;\n \n @fragment\n fn mainFragment(\n\t @builtin(position) position: vec4<f32>,\n\t @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n\t let c = textureSample(uTexture, uSampler, uv);\n\t return vec4<f32>(mix(c.rgb, colorOverlayUniforms.uColor.rgb, c.a * colorOverlayUniforms.uAlpha), c.a);\n }\n ",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform vec3 uColor;\n uniform float uAlpha;\n \n void main(void) {\n\t vec4 c = texture(uTexture, vTextureCoord);\n\t finalColor = vec4(mix(c.rgb, uColor.rgb, c.a * uAlpha), c.a);\n }\n ",name:"color-overlay-filter"}),resources:{colorOverlayUniforms:{uColor:{value:new Float32Array(3),type:"vec3<f32>"},uAlpha:{value:a.alpha,type:"f32"}}}}),ye(this,"uniforms"),ye(this,"_color"),this.uniforms=this.resources.colorOverlayUniforms.uniforms,this._color=new e.Color,this.color=null!=(o=a.color)?o:0}get color(){return this._color.value}set color(t){this._color.setValue(t);const[e,r,n]=this._color.toArray();this.uniforms.uColor[0]=e,this.uniforms.uColor[1]=r,this.uniforms.uColor[2]=n}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}};ye(ve,"DEFAULT_OPTIONS",{color:0,alpha:1});let fe=ve;var me=Object.defineProperty,ge=Object.getOwnPropertySymbols,xe=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable,Se=(t,e,r)=>e in t?me(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Te=(t,e)=>{for(var r in e||(e={}))xe.call(e,r)&&Se(t,r,e[r]);if(ge)for(var r of ge(e))be.call(e,r)&&Se(t,r,e[r]);return t},Pe=(t,e,r)=>(Se(t,"symbol"!=typeof e?e+"":e,r),r);const Oe=class t extends e.Filter{constructor(...r){var s,o,a;let l=null!=(s=r[0])?s:{};("number"==typeof l||Array.isArray(l)||l instanceof Float32Array)&&(e.deprecation("6.0.0","ColorReplaceFilter constructor params are now options object. See params: { originalColor, targetColor, tolerance }"),l={originalColor:l},void 0!==r[1]&&(l.targetColor=r[1]),void 0!==r[2]&&(l.tolerance=r[2])),l=Te(Te({},t.DEFAULT_OPTIONS),l);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct ColorReplaceUniforms {\n uOriginalColor: vec3<f32>,\n uTargetColor: vec3<f32>,\n uTolerance: f32,\n };\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> colorReplaceUniforms : ColorReplaceUniforms;\n \n @fragment\n fn mainFragment(\n\t@builtin(position) position: vec4<f32>,\n\t @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n let sample: vec4<f32> = textureSample(uTexture, uSampler, uv);\n \n let colorDiff: vec3<f32> = colorReplaceUniforms.uOriginalColor - (sample.rgb / max(sample.a, 0.0000000001));\n let colorDistance: f32 = length(colorDiff);\n let doReplace: f32 = step(colorDistance, colorReplaceUniforms.uTolerance);\n \n return vec4<f32>(mix(sample.rgb, (colorReplaceUniforms.uTargetColor + colorDiff) * sample.a, doReplace), sample.a);\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform vec3 uOriginalColor;\n uniform vec3 uTargetColor;\n uniform float uTolerance;\n \n void main(void) {\n\t vec4 c = texture(uTexture, vTextureCoord);\n\t vec3 colorDiff = uOriginalColor - (c.rgb / max(c.a, 0.0000000001));\n\t float colorDistance = length(colorDiff);\n\t float doReplace = step(colorDistance, uTolerance);\n\t finalColor = vec4(mix(c.rgb, (uTargetColor + colorDiff) * c.a, doReplace), c.a);\n }\n ",name:"color-replace-filter"}),resources:{colorReplaceUniforms:{uOriginalColor:{value:new Float32Array(3),type:"vec3<f32>"},uTargetColor:{value:new Float32Array(3),type:"vec3<f32>"},uTolerance:{value:l.tolerance,type:"f32"}}}}),Pe(this,"uniforms"),Pe(this,"_originalColor"),Pe(this,"_targetColor"),this.uniforms=this.resources.colorReplaceUniforms.uniforms,this._originalColor=new e.Color,this._targetColor=new e.Color,this.originalColor=null!=(o=l.originalColor)?o:16711680,this.targetColor=null!=(a=l.targetColor)?a:0,Object.assign(this,l)}get originalColor(){return this._originalColor.value}set originalColor(t){this._originalColor.setValue(t);const[e,r,n]=this._originalColor.toArray();this.uniforms.uOriginalColor[0]=e,this.uniforms.uOriginalColor[1]=r,this.uniforms.uOriginalColor[2]=n}get targetColor(){return this._targetColor.value}set targetColor(t){this._targetColor.setValue(t);const[e,r,n]=this._targetColor.toArray();this.uniforms.uTargetColor[0]=e,this.uniforms.uTargetColor[1]=r,this.uniforms.uTargetColor[2]=n}get tolerance(){return this.uniforms.uTolerance}set tolerance(t){this.uniforms.uTolerance=t}set newColor(t){e.deprecation("6.0.0","ColorReplaceFilter.newColor is deprecated, please use ColorReplaceFilter.targetColor instead"),this.targetColor=t}get newColor(){return e.deprecation("6.0.0","ColorReplaceFilter.newColor is deprecated, please use ColorReplaceFilter.targetColor instead"),this.targetColor}set epsilon(t){e.deprecation("6.0.0","ColorReplaceFilter.epsilon is deprecated, please use ColorReplaceFilter.tolerance instead"),this.tolerance=t}get epsilon(){return e.deprecation("6.0.0","ColorReplaceFilter.epsilon is deprecated, please use ColorReplaceFilter.tolerance instead"),this.tolerance}};Pe(Oe,"DEFAULT_OPTIONS",{originalColor:16711680,targetColor:0,tolerance:.4});let Me=Oe;var we=Object.defineProperty,Ce=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,Re=(t,e,r)=>e in t?we(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ie=(t,e)=>{for(var r in e||(e={}))Ee.call(e,r)&&Re(t,r,e[r]);if(Ce)for(var r of Ce(e))Ae.call(e,r)&&Re(t,r,e[r]);return t},De=(t,e,r)=>(Re(t,"symbol"!=typeof e?e+"":e,r),r);const Be=class t extends e.Filter{constructor(...r){var s,o,a;let l=null!=(s=r[0])?s:{};Array.isArray(l)&&(e.deprecation("6.0.0","ConvolutionFilter constructor params are now options object. See params: { matrix, width, height }"),l={matrix:l},void 0!==r[1]&&(l.width=r[1]),void 0!==r[2]&&(l.height=r[2])),l=Ie(Ie({},t.DEFAULT_OPTIONS),l);const _=null!=(o=l.width)?o:200,u=null!=(a=l.height)?a:200;super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct ConvolutionUniforms {\n\t uMatrix: mat3x3<f32>,\n\t uTexelSize: vec2<f32>,\n };\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> convolutionUniforms : ConvolutionUniforms;\n \n @fragment\n fn mainFragment(\n\t @location(0) uv: vec2<f32>,\n\t @builtin(position) position: vec4<f32>\n ) -> @location(0) vec4<f32> {\n\t let texelSize = convolutionUniforms.uTexelSize;\n\t let matrix = convolutionUniforms.uMatrix;\n \n\t let c11: vec4<f32> = textureSample(uTexture, uSampler, uv - texelSize); // top left\n\t let c12: vec4<f32> = textureSample(uTexture, uSampler, vec2<f32>(uv.x, uv.y - texelSize.y)); // top center\n\t let c13: vec4<f32> = textureSample(uTexture, uSampler, vec2<f32>(uv.x + texelSize.x, uv.y - texelSize.y)); // top right\n \n\t let c21: vec4<f32> = textureSample(uTexture, uSampler, vec2<f32>(uv.x - texelSize.x, uv.y)); // mid left\n\t let c22: vec4<f32> = textureSample(uTexture, uSampler, uv); // mid center\n\t let c23: vec4<f32> = textureSample(uTexture, uSampler, vec2<f32>(uv.x + texelSize.x, uv.y)); // mid right\n \n\t let c31: vec4<f32> = textureSample(uTexture, uSampler, vec2<f32>(uv.x - texelSize.x, uv.y + texelSize.y)); // bottom left\n\t let c32: vec4<f32> = textureSample(uTexture, uSampler, vec2<f32>(uv.x, uv.y + texelSize.y)); // bottom center\n\t let c33: vec4<f32> = textureSample(uTexture, uSampler, uv + texelSize); // bottom right\n \n\t var finalColor: vec4<f32> = vec4<f32>(\n\t\t c11 * matrix[0][0] + c12 * matrix[0][1] + c13 * matrix[0][2] +\n\t\t c21 * matrix[1][0] + c22 * matrix[1][1] + c23 * matrix[1][2] +\n\t\t c31 * matrix[2][0] + c32 * matrix[2][1] + c33 * matrix[2][2]\n\t );\n \n\t finalColor.a = c22.a;\n \n\t return finalColor;\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform vec2 uTexelSize;\n uniform mat3 uMatrix;\n \n void main(void)\n {\n\t vec4 c11 = texture(uTexture, vTextureCoord - uTexelSize); // top left\n\t vec4 c12 = texture(uTexture, vec2(vTextureCoord.x, vTextureCoord.y - uTexelSize.y)); // top center\n\t vec4 c13 = texture(uTexture, vec2(vTextureCoord.x + uTexelSize.x, vTextureCoord.y - uTexelSize.y)); // top right\n \n\t vec4 c21 = texture(uTexture, vec2(vTextureCoord.x - uTexelSize.x, vTextureCoord.y)); // mid left\n\t vec4 c22 = texture(uTexture, vTextureCoord); // mid center\n\t vec4 c23 = texture(uTexture, vec2(vTextureCoord.x + uTexelSize.x, vTextureCoord.y)); // mid right\n \n\t vec4 c31 = texture(uTexture, vec2(vTextureCoord.x - uTexelSize.x, vTextureCoord.y + uTexelSize.y)); // bottom left\n\t vec4 c32 = texture(uTexture, vec2(vTextureCoord.x, vTextureCoord.y + uTexelSize.y)); // bottom center\n\t vec4 c33 = texture(uTexture, vTextureCoord + uTexelSize); // bottom right\n \n\t finalColor =\n\t\t c11 * uMatrix[0][0] + c12 * uMatrix[0][1] + c13 * uMatrix[0][2] +\n\t\t c21 * uMatrix[1][0] + c22 * uMatrix[1][1] + c23 * uMatrix[1][2] +\n\t\t c31 * uMatrix[2][0] + c32 * uMatrix[2][1] + c33 * uMatrix[2][2];\n \n\t finalColor.a = c22.a;\n }",name:"convolution-filter"}),resources:{convolutionUniforms:{uMatrix:{value:l.matrix,type:"mat3x3<f32>"},uTexelSize:{value:{x:1/_,y:1/u},type:"vec2<f32>"}}}}),De(this,"uniforms"),this.uniforms=this.resources.convolutionUniforms.uniforms,this.width=_,this.height=u}get matrix(){return this.uniforms.uMatrix}set matrix(t){t.forEach(((t,e)=>{this.uniforms.uMatrix[e]=t}))}get width(){return 1/this.uniforms.uTexelSize.x}set width(t){this.uniforms.uTexelSize.x=1/t}get height(){return 1/this.uniforms.uTexelSize.y}set height(t){this.uniforms.uTexelSize.y=1/t}};De(Be,"DEFAULT_OPTIONS",{matrix:new Float32Array(9),width:200,height:200});let ke=Be;class Ue extends e.Filter{constructor(){super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"@group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n \n @fragment\n fn mainFragment(\n\t @location(0) uv: vec2<f32>,\n\t @builtin(position) position: vec4<f32>\n ) -> @location(0) vec4<f32> {\n\t let lum: f32 = length(textureSample(uTexture, uSampler, uv).rgb);\n \n\t if (lum < 1.00)\n\t {\n\t\t if (modulo(position.x + position.y, 10.0) == 0.0)\n\t\t {\n\t\t\t return vec4<f32>(0.0, 0.0, 0.0, 1.0);\n\t\t }\n\t }\n \n\t if (lum < 0.75)\n\t {\n\t\t if (modulo(position.x - position.y, 10.0) == 0.0)\n\t\t {\n\t\t\t return vec4<f32>(0.0, 0.0, 0.0, 1.0);\n\t\t }\n\t }\n \n\t if (lum < 0.50)\n\t {\n\t\t if (modulo(position.x + position.y - 5.0, 10.0) == 0.0)\n\t\t {\n\t\t\t return vec4<f32>(0.0, 0.0, 0.0, 1.0);\n\t\t }\n\t }\n \n\t if (lum < 0.3)\n\t {\n\t\t if (modulo(position.x - position.y - 5.0, 10.0) == 0.0)\n\t\t {\n\t\t\t return vec4<f32>(0.0, 0.0, 0.0, 1.0);\n\t\t }\n\t }\n \n\t return vec4<f32>(1.0);\n }\n \n fn modulo(x: f32, y: f32) -> f32\n {\n return x - y * floor(x/y);\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n \n void main(void)\n {\n\t float lum = length(texture(uTexture, vTextureCoord.xy).rgb);\n \n\t finalColor = vec4(1.0, 1.0, 1.0, 1.0);\n \n\t if (lum < 1.00)\n\t {\n\t\t if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0)\n\t\t {\n\t\t\t finalColor = vec4(0.0, 0.0, 0.0, 1.0);\n\t\t }\n\t }\n \n\t if (lum < 0.75)\n\t {\n\t\t if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0)\n\t\t {\n\t\t\t finalColor = vec4(0.0, 0.0, 0.0, 1.0);\n\t\t }\n\t }\n \n\t if (lum < 0.50)\n\t {\n\t\t if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0)\n\t\t {\n\t\t\t finalColor = vec4(0.0, 0.0, 0.0, 1.0);\n\t\t }\n\t }\n \n\t if (lum < 0.3)\n\t {\n\t\t if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0)\n\t\t {\n\t\t\t finalColor = vec4(0.0, 0.0, 0.0, 1.0);\n\t\t }\n\t }\n }\n ",name:"cross-hatch-filter"}),resources:{}})}}var Fe=Object.defineProperty,Le=Object.getOwnPropertySymbols,Ge=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,Ne=(t,e,r)=>e in t?Fe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ze=(t,e)=>{for(var r in e||(e={}))Ge.call(e,r)&&Ne(t,r,e[r]);if(Le)for(var r of Le(e))je.call(e,r)&&Ne(t,r,e[r]);return t},We=(t,e,r)=>(Ne(t,"symbol"!=typeof e?e+"":e,r),r);const Ve=class t extends e.Filter{constructor(r){r=ze(ze({},t.DEFAULT_OPTIONS),r);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct CRTUniforms {\n\t uLine: vec4<f32>,\n\t uNoise: vec2<f32>,\n\t uVignette: vec3<f32>,\n\t uSeed: f32,\n\t uTime: f32,\n\t uDimensions: vec2<f32>,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> crtUniforms : CRTUniforms;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n\t \n var color: vec4<f32> = textureSample(uTexture, uSampler, uv);\n let coord: vec2<f32> = uv * gfu.uInputSize.xy / crtUniforms.uDimensions;\n \n let uNoise = crtUniforms.uNoise;\n \n if (uNoise[0] > 0.0 && uNoise[1] > 0.0)\n {\n\t color += vec4<f32>(vec3<f32>(noise(uv)), color.a);\n }\n \n if (crtUniforms.uVignette[0] > 0.)\n {\n\t color *= vec4<f32>(vec3<f32>(vignette(color.rgb, coord)), color.a);\n }\n \n if (crtUniforms.uLine[1] > 0.0)\n {\n\t color = vec4<f32>(vec3<f32>(interlaceLines(color.rgb, uv)), color.a); \n }\n \n return color;\n }\n \n const SQRT_2: f32 = 1.414213;\n \n fn modulo(x: f32, y: f32) -> f32\n {\n return x - y * floor(x/y);\n }\n \n fn rand(co: vec2<f32>) -> f32\n {\n return fract(sin(dot(co, vec2<f32>(12.9898, 78.233))) * 43758.5453);\n }\n \n fn vignette(co: vec3<f32>, coord: vec2<f32>) -> f32\n {\n let uVignette = crtUniforms.uVignette;\n let uDimensions = crtUniforms.uDimensions;\n \n let outter: f32 = SQRT_2 - uVignette[0] * SQRT_2;\n var dir: vec2<f32> = vec2<f32>(0.5) - coord;\n dir.y *= uDimensions.y / uDimensions.x;\n let darker: f32 = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + uVignette[2] * SQRT_2), 0.0, 1.0);\n return darker + (1.0 - darker) * (1.0 - uVignette[1]);\n }\n \n fn noise(coord: vec2<f32>) -> f32\n {\n let uNoise = crtUniforms.uNoise;\n let uSeed = crtUniforms.uSeed;\n \n var pixelCoord: vec2<f32> = coord * gfu.uInputSize.xy;\n pixelCoord.x = floor(pixelCoord.x / uNoise[1]);\n pixelCoord.y = floor(pixelCoord.y / uNoise[1]);\n return (rand(pixelCoord * uNoise[1] * uSeed) - 0.5) * uNoise[0];\n }\n \n fn interlaceLines(co: vec3<f32>, coord: vec2<f32>) -> vec3<f32>\n {\n var color = co;\n \n let uDimensions = crtUniforms.uDimensions;\n \n let curvature: f32 = crtUniforms.uLine[0];\n let lineWidth: f32 = crtUniforms.uLine[1];\n let lineContrast: f32 = crtUniforms.uLine[2];\n let verticalLine: f32 = crtUniforms.uLine[3];\n \n let dir: vec2<f32> = vec2<f32>(coord * gfu.uInputSize.xy / uDimensions - 0.5);\n \n let _c: f32 = select(1., curvature, curvature > 0.);\n let k: f32 = select(1., (length(dir * dir) * 0.25 * _c * _c + 0.935 * _c), curvature > 0.);\n let uv: vec2<f32> = dir * k;\n let v: f32 = select(uv.y * uDimensions.y, uv.x * uDimensions.x, verticalLine > 0.5) * min(1.0, 2.0 / lineWidth ) / _c;\n let j: f32 = 1. + cos(v * 1.2 - crtUniforms.uTime) * 0.5 * lineContrast;\n color *= j;\n \n let segment: f32 = select(modulo((dir.y + .5) * uDimensions.y, 4.), modulo((dir.x + .5) * uDimensions.x, 4.), verticalLine > 0.5);\n color *= 0.99 + ceil(segment) * 0.015;\n \n return color;\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform vec4 uLine;\n uniform vec2 uNoise;\n uniform vec3 uVignette;\n uniform float uSeed;\n uniform float uTime;\n uniform vec2 uDimensions;\n \n uniform vec4 uInputSize;\n \n const float SQRT_2 = 1.414213;\n \n float rand(vec2 co) {\n\t return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n }\n \n float vignette(vec3 co, vec2 coord)\n {\n\t float outter = SQRT_2 - uVignette[0] * SQRT_2;\n\t vec2 dir = vec2(0.5) - coord;\n\t dir.y *= uDimensions.y / uDimensions.x;\n\t float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + uVignette[2] * SQRT_2), 0.0, 1.0);\n\t return darker + (1.0 - darker) * (1.0 - uVignette[1]);\n }\n \n float noise(vec2 coord)\n {\n\t vec2 pixelCoord = coord * uInputSize.xy;\n\t pixelCoord.x = floor(pixelCoord.x / uNoise[1]);\n\t pixelCoord.y = floor(pixelCoord.y / uNoise[1]);\n\t return (rand(pixelCoord * uNoise[1] * uSeed) - 0.5) * uNoise[0];\n }\n \n vec3 interlaceLines(vec3 co, vec2 coord)\n {\n\t vec3 color = co;\n \n\t float curvature = uLine[0];\n\t float lineWidth = uLine[1];\n\t float lineContrast = uLine[2];\n\t float verticalLine = uLine[3];\n \n\t vec2 dir = vec2(coord * uInputSize.xy / uDimensions - 0.5);\n \n\t float _c = curvature > 0. ? curvature : 1.;\n\t float k = curvature > 0. ? (length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\n\t vec2 uv = dir * k;\n\t float v = verticalLine > 0.5 ? uv.x * uDimensions.x : uv.y * uDimensions.y;\n\t v *= min(1.0, 2.0 / lineWidth ) / _c;\n\t float j = 1. + cos(v * 1.2 - uTime) * 0.5 * lineContrast;\n\t color *= j;\n \n\t float segment = verticalLine > 0.5 ? mod((dir.x + .5) * uDimensions.x, 4.) : mod((dir.y + .5) * uDimensions.y, 4.);\n\t color *= 0.99 + ceil(segment) * 0.015;\n \n\t return color;\n }\n \n void main(void)\n {\n\t finalColor = texture(uTexture, vTextureCoord);\n\t vec2 coord = vTextureCoord * uInputSize.xy / uDimensions;\n \n\t if (uNoise[0] > 0.0 && uNoise[1] > 0.0)\n\t {\n\t\t float n = noise(vTextureCoord);\n\t\t finalColor += vec4(n, n, n, finalColor.a);\n\t }\n \n\t if (uVignette[0] > 0.)\n\t {\n\t\t float v = vignette(finalColor.rgb, coord);\n\t\t finalColor *= vec4(v, v, v, finalColor.a);\n\t }\n \n\t if (uLine[1] > 0.0)\n\t {\n\t\t finalColor = vec4(interlaceLines(finalColor.rgb, vTextureCoord), finalColor.a); \n\t }\n }\n ",name:"crt-filter"}),resources:{crtUniforms:{uLine:{value:new Float32Array(4),type:"vec4<f32>"},uNoise:{value:new Float32Array(2),type:"vec2<f32>"},uVignette:{value:new Float32Array(3),type:"vec3<f32>"},uSeed:{value:r.seed,type:"f32"},uTime:{value:r.time,type:"f32"},uDimensions:{value:new Float32Array(2),type:"vec2<f32>"}}}}),We(this,"uniforms"),We(this,"seed"),We(this,"time"),this.uniforms=this.resources.crtUniforms.uniforms,Object.assign(this,r)}apply(t,e,r,n){this.uniforms.uDimensions[0]=e.frame.width,this.uniforms.uDimensions[1]=e.frame.height,this.uniforms.uSeed=this.seed,this.uniforms.uTime=this.time,t.applyFilter(this,e,r,n)}get curvature(){return this.uniforms.uLine[0]}set curvature(t){this.uniforms.uLine[0]=t}get lineWidth(){return this.uniforms.uLine[1]}set lineWidth(t){this.uniforms.uLine[1]=t}get lineContrast(){return this.uniforms.uLine[2]}set lineContrast(t){this.uniforms.uLine[2]=t}get verticalLine(){return this.uniforms.uLine[3]>.5}set verticalLine(t){this.uniforms.uLine[3]=t?1:0}get noise(){return this.uniforms.uNoise[0]}set noise(t){this.uniforms.uNoise[0]=t}get noiseSize(){return this.uniforms.uNoise[1]}set noiseSize(t){this.uniforms.uNoise[1]=t}get vignetting(){return this.uniforms.uVignette[0]}set vignetting(t){this.uniforms.uVignette[0]=t}get vignettingAlpha(){return this.uniforms.uVignette[1]}set vignettingAlpha(t){this.uniforms.uVignette[1]=t}get vignettingBlur(){return this.uniforms.uVignette[2]}set vignettingBlur(t){this.uniforms.uVignette[2]=t}};We(Ve,"DEFAULT_OPTIONS",{curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0,seed:0});let He=Ve;var Xe=Object.defineProperty,Ke=Object.getOwnPropertySymbols,Ye=Object.prototype.hasOwnProperty,Qe=Object.prototype.propertyIsEnumerable,$e=(t,e,r)=>e in t?Xe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,qe=(t,e)=>{for(var r in e||(e={}))Ye.call(e,r)&&$e(t,r,e[r]);if(Ke)for(var r of Ke(e))Qe.call(e,r)&&$e(t,r,e[r]);return t};const Ze=class t extends e.Filter{constructor(...r){var s;let o=null!=(s=r[0])?s:{};"number"==typeof o&&(e.deprecation("6.0.0","DotFilter constructor params are now options object. See params: { scale, angle, grayscale }"),o={scale:o},void 0!==r[1]&&(o.angle=r[1]),void 0!==r[2]&&(o.grayscale=r[2])),o=qe(qe({},t.DEFAULT_OPTIONS),o);const a={uScale:{value:o.scale,type:"f32"},uAngle:{value:o.angle,type:"f32"},uGrayScale:{value:o.grayscale?1:0,type:"f32"}};super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct DotUniforms {\n uScale:f32,\n uAngle:f32,\n uGrayScale:f32,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> dotUniforms : DotUniforms;\n \n @fragment\n fn mainFragment(\n @location(0) uv: vec2<f32>,\n @builtin(position) position: vec4<f32>\n ) -> @location(0) vec4<f32> {\n let color: vec4<f32> = textureSample(uTexture, uSampler, uv);\n let gray: vec3<f32> = vec3<f32>(dot(color.rgb, vec3<f32>(0.299, 0.587, 0.114)));\n // dotUniforms.uGrayScale == 1 doesn't ever pass so it is converted to a float and compared to 0.5 instead \n let finalColor: vec3<f32> = select(color.rgb, gray, f32(dotUniforms.uGrayScale) >= 0.5);\n \n return vec4<f32>(finalColor * 10.0 - 5.0 + pattern(uv), color.a);\n }\n \n fn pattern(uv: vec2<f32>) -> f32\n {\n let s: f32 = sin(dotUniforms.uAngle);\n let c: f32 = cos(dotUniforms.uAngle);\n \n let tex: vec2<f32> = uv * gfu.uInputSize.xy;\n \n let p: vec2<f32> = vec2<f32>(\n\t c * tex.x - s * tex.y,\n\t s * tex.x + c * tex.y\n ) * dotUniforms.uScale;\n \n return (sin(p.x) * sin(p.y)) * 4.0;\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform float uAngle;\n uniform float uScale;\n uniform bool uGrayScale;\n \n uniform vec4 uInputSize;\n \n float pattern()\n {\n\t float s = sin(uAngle), c = cos(uAngle);\n\t vec2 tex = vTextureCoord * uInputSize.xy;\n\t vec2 point = vec2(\n\t\t c * tex.x - s * tex.y,\n\t\t s * tex.x + c * tex.y\n\t ) * uScale;\n\t return (sin(point.x) * sin(point.y)) * 4.0;\n\t }\n \n\t void main()\n\t {\n\t vec4 color = texture(uTexture, vTextureCoord);\n\t vec3 colorRGB = vec3(color);\n \n\t if (uGrayScale)\n\t {\n\t\t colorRGB = vec3(color.r + color.g + color.b) / 3.0;\n\t }\n \n\t finalColor = vec4(colorRGB * 10.0 - 5.0 + pattern(), color.a);\n }\n ",name:"dot-filter"}),resources:{dotUniforms:a}})}get scale(){return this.resources.dotUniforms.uniforms.uScale}set scale(t){this.resources.dotUniforms.uniforms.uScale=t}get angle(){return this.resources.dotUniforms.uniforms.uAngle}set angle(t){this.resources.dotUniforms.uniforms.uAngle=t}get grayscale(){return 1===this.resources.dotUniforms.uniforms.uGrayScale}set grayscale(t){this.resources.dotUniforms.uniforms.uGrayScale=t?1:0}};((t,e,r)=>{$e(t,"symbol"!=typeof e?e+"":e,r)})(Ze,"DEFAULT_OPTIONS",{scale:1,angle:5,grayscale:!0});let Je=Ze;var tr=Object.defineProperty,er=Object.getOwnPropertySymbols,rr=Object.prototype.hasOwnProperty,nr=Object.prototype.propertyIsEnumerable,ir=(t,e,r)=>e in t?tr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,sr=(t,e)=>{for(var r in e||(e={}))rr.call(e,r)&&ir(t,r,e[r]);if(er)for(var r of er(e))nr.call(e,r)&&ir(t,r,e[r]);return t},or=(t,e,r)=>(ir(t,"symbol"!=typeof e?e+"":e,r),r);const ar=class t extends e.Filter{constructor(r){var s,o;r=sr(sr({},t.DEFAULT_OPTIONS),r);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct DropShadowUniforms {\n uAlpha: f32,\n uColor: vec3<f32>,\n uOffset: vec2<f32>,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> dropShadowUniforms : DropShadowUniforms;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n var color: vec4<f32> = textureSample(uTexture, uSampler, uv - dropShadowUniforms.uOffset * gfu.uInputSize.zw);\n \n // Premultiply alpha\n color = vec4<f32>(vec3<f32>(dropShadowUniforms.uColor.rgb * color.a), color.a);\n // alpha user alpha\n color *= dropShadowUniforms.uAlpha;\n \n return color;\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform float uAlpha;\n uniform vec3 uColor;\n uniform vec2 uOffset;\n \n uniform vec4 uInputSize;\n \n void main(void){\n\t vec4 sample = texture(uTexture, vTextureCoord - uOffset * uInputSize.zw);\n \n\t // Premultiply alpha\n\t sample.rgb = uColor.rgb * sample.a;\n \n\t // alpha user alpha\n\t sample *= uAlpha;\n \n\t finalColor = sample;\n }",name:"drop-shadow-filter"}),resources:{dropShadowUniforms:{uAlpha:{value:r.alpha,type:"f32"},uColor:{value:new Float32Array(3),type:"vec3<f32>"},uOffset:{value:r.offset,type:"vec2<f32>"}}},resolution:r.resolution}),or(this,"uniforms"),or(this,"shadowOnly",!1),or(this,"_color"),or(this,"_blurFilter"),or(this,"_basePass"),this.uniforms=this.resources.dropShadowUniforms.uniforms,this._color=new e.Color,this.color=null!=(s=r.color)?s:0,this._blurFilter=new S({strength:null!=(o=r.kernels)?o:r.blur,quality:r.kernels?void 0:r.quality}),this._basePass=new e.Filter({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"\n\t\t\t\t\t @group(0) @binding(1) var uTexture: texture_2d<f32>; \n\t\t\t\t\t @group(0) @binding(2) var uSampler: sampler;\n\t\t\t\t\t @fragment\n\t\t\t\t\t fn mainFragment(\n\t\t\t\t\t\t @builtin(position) position: vec4<f32>,\n\t\t\t\t\t\t @location(0) uv : vec2<f32>\n\t\t\t\t\t ) -> @location(0) vec4<f32> {\n\t\t\t\t\t\t return textureSample(uTexture, uSampler, uv);\n\t\t\t\t\t }\n\t\t\t\t\t ",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"\n\t\t\t\t in vec2 vTextureCoord;\n\t\t\t\t out vec4 finalColor;\n\t\t\t\t uniform sampler2D uTexture;\n \n\t\t\t\t void main(void){\n\t\t\t\t\t finalColor = texture(uTexture, vTextureCoord);\n\t\t\t\t }\n\t\t\t\t ",name:"drop-shadow-filter"}),resources:{}}),Object.assign(this,r)}apply(t,r,n,i){const s=e.TexturePool.getSameSizeTexture(r);t.applyFilter(this,r,s,!0),this._blurFilter.apply(t,s,n,i),this.shadowOnly||t.applyFilter(this._basePass,r,n,!1),e.TexturePool.returnTexture(s)}get offset(){return this.uniforms.uOffset}set offset(t){this.uniforms.uOffset=t,this._updatePadding()}get offsetX(){return this.offset.x}set offsetX(t){this.offset.x=t,this._updatePadding()}get offsetY(){return this.offset.y}set offsetY(t){this.offset.y=t,this._updatePadding()}get color(){return this._color.value}set color(t){this._color.setValue(t);const[e,r,n]=this._color.toArray();this.uniforms.uColor[0]=e,this.uniforms.uColor[1]=r,this.uniforms.uColor[2]=n}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}get blur(){return this._blurFilter.strength}set blur(t){this._blurFilter.strength=t,this._updatePadding()}get quality(){return this._blurFilter.quality}set quality(t){this._blurFilter.quality=t,this._updatePadding()}get kernels(){return this._blurFilter.kernels}set kernels(t){this._blurFilter.kernels=t}get pixelSize(){return this._blurFilter.pixelSize}set pixelSize(t){"number"==typeof t&&(t={x:t,y:t}),Array.isArray(t)&&(t={x:t[0],y:t[1]}),this._blurFilter.pixelSize=t}get pixelSizeX(){return this._blurFilter.pixelSizeX}set pixelSizeX(t){this._blurFilter.pixelSizeX=t}get pixelSizeY(){return this._blurFilter.pixelSizeY}set pixelSizeY(t){this._blurFilter.pixelSizeY=t}_updatePadding(){const t=Math.max(Math.abs(this.offsetX),Math.abs(this.offsetY));this.padding=t+2*this.blur+4*this.quality}};or(ar,"DEFAULT_OPTIONS",{offset:{x:4,y:4},color:0,alpha:.5,shadowOnly:!1,kernels:void 0,blur:2,quality:3,pixelSize:{x:1,y:1},resolution:1});let lr=ar;var _r=Object.defineProperty,ur=(t,e,r)=>(((t,e,r)=>{e in t?_r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r})(t,"symbol"!=typeof e?e+"":e,r),r);class cr extends e.Filter{constructor(t=5){super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct EmbossUniforms {\n uStrength:f32,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> embossUniforms : EmbossUniforms;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n let onePixel: vec2<f32> = vec2<f32>(1.0 / gfu.uInputSize.xy);\n\t var color: vec3<f32> = vec3<f32>(0.5);\n \n\t color -= (textureSample(uTexture, uSampler, uv - onePixel) * embossUniforms.uStrength).rgb;\n\t color += (textureSample(uTexture, uSampler, uv + onePixel) * embossUniforms.uStrength).rgb;\n \n\t color = vec3<f32>((color.r + color.g + color.b) / 3.0);\n \n\t let blendColor: vec4<f32> = textureSample(uTexture, uSampler, uv);\n \n\t return vec4<f32>(color.rgb * blendColor.a, blendColor.a);\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform float uStrength;\n \n uniform vec4 uInputSize;\n \n void main(void)\n {\n\t vec2 onePixel = vec2(1.0 / uInputSize);\n \n\t vec4 color;\n \n\t color.rgb = vec3(0.5);\n \n\t color -= texture(uTexture, vTextureCoord - onePixel) * uStrength;\n\t color += texture(uTexture, vTextureCoord + onePixel) * uStrength;\n \n\t color.rgb = vec3((color.r + color.g + color.b) / 3.0);\n \n\t float alpha = texture(uTexture, vTextureCoord).a;\n \n\t finalColor = vec4(color.rgb * alpha, alpha);\n }\n ",name:"emboss-filter"}),resources:{embossUniforms:{uStrength:{value:t,type:"f32"}}}}),ur(this,"uniforms"),this.uniforms=this.resources.embossUniforms.uniforms}get strength(){return this.uniforms.uStrength}set strength(t){this.uniforms.uStrength=t}}var hr=Object.defineProperty,dr=Object.getOwnPropertySymbols,pr=Object.prototype.hasOwnProperty,yr=Object.prototype.propertyIsEnumerable,vr=(t,e,r)=>e in t?hr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fr=(t,e)=>{for(var r in e||(e={}))pr.call(e,r)&&vr(t,r,e[r]);if(dr)for(var r of dr(e))yr.call(e,r)&&vr(t,r,e[r]);return t},mr=(t,e,r)=>(vr(t,"symbol"!=typeof e?e+"":e,r),r),gr=(t=>(t[t.TRANSPARENT=0]="TRANSPARENT",t[t.ORIGINAL=1]="ORIGINAL",t[t.LOOP=2]="LOOP",t[t.CLAMP=3]="CLAMP",t[t.MIRROR=4]="MIRROR",t))(gr||{});const xr=class t extends e.Filter{constructor(r){var s,o,a,l,_;r=fr(fr({},t.defaults),r);const u=e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct GlitchUniforms {\n uSeed: f32,\n uDimensions: vec2<f32>,\n uAspect: f32,\n uFillMode: f32,\n uOffset: f32,\n uDirection: f32,\n uRed: vec2<f32>,\n uGreen: vec2<f32>,\n uBlue: vec2<f32>,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> glitchUniforms : GlitchUniforms;\n @group(1) @binding(1) var uDisplacementMap: texture_2d<f32>; \n @group(1) @binding(2) var uDisplacementSampler: sampler; \n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n let uSeed: f32 = glitchUniforms.uSeed;\n let uDimensions: vec2<f32> = glitchUniforms.uDimensions;\n let uAspect: f32 = glitchUniforms.uAspect;\n let uOffset: f32 = glitchUniforms.uOffset;\n let uDirection: f32 = glitchUniforms.uDirection;\n let uRed: vec2<f32> = glitchUniforms.uRed;\n let uGreen: vec2<f32> = glitchUniforms.uGreen;\n let uBlue: vec2<f32> = glitchUniforms.uBlue;\n \n let uInputSize: vec4<f32> = gfu.uInputSize;\n let uInputClamp: vec4<f32> = gfu.uInputClamp;\n \n var discarded: bool = false;\n var coord: vec2<f32> = (uv * uInputSize.xy) / uDimensions;\n \n\t if (coord.x > 1.0 || coord.y > 1.0) {\n\t discarded = true;\n\t }\n \n\t let sinDir: f32 = sin(uDirection);\n\t let cosDir: f32 = cos(uDirection);\n \n\t let cx: f32 = coord.x - 0.5;\n\t let cy: f32 = (coord.y - 0.5) * uAspect;\n\t var ny: f32 = (-sinDir * cx + cosDir * cy) / uAspect + 0.5;\n \n\t ny = select(select(ny, -ny, ny < 0.0), 2.0 - ny, ny > 1.0);\n \n\t let dc: vec4<f32> = textureSample(uDisplacementMap, uDisplacementSampler, vec2<f32>(0.5, ny));\n \n\t let displacement: f32 = (dc.r - dc.g) * (uOffset / uInputSize.x);\n \n\t coord = uv + vec2<f32>(cosDir * displacement, sinDir * displacement * uAspect);\n \n\t let fillMode: i32 = i32(glitchUniforms.uFillMode);\n \n\t if (fillMode == CLAMP) {\n\t coord = clamp(coord, uInputClamp.xy, uInputClamp.zw);\n\t } else {\n\t if (coord.x > uInputClamp.z) {\n\t\t if (fillMode == TRANSPARENT) {\n\t\t discarded = true;\n\t\t } else if (fillMode == LOOP) {\n\t\t coord.x = coord.x - uInputClamp.z;\n\t\t } else if (fillMode == MIRROR) {\n\t\t coord.x = uInputClamp.z * 2.0 - coord.x;\n\t\t }\n\t } else if (coord.x < uInputClamp.x) {\n\t\t if (fillMode == TRANSPARENT) {\n\t\t discarded = true;\n\t\t } else if (fillMode == LOOP) {\n\t\t coord.x = coord.x + uInputClamp.z;\n\t\t } else if (fillMode == MIRROR) {\n\t\t coord.x = coord.x * -uInputClamp.z;\n\t\t }\n\t }\n \n\t if (coord.y > uInputClamp.w) {\n\t\t if (fillMode == TRANSPARENT) {\n\t\t discarded = true;\n\t\t } else if (fillMode == LOOP) {\n\t\t coord.y = coord.y - uInputClamp.w;\n\t\t } else if (fillMode == MIRROR) {\n\t\t coord.y = uInputClamp.w * 2.0 - coord.y;\n\t\t }\n\t } else if (coord.y < uInputClamp.y) {\n\t\t if (fillMode == TRANSPARENT) {\n\t\t discarded = true;\n\t\t } else if (fillMode == LOOP) {\n\t\t coord.y = coord.y + uInputClamp.w;\n\t\t } else if (fillMode == MIRROR) {\n\t\t coord.y = coord.y * -uInputClamp.w;\n\t\t }\n\t }\n\t }\n \n\t let seedR: f32 = 1.0 - uSeed * 0.4;\n\t let seedG: f32 = 1.0 - uSeed * 0.3;\n\t let seedB: f32 = 1.0 - uSeed * 0.2;\n \n\t let offsetR: vec2<f32> = vec2(uRed.x * seedR / uInputSize.x, uRed.y * seedR / uInputSize.y);\n\t let offsetG: vec2<f32> = vec2(uGreen.x * seedG / uInputSize.x, uGreen.y * seedG / uInputSize.y);\n\t let offsetB: vec2<f32> = vec2(uBlue.x * seedB / uInputSize.x, uBlue.y * seedB / uInputSize.y);\n \n\t let r = textureSample(uTexture, uSampler, coord + offsetR).r;\n\t let g = textureSample(uTexture, uSampler, coord + offsetG).g;\n\t let b = textureSample(uTexture, uSampler, coord + offsetB).b;\n\t let a = textureSample(uTexture, uSampler, coord).a;\n \n\t return select(vec4<f32>(r, g, b, a), vec4<f32>(0.0,0.0,0.0,0.0), discarded);\n }\n \n const TRANSPARENT: i32 = 0;\n const ORIGINAL: i32 = 1;\n const LOOP: i32 = 2;\n const CLAMP: i32 = 3;\n const MIRROR: i32 = 4;",entryPoint:"mainFragment"}}),c=e.GlProgram.from({vertex:n,fragment:"precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform sampler2D uDisplacementMap;\n uniform float uSeed;\n uniform vec2 uDimensions;\n uniform float uAspect;\n uniform float uFillMode;\n uniform float uOffset;\n uniform float uDirection;\n uniform vec2 uRed;\n uniform vec2 uGreen;\n uniform vec2 uBlue;\n \n uniform vec4 uInputSize;\n uniform vec4 uInputClamp;\n \n const int TRANSPARENT = 0;\n const int ORIGINAL = 1;\n const int LOOP = 2;\n const int CLAMP = 3;\n const int MIRROR = 4;\n \n void main(void)\n {\n\t vec2 coord = (vTextureCoord * uInputSize.xy) / uDimensions;\n \n\t if (coord.x > 1.0 || coord.y > 1.0) {\n\t\t return;\n\t }\n \n\t float sinDir = sin(uDirection);\n\t float cosDir = cos(uDirection);\n \n\t float cx = coord.x - 0.5;\n\t float cy = (coord.y - 0.5) * uAspect;\n\t float ny = (-sinDir * cx + cosDir * cy) / uAspect + 0.5;\n \n\t // displacementMap: repeat\n\t // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny);\n \n\t // displacementMap: mirror\n\t ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny);\n \n\t vec4 dc = texture(uDisplacementMap, vec2(0.5, ny));\n \n\t float displacement = (dc.r - dc.g) * (uOffset / uInputSize.x);\n \n\t coord = vTextureCoord + vec2(cosDir * displacement, sinDir * displacement * uAspect);\n \n\t int fillMode = int(uFillMode);\n \n\t if (fillMode == CLAMP) {\n\t\t coord = clamp(coord, uInputClamp.xy, uInputClamp.zw);\n\t } else {\n\t\t if( coord.x > uInputClamp.z ) {\n\t\t\t if (fillMode == TRANSPARENT) {\n\t\t\t\t discard;\n\t\t\t } else if (fillMode == LOOP) {\n\t\t\t\t coord.x -= uInputClamp.z;\n\t\t\t } else if (fillMode == MIRROR) {\n\t\t\t\t coord.x = uInputClamp.z * 2.0 - coord.x;\n\t\t\t }\n\t\t } else if( coord.x < uInputClamp.x ) {\n\t\t\t if (fillMode == TRANSPARENT) {\n\t\t\t\t discard;\n\t\t\t } else if (fillMode == LOOP) {\n\t\t\t\t coord.x += uInputClamp.z;\n\t\t\t } else if (fillMode == MIRROR) {\n\t\t\t\t coord.x *= -uInputClamp.z;\n\t\t\t }\n\t\t }\n \n\t\t if( coord.y > uInputClamp.w ) {\n\t\t\t if (fillMode == TRANSPARENT) {\n\t\t\t\t discard;\n\t\t\t } else if (fillMode == LOOP) {\n\t\t\t\t coord.y -= uInputClamp.w;\n\t\t\t } else if (fillMode == MIRROR) {\n\t\t\t\t coord.y = uInputClamp.w * 2.0 - coord.y;\n\t\t\t }\n\t\t } else if( coord.y < uInputClamp.y ) {\n\t\t\t if (fillMode == TRANSPARENT) {\n\t\t\t\t discard;\n\t\t\t } else if (fillMode == LOOP) {\n\t\t\t\t coord.y += uInputClamp.w;\n\t\t\t } else if (fillMode == MIRROR) {\n\t\t\t\t coord.y *= -uInputClamp.w;\n\t\t\t }\n\t\t }\n\t }\n \n\t finalColor.r = texture(uTexture, coord + uRed * (1.0 - uSeed * 0.4) / uInputSize.xy).r;\n\t finalColor.g = texture(uTexture, coord + uGreen * (1.0 - uSeed * 0.3) / uInputSize.xy).g;\n\t finalColor.b = texture(uTexture, coord + uBlue * (1.0 - uSeed * 0.2) / uInputSize.xy).b;\n\t finalColor.a = texture(uTexture, coord).a;\n }\n ",name:"glitch-filter"}),h=document.createElement("canvas");h.width=4,h.height=null!=(s=r.sampleSize)?s:512;const d=new e.Texture({source:new e.ImageSource({resource:h})});super({gpuProgram:u,glProgram:c,resources:{glitchUniforms:{uSeed:{value:null!=(o=null==r?void 0:r.seed)?o:0,type:"f32"},uDimensions:{value:new Float32Array(2),type:"vec2<f32>"},uAspect:{value:1,type:"f32"},uFillMode:{value:null!=(a=null==r?void 0:r.fillMode)?a:0,type:"f32"},uOffset:{value:null!=(l=null==r?void 0:r.offset)?l:100,type:"f32"},uDirection:{value:null!=(_=null==r?void 0:r.direction)?_:0,type:"f32"},uRed:{value:r.red,type:"vec2<f32>"},uGreen:{value:r.green,type:"vec2<f32>"},uBlue:{value:r.blue,type:"vec2<f32>"}},uDisplacementMap:d.source,uDisplacementSampler:d.source.style}}),mr(this,"uniforms"),mr(this,"average",!1),mr(this,"minSize",8),mr(this,"sampleSize",512),mr(this,"_canvas"),mr(this,"texture"),mr(this,"_slices",0),mr(this,"_sizes",new Float32Array(1)),mr(this,"_offsets",new Float32Array(1)),this.uniforms=this.resources.glitchUniforms.uniforms,this._canvas=h,this.texture=d,Object.assign(this,r)}apply(t,e,r,n){const{width:i,height:s}=e.frame;this.uniforms.uDimensions[0]=i,this.uniforms.uDimensions[1]=s,this.uniforms.uAspect=s/i,t.applyFilter(this,e,r,n)}_randomizeSizes(){const t=this._sizes,e=this._slices-1,r=this.sampleSize,n=Math.min(this.minSize/r,.9/this._slices);if(this.average){const r=this._slices;let i=1;for(let s=0;s<e;s++){const e=i/(r-s),o=Math.max(e*(1-.6*Math.random()),n);t[s]=o,i-=o}t[e]=i}else{let r=1;const i=Math.sqrt(1/this._slices);for(let s=0;s<e;s++){const e=Math.max(i*r*Math.random(),n);t[s]=e,r-=e}t[e]=r}this.shuffle()}shuffle(){const t=this._sizes;for(let e=this._slices-1;e>0;e--){const r=Math.random()*e|0,n=t[e];t[e]=t[r],t[r]=n}}_randomizeOffsets(){for(let t=0;t<this._slices;t++)this._offsets[t]=Math.random()*(Math.random()<.5?-1:1)}refresh(){this._randomizeSizes(),this._randomizeOffsets(),this.redraw()}redraw(){const t=this.sampleSize,e=this.texture,r=this._canvas.getContext("2d");r.clearRect(0,0,8,t);let n,i=0;for(let e=0;e<this._slices;e++){n=Math.floor(256*this._offsets[e]);const s=this._sizes[e]*t,o=n>0?n:0,a=n<0?-n:0;r.fillStyle=`rgba(${o}, ${a}, 0, 1)`,r.fillRect(0,i|0,t,s+1|0),i+=s}e.source.update()}set sizes(t){const e=Math.min(this._slices,t.length);for(let r=0;r<e;r++)this._sizes[r]=t[r]}get sizes(){return this._sizes}set offsets(t){const e=Math.min(this._slices,t.length);for(let r=0;r<e;r++)this._offsets[r]=t[r]}get offsets(){return this._offsets}get slices(){return this._slices}set slices(t){this._slices!==t&&(this._slices=t,this._sizes=new Float32Array(t),this._offsets=new Float32Array(t),this.refresh())}get offset(){return this.uniforms.uOffset}set offset(t){this.uniforms.uOffset=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}get fillMode(){return this.uniforms.uFillMode}set fillMode(t){this.uniforms.uFillMode=t}get direction(){return this.uniforms.uDirection/e.DEG_TO_RAD}set direction(t){this.uniforms.uDirection=t*e.DEG_TO_RAD}get red(){return this.uniforms.uRed}set red(t){Array.isArray(t)&&(t={x:t[0],y:t[1]}),this.uniforms.uRed=t}get green(){return this.uniforms.uGreen}set green(t){Array.isArray(t)&&(t={x:t[0],y:t[1]}),this.uniforms.uGreen=t}get blue(){return this.uniforms.uBlue}set blue(t){Array.isArray(t)&&(t={x:t[0],y:t[1]}),this.uniforms.uBlue=t}destroy(){var t;null==(t=this.texture)||t.destroy(!0),this.texture=this._canvas=this.red=this.green=this.blue=this._sizes=this._offsets=null}};mr(xr,"defaults",{slices:5,offset:100,direction:0,fillMode:0,average:!1,seed:0,red:{x:0,y:0},green:{x:0,y:0},blue:{x:0,y:0},minSize:8,sampleSize:512});let br=xr;var Sr="precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform vec2 uStrength;\n uniform vec3 uColor;\n uniform float uKnockout;\n uniform float uAlpha;\n \n uniform vec4 uInputSize;\n uniform vec4 uInputClamp;\n \n const float PI = 3.14159265358979323846264;\n \n // Hard-assignment of DIST and ANGLE_STEP_SIZE instead of using uDistance and uQuality to allow them to be use on GLSL loop conditions\n const float DIST = __DIST__;\n const float ANGLE_STEP_SIZE = min(__ANGLE_STEP_SIZE__, PI * 2.);\n const float ANGLE_STEP_NUM = ceil(PI * 2. / ANGLE_STEP_SIZE);\n const float MAX_TOTAL_ALPHA = ANGLE_STEP_NUM * DIST * (DIST + 1.) / 2.;\n \n void main(void) {\n\t vec2 px = vec2(1.) / uInputSize.xy;\n \n\t float totalAlpha = 0.;\n \n\t vec2 direction;\n\t vec2 displaced;\n\t vec4 curColor;\n \n\t for (float angle = 0.; angle < PI * 2.; angle += ANGLE_STEP_SIZE) {\n\t direction = vec2(cos(angle), sin(angle)) * px;\n \n\t for (float curDistance = 0.; curDistance < DIST; curDistance++) {\n\t\t displaced = clamp(vTextureCoord + direction * (curDistance + 1.), uInputClamp.xy, uInputClamp.zw);\n\t\t curColor = texture(uTexture, displaced);\n\t\t totalAlpha += (DIST - curDistance) * curColor.a;\n\t }\n\t }\n\t \n\t curColor = texture(uTexture, vTextureCoord);\n \n\t vec4 glowColor = vec4(uColor, uAlpha);\n\t bool knockout = uKnockout > .5;\n\t float innerStrength = uStrength[0];\n\t float outerStrength = uStrength[1];\n \n\t float alphaRatio = totalAlpha / MAX_TOTAL_ALPHA;\n\t float innerGlowAlpha = (1. - alphaRatio) * innerStrength * curColor.a * uAlpha;\n\t float innerGlowStrength = min(1., innerGlowAlpha);\n\t \n\t vec4 innerColor = mix(curColor, glowColor, innerGlowStrength);\n\t float outerGlowAlpha = alphaRatio * outerStrength * (1. - curColor.a) * uAlpha;\n\t float outerGlowStrength = min(1. - innerColor.a, outerGlowAlpha);\n\t vec4 outerGlowColor = outerGlowStrength * glowColor.rgba;\n \n\t if (knockout) {\n\t float resultAlpha = outerGlowAlpha + innerGlowAlpha;\n\t finalColor = vec4(glowColor.rgb * resultAlpha, resultAlpha);\n\t }\n\t else {\n\t finalColor = innerColor + outerGlowColor;\n\t }\n }\n ",Tr=Object.defineProperty,Pr=Object.getOwnPropertySymbols,Or=Object.prototype.hasOwnProperty,Mr=Object.prototype.propertyIsEnumerable,wr=(t,e,r)=>e in t?Tr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Cr=(t,e)=>{for(var r in e||(e={}))Or.call(e,r)&&wr(t,r,e[r]);if(Pr)for(var r of Pr(e))Mr.call(e,r)&&wr(t,r,e[r]);return t},Er=(t,e,r)=>(wr(t,"symbol"!=typeof e?e+"":e,r),r);const Ar=class t extends e.Filter{constructor(r){var s,o,a,l;const _=null!=(s=(r=Cr(Cr({},t.DEFAULT_OPTIONS),r)).distance)?s:10,u=null!=(o=r.quality)?o:.1;super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct GlowUniforms {\n uDistance: f32,\n uStrength: vec2<f32>,\n uColor: vec3<f32>,\n uAlpha: f32,\n uQuality: f32,\n uKnockout: f32,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> glowUniforms : GlowUniforms;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n let quality = glowUniforms.uQuality;\n let distance = glowUniforms.uDistance;\n \n let dist: f32 = glowUniforms.uDistance;\n let angleStepSize: f32 = min(1. / quality / distance, PI * 2.0);\n let angleStepNum: f32 = ceil(PI * 2.0 / angleStepSize);\n \n let px: vec2<f32> = vec2<f32>(1.0 / gfu.uInputSize.xy);\n \n var totalAlpha: f32 = 0.0;\n \n var direction: vec2<f32>;\n var displaced: vec2<f32>;\n var curColor: vec4<f32>;\n \n for (var angle = 0.0; angle < PI * 2.0; angle += angleStepSize) {\n\t direction = vec2<f32>(cos(angle), sin(angle)) * px;\n\t for (var curDistance = 0.0; curDistance < dist; curDistance+=1) {\n\t displaced = vec2<f32>(clamp(uv + direction * (curDistance + 1.0), gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n\t curColor = textureSample(uTexture, uSampler, displaced);\n\t totalAlpha += (dist - curDistance) * curColor.a;\n\t }\n }\n\t \n curColor = textureSample(uTexture, uSampler, uv);\n \n let glowColorRGB = glowUniforms.uColor;\n let glowAlpha = glowUniforms.uAlpha;\n let glowColor = vec4<f32>(glowColorRGB, glowAlpha);\n let knockout: bool = glowUniforms.uKnockout > 0.5;\n let innerStrength = glowUniforms.uStrength[0];\n let outerStrength = glowUniforms.uStrength[1];\n \n let alphaRatio: f32 = (totalAlpha / (angleStepNum * dist * (dist + 1.0) / 2.0));\n let innerGlowAlpha: f32 = (1.0 - alphaRatio) * innerStrength * curColor.a * glowAlpha;\n let innerGlowStrength: f32 = min(1.0, innerGlowAlpha);\n \n let innerColor: vec4<f32> = mix(curColor, glowColor, innerGlowStrength);\n let outerGlowAlpha: f32 = alphaRatio * outerStrength * (1. - curColor.a) * glowAlpha;\n let outerGlowStrength: f32 = min(1.0 - innerColor.a, outerGlowAlpha);\n let outerGlowColor: vec4<f32> = outerGlowStrength * glowColor.rgba;\n \n if (knockout) {\n\t let resultAlpha: f32 = outerGlowAlpha + innerGlowAlpha;\n\t return vec4<f32>(glowColor.rgb * resultAlpha, resultAlpha);\n }\n else {\n\t return innerColor + outerGlowColor;\n }\n }\n \n const PI: f32 = 3.14159265358979323846264;",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:Sr.replace(/__ANGLE_STEP_SIZE__/gi,`${(1/u/_).toFixed(7)}`).replace(/__DIST__/gi,`${_.toFixed(0)}.0`),name:"glow-filter"}),resources:{glowUniforms:{uDistance:{value:_,type:"f32"},uStrength:{value:[r.innerStrength,r.outerStrength],type:"vec2<f32>"},uColor:{value:new Float32Array(3),type:"vec3<f32>"},uAlpha:{value:r.alpha,type:"f32"},uQuality:{value:u,type:"f32"},uKnockout:{value:null!=(a=null==r?void 0:r.knockout)&&a?1:0,type:"f32"}}},padding:_}),Er(this,"uniforms"),Er(this,"_color"),this.uniforms=this.resources.glowUniforms.uniforms,this._color=new e.Color,this.color=null!=(l=r.color)?l:16777215}get distance(){return this.uniforms.uDistance}set distance(t){this.uniforms.uDistance=this.padding=t}get innerStrength(){return this.uniforms.uStrength[0]}set innerStrength(t){this.uniforms.uStrength[0]=t}get outerStrength(){return this.uniforms.uStrength[1]}set outerStrength(t){this.uniforms.uStrength[1]=t}get color(){return this._color.value}set color(t){this._color.setValue(t);const[e,r,n]=this._color.toArray();this.uniforms.uColor[0]=e,this.uniforms.uColor[1]=r,this.uniforms.uColor[2]=n}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}get quality(){return this.uniforms.uQuality}set quality(t){this.uniforms.uQuality=t}get knockout(){return 1===this.uniforms.uKnockout}set knockout(t){this.uniforms.uKnockout=t?1:0}};Er(Ar,"DEFAULT_OPTIONS",{distance:10,outerStrength:4,innerStrength:0,color:16777215,alpha:1,quality:.1,knockout:!1});let Rr=Ar;var Ir="precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform vec2 uDimensions;\n uniform float uParallel;\n uniform vec2 uLight;\n uniform float uAspect;\n uniform float uTime;\n uniform vec3 uRay;\n \n uniform vec4 uInputSize;\n \n ${PERLIN}\n \n void main(void) {\n\t vec2 uDimensions = uDimensions;\n\t bool uParallel = uParallel > 0.5;\n\t vec2 uLight = uLight;\n\t float uAspect = uAspect;\n \n\t vec2 coord = vTextureCoord * uInputSize.xy / uDimensions;\n \n\t float d;\n \n\t if (uParallel) {\n\t\t float _cos = uLight.x;\n\t\t float _sin = uLight.y;\n\t\t d = (_cos * coord.x) + (_sin * coord.y * uAspect);\n\t } else {\n\t\t float dx = coord.x - uLight.x / uDimensions.x;\n\t\t float dy = (coord.y - uLight.y / uDimensions.y) * uAspect;\n\t\t float dis = sqrt(dx * dx + dy * dy) + 0.00001;\n\t\t d = dy / dis;\n\t }\n \n\t float uTime = uTime;\n\t vec3 uRay = uRay;\n \n\t float gain = uRay[0];\n\t float lacunarity = uRay[1];\n\t float alpha = uRay[2];\n \n\t vec3 dir = vec3(d, d, 0.0);\n\t float noise = turb(dir + vec3(uTime, 0.0, 62.1 + uTime) * 0.05, vec3(480.0, 320.0, 480.0), lacunarity, gain);\n\t noise = mix(noise, 0.0, 0.3);\n\t //fade vertically.\n\t vec4 mist = vec4(vec3(noise), 1.0) * (1.0 - coord.y);\n\t mist.a = 1.0;\n\t // apply user alpha\n\t mist *= alpha;\n \n\t finalColor = texture(uTexture, vTextureCoord) + mist;\n }\n ",Dr="struct GodrayUniforms {\n uLight: vec2<f32>,\n uParallel: f32,\n uAspect: f32,\n uTime: f32,\n uRay: vec3<f32>,\n uDimensions: vec2<f32>,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> godrayUniforms : GodrayUniforms;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n let uDimensions: vec2<f32> = godrayUniforms.uDimensions;\n let uParallel: bool = godrayUniforms.uParallel > 0.5;\n let uLight: vec2<f32> = godrayUniforms.uLight;\n let uAspect: f32 = godrayUniforms.uAspect;\n \n let coord: vec2<f32> = uv * gfu.uInputSize.xy / uDimensions;\n \n var d: f32;\n \n if (uParallel) {\n\t let _cos: f32 = uLight.x;\n\t let _sin: f32 = uLight.y;\n\t d = (_cos * coord.x) + (_sin * coord.y * uAspect);\n } else {\n\t let dx: f32 = coord.x - uLight.x / uDimensions.x;\n\t let dy: f32 = (coord.y - uLight.y / uDimensions.y) * uAspect;\n\t let dis: f32 = sqrt(dx * dx + dy * dy) + 0.00001;\n\t d = dy / dis;\n }\n \n let uTime: f32 = godrayUniforms.uTime;\n let uRay: vec3<f32> = godrayUniforms.uRay;\n \n let gain = uRay[0];\n let lacunarity = uRay[1];\n let alpha = uRay[2];\n \n let dir: vec3<f32> = vec3<f32>(d, d, 0.0);\n var noise: f32 = turb(dir + vec3<f32>(uTime, 0.0, 62.1 + uTime) * 0.05, vec3<f32>(480.0, 320.0, 480.0), lacunarity, gain);\n noise = mix(noise, 0.0, 0.3);\n //fade vertically.\n var mist: vec4<f32> = vec4<f32>(vec3<f32>(noise), 1.0) * (1.0 - coord.y);\n mist.a = 1.0;\n // apply user alpha\n mist *= alpha;\n return textureSample(uTexture, uSampler, uv) + mist;\n }\n \n ${PERLIN}",Br=Object.defineProperty,kr=Object.getOwnPropertySymbols,Ur=Object.prototype.hasOwnProperty,Fr=Object.prototype.propertyIsEnumerable,Lr=(t,e,r)=>e in t?Br(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Gr=(t,e)=>{for(var r in e||(e={}))Ur.call(e,r)&&Lr(t,r,e[r]);if(kr)for(var r of kr(e))Fr.call(e,r)&&Lr(t,r,e[r]);return t},jr=(t,e,r)=>(Lr(t,"symbol"!=typeof e?e+"":e,r),r);const Nr=class t extends e.Filter{constructor(r){r=Gr(Gr({},t.DEFAULT_OPTIONS),r);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:Dr.replace("${PERLIN}","// Taken from https://gist.github.com/munrocket/236ed5ba7e409b8bdf1ff6eca5dcdc39\n \n fn moduloVec3(x: vec3<f32>, y: vec3<f32>) -> vec3<f32>\n {\n return x - y * floor(x/y);\n }\n fn mod289Vec3(x: vec3<f32>) -> vec3<f32>\n {\n\t return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n fn mod289Vec4(x: vec4<f32>) -> vec4<f32>\n {\n\t return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n fn permute4(x: vec4<f32>) -> vec4<f32>\n {\n\t return mod289Vec4(((x * 34.0) + 1.0) * x);\n }\n fn taylorInvSqrt(r: vec4<f32>) -> vec4<f32>\n {\n\t return 1.79284291400159 - 0.85373472095314 * r;\n }\n fn fade3(t: vec3<f32>) -> vec3<f32>\n {\n\t return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);\n }\n fn fade2(t: vec2<f32>) -> vec2<f32> { return t * t * t * (t * (t * 6. - 15.) + 10.); }\n \n fn perlinNoise2(P: vec2<f32>) -> f32 {\n var Pi: vec4<f32> = floor(P.xyxy) + vec4<f32>(0., 0., 1., 1.);\n let Pf = fract(P.xyxy) - vec4<f32>(0., 0., 1., 1.);\n Pi = Pi % vec4<f32>(289.); // To avoid truncation effects in permutation\n let ix = Pi.xzxz;\n let iy = Pi.yyww;\n let fx = Pf.xzxz;\n let fy = Pf.yyww;\n let i = permute4(permute4(ix) + iy);\n var gx: vec4<f32> = 2. * fract(i * 0.0243902439) - 1.; // 1/41 = 0.024...\n let gy = abs(gx) - 0.5;\n let tx = floor(gx + 0.5);\n gx = gx - tx;\n var g00: vec2<f32> = vec2<f32>(gx.x, gy.x);\n var g10: vec2<f32> = vec2<f32>(gx.y, gy.y);\n var g01: vec2<f32> = vec2<f32>(gx.z, gy.z);\n var g11: vec2<f32> = vec2<f32>(gx.w, gy.w);\n let norm = 1.79284291400159 - 0.85373472095314 *\n\t vec4<f32>(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11));\n g00 = g00 * norm.x;\n g01 = g01 * norm.y;\n g10 = g10 * norm.z;\n g11 = g11 * norm.w;\n let n00 = dot(g00, vec2<f32>(fx.x, fy.x));\n let n10 = dot(g10, vec2<f32>(fx.y, fy.y));\n let n01 = dot(g01, vec2<f32>(fx.z, fy.z));\n let n11 = dot(g11, vec2<f32>(fx.w, fy.w));\n let fade_xy = fade2(Pf.xy);\n let n_x = mix(vec2<f32>(n00, n01), vec2<f32>(n10, n11), vec2<f32>(fade_xy.x));\n let n_xy = mix(n_x.x, n_x.y, fade_xy.y);\n return 2.3 * n_xy;\n }\n \n // Classic Perlin noise, periodic variant\n fn perlinNoise3(P: vec3<f32>, rep: vec3<f32>) -> f32\n {\n\t var Pi0: vec3<f32> = moduloVec3(floor(P), rep); // Integer part, modulo period\n\t var Pi1: vec3<f32> = moduloVec3(Pi0 + vec3<f32>(1.0), rep); // Integer part + 1, mod period\n\t Pi0 = mod289Vec3(Pi0);\n\t Pi1 = mod289Vec3(Pi1);\n\t let Pf0: vec3<f32> = fract(P); // Fractional part for interpolation\n\t let Pf1: vec3<f32> = Pf0 - vec3<f32>(1.0); // Fractional part - 1.0\n\t let ix: vec4<f32> = vec4<f32>(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n\t let iy: vec4<f32> = vec4<f32>(Pi0.yy, Pi1.yy);\n\t let iz0: vec4<f32> = Pi0.zzzz;\n\t let iz1: vec4<f32> = Pi1.zzzz;\n\t let ixy: vec4<f32> = permute4(permute4(ix) + iy);\n\t let ixy0: vec4<f32> = permute4(ixy + iz0);\n\t let ixy1: vec4<f32> = permute4(ixy + iz1);\n\t var gx0: vec4<f32> = ixy0 * (1.0 / 7.0);\n\t var gy0: vec4<f32> = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n\t gx0 = fract(gx0);\n\t let gz0: vec4<f32> = vec4<f32>(0.5) - abs(gx0) - abs(gy0);\n\t let sz0: vec4<f32> = step(gz0, vec4<f32>(0.0));\n\t gx0 -= sz0 * (step(vec4<f32>(0.0), gx0) - 0.5);\n\t gy0 -= sz0 * (step(vec4<f32>(0.0), gy0) - 0.5);\n\t var gx1: vec4<f32> = ixy1 * (1.0 / 7.0);\n\t var gy1: vec4<f32> = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n\t gx1 = fract(gx1);\n\t let gz1: vec4<f32> = vec4<f32>(0.5) - abs(gx1) - abs(gy1);\n\t let sz1: vec4<f32> = step(gz1, vec4<f32>(0.0));\n\t gx1 -= sz1 * (step(vec4<f32>(0.0), gx1) - 0.5);\n\t gy1 -= sz1 * (step(vec4<f32>(0.0), gy1) - 0.5);\n\t var g000: vec3<f32> = vec3<f32>(gx0.x, gy0.x, gz0.x);\n\t var g100: vec3<f32> = vec3<f32>(gx0.y, gy0.y, gz0.y);\n\t var g010: vec3<f32> = vec3<f32>(gx0.z, gy0.z, gz0.z);\n\t var g110: vec3<f32> = vec3<f32>(gx0.w, gy0.w, gz0.w);\n\t var g001: vec3<f32> = vec3<f32>(gx1.x, gy1.x, gz1.x);\n\t var g101: vec3<f32> = vec3<f32>(gx1.y, gy1.y, gz1.y);\n\t var g011: vec3<f32> = vec3<f32>(gx1.z, gy1.z, gz1.z);\n\t var g111: vec3<f32> = vec3<f32>(gx1.w, gy1.w, gz1.w);\n\t let norm0: vec4<f32> = taylorInvSqrt(vec4<f32>(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n\t g000 *= norm0.x;\n\t g010 *= norm0.y;\n\t g100 *= norm0.z;\n\t g110 *= norm0.w;\n\t let norm1: vec4<f32> = taylorInvSqrt(vec4<f32>(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n\t g001 *= norm1.x;\n\t g011 *= norm1.y;\n\t g101 *= norm1.z;\n\t g111 *= norm1.w;\n\t let n000: f32 = dot(g000, Pf0);\n\t let n100: f32 = dot(g100, vec3<f32>(Pf1.x, Pf0.yz));\n\t let n010: f32 = dot(g010, vec3<f32>(Pf0.x, Pf1.y, Pf0.z));\n\t let n110: f32 = dot(g110, vec3<f32>(Pf1.xy, Pf0.z));\n\t let n001: f32 = dot(g001, vec3<f32>(Pf0.xy, Pf1.z));\n\t let n101: f32 = dot(g101, vec3<f32>(Pf1.x, Pf0.y, Pf1.z));\n\t let n011: f32 = dot(g011, vec3<f32>(Pf0.x, Pf1.yz));\n\t let n111: f32 = dot(g111, Pf1);\n\t let fade_xyz: vec3<f32> = fade3(Pf0);\n\t let n_z: vec4<f32> = mix(vec4<f32>(n000, n100, n010, n110), vec4<f32>(n001, n101, n011, n111), fade_xyz.z);\n\t let n_yz: vec2<f32> = mix(n_z.xy, n_z.zw, fade_xyz.y);\n\t let n_xyz: f32 = mix(n_yz.x, n_yz.y, fade_xyz.x);\n\t return 2.2 * n_xyz;\n }\n fn turb(P: vec3<f32>, rep: vec3<f32>, lacunarity: f32, gain: f32) -> f32\n {\n\t var sum: f32 = 0.0;\n\t var sc: f32 = 1.0;\n\t var totalgain: f32 = 1.0;\n\t for (var i = 0.0; i < 6.0; i += 1)\n\t {\n\t\t sum += totalgain * perlinNoise3(P * sc, rep);\n\t\t sc *= lacunarity;\n\t\t totalgain *= gain;\n\t }\n\t return abs(sum);\n }"),entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:Ir.replace("${PERLIN}","vec3 mod289(vec3 x)\n {\n\t return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n vec4 mod289(vec4 x)\n {\n\t return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n vec4 permute(vec4 x)\n {\n\t return mod289(((x * 34.0) + 1.0) * x);\n }\n vec4 taylorInvSqrt(vec4 r)\n {\n\t return 1.79284291400159 - 0.85373472095314 * r;\n }\n vec3 fade(vec3 t)\n {\n\t return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);\n }\n // Classic Perlin noise, periodic variant\n float pnoise(vec3 P, vec3 rep)\n {\n\t vec3 Pi0 = mod(floor(P), rep); // Integer part, modulo period\n\t vec3 Pi1 = mod(Pi0 + vec3(1.0), rep); // Integer part + 1, mod period\n\t Pi0 = mod289(Pi0);\n\t Pi1 = mod289(Pi1);\n\t vec3 Pf0 = fract(P); // Fractional part for interpolation\n\t vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0\n\t vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);\n\t vec4 iy = vec4(Pi0.yy, Pi1.yy);\n\t vec4 iz0 = Pi0.zzzz;\n\t vec4 iz1 = Pi1.zzzz;\n\t vec4 ixy = permute(permute(ix) + iy);\n\t vec4 ixy0 = permute(ixy + iz0);\n\t vec4 ixy1 = permute(ixy + iz1);\n\t vec4 gx0 = ixy0 * (1.0 / 7.0);\n\t vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;\n\t gx0 = fract(gx0);\n\t vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);\n\t vec4 sz0 = step(gz0, vec4(0.0));\n\t gx0 -= sz0 * (step(0.0, gx0) - 0.5);\n\t gy0 -= sz0 * (step(0.0, gy0) - 0.5);\n\t vec4 gx1 = ixy1 * (1.0 / 7.0);\n\t vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;\n\t gx1 = fract(gx1);\n\t vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);\n\t vec4 sz1 = step(gz1, vec4(0.0));\n\t gx1 -= sz1 * (step(0.0, gx1) - 0.5);\n\t gy1 -= sz1 * (step(0.0, gy1) - 0.5);\n\t vec3 g000 = vec3(gx0.x, gy0.x, gz0.x);\n\t vec3 g100 = vec3(gx0.y, gy0.y, gz0.y);\n\t vec3 g010 = vec3(gx0.z, gy0.z, gz0.z);\n\t vec3 g110 = vec3(gx0.w, gy0.w, gz0.w);\n\t vec3 g001 = vec3(gx1.x, gy1.x, gz1.x);\n\t vec3 g101 = vec3(gx1.y, gy1.y, gz1.y);\n\t vec3 g011 = vec3(gx1.z, gy1.z, gz1.z);\n\t vec3 g111 = vec3(gx1.w, gy1.w, gz1.w);\n\t vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));\n\t g000 *= norm0.x;\n\t g010 *= norm0.y;\n\t g100 *= norm0.z;\n\t g110 *= norm0.w;\n\t vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));\n\t g001 *= norm1.x;\n\t g011 *= norm1.y;\n\t g101 *= norm1.z;\n\t g111 *= norm1.w;\n\t float n000 = dot(g000, Pf0);\n\t float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));\n\t float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));\n\t float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));\n\t float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));\n\t float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));\n\t float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));\n\t float n111 = dot(g111, Pf1);\n\t vec3 fade_xyz = fade(Pf0);\n\t vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);\n\t vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);\n\t float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);\n\t return 2.2 * n_xyz;\n }\n float turb(vec3 P, vec3 rep, float lacunarity, float gain)\n {\n\t float sum = 0.0;\n\t float sc = 1.0;\n\t float totalgain = 1.0;\n\t for (float i = 0.0; i < 6.0; i++)\n\t {\n\t\t sum += totalgain * pnoise(P * sc, rep);\n\t\t sc *= lacunarity;\n\t\t totalgain *= gain;\n\t }\n\t return abs(sum);\n }\n "),name:"god-ray-filter"}),resources:{godrayUniforms:{uLight:{value:new Float32Array(2),type:"vec2<f32>"},uParallel:{value:0,type:"f32"},uAspect:{value:0,type:"f32"},uTime:{value:r.time,type:"f32"},uRay:{value:new Float32Array(3),type:"vec3<f32>"},uDimensions:{value:new Float32Array(2),type:"vec2<f32>"}}}}),jr(this,"uniforms"),jr(this,"time",0),jr(this,"_angleLight",[0,0]),jr(this,"_angle",0),jr(this,"_center"),this.uniforms=this.resources.godrayUniforms.uniforms,Object.assign(this,r)}apply(t,e,r,n){const i=e.frame.width,s=e.frame.height;this.uniforms.uLight[0]=this.parallel?this._angleLight[0]:this._center.x,this.uniforms.uLight[1]=this.parallel?this._angleLight[1]:this._center.y,this.uniforms.uDimensions[0]=i,this.uniforms.uDimensions[1]=s,this.uniforms.uAspect=s/i,this.uniforms.uTime=this.time,t.applyFilter(this,e,r,n)}get angle(){return this._angle}set angle(t){this._angle=t;const r=t*e.DEG_TO_RAD;this._angleLight[0]=Math.cos(r),this._angleLight[1]=Math.sin(r)}get parallel(){return this.uniforms.uParallel>.5}set parallel(t){this.uniforms.uParallel=t?1:0}get center(){return this._center}set center(t){Array.isArray(t)&&(t={x:t[0],y:t[1]}),this._center=t}get centerX(){return this.center.x}set centerX(t){this.center.x=t}get centerY(){return this.center.y}set centerY(t){this.center.y=t}get gain(){return this.uniforms.uRay[0]}set gain(t){this.uniforms.uRay[0]=t}get lacunarity(){return this.uniforms.uRay[1]}set lacunarity(t){this.uniforms.uRay[1]=t}get alpha(){return this.uniforms.uRay[2]}set alpha(t){this.uniforms.uRay[2]=t}};jr(Nr,"DEFAULT_OPTIONS",{angle:30,gain:.5,lacunarity:2.5,parallel:!0,time:0,center:{x:0,y:0},alpha:1});let zr=Nr;class Wr extends e.Filter{constructor(){super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"@group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n \n @fragment\n fn mainFragment(\n @location(0) uv: vec2<f32>,\n @builtin(position) position: vec4<f32>\n ) -> @location(0) vec4<f32> {\n let color: vec4<f32> = textureSample(uTexture, uSampler, uv);\n \n let g: f32 = dot(color.rgb, vec3<f32>(0.299, 0.587, 0.114));\n return vec4<f32>(vec3<f32>(g), 1.);\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"in vec2 vTextureCoord;\n \n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n \n // https://en.wikipedia.org/wiki/Luma_(video)\n const vec3 weight = vec3(0.299, 0.587, 0.114);\n \n void main()\n {\n\t vec4 c = texture(uTexture, vTextureCoord);\n\t finalColor = vec4(\n\t\t vec3(c.r * weight.r + c.g * weight.g + c.b * weight.b),\n\t\t c.a\n\t );\n }\n ",name:"grayscale-filter"}),resources:{}})}}var Vr=Object.defineProperty,Hr=Object.getOwnPropertySymbols,Xr=Object.prototype.hasOwnProperty,Kr=Object.prototype.propertyIsEnumerable,Yr=(t,e,r)=>e in t?Vr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Qr=(t,e)=>{for(var r in e||(e={}))Xr.call(e,r)&&Yr(t,r,e[r]);if(Hr)for(var r of Hr(e))Kr.call(e,r)&&Yr(t,r,e[r]);return t},$r=(t,e,r)=>(Yr(t,"symbol"!=typeof e?e+"":e,r),r);const qr=class t extends e.Filter{constructor(r){r=Qr(Qr({},t.DEFAULT_OPTIONS),r);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct HslUniforms {\n uHsl:vec3<f32>,\n uColorize:f32,\n uAlpha:f32,\n };\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> hslUniforms : HslUniforms;\n \n @fragment\n fn mainFragment(\n @location(0) uv: vec2<f32>,\n @builtin(position) position: vec4<f32>\n ) -> @location(0) vec4<f32> {\n\t let color: vec4<f32> = textureSample(uTexture, uSampler, uv);\n\t var resultRGB: vec3<f32> = color.rgb;\n \n\t let hue: f32 = hslUniforms.uHsl[0];\n\t let saturation: f32 = hslUniforms.uHsl[1];\n\t let lightness: f32 = hslUniforms.uHsl[2];\n \n\t // colorize\n\t if (hslUniforms.uColorize > 0.5) {\n\t\t resultRGB = vec3<f32>(dot(color.rgb, vec3<f32>(0.299, 0.587, 0.114)), 0., 0.);\n\t }\n \n\t // hue\n\t resultRGB = hueShift(resultRGB, hue);\n \n\t // saturation\n\t // https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/huesaturation.js\n\t let average: f32 = (resultRGB.r + resultRGB.g + resultRGB.b) / 3.0;\n \n\t if (saturation > 0.) {\n\t\t resultRGB += (average - resultRGB) * (1. - 1. / (1.001 - saturation));\n\t } else {\n\t\t resultRGB -= (average - resultRGB) * saturation;\n\t }\n \n\t // lightness\n\t resultRGB = mix(resultRGB, vec3<f32>(ceil(lightness)) * color.a, abs(lightness));\n \n\t // alpha\n\t return mix(color, vec4<f32>(resultRGB, color.a), hslUniforms.uAlpha);\n }\n \n // https://gist.github.com/mairod/a75e7b44f68110e1576d77419d608786?permalink_comment_id=3195243#gistcomment-3195243\n const k: vec3<f32> = vec3(0.57735, 0.57735, 0.57735);\n \n fn hueShift(color: vec3<f32>, angle: f32) -> vec3<f32> \n {\n\t let cosAngle: f32 = cos(angle);\n\t return vec3<f32>(\n\t color * cosAngle +\n\t cross(k, color) * sin(angle) +\n\t k * dot(k, color) * (1.0 - cosAngle)\n\t );\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform vec3 uHsl;\n uniform float uAlpha;\n uniform float uColorize;\n \n // https://en.wikipedia.org/wiki/Luma_(video)\n const vec3 weight = vec3(0.299, 0.587, 0.114);\n \n float getWeightedAverage(vec3 rgb) {\n\t return rgb.r * weight.r + rgb.g * weight.g + rgb.b * weight.b;\n }\n \n // https://gist.github.com/mairod/a75e7b44f68110e1576d77419d608786?permalink_comment_id=3195243#gistcomment-3195243\n const vec3 k = vec3(0.57735, 0.57735, 0.57735);\n \n vec3 hueShift(vec3 color, float angle) {\n\t float cosAngle = cos(angle);\n\t return vec3(\n\t color * cosAngle +\n\t cross(k, color) * sin(angle) +\n\t k * dot(k, color) * (1.0 - cosAngle)\n\t );\n }\n \n void main()\n {\n\t vec4 color = texture(uTexture, vTextureCoord);\n\t vec3 resultRGB = color.rgb;\n \n\t float hue = uHsl[0];\n\t float saturation = uHsl[1];\n\t float lightness = uHsl[2];\n \n\t // colorize\n\t if (uColorize > 0.5) {\n\t\t resultRGB = vec3(getWeightedAverage(resultRGB), 0., 0.);\n\t }\n \n\t // hue\n\t resultRGB = hueShift(resultRGB, hue);\n \n\t // saturation\n\t // https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/huesaturation.js\n\t float average = (resultRGB.r + resultRGB.g + resultRGB.b) / 3.0;\n \n\t if (saturation > 0.) {\n\t\t resultRGB += (average - resultRGB) * (1. - 1. / (1.001 - saturation));\n\t } else {\n\t\t resultRGB -= (average - resultRGB) * saturation;\n\t }\n \n\t // lightness\n\t resultRGB = mix(resultRGB, vec3(ceil(lightness)) * color.a, abs(lightness));\n \n\t // alpha\n\t finalColor = mix(color, vec4(resultRGB, color.a), uAlpha);\n }\n ",name:"hsl-adjustment-filter"}),resources:{hslUniforms:{uHsl:{value:new Float32Array(3),type:"vec3<f32>"},uColorize:{value:r.colorize?1:0,type:"f32"},uAlpha:{value:r.alpha,type:"f32"}}}}),$r(this,"uniforms"),$r(this,"_hue"),this.uniforms=this.resources.hslUniforms.uniforms,this.hue=r.hue}get hue(){return this._hue}set hue(t){this._hue=t,this.resources.hslUniforms.uniforms.uHsl[0]=t*(Math.PI/180)}get saturation(){return this.resources.hslUniforms.uniforms.uHsl[1]}set saturation(t){this.resources.hslUniforms.uniforms.uHsl[1]=t}get lightness(){return this.resources.hslUniforms.uniforms.uHsl[2]}set lightness(t){this.resources.hslUniforms.uniforms.uHsl[2]=t}get colorize(){return 1===this.resources.hslUniforms.uniforms.uColorize}set colorize(t){this.resources.hslUniforms.uniforms.uColorize=t?1:0}get alpha(){return this.resources.hslUniforms.uniforms.uAlpha}set alpha(t){this.resources.hslUniforms.uniforms.uAlpha=t}};$r(qr,"DEFAULT_OPTIONS",{hue:0,saturation:0,lightness:0,colorize:!1,alpha:1});let Zr=qr;var Jr=Object.defineProperty,tn=Object.getOwnPropertySymbols,en=Object.prototype.hasOwnProperty,rn=Object.prototype.propertyIsEnumerable,nn=(t,e,r)=>e in t?Jr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,sn=(t,e)=>{for(var r in e||(e={}))en.call(e,r)&&nn(t,r,e[r]);if(tn)for(var r of tn(e))rn.call(e,r)&&nn(t,r,e[r]);return t},on=(t,e,r)=>(nn(t,"symbol"!=typeof e?e+"":e,r),r);const an=class t extends e.Filter{constructor(...r){var s,o;let a=null!=(s=r[0])?s:{};if(Array.isArray(a)||"x"in a&&"y"in a||a instanceof e.ObservablePoint){e.deprecation("6.0.0","MotionBlurFilter constructor params are now options object. See params: { velocity, kernelSize, offset }");a={velocity:{x:"x"in a?a.x:a[0],y:"y"in a?a.y:a[1]}},void 0!==r[1]&&(a.kernelSize=r[1]),void 0!==r[2]&&(a.offset=r[2])}a=sn(sn({},t.DEFAULT_OPTIONS),a);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct MotionBlurUniforms {\n uVelocity: vec2<f32>,\n uKernelSize: f32,\n uOffset: f32,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> motionBlurUniforms : MotionBlurUniforms;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n let uVelocity = motionBlurUniforms.uVelocity;\n let uKernelSize = motionBlurUniforms.uKernelSize;\n let uOffset = motionBlurUniforms.uOffset;\n \n let velocity: vec2<f32> = uVelocity / gfu.uInputSize.xy;\n let offset: f32 = -uOffset / length(uVelocity) - 0.5;\n let k: i32 = i32(min(uKernelSize - 1, MAX_KERNEL_SIZE - 1));\n \n var color: vec4<f32> = textureSample(uTexture, uSampler, uv);\n \n for(var i: i32 = 0; i < k; i += 1) {\n\t let bias: vec2<f32> = velocity * (f32(i) / f32(k) + offset);\n\t color += textureSample(uTexture, uSampler, uv + bias);\n }\n \n return select(color / f32(uKernelSize), textureSample(uTexture, uSampler, uv), uKernelSize == 0);\n }\n \n const MAX_KERNEL_SIZE: f32 = 2048;",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform vec2 uVelocity;\n uniform int uKernelSize;\n uniform float uOffset;\n \n uniform vec4 uInputSize;\n \n const int MAX_KERNEL_SIZE = 2048;\n \n // Notice:\n // the perfect way:\n // int kernelSize = min(uKernelSize, MAX_KERNELSIZE);\n // BUT in real use-case , uKernelSize < MAX_KERNELSIZE almost always.\n // So use uKernelSize directly.\n \n void main(void)\n {\n\t vec4 color = texture(uTexture, vTextureCoord);\n \n\t if (uKernelSize == 0)\n\t {\n\t\t finalColor = color;\n\t\t return;\n\t }\n \n\t vec2 velocity = uVelocity / uInputSize.xy;\n\t float offset = -uOffset / length(uVelocity) - 0.5;\n\t int k = uKernelSize - 1;\n \n\t for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n\t\t if (i == k) {\n\t\t\t break;\n\t\t }\n\t\t vec2 bias = velocity * (float(i) / float(k) + offset);\n\t\t color += texture(uTexture, vTextureCoord + bias);\n\t }\n\t finalColor = color / float(uKernelSize);\n }\n ",name:"motion-blur-filter"}),resources:{motionBlurUniforms:{uVelocity:{value:a.velocity,type:"vec2<f32>"},uKernelSize:{value:Math.trunc(null!=(o=a.kernelSize)?o:5),type:"i32"},uOffset:{value:a.offset,type:"f32"}}}}),on(this,"uniforms"),on(this,"_kernelSize"),this.uniforms=this.resources.motionBlurUniforms.uniforms,Object.assign(this,a)}get velocity(){return this.uniforms.uVelocity}set velocity(t){Array.isArray(t)&&(t={x:t[0],y:t[1]}),this.uniforms.uVelocity=t,this._updateDirty()}get velocityX(){return this.velocity.x}set velocityX(t){this.velocity.x=t,this._updateDirty()}get velocityY(){return this.velocity.y}set velocityY(t){this.velocity.y=t,this._updateDirty()}get kernelSize(){return this._kernelSize}set kernelSize(t){this._kernelSize=t,this._updateDirty()}get offset(){return this.uniforms.uOffset}set offset(t){this.uniforms.uOffset=t}_updateDirty(){this.padding=1+(Math.max(Math.abs(this.velocityX),Math.abs(this.velocityY))|0),this.uniforms.uKernelSize=0!==this.velocityX||0!==this.velocityY?this._kernelSize:0}};on(an,"DEFAULT_OPTIONS",{velocity:{x:0,y:0},kernelSize:5,offset:0});let ln=an;var _n="in vec2 vTextureCoord;\n out vec4 finalColor;\n \n const int MAX_COLORS = ${MAX_COLORS};\n \n uniform sampler2D uTexture;\n uniform vec3 uOriginalColors[MAX_COLORS];\n uniform vec3 uTargetColors[MAX_COLORS];\n uniform float uTolerance;\n \n void main(void)\n {\n\t finalColor = texture(uTexture, vTextureCoord);\n \n\t float alpha = finalColor.a;\n\t if (alpha < 0.0001)\n\t {\n\t return;\n\t }\n \n\t vec3 color = finalColor.rgb / alpha;\n \n\t for(int i = 0; i < MAX_COLORS; i++)\n\t {\n\t vec3 origColor = uOriginalColors[i];\n\t if (origColor.r < 0.0)\n\t {\n\t\t break;\n\t }\n\t vec3 colorDiff = origColor - color;\n\t if (length(colorDiff) < uTolerance)\n\t {\n\t\t vec3 targetColor = uTargetColors[i];\n\t\t finalColor = vec4((targetColor + colorDiff) * alpha, alpha);\n\t\t return;\n\t }\n\t }\n }\n ",un="struct MultiColorReplaceUniforms {\n uOriginalColors: array<vec3<f32>, MAX_COLORS>,\n uTargetColors: array<vec3<f32>, MAX_COLORS>,\n uTolerance:f32,\n };\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> multiColorReplaceUniforms : MultiColorReplaceUniforms;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n let uOriginalColors = multiColorReplaceUniforms.uOriginalColors;\n let uTargetColors = multiColorReplaceUniforms.uTargetColors;\n let uTolerance = multiColorReplaceUniforms.uTolerance;\n \n var color: vec4<f32> = textureSample(uTexture, uSampler, uv);\n \n let alpha: f32 = color.a;\n \n if (alpha > 0.0001)\n {\n\t var modColor: vec3<f32> = vec3<f32>(color.rgb) / alpha;\n \n\t for(var i: i32 = 0; i < MAX_COLORS; i += 1)\n\t {\n\t let origColor: vec3<f32> = uOriginalColors[i];\n\t if (origColor.r < 0.0)\n\t {\n\t\t break;\n\t }\n\t let colorDiff: vec3<f32> = origColor - modColor;\n\t \n\t if (length(colorDiff) < uTolerance)\n\t {\n\t\t let targetColor: vec3<f32> = uTargetColors[i];\n\t\t color = vec4((targetColor + colorDiff) * alpha, alpha);\n\t\t return color;\n\t }\n\t }\n }\n \n return color;\n }\n \n const MAX_COLORS: i32 = ${MAX_COLORS};",cn=Object.defineProperty,hn=Object.getOwnPropertySymbols,dn=Object.prototype.hasOwnProperty,pn=Object.prototype.propertyIsEnumerable,yn=(t,e,r)=>e in t?cn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vn=(t,e)=>{for(var r in e||(e={}))dn.call(e,r)&&yn(t,r,e[r]);if(hn)for(var r of hn(e))pn.call(e,r)&&yn(t,r,e[r]);return t},fn=(t,e,r)=>(yn(t,"symbol"!=typeof e?e+"":e,r),r);const mn=class t extends e.Filter{constructor(...r){var s,o;let a=null!=(s=r[0])?s:{};Array.isArray(a)&&(e.deprecation("6.0.0","MultiColorReplaceFilter constructor params are now options object. See params: { replacements, tolerance, maxColors }"),a={replacements:a},r[1]&&(a.tolerance=r[1]),r[2]&&(a.maxColors=r[2])),a=vn(vn({},t.DEFAULT_OPTIONS),a);const l=null!=(o=a.maxColors)?o:a.replacements.length;super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:un.replace(/\$\{MAX_COLORS\}/g,l.toFixed(0)),entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:_n.replace(/\$\{MAX_COLORS\}/g,l.toFixed(0)),name:"multi-color-replace-filter"}),resources:{multiColorReplaceUniforms:{uOriginalColors:{value:new Float32Array(3*l),type:"vec3<f32>",size:l},uTargetColors:{value:new Float32Array(3*l),type:"vec3<f32>",size:l},uTolerance:{value:a.tolerance,type:"f32"}}}}),fn(this,"uniforms"),fn(this,"_replacements",[]),fn(this,"_maxColors"),this._maxColors=l,this.uniforms=this.resources.multiColorReplaceUniforms.uniforms,this.replacements=a.replacements}set replacements(t){const r=this.uniforms.uOriginalColors,n=this.uniforms.uTargetColors,i=t.length,s=new e.Color;if(i>this._maxColors)throw new Error(`Length of replacements (${i}) exceeds the maximum colors length (${this._maxColors})`);let o,a,l;r[3*i]=-1;for(let e=0;e<i;e++){const i=t[e];s.setValue(i[0]),[o,a,l]=s.toArray(),r[3*e]=o,r[3*e+1]=a,r[3*e+2]=l,s.setValue(i[1]),[o,a,l]=s.toArray(),n[3*e]=o,n[3*e+1]=a,n[3*e+2]=l}this._replacements=t}get replacements(){return this._replacements}refresh(){this.replacements=this._replacements}get maxColors(){return this._maxColors}get tolerance(){return this.uniforms.uTolerance}set tolerance(t){this.uniforms.uTolerance=t}set epsilon(t){e.deprecation("6.0.0","MultiColorReplaceFilter.epsilon is deprecated, please use MultiColorReplaceFilter.tolerance instead"),this.tolerance=t}get epsilon(){return e.deprecation("6.0.0","MultiColorReplaceFilter.epsilon is deprecated, please use MultiColorReplaceFilter.tolerance instead"),this.tolerance}};fn(mn,"DEFAULT_OPTIONS",{replacements:[[16711680,255]],tolerance:.05,maxColors:void 0});let gn=mn;var xn=Object.defineProperty,bn=Object.getOwnPropertySymbols,Sn=Object.prototype.hasOwnProperty,Tn=Object.prototype.propertyIsEnumerable,Pn=(t,e,r)=>e in t?xn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,On=(t,e)=>{for(var r in e||(e={}))Sn.call(e,r)&&Pn(t,r,e[r]);if(bn)for(var r of bn(e))Tn.call(e,r)&&Pn(t,r,e[r]);return t},Mn=(t,e,r)=>(Pn(t,"symbol"!=typeof e?e+"":e,r),r);const wn=class t extends e.Filter{constructor(r){r=On(On({},t.DEFAULT_OPTIONS),r);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct OldFilmUniforms {\n\t uSepia: f32,\n\t uNoise: vec2<f32>,\n\t uScratch: vec3<f32>,\n\t uVignetting: vec3<f32>,\n\t uSeed: f32,\n\t uDimensions: vec2<f32>,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> oldFilmUniforms : OldFilmUniforms;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n var color: vec4<f32> = textureSample(uTexture, uSampler, uv);\n \n if (oldFilmUniforms.uSepia > 0.)\n {\n\t color = vec4<f32>(sepia(color.rgb), color.a);\n }\n \n let coord: vec2<f32> = uv * gfu.uInputSize.xy / oldFilmUniforms.uDimensions;\n \n if (oldFilmUniforms.uVignetting[0] > 0.)\n {\n\t color *= vec4<f32>(vec3<f32>(vignette(color.rgb, coord)), color.a);\n }\n \n let uScratch = oldFilmUniforms.uScratch; \n \n if (uScratch[1] > oldFilmUniforms.uSeed && uScratch[0] != 0.)\n {\n\t color = vec4<f32>(scratch(color.rgb, coord), color.a);\n }\n \n let uNoise = oldFilmUniforms.uNoise;\n \n if (uNoise[0] > 0.0 && uNoise[1] > 0.0)\n {\n\t color += vec4<f32>(vec3<f32>(noise(uv)), color.a);\n }\n \n return color;\n }\n \n const SQRT_2: f32 = 1.414213;\n const SEPIA_RGB: vec3<f32> = vec3<f32>(112.0 / 255.0, 66.0 / 255.0, 20.0 / 255.0);\n \n fn modulo(x: f32, y: f32) -> f32\n {\n return x - y * floor(x/y);\n }\n \n fn rand(co: vec2<f32>) -> f32\n {\n return fract(sin(dot(co, vec2<f32>(12.9898, 78.233))) * 43758.5453);\n }\n \n fn overlay(src: vec3<f32>, dst: vec3<f32>) -> vec3<f32>\n {\n\t // if (dst <= 0.5) then: 2 * src * dst\n\t // if (dst > 0.5) then: 1 - 2 * (1 - dst) * (1 - src)\n \n\t return vec3<f32>(\n\t select((1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)), (2.0 * src.x * dst.x), (dst.x <= 0.5)), \n\t select((1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)), (2.0 * src.y * dst.y), (dst.y <= 0.5)),\n\t select((1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z)), (2.0 * src.z * dst.z), (dst.z <= 0.5))\n\t );\n }\n \n fn sepia(co: vec3<f32>) -> vec3<f32>\n {\n let gray: f32 = (co.x + co.y + co.z) / 3.0;\n let grayscale: vec3<f32> = vec3<f32>(gray);\n let color = overlay(SEPIA_RGB, grayscale);\n return grayscale + oldFilmUniforms.uSepia * (color - grayscale);\n }\n \n fn vignette(co: vec3<f32>, coord: vec2<f32>) -> f32\n {\n let uVignetting = oldFilmUniforms.uVignetting;\n let uDimensions = oldFilmUniforms.uDimensions;\n \n let outter: f32 = SQRT_2 - uVignetting[0] * SQRT_2;\n var dir: vec2<f32> = vec2<f32>(vec2<f32>(0.5) - coord);\n dir.y *= uDimensions.y / uDimensions.x;\n let darker: f32 = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + uVignetting[2] * SQRT_2), 0.0, 1.0);\n return darker + (1.0 - darker) * (1.0 - uVignetting[1]);\n }\n \n fn scratch(co: vec3<f32>, coord: vec2<f32>) -> vec3<f32>\n {\n var color = co;\n let uScratch = oldFilmUniforms.uScratch;\n let uSeed = oldFilmUniforms.uSeed;\n let uDimensions = oldFilmUniforms.uDimensions;\n \n let phase: f32 = uSeed * 256.0;\n let s: f32 = modulo(floor(phase), 2.0);\n let dist: f32 = 1.0 / uScratch[1];\n let d: f32 = distance(coord, vec2<f32>(uSeed * dist, abs(s - uSeed * dist)));\n \n if (d < uSeed * 0.6 + 0.4)\n {\n\t let period: f32 = uScratch[1] * 10.0;\n \n\t let xx: f32 = coord.x * period + phase;\n\t let aa: f32 = abs(modulo(xx, 0.5) * 4.0);\n\t let bb: f32 = modulo(floor(xx / 0.5), 2.0);\n\t let yy: f32 = (1.0 - bb) * aa + bb * (2.0 - aa);\n \n\t let kk: f32 = 2.0 * period;\n\t let dw: f32 = uScratch[2] / uDimensions.x * (0.75 + uSeed);\n\t let dh: f32 = dw * kk;\n \n\t var tine: f32 = (yy - (2.0 - dh));\n \n\t if (tine > 0.0) {\n\t\t let _sign: f32 = sign(uScratch[0]);\n \n\t\t tine = s * tine / period + uScratch[0] + 0.1;\n\t\t tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5);\n \n\t\t color *= tine;\n\t }\n }\n \n return color;\n }\n \n fn noise(coord: vec2<f32>) -> f32\n {\n let uNoise = oldFilmUniforms.uNoise;\n let uSeed = oldFilmUniforms.uSeed;\n \n var pixelCoord: vec2<f32> = coord * gfu.uInputSize.xy;\n pixelCoord.x = floor(pixelCoord.x / uNoise[1]);\n pixelCoord.y = floor(pixelCoord.y / uNoise[1]);\n return (rand(pixelCoord * uNoise[1] * uSeed) - 0.5) * uNoise[0];\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform float uSepia;\n uniform vec2 uNoise;\n uniform vec3 uScratch;\n uniform vec3 uVignetting;\n uniform float uSeed;\n uniform vec2 uDimensions;\n \n uniform vec4 uInputSize;\n \n const float SQRT_2 = 1.414213;\n const vec3 SEPIA_RGB = vec3(112.0 / 255.0, 66.0 / 255.0, 20.0 / 255.0);\n \n float rand(vec2 co) {\n\t return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n }\n \n vec3 Overlay(vec3 src, vec3 dst)\n {\n\t // if (dst <= 0.5) then: 2 * src * dst\n\t // if (dst > 0.5) then: 1 - 2 * (1 - dst) * (1 - src)\n\t return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)),\n\t\t\t\t (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)),\n\t\t\t\t (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z)));\n }\n \n \n void main()\n {\n\t finalColor = texture(uTexture, vTextureCoord);\n\t vec3 color = finalColor.rgb;\n \n\t if (uSepia > 0.0)\n\t {\n\t\t float gray = (color.x + color.y + color.z) / 3.0;\n\t\t vec3 grayscale = vec3(gray);\n \n\t\t color = Overlay(SEPIA_RGB, grayscale);\n \n\t\t color = grayscale + uSepia * (color - grayscale);\n\t }\n \n\t vec2 coord = vTextureCoord * uInputSize.xy / uDimensions.xy;\n \n\t float vignette = uVignetting[0];\n\t float vignetteAlpha = uVignetting[1];\n\t float vignetteBlur = uVignetting[2];\n \n\t if (vignette > 0.0)\n\t {\n\t\t float outter = SQRT_2 - vignette * SQRT_2;\n\t\t vec2 dir = vec2(vec2(0.5, 0.5) - coord);\n\t\t dir.y *= uDimensions.y / uDimensions.x;\n\t\t float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignetteBlur * SQRT_2), 0.0, 1.0);\n\t\t color.rgb *= darker + (1.0 - darker) * (1.0 - vignetteAlpha);\n\t }\n \n\t float scratch = uScratch[0];\n\t float scratchDensity = uScratch[1];\n\t float scratchWidth = uScratch[2];\n \n\t if (scratchDensity > uSeed && scratch != 0.0)\n\t {\n\t\t float phase = uSeed * 256.0;\n\t\t float s = mod(floor(phase), 2.0);\n\t\t float dist = 1.0 / scratchDensity;\n\t\t float d = distance(coord, vec2(uSeed * dist, abs(s - uSeed * dist)));\n\t\t if (d < uSeed * 0.6 + 0.4)\n\t\t {\n\t\t\t highp float period = scratchDensity * 10.0;\n \n\t\t\t float xx = coord.x * period + phase;\n\t\t\t float aa = abs(mod(xx, 0.5) * 4.0);\n\t\t\t float bb = mod(floor(xx / 0.5), 2.0);\n\t\t\t float yy = (1.0 - bb) * aa + bb * (2.0 - aa);\n \n\t\t\t float kk = 2.0 * period;\n\t\t\t float dw = scratchWidth / uDimensions.x * (0.75 + uSeed);\n\t\t\t float dh = dw * kk;\n \n\t\t\t float tine = (yy - (2.0 - dh));\n \n\t\t\t if (tine > 0.0) {\n\t\t\t\t float _sign = sign(scratch);\n \n\t\t\t\t tine = s * tine / period + scratch + 0.1;\n\t\t\t\t tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5);\n \n\t\t\t\t color.rgb *= tine;\n\t\t\t }\n\t\t }\n\t }\n \n\t float noise = uNoise[0];\n\t float noiseSize = uNoise[1];\n \n\t if (noise > 0.0 && noiseSize > 0.0)\n\t {\n\t\t vec2 pixelCoord = vTextureCoord.xy * uInputSize.xy;\n\t\t pixelCoord.x = floor(pixelCoord.x / noiseSize);\n\t\t pixelCoord.y = floor(pixelCoord.y / noiseSize);\n\t\t // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + uSeed * 512.0, 1024.0 - uSeed * 512.0);\n\t\t // float _noise = snoise(d) * 0.5;\n\t\t float _noise = rand(pixelCoord * noiseSize * uSeed) - 0.5;\n\t\t color += _noise * noise;\n\t }\n \n\t finalColor.rgb = color;\n }",name:"old-film-filter"}),resources:{oldFilmUniforms:{uSepia:{value:r.sepia,type:"f32"},uNoise:{value:new Float32Array(2),type:"vec2<f32>"},uScratch:{value:new Float32Array(3),type:"vec3<f32>"},uVignetting:{value:new Float32Array(3),type:"vec3<f32>"},uSeed:{value:r.seed,type:"f32"},uDimensions:{value:new Float32Array(2),type:"vec2<f32>"}}}}),Mn(this,"uniforms"),Mn(this,"seed"),this.uniforms=this.resources.oldFilmUniforms.uniforms,Object.assign(this,r)}apply(t,e,r,n){this.uniforms.uDimensions[0]=e.frame.width,this.uniforms.uDimensions[1]=e.frame.height,this.uniforms.uSeed=this.seed,t.applyFilter(this,e,r,n)}get sepia(){return this.uniforms.uSepia}set sepia(t){this.uniforms.uSepia=t}get noise(){return this.uniforms.uNoise[0]}set noise(t){this.uniforms.uNoise[0]=t}get noiseSize(){return this.uniforms.uNoise[1]}set noiseSize(t){this.uniforms.uNoise[1]=t}get scratch(){return this.uniforms.uScratch[0]}set scratch(t){this.uniforms.uScratch[0]=t}get scratchDensity(){return this.uniforms.uScratch[1]}set scratchDensity(t){this.uniforms.uScratch[1]=t}get scratchWidth(){return this.uniforms.uScratch[2]}set scratchWidth(t){this.uniforms.uScratch[2]=t}get vignetting(){return this.uniforms.uVignetting[0]}set vignetting(t){this.uniforms.uVignetting[0]=t}get vignettingAlpha(){return this.uniforms.uVignetting[1]}set vignettingAlpha(t){this.uniforms.uVignetting[1]=t}get vignettingBlur(){return this.uniforms.uVignetting[2]}set vignettingBlur(t){this.uniforms.uVignetting[2]=t}};Mn(wn,"DEFAULT_OPTIONS",{sepia:.3,noise:.3,noiseSize:1,scratch:.5,scratchDensity:.3,scratchWidth:1,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,seed:0});let Cn=wn;var En="precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform vec2 uThickness;\n uniform vec3 uColor;\n uniform float uAlpha;\n uniform float uKnockout;\n \n uniform vec4 uInputClamp;\n \n const float DOUBLE_PI = 2. * 3.14159265358979323846264;\n const float ANGLE_STEP = ${ANGLE_STEP};\n \n float outlineMaxAlphaAtPos(vec2 pos) {\n\t if (uThickness.x == 0. || uThickness.y == 0.) {\n\t\t return 0.;\n\t }\n \n\t vec4 displacedColor;\n\t vec2 displacedPos;\n\t float maxAlpha = 0.;\n \n\t for (float angle = 0.; angle <= DOUBLE_PI; angle += ANGLE_STEP) {\n\t\t displacedPos.x = vTextureCoord.x + uThickness.x * cos(angle);\n\t\t displacedPos.y = vTextureCoord.y + uThickness.y * sin(angle);\n\t\t displacedColor = texture(uTexture, clamp(displacedPos, uInputClamp.xy, uInputClamp.zw));\n\t\t maxAlpha = max(maxAlpha, displacedColor.a);\n\t }\n \n\t return maxAlpha;\n }\n \n void main(void) {\n\t vec4 sourceColor = texture(uTexture, vTextureCoord);\n\t vec4 contentColor = sourceColor * float(uKnockout < 0.5);\n\t float outlineAlpha = uAlpha * outlineMaxAlphaAtPos(vTextureCoord.xy) * (1.-sourceColor.a);\n\t vec4 outlineColor = vec4(vec3(uColor) * outlineAlpha, outlineAlpha);\n\t finalColor = contentColor + outlineColor;\n }\n ",An=Object.defineProperty,Rn=Object.getOwnPropertySymbols,In=Object.prototype.hasOwnProperty,Dn=Object.prototype.propertyIsEnumerable,Bn=(t,e,r)=>e in t?An(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kn=(t,e)=>{for(var r in e||(e={}))In.call(e,r)&&Bn(t,r,e[r]);if(Rn)for(var r of Rn(e))Dn.call(e,r)&&Bn(t,r,e[r]);return t},Un=(t,e,r)=>(Bn(t,"symbol"!=typeof e?e+"":e,r),r);const Fn=class t extends e.Filter{constructor(...r){var s,o,a;let l=null!=(s=r[0])?s:{};"number"==typeof l&&(e.deprecation("6.0.0","OutlineFilter constructor params are now options object. See params: { thickness, color, quality, alpha, knockout }"),l={thickness:l},void 0!==r[1]&&(l.color=r[1]),void 0!==r[2]&&(l.quality=r[2]),void 0!==r[3]&&(l.alpha=r[3]),void 0!==r[4]&&(l.knockout=r[4])),l=kn(kn({},t.DEFAULT_OPTIONS),l);const _=null!=(o=l.quality)?o:.1;super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct OutlineUniforms {\n uThickness:vec2<f32>,\n uColor:vec3<f32>,\n uAlpha:f32,\n uAngleStep:f32,\n uKnockout:f32,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> outlineUniforms : OutlineUniforms;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n let sourceColor: vec4<f32> = textureSample(uTexture, uSampler, uv);\n let contentColor: vec4<f32> = sourceColor * (1. - outlineUniforms.uKnockout);\n \n let outlineAlpha: f32 = outlineUniforms.uAlpha * outlineMaxAlphaAtPos(uv) * (1. - sourceColor.a);\n let outlineColor: vec4<f32> = vec4<f32>(vec3<f32>(outlineUniforms.uColor) * outlineAlpha, outlineAlpha);\n \n return contentColor + outlineColor;\n }\n \n fn outlineMaxAlphaAtPos(uv: vec2<f32>) -> f32 {\n let thickness = outlineUniforms.uThickness;\n \n if (thickness.x == 0. || thickness.y == 0.) {\n\t return 0.;\n }\n \n let angleStep = outlineUniforms.uAngleStep;\n \n var displacedColor: vec4<f32>;\n var displacedPos: vec2<f32>;\n \n var maxAlpha: f32 = 0.;\n var displaced: vec2<f32>;\n var curColor: vec4<f32>;\n \n for (var angle = 0.; angle <= DOUBLE_PI; angle += angleStep)\n {\n\t displaced.x = uv.x + thickness.x * cos(angle);\n\t displaced.y = uv.y + thickness.y * sin(angle);\n\t curColor = textureSample(uTexture, uSampler, clamp(displaced, gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n\t maxAlpha = max(maxAlpha, curColor.a);\n }\n \n return maxAlpha;\n }\n \n const DOUBLE_PI: f32 = 3.14159265358979323846264 * 2.;",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:En.replace(/\$\{ANGLE_STEP\}/,t.getAngleStep(_).toFixed(7)),name:"outline-filter"}),resources:{outlineUniforms:{uThickness:{value:new Float32Array(2),type:"vec2<f32>"},uColor:{value:new Float32Array(3),type:"vec3<f32>"},uAlpha:{value:l.alpha,type:"f32"},uAngleStep:{value:0,type:"f32"},uKnockout:{value:l.knockout?1:0,type:"f32"}}}}),Un(this,"uniforms"),Un(this,"_thickness"),Un(this,"_quality"),Un(this,"_color"),this.uniforms=this.resources.outlineUniforms.uniforms,this.uniforms.uAngleStep=t.getAngleStep(_),this._color=new e.Color,this.color=null!=(a=l.color)?a:0,Object.assign(this,l)}apply(t,e,r,n){this.uniforms.uThickness[0]=this.thickness/e.source.width,this.uniforms.uThickness[1]=this.thickness/e.source.height,t.applyFilter(this,e,r,n)}static getAngleStep(e){return parseFloat((2*Math.PI/Math.max(e*t.MAX_SAMPLES,t.MIN_SAMPLES)).toFixed(7))}get thickness(){return this._thickness}set thickness(t){this._thickness=this.padding=t}get color(){return this._color.value}set color(t){this._color.setValue(t);const[e,r,n]=this._color.toArray();this.uniforms.uColor[0]=e,this.uniforms.uColor[1]=r,this.uniforms.uColor[2]=n}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}get quality(){return this._quality}set quality(e){this._quality=e,this.uniforms.uAngleStep=t.getAngleStep(e)}get knockout(){return 1===this.uniforms.uKnockout}set knockout(t){this.uniforms.uKnockout=t?1:0}};Un(Fn,"DEFAULT_OPTIONS",{thickness:1,color:0,alpha:1,quality:.1,knockout:!1}),Un(Fn,"MIN_SAMPLES",1),Un(Fn,"MAX_SAMPLES",100);let Ln=Fn;class Gn extends e.Filter{constructor(t=10){super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct PixelateUniforms {\n uSize:vec2<f32>,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> pixelateUniforms : PixelateUniforms;\n \n @fragment\n fn mainFragment(\n @location(0) uv: vec2<f32>,\n @builtin(position) position: vec4<f32>\n ) -> @location(0) vec4<f32> {\n let pixelSize: vec2<f32> = pixelateUniforms.uSize;\n let coord: vec2<f32> = mapCoord(uv);\n \n var pixCoord: vec2<f32> = pixelate(coord, pixelSize);\n pixCoord = unmapCoord(pixCoord);\n \n return textureSample(uTexture, uSampler, pixCoord);\n }\n \n fn mapCoord(coord: vec2<f32> ) -> vec2<f32>\n {\n var mappedCoord: vec2<f32> = coord;\n mappedCoord *= gfu.uInputSize.xy;\n mappedCoord += gfu.uOutputFrame.xy;\n return mappedCoord;\n }\n \n fn unmapCoord(coord: vec2<f32> ) -> vec2<f32>\n {\n var mappedCoord: vec2<f32> = coord;\n mappedCoord -= gfu.uOutputFrame.xy;\n mappedCoord /= gfu.uInputSize.xy;\n return mappedCoord;\n }\n \n fn pixelate(coord: vec2<f32>, size: vec2<f32>) -> vec2<f32>\n {\n return floor( coord / size ) * size;\n }\n \n ",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform vec2 uSize;\n uniform sampler2D uTexture;\n uniform vec4 uInputSize;\n \n vec2 mapCoord( vec2 coord )\n {\n\t coord *= uInputSize.xy;\n\t coord += uInputSize.zw;\n \n\t return coord;\n }\n \n vec2 unmapCoord( vec2 coord )\n {\n\t coord -= uInputSize.zw;\n\t coord /= uInputSize.xy;\n \n\t return coord;\n }\n \n vec2 pixelate(vec2 coord, vec2 uSize)\n {\n\t return floor( coord / uSize ) * uSize;\n }\n \n void main(void)\n {\n\t vec2 coord = mapCoord(vTextureCoord);\n\t coord = pixelate(coord, uSize);\n\t coord = unmapCoord(coord);\n\t finalColor = texture(uTexture, coord);\n }\n ",name:"pixelate-filter"}),resources:{pixelateUniforms:{uSize:{value:new Float32Array(2),type:"vec2<f32>"}}}}),this.size=t}get size(){return this.resources.pixelateUniforms.uniforms.uSize}set size(t){t instanceof e.Point?(this.sizeX=t.x,this.sizeY=t.y):Array.isArray(t)?this.resources.pixelateUniforms.uniforms.uSize=t:this.sizeX=this.sizeY=t}get sizeX(){return this.resources.pixelateUniforms.uniforms.uSize[0]}set sizeX(t){this.resources.pixelateUniforms.uniforms.uSize[0]=t}get sizeY(){return this.resources.pixelateUniforms.uniforms.uSize[1]}set sizeY(t){this.resources.pixelateUniforms.uniforms.uSize[1]=t}}var jn=Object.defineProperty,Nn=Object.getOwnPropertySymbols,zn=Object.prototype.hasOwnProperty,Wn=Object.prototype.propertyIsEnumerable,Vn=(t,e,r)=>e in t?jn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Hn=(t,e)=>{for(var r in e||(e={}))zn.call(e,r)&&Vn(t,r,e[r]);if(Nn)for(var r of Nn(e))Wn.call(e,r)&&Vn(t,r,e[r]);return t},Xn=(t,e,r)=>(Vn(t,"symbol"!=typeof e?e+"":e,r),r);const Kn=class t extends e.Filter{constructor(...r){var s;let o=null!=(s=r[0])?s:{};if("number"==typeof o){if(e.deprecation("6.0.0","RadialBlurFilter constructor params are now options object. See params: { angle, center, kernelSize, radius }"),o={angle:o},r[1]){const t="x"in r[1]?r[1].x:r[1][0],e="y"in r[1]?r[1].y:r[1][1];o.center={x:t,y:e}}r[2]&&(o.kernelSize=r[2]),r[3]&&(o.radius=r[3])}o=Hn(Hn({},t.DEFAULT_OPTIONS),o);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct RadialBlurUniforms {\n uRadian: f32,\n uCenter: vec2<f32>,\n uKernelSize: f32,\n uRadius: f32,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> radialBlurUniforms : RadialBlurUniforms;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n let uRadian = radialBlurUniforms.uRadian;\n let uCenter = radialBlurUniforms.uCenter;\n let uKernelSize = radialBlurUniforms.uKernelSize;\n let uRadius = radialBlurUniforms.uRadius;\n \n var returnColorOnly = false;\n \n if (uKernelSize == 0)\n {\n\t returnColorOnly = true;\n }\n \n let aspect: f32 = gfu.uInputSize.y / gfu.uInputSize.x;\n let center: vec2<f32> = uCenter.xy / gfu.uInputSize.xy;\n let gradient: f32 = uRadius / gfu.uInputSize.x * 0.3;\n let radius: f32 = uRadius / gfu.uInputSize.x - gradient * 0.5;\n let k: i32 = i32(uKernelSize - 1);\n \n var coord: vec2<f32> = uv;\n let dir: vec2<f32> = vec2<f32>(center - coord);\n let dist: f32 = length(vec2<f32>(dir.x, dir.y * aspect));\n \n var radianStep: f32 = uRadian;\n \n if (radius >= 0.0 && dist > radius)\n {\n\t let delta: f32 = dist - radius;\n\t let gap: f32 = gradient;\n\t let scale: f32 = 1.0 - abs(delta / gap);\n\t if (scale <= 0.0) {\n\t returnColorOnly = true;\n\t }\n\t radianStep *= scale;\n }\n \n radianStep /= f32(k);\n \n let s: f32 = sin(radianStep);\n let c: f32 = cos(radianStep);\n let rotationMatrix: mat2x2<f32> = mat2x2<f32>(vec2<f32>(c, -s), vec2<f32>(s, c));\n \n var color: vec4<f32> = textureSample(uTexture, uSampler, uv);\n let baseColor = vec4<f32>(color);\n \n let minK: i32 = min(i32(uKernelSize) - 1, MAX_KERNEL_SIZE - 1);\n \n for(var i: i32 = 0; i < minK; i += 1) \n {\n\t coord -= center;\n\t coord.y *= aspect;\n\t coord = rotationMatrix * coord;\n\t coord.y /= aspect;\n\t coord += center;\n\t let sample: vec4<f32> = textureSample(uTexture, uSampler, coord);\n\t // switch to pre-multiplied alpha to correctly blur transparent images\n\t // sample.rgb *= sample.a;\n\t color += sample;\n }\n \n return select(color / f32(uKernelSize), baseColor, returnColorOnly);\n }\n \n const MAX_KERNEL_SIZE: i32 = 2048;",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform float uRadian;\n uniform vec2 uCenter;\n uniform float uRadius;\n uniform int uKernelSize;\n \n uniform vec4 uInputSize;\n \n const int MAX_KERNEL_SIZE = 2048;\n \n void main(void)\n {\n\t vec4 color = texture(uTexture, vTextureCoord);\n \n\t if (uKernelSize == 0)\n\t {\n\t\t finalColor = color;\n\t\t return;\n\t }\n \n\t float aspect = uInputSize.y / uInputSize.x;\n\t vec2 center = uCenter.xy / uInputSize.xy;\n\t float gradient = uRadius / uInputSize.x * 0.3;\n\t float radius = uRadius / uInputSize.x - gradient * 0.5;\n\t int k = uKernelSize - 1;\n \n\t vec2 coord = vTextureCoord;\n\t vec2 dir = vec2(center - coord);\n\t float dist = length(vec2(dir.x, dir.y * aspect));\n \n\t float radianStep = uRadian;\n\t if (radius >= 0.0 && dist > radius) {\n\t\t float delta = dist - radius;\n\t\t float gap = gradient;\n\t\t float scale = 1.0 - abs(delta / gap);\n\t\t if (scale <= 0.0) {\n\t\t\t finalColor = color;\n\t\t\t return;\n\t\t }\n\t\t radianStep *= scale;\n\t }\n\t radianStep /= float(k);\n \n\t float s = sin(radianStep);\n\t float c = cos(radianStep);\n\t mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c));\n \n\t for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n\t\t if (i == k) {\n\t\t\t break;\n\t\t }\n \n\t\t coord -= center;\n\t\t coord.y *= aspect;\n\t\t coord = rotationMatrix * coord;\n\t\t coord.y /= aspect;\n\t\t coord += center;\n \n\t\t vec4 sample = texture(uTexture, coord);\n \n\t\t // switch to pre-multiplied alpha to correctly blur transparent images\n\t\t // sample.rgb *= sample.a;\n \n\t\t color += sample;\n\t }\n \n\t finalColor = color / float(uKernelSize);\n }\n ",name:"radial-blur-filter"}),resources:{radialBlurUniforms:{uRadian:{value:0,type:"f32"},uCenter:{value:o.center,type:"vec2<f32>"},uKernelSize:{value:o.kernelSize,type:"i32"},uRadius:{value:o.radius,type:"f32"}}}}),Xn(this,"uniforms"),Xn(this,"_angle"),Xn(this,"_kernelSize"),this.uniforms=this.resources.radialBlurUniforms.uniforms,Object.assign(this,o)}_updateKernelSize(){this.uniforms.uKernelSize=0!==this._angle?this.kernelSize:0}get angle(){return this._angle}set angle(t){this._angle=t,this.uniforms.uRadian=t*Math.PI/180,this._updateKernelSize()}get center(){return this.uniforms.uCenter}set center(t){Array.isArray(t)&&(t={x:t[0],y:t[1]}),this.uniforms.uCenter=t}get centerX(){return this.center.x}set centerX(t){this.center.x=t}get centerY(){return this.center.y}set centerY(t){this.center.y=t}get kernelSize(){return this._kernelSize}set kernelSize(t){this._kernelSize=t,this._updateKernelSize()}get radius(){return this.uniforms.uRadius}set radius(t){this.uniforms.uRadius=t<0||t===1/0?-1:t}};Xn(Kn,"DEFAULT_OPTIONS",{angle:0,center:{x:0,y:0},kernelSize:5,radius:-1});let Yn=Kn;var Qn=Object.defineProperty,$n=Object.getOwnPropertySymbols,qn=Object.prototype.hasOwnProperty,Zn=Object.prototype.propertyIsEnumerable,Jn=(t,e,r)=>e in t?Qn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ti=(t,e)=>{for(var r in e||(e={}))qn.call(e,r)&&Jn(t,r,e[r]);if($n)for(var r of $n(e))Zn.call(e,r)&&Jn(t,r,e[r]);return t},ei=(t,e,r)=>(Jn(t,"symbol"!=typeof e?e+"":e,r),r);const ri=class t extends e.Filter{constructor(r){r=ti(ti({},t.DEFAULT_OPTIONS),r);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct ReflectionUniforms {\n uMirror: f32,\n uBoundary: f32,\n uAmplitude: vec2<f32>,\n uWavelength: vec2<f32>,\n uAlpha: vec2<f32>,\n uTime: f32,\n uDimensions: vec2<f32>,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> reflectionUniforms : ReflectionUniforms;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n let uDimensions: vec2<f32> = reflectionUniforms.uDimensions;\n let uBoundary: f32 = reflectionUniforms.uBoundary;\n let uMirror: bool = reflectionUniforms.uMirror > 0.5;\n let uAmplitude: vec2<f32> = reflectionUniforms.uAmplitude;\n let uWavelength: vec2<f32> = reflectionUniforms.uWavelength;\n let uAlpha: vec2<f32> = reflectionUniforms.uAlpha;\n let uTime: f32 = reflectionUniforms.uTime;\n \n let pixelCoord: vec2<f32> = uv * gfu.uInputSize.xy;\n let coord: vec2<f32> = pixelCoord /uDimensions;\n var returnColorOnly: bool = false;\n \n if (coord.y < uBoundary) {\n\t returnColorOnly = true;\n }\n \n let k: f32 = (coord.y - uBoundary) / (1. - uBoundary + 0.0001);\n let areaY: f32 = uBoundary * uDimensions.y / gfu.uInputSize.y;\n let v: f32 = areaY + areaY - uv.y;\n let y: f32 = select(uv.y, v, uMirror);\n \n let amplitude: f32 = ((uAmplitude.y - uAmplitude.x) * k + uAmplitude.x ) / gfu.uInputSize.x;\n let waveLength: f32 = ((uWavelength.y - uWavelength.x) * k + uWavelength.x) / gfu.uInputSize.y;\n let alpha: f32 = select((uAlpha.y - uAlpha.x) * k + uAlpha.x, 1., returnColorOnly);\n \n var x: f32 = uv.x + cos(v * 6.28 / waveLength - uTime) * amplitude;\n x = clamp(x, gfu.uInputClamp.x, gfu.uInputClamp.z);\n \n return textureSample(uTexture, uSampler, select(vec2<f32>(x, y), uv, returnColorOnly)) * alpha;\n }\n \n fn rand(co: vec2<f32>) -> f32 \n {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform float uMirror;\n uniform float uBoundary;\n uniform vec2 uAmplitude;\n uniform vec2 uWavelength;\n uniform vec2 uAlpha;\n uniform float uTime;\n uniform vec2 uDimensions;\n \n uniform vec4 uInputSize;\n uniform vec4 uInputClamp;\n \n float rand(vec2 co) {\n\t return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n }\n \n void main(void)\n {\n\t vec2 pixelCoord = vTextureCoord.xy * uInputSize.xy;\n\t vec2 coord = pixelCoord / uDimensions;\n \n\t if (coord.y < uBoundary) {\n\t\t finalColor = texture(uTexture, vTextureCoord);\n\t\t return;\n\t }\n \n\t float k = (coord.y - uBoundary) / (1. - uBoundary + 0.0001);\n\t float areaY = uBoundary * uDimensions.y / uInputSize.y;\n\t float v = areaY + areaY - vTextureCoord.y;\n\t float y = uMirror > 0.5 ? v : vTextureCoord.y;\n \n\t float _amplitude = ((uAmplitude.y - uAmplitude.x) * k + uAmplitude.x ) / uInputSize.x;\n\t float _waveLength = ((uWavelength.y - uWavelength.x) * k + uWavelength.x) / uInputSize.y;\n\t float _alpha = (uAlpha.y - uAlpha.x) * k + uAlpha.x;\n \n\t float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - uTime) * _amplitude;\n\t x = clamp(x, uInputClamp.x, uInputClamp.z);\n \n\t vec4 color = texture(uTexture, vec2(x, y));\n \n\t finalColor = color * _alpha;\n }\n ",name:"reflection-filter"}),resources:{reflectionUniforms:{uMirror:{value:r.mirror?1:0,type:"f32"},uBoundary:{value:r.boundary,type:"f32"},uAmplitude:{value:r.amplitude,type:"vec2<f32>"},uWavelength:{value:r.waveLength,type:"vec2<f32>"},uAlpha:{value:r.alpha,type:"vec2<f32>"},uTime:{value:r.time,type:"f32"},uDimensions:{value:new Float32Array(2),type:"vec2<f32>"}}}}),ei(this,"uniforms"),ei(this,"time",0),this.uniforms=this.resources.reflectionUniforms.uniforms,Object.assign(this,r)}apply(t,e,r,n){this.uniforms.uDimensions[0]=e.frame.width,this.uniforms.uDimensions[1]=e.frame.height,this.uniforms.uTime=this.time,t.applyFilter(this,e,r,n)}get mirror(){return this.uniforms.uMirror>.5}set mirror(t){this.uniforms.uMirror=t?1:0}get boundary(){return this.uniforms.uBoundary}set boundary(t){this.uniforms.uBoundary=t}get amplitude(){return Array.from(this.uniforms.uAmplitude)}set amplitude(t){this.uniforms.uAmplitude[0]=t[0],this.uniforms.uAmplitude[1]=t[1]}get amplitudeStart(){return this.uniforms.uAmplitude[0]}set amplitudeStart(t){this.uniforms.uAmplitude[0]=t}get amplitudeEnd(){return this.uniforms.uAmplitude[1]}set amplitudeEnd(t){this.uniforms.uAmplitude[1]=t}get waveLength(){return Array.from(this.uniforms.uWavelength)}set waveLength(t){this.uniforms.uWavelength[0]=t[0],this.uniforms.uWavelength[1]=t[1]}get wavelengthStart(){return this.uniforms.uWavelength[0]}set wavelengthStart(t){this.uniforms.uWavelength[0]=t}get wavelengthEnd(){return this.uniforms.uWavelength[1]}set wavelengthEnd(t){this.uniforms.uWavelength[1]=t}get alpha(){return Array.from(this.uniforms.uAlpha)}set alpha(t){this.uniforms.uAlpha[0]=t[0],this.uniforms.uAlpha[1]=t[1]}get alphaStart(){return this.uniforms.uAlpha[0]}set alphaStart(t){this.uniforms.uAlpha[0]=t}get alphaEnd(){return this.uniforms.uAlpha[1]}set alphaEnd(t){this.uniforms.uAlpha[1]=t}};ei(ri,"DEFAULT_OPTIONS",{mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0});let ni=ri;var ii=Object.defineProperty,si=Object.getOwnPropertySymbols,oi=Object.prototype.hasOwnProperty,ai=Object.prototype.propertyIsEnumerable,li=(t,e,r)=>e in t?ii(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,_i=(t,e)=>{for(var r in e||(e={}))oi.call(e,r)&&li(t,r,e[r]);if(si)for(var r of si(e))ai.call(e,r)&&li(t,r,e[r]);return t},ui=(t,e,r)=>(li(t,"symbol"!=typeof e?e+"":e,r),r);const ci=class t extends e.Filter{constructor(...r){var s;let o=null!=(s=r[0])?s:{};(Array.isArray(o)||"x"in o&&"y"in o)&&(e.deprecation("6.0.0","RGBSplitFilter constructor params are now options object. See params: { red, green, blue }"),o={red:o},void 0!==r[1]&&(o.green=r[1]),void 0!==r[2]&&(o.blue=r[2])),o=_i(_i({},t.DEFAULT_OPTIONS),o);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct RgbSplitUniforms {\n\t uRed: vec2<f32>,\n\t uGreen: vec2<f32>,\n\t uBlue: vec3<f32>,\n };\n \n struct GlobalFilterUniforms {\n\t uInputSize:vec4<f32>,\n\t uInputPixel:vec4<f32>,\n\t uInputClamp:vec4<f32>,\n\t uOutputFrame:vec4<f32>,\n\t uGlobalFrame:vec4<f32>,\n\t uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> rgbSplitUniforms : RgbSplitUniforms;\n \n @fragment\n fn mainFragment(\n\t @builtin(position) position: vec4<f32>,\n\t @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n\t let r = textureSample(uTexture, uSampler, uv + vec2<f32>(rgbSplitUniforms.uRed.x / gfu.uInputSize.x, rgbSplitUniforms.uRed.y / gfu.uInputSize.y)).r;\n\t let g = textureSample(uTexture, uSampler, uv + vec2<f32>(rgbSplitUniforms.uGreen.x / gfu.uInputSize.x, rgbSplitUniforms.uGreen.y / gfu.uInputSize.y)).g;\n\t let b = textureSample(uTexture, uSampler, uv + vec2<f32>(rgbSplitUniforms.uBlue.x / gfu.uInputSize.x, rgbSplitUniforms.uBlue.y / gfu.uInputSize.y)).b;\n\t let a = textureSample(uTexture, uSampler, uv).a;\n\t return vec4<f32>(r, g, b, a);\n }\n ",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform vec4 uInputSize;\n uniform vec2 uRed;\n uniform vec2 uGreen;\n uniform vec2 uBlue;\n \n void main(void)\n {\n\tfloat r = texture(uTexture, vTextureCoord + uRed/uInputSize.xy).r;\n\tfloat g = texture(uTexture, vTextureCoord + uGreen/uInputSize.xy).g;\n\tfloat b = texture(uTexture, vTextureCoord + uBlue/uInputSize.xy).b;\n\tfloat a = texture(uTexture, vTextureCoord).a;\n\tfinalColor = vec4(r, g, b, a);\n }\n ",name:"rgb-split-filter"}),resources:{rgbSplitUniforms:{uRed:{value:o.red,type:"vec2<f32>"},uGreen:{value:o.green,type:"vec2<f32>"},uBlue:{value:o.blue,type:"vec2<f32>"}}}}),ui(this,"uniforms"),this.uniforms=this.resources.rgbSplitUniforms.uniforms,Object.assign(this,o)}get red(){return this.uniforms.uRed}set red(t){Array.isArray(t)&&(t={x:t[0],y:t[1]}),this.uniforms.uRed=t}get redX(){return this.red.x}set redX(t){this.red.x=t}get redY(){return this.red.y}set redY(t){this.red.y=t}get green(){return this.uniforms.uGreen}set green(t){Array.isArray(t)&&(t={x:t[0],y:t[1]}),this.uniforms.uGreen=t}get greenX(){return this.green.x}set greenX(t){this.green.x=t}get greenY(){return this.green.y}set greenY(t){this.green.y=t}get blue(){return this.uniforms.uBlue}set blue(t){Array.isArray(t)&&(t={x:t[0],y:t[1]}),this.uniforms.uBlue=t}get blueX(){return this.blue.x}set blueX(t){this.blue.x=t}get blueY(){return this.blue.y}set blueY(t){this.blue.y=t}};ui(ci,"DEFAULT_OPTIONS",{red:{x:-10,y:0},green:{x:0,y:10},blue:{x:0,y:0}});let hi=ci;var di=Object.defineProperty,pi=Object.getOwnPropertySymbols,yi=Object.prototype.hasOwnProperty,vi=Object.prototype.propertyIsEnumerable,fi=(t,e,r)=>e in t?di(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,mi=(t,e)=>{for(var r in e||(e={}))yi.call(e,r)&&fi(t,r,e[r]);if(pi)for(var r of pi(e))vi.call(e,r)&&fi(t,r,e[r]);return t},gi=(t,e,r)=>(fi(t,"symbol"!=typeof e?e+"":e,r),r);const xi=class t extends e.Filter{constructor(...r){var s;let o=null!=(s=r[0])?s:{};(Array.isArray(o)||"x"in o&&"y"in o)&&(e.deprecation("6.0.0","ShockwaveFilter constructor params are now options object. See params: { center, speed, amplitude, wavelength, brightness, radius, time }"),o=mi({center:o},r[1]),void 0!==r[2]&&(o.time=r[2])),o=mi(mi({},t.DEFAULT_OPTIONS),o);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"\n struct ShockWaveUniforms {\n\t uTime: f32,\n\t uOffset: vec2<f32>,\n\t uSpeed: f32,\n\t uWave: vec4<f32>,\n };\n \n struct GlobalFilterUniforms {\n\t uInputSize:vec4<f32>,\n\t uInputPixel:vec4<f32>,\n\t uInputClamp:vec4<f32>,\n\t uOutputFrame:vec4<f32>,\n\t uGlobalFrame:vec4<f32>,\n\t uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> shockwaveUniforms : ShockWaveUniforms;\n \n @fragment\n fn mainFragment(\n\t @builtin(position) position: vec4<f32>,\n\t @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n \n\t let uTime = shockwaveUniforms.uTime;\n\t let uOffset = shockwaveUniforms.uOffset;\n\t let uSpeed = shockwaveUniforms.uSpeed;\n\t let uAmplitude = shockwaveUniforms.uWave[0];\n\t let uWavelength = shockwaveUniforms.uWave[1];\n\t let uBrightness = shockwaveUniforms.uWave[2];\n\t let uRadius = shockwaveUniforms.uWave[3];\n\t let halfWavelength: f32 = uWavelength * 0.5 / gfu.uInputSize.x;\n\t let maxRadius: f32 = uRadius / gfu.uInputSize.x;\n\t let currentRadius: f32 = uTime * uSpeed / gfu.uInputSize.x;\n\t var fade: f32 = 1.0;\n\t var returnColorOnly: bool = false;\n\t \n\t if (maxRadius > 0.0) {\n\t\t if (currentRadius > maxRadius) {\n\t\t\t returnColorOnly = true;\n\t\t }\n\t\t fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\n\t }\n\t var dir: vec2<f32> = vec2<f32>(uv - uOffset / gfu.uInputSize.xy);\n\t dir.y *= gfu.uInputSize.y / gfu.uInputSize.x;\n \n\t let dist:f32 = length(dir);\n \n\t if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\n\t\t returnColorOnly = true;\n\t }\n \n\t let diffUV: vec2<f32> = normalize(dir);\n\t let diff: f32 = (dist - currentRadius) / halfWavelength;\n\t let p: f32 = 1.0 - pow(abs(diff), 2.0);\n\t let powDiff: f32 = 1.25 * sin(diff * PI) * p * ( uAmplitude * fade );\n\t let offset: vec2<f32> = diffUV * powDiff / gfu.uInputSize.xy;\n\t // Do clamp :\n\t let coord: vec2<f32> = uv + offset;\n\t let clampedCoord: vec2<f32> = clamp(coord, gfu.uInputClamp.xy, gfu.uInputClamp.zw);\n \n\t var clampedColor: vec4<f32> = textureSample(uTexture, uSampler, clampedCoord);\n\t \n\t if (boolVec2(coord, clampedCoord)) \n\t {\n\t\t clampedColor *= max(0.0, 1.0 - length(coord - clampedCoord));\n\t }\n\t // No clamp :\n\t var finalColor = clampedColor;\n \n\t return select(finalColor, textureSample(uTexture, uSampler, uv), returnColorOnly);\n }\n \n fn boolVec2(x: vec2<f32>, y: vec2<f32>) -> bool\n {\n\t if (x.x == y.x && x.y == y.y)\n\t {\n\t\t return true;\n\t }\n\t \n\t return false;\n }\n \n const PI: f32 = 3.14159265358979323846264;\n ",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"\n precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform vec2 uCenter;\n uniform float uTime;\n uniform float uSpeed;\n uniform vec4 uWave;\n \n uniform vec4 uInputSize;\n uniform vec4 uInputClamp;\n \n const float PI = 3.14159;\n \n void main()\n {\n\t float uAmplitude = uWave[0];\n\t float uWavelength = uWave[1];\n\t float uBrightness = uWave[2];\n\t float uRadius = uWave[3];\n \n\t float halfWavelength = uWavelength * 0.5 / uInputSize.x;\n\t float maxRadius = uRadius / uInputSize.x;\n\t float currentRadius = uTime * uSpeed / uInputSize.x;\n \n\t float fade = 1.0;\n \n\t if (maxRadius > 0.0) {\n\t\t if (currentRadius > maxRadius) {\n\t\t\t finalColor = texture(uTexture, vTextureCoord);\n\t\t\t return;\n\t\t }\n\t\t fade = 1.0 - pow(currentRadius / maxRadius, 2.0);\n\t }\n \n\t vec2 dir = vec2(vTextureCoord - uCenter / uInputSize.xy);\n\t dir.y *= uInputSize.y / uInputSize.x;\n\t float dist = length(dir);\n \n\t if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) {\n\t\t finalColor = texture(uTexture, vTextureCoord);\n\t\t return;\n\t }\n \n\t vec2 diffUV = normalize(dir);\n \n\t float diff = (dist - currentRadius) / halfWavelength;\n \n\t float p = 1.0 - pow(abs(diff), 2.0);\n \n\t // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade );\n\t float powDiff = 1.25 * sin(diff * PI) * p * ( uAmplitude * fade );\n \n\t vec2 offset = diffUV * powDiff / uInputSize.xy;\n \n\t // Do clamp :\n\t vec2 coord = vTextureCoord + offset;\n\t vec2 clampedCoord = clamp(coord, uInputClamp.xy, uInputClamp.zw);\n\t vec4 color = texture(uTexture, clampedCoord);\n\t if (coord != clampedCoord) {\n\t\t color *= max(0.0, 1.0 - length(coord - clampedCoord));\n\t }\n \n\t // No clamp :\n\t // finalColor = texture(uTexture, vTextureCoord + offset);\n \n\t color.rgb *= 1.0 + (uBrightness - 1.0) * p * fade;\n \n\t finalColor = color;\n }\n ",name:"shockwave-filter"}),resources:{shockwaveUniforms:{uTime:{value:o.time,type:"f32"},uCenter:{value:o.center,type:"vec2<f32>"},uSpeed:{value:o.speed,type:"f32"},uWave:{value:new Float32Array(4),type:"vec4<f32>"}}}}),gi(this,"uniforms"),gi(this,"time"),this.time=0,this.uniforms=this.resources.shockwaveUniforms.uniforms,Object.assign(this,o)}apply(t,e,r,n){this.uniforms.uTime=this.time,t.applyFilter(this,e,r,n)}get center(){return this.uniforms.uCenter}set center(t){Array.isArray(t)&&(t={x:t[0],y:t[1]}),this.uniforms.uCenter=t}get centerX(){return this.uniforms.uCenter.x}set centerX(t){this.uniforms.uCenter.x=t}get centerY(){return this.uniforms.uCenter.y}set centerY(t){this.uniforms.uCenter.y=t}get speed(){return this.uniforms.uSpeed}set speed(t){this.uniforms.uSpeed=t}get amplitude(){return this.uniforms.uWave[0]}set amplitude(t){this.uniforms.uWave[0]=t}get wavelength(){return this.uniforms.uWave[1]}set wavelength(t){this.uniforms.uWave[1]=t}get brightness(){return this.uniforms.uWave[2]}set brightness(t){this.uniforms.uWave[2]=t}get radius(){return this.uniforms.uWave[3]}set radius(t){this.uniforms.uWave[3]=t}};gi(xi,"DEFAULT_OPTIONS",{center:{x:0,y:0},speed:500,amplitude:30,wavelength:160,brightness:1,radius:-1});let bi=xi;var Si=Object.defineProperty,Ti=Object.getOwnPropertySymbols,Pi=Object.prototype.hasOwnProperty,Oi=Object.prototype.propertyIsEnumerable,Mi=(t,e,r)=>e in t?Si(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,wi=(t,e)=>{for(var r in e||(e={}))Pi.call(e,r)&&Mi(t,r,e[r]);if(Ti)for(var r of Ti(e))Oi.call(e,r)&&Mi(t,r,e[r]);return t},Ci=(t,e,r)=>(Mi(t,"symbol"!=typeof e?e+"":e,r),r);const Ei=class t extends e.Filter{constructor(...r){var s,o;let a=null!=(s=r[0])?s:{};if(a instanceof e.Texture&&(e.deprecation("6.0.0","SimpleLightmapFilter constructor params are now options object. See params: { lightMap, color, alpha }"),a={lightMap:a},void 0!==r[1]&&(a.color=r[1]),void 0!==r[2]&&(a.alpha=r[2])),a=wi(wi({},t.DEFAULT_OPTIONS),a),!a.lightMap)throw Error("No light map texture source was provided to SimpleLightmapFilter");super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct SimpleLightmapUniforms {\n uColor: vec3<f32>,\n uAlpha: f32,\n uDimensions: vec2<f32>,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> simpleLightmapUniforms : SimpleLightmapUniforms;\n @group(1) @binding(1) var uMapTexture: texture_2d<f32>;\n @group(1) @binding(2) var uMapSampler: sampler;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>,\n ) -> @location(0) vec4<f32> {\n let uColor = simpleLightmapUniforms.uColor;\n let uAlpha = simpleLightmapUniforms.uAlpha;\n let uDimensions = simpleLightmapUniforms.uDimensions;\n \n let diffuseColor: vec4<f32> = textureSample(uTexture, uSampler, uv);\n let lightCoord: vec2<f32> = (uv * gfu.uInputSize.xy) / simpleLightmapUniforms.uDimensions;\n let light: vec4<f32> = textureSample(uMapTexture, uMapSampler, lightCoord);\n let ambient: vec3<f32> = uColor * uAlpha;\n let intensity: vec3<f32> = ambient + light.rgb;\n let finalColor: vec3<f32> = diffuseColor.rgb * intensity;\n return vec4<f32>(finalColor, diffuseColor.a);\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform sampler2D uMapTexture;\n uniform vec3 uColor;\n uniform float uAlpha;\n uniform vec2 uDimensions;\n \n uniform vec4 uInputSize;\n \n void main() {\n\t vec4 diffuseColor = texture(uTexture, vTextureCoord);\n\t vec2 lightCoord = (vTextureCoord * uInputSize.xy) / uDimensions;\n\t vec4 light = texture(uMapTexture, lightCoord);\n\t vec3 ambient = uColor.rgb * uAlpha;\n\t vec3 intensity = ambient + light.rgb;\n\t vec3 color = diffuseColor.rgb * intensity;\n\t finalColor = vec4(color, diffuseColor.a);\n }\n ",name:"simple-lightmap-filter"}),resources:{simpleLightmapUniforms:{uColor:{value:new Float32Array(3),type:"vec3<f32>"},uAlpha:{value:a.alpha,type:"f32"},uDimensions:{value:new Float32Array(2),type:"vec2<f32>"}},uMapTexture:a.lightMap.source,uMapSampler:a.lightMap.source.style}}),Ci(this,"uniforms"),Ci(this,"_color"),Ci(this,"_lightMap"),this.uniforms=this.resources.simpleLightmapUniforms.uniforms,this._color=new e.Color,this.color=null!=(o=a.color)?o:0,Object.assign(this,a)}apply(t,e,r,n){this.uniforms.uDimensions[0]=e.frame.width,this.uniforms.uDimensions[1]=e.frame.height,t.applyFilter(this,e,r,n)}get lightMap(){return this._lightMap}set lightMap(t){this._lightMap=t,this.resources.uMapTexture=t.source,this.resources.uMapSampler=t.source.style}get color(){return this._color.value}set color(t){this._color.setValue(t);const[e,r,n]=this._color.toArray();this.uniforms.uColor[0]=e,this.uniforms.uColor[1]=r,this.uniforms.uColor[2]=n}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}};Ci(Ei,"DEFAULT_OPTIONS",{lightMap:e.Texture.WHITE,color:0,alpha:1});let Ai=Ei;var Ri=Object.defineProperty,Ii=Object.getOwnPropertySymbols,Di=Object.prototype.hasOwnProperty,Bi=Object.prototype.propertyIsEnumerable,ki=(t,e,r)=>e in t?Ri(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ui=(t,e)=>{for(var r in e||(e={}))Di.call(e,r)&&ki(t,r,e[r]);if(Ii)for(var r of Ii(e))Bi.call(e,r)&&ki(t,r,e[r]);return t},Fi=(t,e,r)=>(ki(t,"symbol"!=typeof e?e+"":e,r),r);const Li=class t extends e.Filter{constructor(r){var s,o;r=Ui(Ui({},t.DEFAULT_OPTIONS),r);super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct TiltShiftUniforms {\n uBlur: vec2<f32>,\n uStart: vec2<f32>,\n uEnd: vec2<f32>,\n uDelta: vec2<f32>,\n uTexSize: vec2<f32>,\n };\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> tiltShiftUniforms : TiltShiftUniforms;\n \n @fragment\n fn mainFragment(\n @builtin(position) position: vec4<f32>,\n @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n let uBlur = tiltShiftUniforms.uBlur[0];\n let uBlurGradient = tiltShiftUniforms.uBlur[1];\n let uStart = tiltShiftUniforms.uStart;\n let uEnd = tiltShiftUniforms.uEnd;\n let uDelta = tiltShiftUniforms.uDelta;\n let uTexSize = tiltShiftUniforms.uTexSize;\n \n var color: vec4<f32> = vec4<f32>(0.0);\n var total: f32 = 0.0;\n \n let offset: f32 = random(position, vec3<f32>(12.9898, 78.233, 151.7182), 0.0);\n let normal: vec2<f32> = normalize(vec2<f32>(uStart.y - uEnd.y, uEnd.x - uStart.x));\n let radius: f32 = smoothstep(0.0, 1.0, abs(dot(uv * uTexSize - uStart, normal)) / uBlurGradient) * uBlur;\n \n for (var t: f32 = -30.0; t <= 30.0; t += 1.0)\n {\n\t var percent: f32 = (t + offset - 0.5) / 30.0;\n\t var weight: f32 = 1.0 - abs(percent);\n\t var sample: vec4<f32> = textureSample(uTexture, uSampler, uv + uDelta / uTexSize * percent * radius);\n\t sample = vec4<f32>(sample.xyz * sample.a, sample.a); // multiply sample.rgb with sample.a\n\t color += sample * weight;\n\t total += weight;\n }\n \n color /= total;\n color = vec4<f32>(color.xyz / (color.a + 0.00001), color.a); // divide color.rgb by color.a + 0.00001\n \n return color;\n }\n \n \n fn random(position: vec4<f32>, scale: vec3<f32>, seed: f32) -> f32\n {\n return fract(sin(dot(position.xyz + seed, scale)) * 43758.5453 + seed);\n }",entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:"in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform vec2 uBlur;\n uniform vec2 uStart;\n uniform vec2 uEnd;\n uniform vec2 uDelta;\n uniform vec2 uTexSize;\n \n float random(vec3 scale, float seed)\n {\n\t return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n }\n \n void main(void)\n {\n\t vec4 color = vec4(0.0);\n\t float total = 0.0;\n \n\t float blur = uBlur[0];\n\t float gradientBlur = uBlur[1];\n \n\t float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\t vec2 normal = normalize(vec2(uStart.y - uEnd.y, uEnd.x - uStart.x));\n\t float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * uTexSize - uStart, normal)) / gradientBlur) * blur;\n \n\t for (float t = -30.0; t <= 30.0; t++)\n\t {\n\t\t float percent = (t + offset - 0.5) / 30.0;\n\t\t float weight = 1.0 - abs(percent);\n\t\t vec4 sample = texture(uTexture, vTextureCoord + uDelta / uTexSize * percent * radius);\n\t\t sample.rgb *= sample.a;\n\t\t color += sample * weight;\n\t\t total += weight;\n\t }\n \n\t color /= total;\n\t color.rgb /= color.a + 0.00001;\n \n\t finalColor = color;\n }\n ",name:"tilt-shift-axis-filter"}),resources:{tiltShiftUniforms:{uBlur:{value:new Float32Array([null!=(s=r.blur)?s:100,null!=(o=r.gradientBlur)?o:600]),type:"vec2<f32>"},uStart:{value:r.start,type:"vec2<f32>"},uEnd:{value:r.end,type:"vec2<f32>"},uDelta:{value:new Float32Array([30,30]),type:"vec2<f32>"},uTexSize:{value:new Float32Array([window.innerWidth,window.innerHeight]),type:"vec2<f32>"}}}}),Fi(this,"uniforms"),Fi(this,"_tiltAxis"),this.uniforms=this.resources.tiltShiftUniforms.uniforms,this._tiltAxis=r.axis,this.updateDelta()}updateDelta(){if(this.uniforms.uDelta[0]=0,this.uniforms.uDelta[1]=0,void 0===this._tiltAxis)return;const t=this.uniforms.uEnd,e=this.uniforms.uStart,r=t.x-e.x,n=t.y-e.y,i=Math.sqrt(r*r+n*n),s="vertical"===this._tiltAxis;this.uniforms.uDelta[0]=s?-n/i:r/i,this.uniforms.uDelta[1]=s?r/i:n/i}};Fi(Li,"DEFAULT_OPTIONS",{blur:100,gradientBlur:600,start:{x:0,y:window.innerHeight/2},end:{x:600,y:window.innerHeight/2}});let Gi=Li;var ji=Object.defineProperty,Ni=Object.defineProperties,zi=Object.getOwnPropertyDescriptors,Wi=Object.getOwnPropertySymbols,Vi=Object.prototype.hasOwnProperty,Hi=Object.prototype.propertyIsEnumerable,Xi=(t,e,r)=>e in t?ji(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ki=(t,e)=>{for(var r in e||(e={}))Vi.call(e,r)&&Xi(t,r,e[r]);if(Wi)for(var r of Wi(e))Hi.call(e,r)&&Xi(t,r,e[r]);return t},Yi=(t,e)=>Ni(t,zi(e));var Qi=Object.defineProperty,$i=Object.getOwnPropertySymbols,qi=Object.prototype.hasOwnProperty,Zi=Object.prototype.propertyIsEnumerable,Ji=(t,e,r)=>e in t?Qi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ts=(t,e)=>{for(var r in e||(e={}))qi.call(e,r)&&Ji(t,r,e[r]);if($i)for(var r of $i(e))Zi.call(e,r)&&Ji(t,r,e[r]);return t},es=(t,e,r)=>(Ji(t,"symbol"!=typeof e?e+"":e,r),r);const rs=class t extends e.Filter{constructor(r){var s,o;r=ts(ts({},t.DEFAULT_OPTIONS),r);const a=e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:"struct TwistUniforms {\n uTwist:vec2<f32>,\n uOffset:vec2<f32>,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> twistUniforms : TwistUniforms;\n \n @fragment\n fn mainFragment(\n @location(0) uv: vec2<f32>,\n @builtin(position) position: vec4<f32>\n ) -> @location(0) vec4<f32> {\n return textureSample(uTexture, uSampler, unmapCoord(twist(mapCoord(uv))));\n }\n \n fn mapCoord(coord: vec2<f32> ) -> vec2<f32>\n {\n var mappedCoord: vec2<f32> = coord;\n mappedCoord *= gfu.uInputSize.xy;\n mappedCoord += gfu.uOutputFrame.xy;\n return mappedCoord;\n }\n \n fn unmapCoord(coord: vec2<f32> ) -> vec2<f32>\n {\n var mappedCoord: vec2<f32> = coord;\n mappedCoord -= gfu.uOutputFrame.xy;\n mappedCoord /= gfu.uInputSize.xy;\n return mappedCoord;\n }\n \n fn twist(coord: vec2<f32>) -> vec2<f32>\n {\n var twistedCoord: vec2<f32> = coord;\n let uRadius = twistUniforms.uTwist[0];\n let uAngle = twistUniforms.uTwist[1];\n let uOffset = twistUniforms.uOffset;\n \n twistedCoord -= uOffset;\n \n let dist = length(twistedCoord);\n \n if (dist < uRadius)\n {\n\t let ratioDist: f32 = (uRadius - dist) / uRadius;\n\t let angleMod: f32 = ratioDist * ratioDist * uAngle;\n\t let s: f32 = sin(angleMod);\n\t let c: f32 = cos(angleMod);\n\t twistedCoord = vec2<f32>(twistedCoord.x * c - twistedCoord.y * s, twistedCoord.x * s + twistedCoord.y * c);\n }\n \n twistedCoord += uOffset;\n return twistedCoord;\n }\n ",entryPoint:"mainFragment"}}),l=e.GlProgram.from({vertex:n,fragment:"precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform vec2 uTwist;\n uniform vec2 uOffset;\n uniform vec4 uInputSize;\n \n vec2 mapCoord( vec2 coord )\n {\n\t coord *= uInputSize.xy;\n\t coord += uInputSize.zw;\n \n\t return coord;\n }\n \n vec2 unmapCoord( vec2 coord )\n {\n\t coord -= uInputSize.zw;\n\t coord /= uInputSize.xy;\n \n\t return coord;\n }\n \n vec2 twist(vec2 coord)\n {\n\t coord -= uOffset;\n \n\t float dist = length(coord);\n\t float uRadius = uTwist[0];\n\t float uAngle = uTwist[1];\n \n\t if (dist < uRadius)\n\t {\n\t\t float ratioDist = (uRadius - dist) / uRadius;\n\t\t float angleMod = ratioDist * ratioDist * uAngle;\n\t\t float s = sin(angleMod);\n\t\t float c = cos(angleMod);\n\t\t coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n\t }\n \n\t coord += uOffset;\n \n\t return coord;\n }\n \n void main(void)\n {\n\t vec2 coord = mapCoord(vTextureCoord);\n\t coord = twist(coord);\n\t coord = unmapCoord(coord);\n\t finalColor = texture(uTexture, coord);\n }\n ",name:"twist-filter"});super(ts({gpuProgram:a,glProgram:l,resources:{twistUniforms:{uTwist:{value:[null!=(s=r.radius)?s:0,null!=(o=r.angle)?o:0],type:"vec2<f32>"},uOffset:{value:r.offset,type:"vec2<f32>"}}}},r)),es(this,"uniforms"),this.uniforms=this.resources.twistUniforms.uniforms}get radius(){return this.uniforms.uTwist[0]}set radius(t){this.uniforms.uTwist[0]=t}get angle(){return this.uniforms.uTwist[1]}set angle(t){this.uniforms.uTwist[1]=t}get offset(){return this.uniforms.uOffset}set offset(t){this.uniforms.uOffset=t}get offsetX(){return this.offset.x}set offsetX(t){this.offset.x=t}get offsetY(){return this.offset.y}set offsetY(t){this.offset.y=t}};es(rs,"DEFAULT_OPTIONS",{padding:20,radius:200,angle:4,offset:{x:0,y:0}});let ns=rs;var is="precision highp float;\n in vec2 vTextureCoord;\n out vec4 finalColor;\n \n uniform sampler2D uTexture;\n uniform float uStrength;\n uniform vec2 uCenter;\n uniform vec2 uRadii;\n \n uniform vec4 uInputSize;\n \n const float MAX_KERNEL_SIZE = ${MAX_KERNEL_SIZE};\n \n // author: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\n highp float rand(vec2 co, float seed) {\n\t const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\t highp float dt = dot(co + seed, vec2(a, b)), sn = mod(dt, 3.14159);\n\t return fract(sin(sn) * c + seed);\n }\n \n void main() {\n\t float minGradient = uRadii[0] * 0.3;\n\t float innerRadius = (uRadii[0] + minGradient * 0.5) / uInputSize.x;\n \n\t float gradient = uRadii[1] * 0.3;\n\t float radius = (uRadii[1] - gradient * 0.5) / uInputSize.x;\n \n\t float countLimit = MAX_KERNEL_SIZE;\n \n\t vec2 dir = vec2(uCenter.xy / uInputSize.xy - vTextureCoord);\n\t float dist = length(vec2(dir.x, dir.y * uInputSize.y / uInputSize.x));\n \n\t float strength = uStrength;\n \n\t float delta = 0.0;\n\t float gap;\n\t if (dist < innerRadius) {\n\t\t delta = innerRadius - dist;\n\t\t gap = minGradient;\n\t } else if (radius >= 0.0 && dist > radius) { // radius < 0 means it's infinity\n\t\t delta = dist - radius;\n\t\t gap = gradient;\n\t }\n \n\t if (delta > 0.0) {\n\t\t float normalCount = gap / uInputSize.x;\n\t\t delta = (normalCount - delta) / normalCount;\n\t\t countLimit *= delta;\n\t\t strength *= delta;\n\t\t if (countLimit < 1.0)\n\t\t {\n\t\t\t gl_FragColor = texture(uTexture, vTextureCoord);\n\t\t\t return;\n\t\t }\n\t }\n \n\t // randomize the lookup values to hide the fixed number of samples\n\t float offset = rand(vTextureCoord, 0.0);\n \n\t float total = 0.0;\n\t vec4 color = vec4(0.0);\n \n\t dir *= strength;\n \n\t for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) {\n\t\t float percent = (t + offset) / MAX_KERNEL_SIZE;\n\t\t float weight = 4.0 * (percent - percent * percent);\n\t\t vec2 p = vTextureCoord + dir * percent;\n\t\t vec4 sample = texture(uTexture, p);\n \n\t\t // switch to pre-multiplied alpha to correctly blur transparent images\n\t\t // sample.rgb *= sample.a;\n \n\t\t color += sample * weight;\n\t\t total += weight;\n \n\t\t if (t > countLimit){\n\t\t\t break;\n\t\t }\n\t }\n \n\t color /= total;\n\t // switch back from pre-multiplied alpha\n\t // color.rgb /= color.a + 0.00001;\n \n\t gl_FragColor = color;\n }\n ",ss="struct ZoomBlurUniforms {\n\t uStrength:f32,\n\t uCenter:vec2<f32>,\n\t uRadii:vec2<f32>,\n };\n \n struct GlobalFilterUniforms {\n uInputSize:vec4<f32>,\n uInputPixel:vec4<f32>,\n uInputClamp:vec4<f32>,\n uOutputFrame:vec4<f32>,\n uGlobalFrame:vec4<f32>,\n uOutputTexture:vec4<f32>,\n };\n \n @group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n \n @group(0) @binding(1) var uTexture: texture_2d<f32>; \n @group(0) @binding(2) var uSampler: sampler;\n @group(1) @binding(0) var<uniform> zoomBlurUniforms : ZoomBlurUniforms;\n \n @fragment\n fn mainFragment(\n\t @builtin(position) position: vec4<f32>,\n\t @location(0) uv : vec2<f32>\n ) -> @location(0) vec4<f32> {\n let uStrength = zoomBlurUniforms.uStrength;\n let uCenter = zoomBlurUniforms.uCenter;\n let uRadii = zoomBlurUniforms.uRadii;\n \n let minGradient: f32 = uRadii[0] * 0.3;\n let innerRadius: f32 = (uRadii[0] + minGradient * 0.5) / gfu.uInputSize.x;\n \n let gradient: f32 = uRadii[1] * 0.3;\n let radius: f32 = (uRadii[1] - gradient * 0.5) / gfu.uInputSize.x;\n \n let MAX_KERNEL_SIZE: f32 = ${MAX_KERNEL_SIZE};\n \n var countLimit: f32 = MAX_KERNEL_SIZE;\n \n var dir: vec2<f32> = vec2<f32>(uCenter / gfu.uInputSize.xy - uv);\n let dist: f32 = length(vec2<f32>(dir.x, dir.y * gfu.uInputSize.y / gfu.uInputSize.x));\n \n var strength: f32 = uStrength;\n \n var delta: f32 = 0.0;\n var gap: f32;\n \n if (dist < innerRadius) {\n\t delta = innerRadius - dist;\n\t gap = minGradient;\n } else if (radius >= 0.0 && dist > radius) { // radius < 0 means it's infinity\n\t delta = dist - radius;\n\t gap = gradient;\n }\n \n var returnColorOnly: bool = false;\n \n if (delta > 0.0) {\n\t let normalCount: f32 = gap / gfu.uInputSize.x;\n\t delta = (normalCount - delta) / normalCount;\n\t countLimit *= delta;\n\t strength *= delta;\n\t \n\t if (countLimit < 1.0)\n\t {\n\t returnColorOnly = true;;\n\t }\n }\n \n // randomize the lookup values to hide the fixed number of samples\n let offset: f32 = rand(uv, 0.0);\n \n var total: f32 = 0.0;\n var color: vec4<f32> = vec4<f32>(0.);\n \n dir *= strength;\n \n for (var t = 0.0; t < MAX_KERNEL_SIZE; t += 1.0) {\n\t let percent: f32 = (t + offset) / MAX_KERNEL_SIZE;\n\t let weight: f32 = 4.0 * (percent - percent * percent);\n\t let p: vec2<f32> = uv + dir * percent;\n\t let sample: vec4<f32> = textureSample(uTexture, uSampler, p);\n\t \n\t if (t < countLimit)\n\t {\n\t color += sample * weight;\n\t total += weight;\n\t }\n }\n \n color /= total;\n \n return select(color, textureSample(uTexture, uSampler, uv), returnColorOnly);\n }\n \n fn modulo(x: f32, y: f32) -> f32\n {\n return x - y * floor(x/y);\n }\n \n // author: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\n fn rand(co: vec2<f32>, seed: f32) -> f32\n {\n let a: f32 = 12.9898;\n let b: f32 = 78.233;\n let c: f32 = 43758.5453;\n let dt: f32 = dot(co + seed, vec2<f32>(a, b));\n let sn: f32 = modulo(dt, 3.14159);\n return fract(sin(sn) * c + seed);\n }",os=Object.defineProperty,as=Object.getOwnPropertySymbols,ls=Object.prototype.hasOwnProperty,_s=Object.prototype.propertyIsEnumerable,us=(t,e,r)=>e in t?os(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,cs=(t,e)=>{for(var r in e||(e={}))ls.call(e,r)&&us(t,r,e[r]);if(as)for(var r of as(e))_s.call(e,r)&&us(t,r,e[r]);return t},hs=(t,e,r)=>(us(t,"symbol"!=typeof e?e+"":e,r),r);const ds=class t extends e.Filter{constructor(r){var s;const o=null!=(s=(r=cs(cs({},t.DEFAULT_OPTIONS),r)).maxKernelSize)?s:32;super({gpuProgram:e.GpuProgram.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:ss.replace("${MAX_KERNEL_SIZE}",o.toFixed(1)),entryPoint:"mainFragment"}}),glProgram:e.GlProgram.from({vertex:n,fragment:is.replace("${MAX_KERNEL_SIZE}",o.toFixed(1)),name:"zoom-blur-filter"}),resources:{zoomBlurUniforms:{uStrength:{value:r.strength,type:"f32"},uCenter:{value:r.center,type:"vec2<f32>"},uRadii:{value:new Float32Array(2),type:"vec2<f32>"}}}}),hs(this,"uniforms"),this.uniforms=this.resources.zoomBlurUniforms.uniforms,Object.assign(this,r)}get strength(){return this.uniforms.uStrength}set strength(t){this.uniforms.uStrength=t}get center(){return this.uniforms.uCenter}set center(t){Array.isArray(t)&&(t={x:t[0],y:t[1]}),this.uniforms.uCenter=t}get centerX(){return this.uniforms.uCenter.x}set centerX(t){this.uniforms.uCenter.x=t}get centerY(){return this.uniforms.uCenter.y}set centerY(t){this.uniforms.uCenter.y=t}get innerRadius(){return this.uniforms.uRadii[0]}set innerRadius(t){this.uniforms.uRadii[0]=t}get radius(){return this.uniforms.uRadii[1]}set radius(t){this.uniforms.uRadii[1]=t<0||t===1/0?-1:t}};hs(ds,"DEFAULT_OPTIONS",{strength:.1,center:{x:0,y:0},innerRadius:0,radius:-1,maxKernelSize:32});let ps=ds;return t.AdjustmentFilter=d,t.AdvancedBloomFilter=j,t.AsciiFilter=Q,t.BackdropBlurFilter=Z,t.BevelFilter=at,t.BloomFilter=gt,t.BulgePinchFilter=Ct,t.CRTFilter=He,t.ColorGradientFilter=Jt,t.ColorMapFilter=le,t.ColorOverlayFilter=fe,t.ColorReplaceFilter=Me,t.ConvolutionFilter=ke,t.CrossHatchFilter=Ue,t.DotFilter=Je,t.DropShadowFilter=lr,t.EmbossFilter=cr,t.GlitchFilter=br,t.GlowFilter=Rr,t.GodrayFilter=zr,t.GrayscaleFilter=Wr,t.HslAdjustmentFilter=Zr,t.KawaseBlurFilter=S,t.MotionBlurFilter=ln,t.MultiColorReplaceFilter=gn,t.OldFilmFilter=Cn,t.OutlineFilter=Ln,t.PixelateFilter=Gn,t.RGBSplitFilter=hi,t.RadialBlurFilter=Yn,t.ReflectionFilter=ni,t.ShockwaveFilter=bi,t.SimpleLightmapFilter=Ai,t.TiltShiftAxisFilter=Gi,t.TiltShiftFilter=class extends Gi{constructor(t){t=Ki(Ki({},Gi.DEFAULT_OPTIONS),t),super(Yi(Ki({},t),{axis:"horizontal"})),((t,e,r)=>{Xi(t,"symbol"!=typeof e?e+"":e,r)})(this,"_tiltShiftYFilter"),this._tiltShiftYFilter=new Gi(Yi(Ki({},t),{axis:"vertical"})),Object.assign(this,t)}apply(t,r,n,i){const s=e.TexturePool.getSameSizeTexture(r);t.applyFilter(this,r,s,!0),t.applyFilter(this._tiltShiftYFilter,s,n,i),e.TexturePool.returnTexture(s)}get blur(){return this.uniforms.uBlur[0]}set blur(t){this.uniforms.uBlur[0]=this._tiltShiftYFilter.uniforms.uBlur[0]=t}get gradientBlur(){return this.uniforms.uBlur[1]}set gradientBlur(t){this.uniforms.uBlur[1]=this._tiltShiftYFilter.uniforms.uBlur[1]=t}get start(){return this.uniforms.uStart}set start(t){this.uniforms.uStart=this._tiltShiftYFilter.uniforms.uStart=t}get startX(){return this.start.x}set startX(t){this.start.x=t}get startY(){return this.start.y}set startY(t){this.start.y=t}get end(){return this.uniforms.uEnd}set end(t){this.uniforms.uEnd=this._tiltShiftYFilter.uniforms.uEnd=t}get endX(){return this.end.x}set endX(t){this.end.x=t}get endY(){return this.end.y}set endY(t){this.end.y=t}},t.TwistFilter=ns,t.ZoomBlurFilter=ps,t.angleFromCssOrientation=jt,t.angleFromDirectionalValue=Nt,t.colorAsStringFromCssStop=Ft,t.offsetsFromCssColorStops=Lt,t.parseCssGradient=Bt,t.stopsFromCssStops=Ut,t.trimCssGradient=zt,t.typeFromCssType=kt,t.vertex=n,t.wgslVertex=i,Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI)},966:(t,e,r)=>{
12
+ /*!
13
+ * PixiJS - v8.5.2
14
+ * Compiled Wed, 23 Oct 2024 08:23:18 UTC
15
+ *
16
+ * PixiJS is licensed under the MIT License.
17
+ * http://www.opensource.org/licenses/mit-license
18
+ */
19
+ globalThis.PIXI=function(t){"use strict";var e,n=Object.defineProperty,i=Object.defineProperties,s=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,_=(t,e,r)=>e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,u=(t,e)=>{for(var r in e||(e={}))a.call(e,r)&&_(t,r,e[r]);if(o)for(var r of o(e))l.call(e,r)&&_(t,r,e[r]);return t},c=((e=c||{}).Application="application",e.WebGLPipes="webgl-pipes",e.WebGLPipesAdaptor="webgl-pipes-adaptor",e.WebGLSystem="webgl-system",e.WebGPUPipes="webgpu-pipes",e.WebGPUPipesAdaptor="webgpu-pipes-adaptor",e.WebGPUSystem="webgpu-system",e.CanvasSystem="canvas-system",e.CanvasPipesAdaptor="canvas-pipes-adaptor",e.CanvasPipes="canvas-pipes",e.Asset="asset",e.LoadParser="load-parser",e.ResolveParser="resolve-parser",e.CacheParser="cache-parser",e.DetectionParser="detection-parser",e.MaskEffect="mask-effect",e.BlendMode="blend-mode",e.TextureSource="texture-source",e.Environment="environment",e.ShapeBuilder="shape-builder",e.Batcher="batcher",e);const h=t=>{if("function"==typeof t||"object"==typeof t&&t.extension){const e="object"!=typeof t.extension?{type:t.extension}:t.extension;t=((t,e)=>i(t,s(e)))(u({},e),{ref:t})}if("object"!=typeof t)throw new Error("Invalid extension type");return"string"==typeof(t=u({},t)).type&&(t.type=[t.type]),t},d=(t,e)=>{var r;return null!=(r=h(t).priority)?r:e},p={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...t){return t.map(h).forEach((t=>{t.type.forEach((e=>{var r,n;return null==(n=(r=this._removeHandlers)[e])?void 0:n.call(r,t)}))})),this},add(...t){return t.map(h).forEach((t=>{t.type.forEach((e=>{var r,n;const i=this._addHandlers,s=this._queue;i[e]?null==(n=i[e])||n.call(i,t):(s[e]=s[e]||[],null==(r=s[e])||r.push(t))}))})),this},handle(t,e,r){var n;const i=this._addHandlers,s=this._removeHandlers;i[t]=e,s[t]=r;const o=this._queue;return o[t]&&(null==(n=o[t])||n.forEach((t=>e(t))),delete o[t]),this},handleByMap(t,e){return this.handle(t,(t=>{t.name&&(e[t.name]=t.ref)}),(t=>{t.name&&delete e[t.name]}))},handleByNamedList(t,e,r=-1){return this.handle(t,(t=>{e.findIndex((e=>e.name===t.name))>=0||(e.push({name:t.name,value:t.ref}),e.sort(((t,e)=>d(e.value,r)-d(t.value,r))))}),(t=>{const r=e.findIndex((e=>e.name===t.name));-1!==r&&e.splice(r,1)}))},handleByList(t,e,r=-1){return this.handle(t,(t=>{e.includes(t.ref)||(e.push(t.ref),e.sort(((t,e)=>d(e,r)-d(t,r))))}),(t=>{const r=e.indexOf(t.ref);-1!==r&&e.splice(r,1)}))}};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self&&self;function y(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var v={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}function i(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function s(t,e,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new i(n,s||t,o),l=r?r+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var t,n,i=[];if(0===this._eventsCount)return i;for(n in t=this._events)e.call(t,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},a.prototype.listeners=function(t){var e=r?r+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,o=new Array(s);i<s;i++)o[i]=n[i].fn;return o},a.prototype.listenerCount=function(t){var e=r?r+t:t,n=this._events[e];return n?n.fn?1:n.length:0},a.prototype.emit=function(t,e,n,i,s,o){var a=r?r+t:t;if(!this._events[a])return!1;var l,_,u=this._events[a],c=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),c){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,n),!0;case 4:return u.fn.call(u.context,e,n,i),!0;case 5:return u.fn.call(u.context,e,n,i,s),!0;case 6:return u.fn.call(u.context,e,n,i,s,o),!0}for(_=1,l=new Array(c-1);_<c;_++)l[_-1]=arguments[_];u.fn.apply(u.context,l)}else{var h,d=u.length;for(_=0;_<d;_++)switch(u[_].once&&this.removeListener(t,u[_].fn,void 0,!0),c){case 1:u[_].fn.call(u[_].context);break;case 2:u[_].fn.call(u[_].context,e);break;case 3:u[_].fn.call(u[_].context,e,n);break;case 4:u[_].fn.call(u[_].context,e,n,i);break;default:if(!l)for(h=1,l=new Array(c-1);h<c;h++)l[h-1]=arguments[h];u[_].fn.apply(u[_].context,l)}}return!0},a.prototype.on=function(t,e,r){return s(this,t,e,r,!1)},a.prototype.once=function(t,e,r){return s(this,t,e,r,!0)},a.prototype.removeListener=function(t,e,n,i){var s=r?r+t:t;if(!this._events[s])return this;if(!e)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn===e&&(!i||a.once)&&(!n||a.context===n)&&o(this,s);else{for(var l=0,_=[],u=a.length;l<u;l++)(a[l].fn!==e||i&&!a[l].once||n&&a[l].context!==n)&&_.push(a[l]);_.length?this._events[s]=1===_.length?_[0]:_:o(this,s)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&o(this,e)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,t.exports=a}(v);var f=y(v.exports),m={grad:.9,turn:360,rad:360/(2*Math.PI)},g=function(t){return"string"==typeof t?t.length>0:"number"==typeof t},x=function(t,e,r){return void 0===e&&(e=0),void 0===r&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},b=function(t,e,r){return void 0===e&&(e=0),void 0===r&&(r=1),t>r?r:t>e?t:e},S=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},T=function(t){return{r:b(t.r,0,255),g:b(t.g,0,255),b:b(t.b,0,255),a:b(t.a)}},P=function(t){return{r:x(t.r),g:x(t.g),b:x(t.b),a:x(t.a,3)}},O=/^#([0-9a-f]{3,8})$/i,M=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},w=function(t){var e=t.r,r=t.g,n=t.b,i=t.a,s=Math.max(e,r,n),o=s-Math.min(e,r,n),a=o?s===e?(r-n)/o:s===r?2+(n-e)/o:4+(e-r)/o:0;return{h:60*(a<0?a+6:a),s:s?o/s*100:0,v:s/255*100,a:i}},C=function(t){var e=t.h,r=t.s,n=t.v,i=t.a;e=e/360*6,r/=100,n/=100;var s=Math.floor(e),o=n*(1-r),a=n*(1-(e-s)*r),l=n*(1-(1-e+s)*r),_=s%6;return{r:255*[n,a,o,o,l,n][_],g:255*[l,n,n,a,o,o][_],b:255*[o,o,l,n,n,a][_],a:i}},E=function(t){return{h:S(t.h),s:b(t.s,0,100),l:b(t.l,0,100),a:b(t.a)}},A=function(t){return{h:x(t.h),s:x(t.s),l:x(t.l),a:x(t.a,3)}},R=function(t){return C((r=(e=t).s,{h:e.h,s:(r*=((n=e.l)<50?n:100-n)/100)>0?2*r/(n+r)*100:0,v:n+r,a:e.a}));var e,r,n},I=function(t){return{h:(e=w(t)).h,s:(i=(200-(r=e.s))*(n=e.v)/100)>0&&i<200?r*n/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,r,n,i},D=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,B=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,k=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,U=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,F={string:[[function(t){var e=O.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:4===t.length?x(parseInt(t[3]+t[3],16)/255,2):1}:6===t.length||8===t.length?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:8===t.length?x(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=k.exec(t)||U.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:T({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:void 0===e[7]?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=D.exec(t)||B.exec(t);if(!e)return null;var r,n,i=E({h:(r=e[1],n=e[2],void 0===n&&(n="deg"),Number(r)*(m[n]||1)),s:Number(e[3]),l:Number(e[4]),a:void 0===e[5]?1:Number(e[5])/(e[6]?100:1)});return R(i)},"hsl"]],object:[[function(t){var e=t.r,r=t.g,n=t.b,i=t.a,s=void 0===i?1:i;return g(e)&&g(r)&&g(n)?T({r:Number(e),g:Number(r),b:Number(n),a:Number(s)}):null},"rgb"],[function(t){var e=t.h,r=t.s,n=t.l,i=t.a,s=void 0===i?1:i;if(!g(e)||!g(r)||!g(n))return null;var o=E({h:Number(e),s:Number(r),l:Number(n),a:Number(s)});return R(o)},"hsl"],[function(t){var e=t.h,r=t.s,n=t.v,i=t.a,s=void 0===i?1:i;if(!g(e)||!g(r)||!g(n))return null;var o,a=(o={h:Number(e),s:Number(r),v:Number(n),a:Number(s)},{h:S(o.h),s:b(o.s,0,100),v:b(o.v,0,100),a:b(o.a)});return C(a)},"hsv"]]},L=function(t,e){for(var r=0;r<e.length;r++){var n=e[r][0](t);if(n)return[n,e[r][1]]}return[null,void 0]},G=function(t){return"string"==typeof t?L(t.trim(),F.string):"object"==typeof t&&null!==t?L(t,F.object):[null,void 0]},j=function(t,e){var r=I(t);return{h:r.h,s:b(r.s+100*e,0,100),l:r.l,a:r.a}},N=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},z=function(t,e){var r=I(t);return{h:r.h,s:r.s,l:b(r.l+100*e,0,100),a:r.a}},W=function(){function t(t){this.parsed=G(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return null!==this.parsed},t.prototype.brightness=function(){return x(N(this.rgba),2)},t.prototype.isDark=function(){return N(this.rgba)<.5},t.prototype.isLight=function(){return N(this.rgba)>=.5},t.prototype.toHex=function(){return e=(t=P(this.rgba)).r,r=t.g,n=t.b,s=(i=t.a)<1?M(x(255*i)):"","#"+M(e)+M(r)+M(n)+s;var t,e,r,n,i,s},t.prototype.toRgb=function(){return P(this.rgba)},t.prototype.toRgbString=function(){return e=(t=P(this.rgba)).r,r=t.g,n=t.b,(i=t.a)<1?"rgba("+e+", "+r+", "+n+", "+i+")":"rgb("+e+", "+r+", "+n+")";var t,e,r,n,i},t.prototype.toHsl=function(){return A(I(this.rgba))},t.prototype.toHslString=function(){return e=(t=A(I(this.rgba))).h,r=t.s,n=t.l,(i=t.a)<1?"hsla("+e+", "+r+"%, "+n+"%, "+i+")":"hsl("+e+", "+r+"%, "+n+"%)";var t,e,r,n,i},t.prototype.toHsv=function(){return t=w(this.rgba),{h:x(t.h),s:x(t.s),v:x(t.v),a:x(t.a,3)};var t},t.prototype.invert=function(){return V({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},t.prototype.saturate=function(t){return void 0===t&&(t=.1),V(j(this.rgba,t))},t.prototype.desaturate=function(t){return void 0===t&&(t=.1),V(j(this.rgba,-t))},t.prototype.grayscale=function(){return V(j(this.rgba,-1))},t.prototype.lighten=function(t){return void 0===t&&(t=.1),V(z(this.rgba,t))},t.prototype.darken=function(t){return void 0===t&&(t=.1),V(z(this.rgba,-t))},t.prototype.rotate=function(t){return void 0===t&&(t=15),this.hue(this.hue()+t)},t.prototype.alpha=function(t){return"number"==typeof t?V({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):x(this.rgba.a,3);var e},t.prototype.hue=function(t){var e=I(this.rgba);return"number"==typeof t?V({h:t,s:e.s,l:e.l,a:e.a}):x(e.h)},t.prototype.isEqual=function(t){return this.toHex()===V(t).toHex()},t}(),V=function(t){return t instanceof W?t:new W(t)},H=[];var X=Object.defineProperty,K=Object.getOwnPropertySymbols,Y=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,$=(t,e,r)=>e in t?X(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;!function(t){t.forEach((function(t){H.indexOf(t)<0&&(t(W,F),H.push(t))}))}([function(t,e){var r={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"},n={};for(var i in r)n[r[i]]=i;var s={};t.prototype.toName=function(e){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var i,o,a=n[this.toHex()];if(a)return a;if(null!=e&&e.closest){var l=this.toRgb(),_=1/0,u="black";if(!s.length)for(var c in r)s[c]=new t(r[c]).toRgb();for(var h in r){var d=(i=l,o=s[h],Math.pow(i.r-o.r,2)+Math.pow(i.g-o.g,2)+Math.pow(i.b-o.b,2));d<_&&(_=d,u=h)}return u}},e.string.push([function(e){var n=e.toLowerCase(),i="transparent"===n?"#0000":r[n];return i?new t(i).toRgb():null},"name"])}]);const q=class t{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(e){if(e instanceof t)this._value=this._cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(null===e)throw new Error("Cannot set Color#value to null");(null===this._value||!this._isSourceEqual(this._value,e))&&(this._value=this._cloneSource(e),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return"string"==typeof t||"number"==typeof t||t instanceof Number||null===t?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):"object"==typeof t&&null!==t?((t,e)=>{for(var r in e||(e={}))Y.call(e,r)&&$(t,r,e[r]);if(K)for(var r of K(e))Q.call(e,r)&&$(t,r,e[r]);return t})({},t):t}_isSourceEqual(t,e){const r=typeof t;if(r!==typeof e)return!1;if("number"===r||"string"===r||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length===e.length&&t.every(((t,r)=>t===e[r]));if(null!==t&&null!==e){const r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every((r=>t[r]===e[r]))}return t===e}toRgba(){const[t,e,r,n]=this._components;return{r:t,g:e,b:r,a:n}}toRgb(){const[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){const[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){const[e,r,n]=this._components;return this._arrayRgb||(this._arrayRgb=[]),(t=t||this._arrayRgb)[0]=Math.round(255*e),t[1]=Math.round(255*r),t[2]=Math.round(255*n),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t=t||this._arrayRgba;const[e,r,n,i]=this._components;return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb;const[e,r,n]=this._components;return t[0]=e,t[1]=r,t[2]=n,t}toNumber(){return this._int}toBgrNumber(){const[t,e,r]=this.toUint8RgbArray();return(r<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(65280&t)+((255&t)<<16)}multiply(e){const[r,n,i,s]=t._temp.setValue(e)._components;return this._components[0]*=r,this._components[1]*=n,this._components[2]*=i,this._components[3]*=s,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(1===t)return(255<<24)+this._int;if(0===t)return e?0:this._int;let r=this._int>>16&255,n=this._int>>8&255,i=255&this._int;return e&&(r=r*t+.5|0,n=n*t+.5|0,i=i*t+.5|0),(255*t<<24)+(r<<16)+(n<<8)+i}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(255*this._components[3]).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(e){let r,n,i,s;if(("number"==typeof e||e instanceof Number)&&e>=0&&e<=16777215){r=(e>>16&255)/255,n=(e>>8&255)/255,i=(255&e)/255,s=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[r,n,i,s=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[r,n,i,s=255]=e,r/=255,n/=255,i/=255,s/=255;else if("string"==typeof e||"object"==typeof e){if("string"==typeof e){const r=t.HEX_PATTERN.exec(e);r&&(e=`#${r[2]}`)}const o=V(e);o.isValid()&&(({r,g:n,b:i,a:s}=o.rgba),r/=255,n/=255,i/=255)}if(void 0===r)throw new Error(`Unable to convert color ${e}`);this._components[0]=r,this._components[1]=n,this._components[2]=i,this._components[3]=s,this._refreshInt()}_refreshInt(){this._clamp(this._components);const[t,e,r]=this._components;this._int=(255*t<<16)+(255*e<<8)+(255*r|0)}_clamp(t,e=0,r=1){return"number"==typeof t?Math.min(Math.max(t,e),r):(t.forEach(((n,i)=>{t[i]=Math.min(Math.max(n,e),r)})),t)}static isColorLike(e){return"number"==typeof e||"string"==typeof e||e instanceof Number||e instanceof t||Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||void 0!==e.r&&void 0!==e.g&&void 0!==e.b||void 0!==e.r&&void 0!==e.g&&void 0!==e.b&&void 0!==e.a||void 0!==e.h&&void 0!==e.s&&void 0!==e.l||void 0!==e.h&&void 0!==e.s&&void 0!==e.l&&void 0!==e.a||void 0!==e.h&&void 0!==e.s&&void 0!==e.v||void 0!==e.h&&void 0!==e.s&&void 0!==e.v&&void 0!==e.a}};q.shared=new q,q._temp=new q,q.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Z=q;const J={cullArea:null,cullable:!1,cullableChildren:!0},tt=2*Math.PI,et=180/Math.PI,rt=Math.PI/180;class nt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new nt(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}static get shared(){return it.x=0,it.y=0,it}}const it=new nt;class st{constructor(t=1,e=0,r=0,n=1,i=0,s=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=n,this.tx=i,this.ty=s}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,r,n,i,s){return this.a=t,this.b=e,this.c=r,this.d=n,this.tx=i,this.ty=s,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new nt;const r=t.x,n=t.y;return e.x=this.a*r+this.c*n+this.tx,e.y=this.b*r+this.d*n+this.ty,e}applyInverse(t,e){e=e||new nt;const r=this.a,n=this.b,i=this.c,s=this.d,o=this.tx,a=this.ty,l=1/(r*s+i*-n),_=t.x,u=t.y;return e.x=s*l*_+-i*l*u+(a*i-o*s)*l,e.y=r*l*u+-n*l*_+(-a*r+o*n)*l,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),r=Math.sin(t),n=this.a,i=this.c,s=this.tx;return this.a=n*e-this.b*r,this.b=n*r+this.b*e,this.c=i*e-this.d*r,this.d=i*r+this.d*e,this.tx=s*e-this.ty*r,this.ty=s*r+this.ty*e,this}append(t){const e=this.a,r=this.b,n=this.c,i=this.d;return this.a=t.a*e+t.b*n,this.b=t.a*r+t.b*i,this.c=t.c*e+t.d*n,this.d=t.c*r+t.d*i,this.tx=t.tx*e+t.ty*n+this.tx,this.ty=t.tx*r+t.ty*i+this.ty,this}appendFrom(t,e){const r=t.a,n=t.b,i=t.c,s=t.d,o=t.tx,a=t.ty,l=e.a,_=e.b,u=e.c,c=e.d;return this.a=r*l+n*u,this.b=r*_+n*c,this.c=i*l+s*u,this.d=i*_+s*c,this.tx=o*l+a*u+e.tx,this.ty=o*_+a*c+e.ty,this}setTransform(t,e,r,n,i,s,o,a,l){return this.a=Math.cos(o+l)*i,this.b=Math.sin(o+l)*i,this.c=-Math.sin(o-a)*s,this.d=Math.cos(o-a)*s,this.tx=t-(r*this.a+n*this.c),this.ty=e-(r*this.b+n*this.d),this}prepend(t){const e=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){const e=this.a,r=this.c;this.a=e*t.a+this.b*t.c,this.b=e*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*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,r=this.b,n=this.c,i=this.d,s=t.pivot,o=-Math.atan2(-n,i),a=Math.atan2(r,e),l=Math.abs(o+a);return l<1e-5||Math.abs(tt-l)<1e-5?(t.rotation=a,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=a),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(n*n+i*i),t.position.x=this.tx+(s.x*e+s.y*n),t.position.y=this.ty+(s.x*r+s.y*i),t}invert(){const t=this.a,e=this.b,r=this.c,n=this.d,i=this.tx,s=t*n-e*r;return this.a=n/s,this.b=-e/s,this.c=-r/s,this.d=t/s,this.tx=(r*this.ty-n*i)/s,this.ty=-(t*this.ty-e*i)/s,this}isIdentity(){return 1===this.a&&0===this.b&&0===this.c&&1===this.d&&0===this.tx&&0===this.ty}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 st;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}equals(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}static get IDENTITY(){return at.identity()}static get shared(){return ot.identity()}}const ot=new st,at=new st;class lt{constructor(t,e,r){this._x=e||0,this._y=r||0,this._observer=t}clone(t){return new lt(null!=t?t:this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),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._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}const _t={default:-1};function ut(t="default"){return void 0===_t[t]&&(_t[t]=-1),++_t[t]}class ct{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){var e;let r;return r=this._index>0?this._pool[--this._index]:new this._classType,null==(e=r.init)||e.call(r,t),r}return(t){var e;null==(e=t.reset)||e.call(t),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}class ht{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new ct(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach((e=>{const r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}})),t}}const dt=new ht;function pt(t,e,r){const n=t.length;let i;if(e>=n||0===r)return;const s=n-(r=e+r>n?n-e:r);for(i=e;i<s;++i)t[i]=t[i+r];t.length=s}const yt={allowChildren:!0,removeChildren(t=0,e){const r=null!=e?e:this.children.length,n=r-t,i=[];if(n>0&&n<=r){for(let e=r-1;e>=t;e--){const t=this.children[e];t&&(i.push(t),t.parent=null)}pt(this.children,t,r);const e=this.renderGroup||this.parentRenderGroup;e&&e.removeChildren(i);for(let t=0;t<i.length;++t)this.emit("childRemoved",i[t],this,t),i[t].emit("removed",this);return i}if(0===n&&0===this.children.length)return i;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(t){const e=this.getChildAt(t);return this.removeChild(e)},getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]},setChildIndex(t,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(t),this.addChildAt(t,e)},getChildIndex(t){const e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(t,e){const{children:r}=this;if(e<0||e>r.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${r.length}`);if(t.parent){const r=t.parent.children.indexOf(t);if(t.parent===this&&r===e)return t;-1!==r&&t.parent.children.splice(r,1)}e===r.length?r.push(t):r.splice(e,0,t),t.parent=this,t.didChange=!0,t._updateFlags=15;const n=this.renderGroup||this.parentRenderGroup;return n&&n.addChild(t),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",t,this,e),t.emit("added",this),t},swapChildren(t,e){if(t===e)return;const r=this.getChildIndex(t),n=this.getChildIndex(e);this.children[r]=e,this.children[n]=t;const i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var t;null==(t=this.parent)||t.removeChild(this)},reparentChild(...t){return 1===t.length?this.reparentChildAt(t[0],this.children.length):(t.forEach((t=>this.reparentChildAt(t,this.children.length))),t[0])},reparentChildAt(t,e){if(t.parent===this)return this.setChildIndex(t,e),t;const r=t.worldTransform.clone();t.removeFromParent(),this.addChildAt(t,e);const n=this.worldTransform.clone();return n.invert(),r.prepend(n),t.setFromMatrix(r),t}};class vt{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}class ft{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach((t=>{this.add({test:t.test,maskClass:t})})))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){const r=this._tests[e];if(r.test(t))return dt.get(r.maskClass,t)}return t}returnMaskEffect(t){dt.return(t)}}const mt=new ft;p.handleByList(c.MaskEffect,mt._effectClasses);var gt=Object.defineProperty,xt=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable,Tt=(t,e,r)=>e in t?gt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Pt=(t,e)=>{for(var r in e||(e={}))bt.call(e,r)&&Tt(t,r,e[r]);if(xt)for(var r of xt(e))St.call(e,r)&&Tt(t,r,e[r]);return t};const Ot={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],addEffect(t){if(-1!==this.effects.indexOf(t))return;this.effects.push(t),this.effects.sort(((t,e)=>t.priority-e.priority));const e=this.renderGroup||this.parentRenderGroup;e&&(e.structureDidChange=!0),this._updateIsSimple()},removeEffect(t){const e=this.effects.indexOf(t);-1!==e&&(this.effects.splice(e,1),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateIsSimple())},set mask(t){const e=this._maskEffect;(null==e?void 0:e.mask)!==t&&(e&&(this.removeEffect(e),mt.returnMaskEffect(e),this._maskEffect=null),null!=t&&(this._maskEffect=mt.getMaskEffect(t),this.addEffect(this._maskEffect)))},setMask(t){this._maskOptions=Pt(Pt({},this._maskOptions),t),t.mask&&(this.mask=t.mask)},get mask(){var t;return null==(t=this._maskEffect)?void 0:t.mask},set filters(t){var e;!Array.isArray(t)&&t&&(t=[t]);const r=this._filterEffect||(this._filterEffect=new vt),n=(null==t?void 0:t.length)>0,i=n!==(null==(e=r.filters)?void 0:e.length)>0;t=Array.isArray(t)?t.slice(0):t,r.filters=Object.freeze(t),i&&(n?this.addEffect(r):(this.removeEffect(r),r.filters=null!=t?t:null))},get filters(){var t;return null==(t=this._filterEffect)?void 0:t.filters},set filterArea(t){this._filterEffect||(this._filterEffect=new vt),this._filterEffect.filterArea=t},get filterArea(){var t;return null==(t=this._filterEffect)?void 0:t.filterArea}},Mt={label:null,get name(){return this.label},set name(t){this.label=t},getChildByName(t,e=!1){return this.getChildByLabel(t,e)},getChildByLabel(t,e=!1){const r=this.children;for(let e=0;e<r.length;e++){const n=r[e];if(n.label===t||t instanceof RegExp&&t.test(n.label))return n}if(e)for(let e=0;e<r.length;e++){const n=r[e].getChildByLabel(t,!0);if(n)return n}return null},getChildrenByLabel(t,e=!1,r=[]){const n=this.children;for(let e=0;e<n.length;e++){const i=n[e];(i.label===t||t instanceof RegExp&&t.test(i.label))&&r.push(i)}if(e)for(let e=0;e<n.length;e++)n[e].getChildrenByLabel(t,!0,r);return r}},wt=[new nt,new nt,new nt,new nt];class Ct{constructor(t=0,e=0,r=0,n=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(n)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new Ct(0,0,0,0)}clone(){return new Ct(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return!(this.width<=0||this.height<=0)&&(t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height)}strokeContains(t,e,r){const{width:n,height:i}=this;if(n<=0||i<=0)return!1;const s=this.x,o=this.y;return t>=s-r/2&&t<=s+n+r/2&&e>=o-r/2&&e<=o+i+r/2&&!(t>s+r/2&&t<s+n-r/2&&e>o+r/2&&e<o+i-r/2)}intersects(t,e){if(!e){const e=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=e)return!1;const r=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>r}const r=this.left,n=this.right,i=this.top,s=this.bottom;if(n<=r||s<=i)return!1;const o=wt[0].set(t.left,t.top),a=wt[1].set(t.left,t.bottom),l=wt[2].set(t.right,t.top),_=wt[3].set(t.right,t.bottom);if(l.x<=o.x||a.y<=o.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(0===u||(e.apply(o,o),e.apply(a,a),e.apply(l,l),e.apply(_,_),Math.max(o.x,a.x,l.x,_.x)<=r||Math.min(o.x,a.x,l.x,_.x)>=n||Math.max(o.y,a.y,l.y,_.y)<=i||Math.min(o.y,a.y,l.y,_.y)>=s))return!1;const c=u*(a.y-o.y),h=u*(o.x-a.x),d=c*r+h*i,p=c*n+h*i,y=c*r+h*s,v=c*n+h*s;if(Math.max(d,p,y,v)<=c*o.x+h*o.y||Math.min(d,p,y,v)>=c*_.x+h*_.y)return!1;const f=u*(o.y-l.y),m=u*(l.x-o.x),g=f*r+m*i,x=f*n+m*i,b=f*r+m*s,S=f*n+m*s;return!(Math.max(g,x,b,S)<=f*o.x+m*o.y||Math.min(g,x,b,S)>=f*_.x+m*_.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this}fit(t){const e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),n=Math.max(this.y,t.y),i=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=n,this.height=Math.max(i-n,0),this}ceil(t=1,e=.001){const r=Math.ceil((this.x+this.width-e)*t)/t,n=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=r-this.x,this.height=n-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),n=Math.min(this.y,t.y),i=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=n,this.height=i-n,this}getBounds(t){return(t=t||new Ct).copyFrom(this),t}}const Et=new st;class At{constructor(t=1/0,e=1/0,r=-1/0,n=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Et,this.minX=t,this.minY=e,this.maxX=r,this.maxY=n}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Ct);const t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Et,this}set(t,e,r,n){this.minX=t,this.minY=e,this.maxX=r,this.maxY=n}addFrame(t,e,r,n,i){i||(i=this.matrix);const s=i.a,o=i.b,a=i.c,l=i.d,_=i.tx,u=i.ty;let c=this.minX,h=this.minY,d=this.maxX,p=this.maxY,y=s*t+a*e+_,v=o*t+l*e+u;y<c&&(c=y),v<h&&(h=v),y>d&&(d=y),v>p&&(p=v),y=s*r+a*e+_,v=o*r+l*e+u,y<c&&(c=y),v<h&&(h=v),y>d&&(d=y),v>p&&(p=v),y=s*t+a*n+_,v=o*t+l*n+u,y<c&&(c=y),v<h&&(h=v),y>d&&(d=y),v>p&&(p=v),y=s*r+a*n+_,v=o*r+l*n+u,y<c&&(c=y),v<h&&(h=v),y>d&&(d=y),v>p&&(p=v),this.minX=c,this.minY=h,this.maxX=d,this.maxY=p}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){const e=this.minX,r=this.minY,n=this.maxX,i=this.maxY,{a:s,b:o,c:a,d:l,tx:_,ty:u}=t;let c=s*e+a*r+_,h=o*e+l*r+u;this.minX=c,this.minY=h,this.maxX=c,this.maxY=h,c=s*n+a*r+_,h=o*n+l*r+u,this.minX=c<this.minX?c:this.minX,this.minY=h<this.minY?h:this.minY,this.maxX=c>this.maxX?c:this.maxX,this.maxY=h>this.maxY?h:this.maxY,c=s*e+a*i+_,h=o*e+l*i+u,this.minX=c<this.minX?c:this.minX,this.minY=h<this.minY?h:this.minY,this.maxX=c>this.maxX?c:this.maxX,this.maxY=h>this.maxY?h:this.maxY,c=s*n+a*i+_,h=o*n+l*i+u,this.minX=c<this.minX?c:this.minX,this.minY=h<this.minY?h:this.minY,this.maxX=c>this.maxX?c:this.maxX,this.maxY=h>this.maxY?h:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,r,n){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<r&&(this.minY=r),this.maxY>n&&(this.maxY=n),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new At(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,r,n){let i=this.minX,s=this.minY,o=this.maxX,a=this.maxY;n||(n=this.matrix);const l=n.a,_=n.b,u=n.c,c=n.d,h=n.tx,d=n.ty;for(let n=e;n<r;n+=2){const e=t[n],r=t[n+1],p=l*e+u*r+h,y=_*e+c*r+d;i=p<i?p:i,s=y<s?y:s,o=p>o?p:o,a=y>a?y:a}this.minX=i,this.minY=s,this.maxX=o,this.maxY=a}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}}const Rt=new ct(st),It=new ct(At);function Dt(t,e,r){let n,i;return r.clear(),t.parent?e?n=t.parent.worldTransform:(i=Rt.get().identity(),n=kt(t,i)):n=st.IDENTITY,Bt(t,r,n,e),i&&Rt.return(i),r.isValid||r.set(0,0,0,0),r}function Bt(t,e,r,n){var i,s;if(!t.visible||!t.measurable)return;let o;n?o=t.worldTransform:(t.updateLocalTransform(),o=Rt.get(),o.appendFrom(t.localTransform,r));const a=e,l=!!t.effects.length;if(l&&(e=It.get().clear()),t.boundsArea)e.addRect(t.boundsArea,o);else{t.addBounds&&(e.matrix=o,t.addBounds(e));for(let r=0;r<t.children.length;r++)Bt(t.children[r],e,o,n)}if(l){for(let r=0;r<t.effects.length;r++)null==(s=(i=t.effects[r]).addBounds)||s.call(i,e);a.addBounds(e,st.IDENTITY),It.return(e)}n||Rt.return(o)}function kt(t,e){const r=t.parent;return r&&(kt(r,e),r.updateLocalTransform(),e.append(r.localTransform)),e}function Ut(t,e,r){return e.clear(),r||(r=st.IDENTITY),Ft(t,e,r,t,!0),e.isValid||e.set(0,0,0,0),e}function Ft(t,e,r,n,i){var s,o;let a;if(i)a=Rt.get(),a=r.copyTo(a);else{if(!t.visible||!t.measurable)return;t.updateLocalTransform();const e=t.localTransform;a=Rt.get(),a.appendFrom(e,r)}const l=e,_=!!t.effects.length;if(_&&(e=It.get().clear()),t.boundsArea)e.addRect(t.boundsArea,a);else{t.renderPipeId&&(e.matrix=a,t.addBounds(e));const r=t.children;for(let t=0;t<r.length;t++)Ft(r[t],e,a,n,!1)}if(_){for(let r=0;r<t.effects.length;r++)null==(o=(s=t.effects[r]).addLocalBounds)||o.call(s,e,n);l.addBounds(e,st.IDENTITY),It.return(e)}Rt.return(a)}function Lt(t,e){const r=t.children;for(let t=0;t<r.length;t++){const n=r[t],i=n.uid,s=(65535&n._didViewChangeTick)<<16|65535&n._didContainerChangeTick,o=e.index;(e.data[o]!==i||e.data[o+1]!==s)&&(e.data[e.index]=i,e.data[e.index+1]=s,e.didChange=!0),e.index=o+2,n.children.length&&Lt(n,e)}return e.didChange}const Gt=new st,jt={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(t,e){const r=Math.sign(this.scale.x)||1;this.scale.x=0!==e?t/e*r:r},_setHeight(t,e){const r=Math.sign(this.scale.y)||1;this.scale.y=0!==e?t/e*r:r},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new At});const t=this._localBoundsCacheData;return t.index=1,t.didChange=!1,t.data[0]!==this._didViewChangeTick&&(t.didChange=!0,t.data[0]=this._didViewChangeTick),Lt(this,t),t.didChange&&Ut(this,t.localBounds,Gt),t.localBounds},getBounds(t,e){return Dt(this,t,e||new At)}},Nt={_onRender:null,set onRender(t){const e=this.renderGroup||this.parentRenderGroup;if(!t)return this._onRender&&(null==e||e.removeOnRender(this)),void(this._onRender=null);this._onRender||null==e||e.addOnRender(this),this._onRender=t},get onRender(){return this._onRender}},zt={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(t){this._zIndex!==t&&(this._zIndex=t,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(Wt))}};function Wt(t,e){return t._zIndex-e._zIndex}const Vt={getGlobalPosition(t=new nt,e=!1){return this.parent?this.parent.toGlobal(this._position,t,e):(t.x=this._position.x,t.y=this._position.y),t},toGlobal(t,e,r=!1){if(!r){this.updateLocalTransform();const r=kt(this,new st);return r.append(this.localTransform),r.apply(t,e)}return this.worldTransform.apply(t,e)},toLocal(t,e,r,n){if(e&&(t=e.toGlobal(t,r,n)),!n){this.updateLocalTransform();const e=kt(this,new st);return e.append(this.localTransform),e.applyInverse(t,r)}return this.worldTransform.applyInverse(t,r)}};let Ht=0;class Xt{constructor(){this.uid=ut("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.tick=0}reset(){this.instructionSize=0,this.tick=Ht++}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}class Kt{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new st,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new Xt,this._onRenderContainers=[]}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;const e=t.children;for(let t=0;t<e.length;t++)this.addChild(e[t])}reset(){this.renderGroupChildren.length=0;for(const t in this.childrenToUpdate){const e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){const e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup)return void this.addRenderGroupChild(t.renderGroup);t._onRender&&this.addOnRender(t);const e=t.children;for(let t=0;t<e.length;t++)this.addChild(e[t])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup)return void this._removeRenderGroupChild(t.renderGroup);const e=t.children;for(let t=0;t<e.length;t++)this.removeChild(e[t])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return 7===this.root.localDisplayStatus&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(){for(let t=0;t<this._onRenderContainers.length;t++)this._onRenderContainers[t]._onRender()}destroy(){this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){const e=this.root.children;for(let r=0;r<e.length;r++)this._getChildren(e[r],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;const r=t.children;for(let t=0;t<r.length;t++)this._getChildren(r[t],e);return e}}function Yt(t,e,r={}){for(const n in e)!r[n]&&void 0!==e[n]&&(t[n]=e[n])}const Qt=new lt(null),$t=new lt(null),qt=new lt(null,1,1);class Zt extends f{constructor(t={}){var e,r;super(),this.uid=ut("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new st,this.relativeGroupTransform=new st,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new lt(this,0,0),this._scale=qt,this._pivot=$t,this._skew=Qt,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],Yt(this,t,{children:!0,parent:!0,effects:!0}),null==(e=t.children)||e.forEach((t=>this.addChild(t))),null==(r=t.parent)||r.addChild(this)}static mixin(t){Object.defineProperties(Zt.prototype,Object.getOwnPropertyDescriptors(t))}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=4095&t}get _didChangeId(){return 4095&this._didContainerChangeTick|(4095&this._didViewChangeTick)<<12}addChild(...t){if(t.length>1){for(let e=0;e<t.length;e++)this.addChild(t[e]);return t[0]}const e=t[0];if(e.parent===this)return this.children.splice(this.children.indexOf(e),1),this.children.push(e),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),e;e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15;const r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,0!==e._zIndex&&e.depthOfChildModified(),e}removeChild(...t){if(t.length>1){for(let e=0;e<t.length;e++)this.removeChild(t[e]);return t[0]}const e=t[0],r=this.children.indexOf(e);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parent=null,this.emit("childRemoved",e,this,r),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const t=this.parentRenderGroup;null==t||t.removeChild(this),this.renderGroup=dt.get(Kt,this),this.groupTransform=st.IDENTITY,null==t||t.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;null==t||t.removeChild(this),dt.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,null==t||t.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&0===this.effects.length}get worldTransform(){return this._worldTransform||(this._worldTransform=new st),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*et}set angle(t){this.rotation=t*rt}get pivot(){return this._pivot===$t&&(this._pivot=new lt(this,0,0)),this._pivot}set pivot(t){this._pivot===$t&&(this._pivot=new lt(this,0,0)),"number"==typeof t?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Qt&&(this._skew=new lt(this,0,0)),this._skew}set skew(t){this._skew===Qt&&(this._skew=new lt(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===qt&&(this._scale=new lt(this,1,1)),this._scale}set scale(t){this._scale===qt&&(this._scale=new lt(this,0,0)),"number"==typeof t?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){var r;const n=this.getLocalBounds();"object"==typeof t?(e=null!=(r=t.height)?r:t.width,t=t.width):null!=e||(e=t),void 0!==t&&this._setWidth(t,n.width),void 0!==e&&this._setHeight(e,n.height)}_updateSkew(){const t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set("number"==typeof t.x?t.x:this.position.x,"number"==typeof t.y?t.y:this.position.y),this.scale.set("number"==typeof t.scaleX?t.scaleX||1:this.scale.x,"number"==typeof t.scaleY?t.scaleY||1:this.scale.y),this.rotation="number"==typeof t.rotation?t.rotation:this.rotation,this.skew.set("number"==typeof t.skewX?t.skewX:this.skew.x,"number"==typeof t.skewY?t.skewY:this.skew.y),this.pivot.set("number"==typeof t.pivotX?t.pivotX:this.pivot.x,"number"==typeof t.pivotY?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,r=this._scale,n=this._pivot,i=this._position,s=r._x,o=r._y,a=n._x,l=n._y;e.a=this._cx*s,e.b=this._sx*s,e.c=this._cy*o,e.d=this._sy*o,e.tx=i._x-(a*e.a+l*e.c),e.ty=i._y-(a*e.b+l*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=1,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const e=Z.shared.setValue(null!=t?t:16777215).toBgrNumber();e!==this.localColor&&(this.localColor=e,this._updateFlags|=1,this._onUpdate())}get tint(){const t=this.localColor;return((255&t)<<16)+(65280&t)+(t>>16&255)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=2,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(2&this.localDisplayStatus)}set visible(t){const e=t?2:0;(2&this.localDisplayStatus)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=4,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(4&this.localDisplayStatus)}set culled(t){const e=t?0:4;(4&this.localDisplayStatus)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=4,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(1&this.localDisplayStatus)}set renderable(t){const e=t?1:0;(1&this.localDisplayStatus)!==e&&(this._updateFlags|=4,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return 7===this.localDisplayStatus&&this.groupAlpha>0}destroy(t=!1){var e;if(this.destroyed)return;let r;if(this.destroyed=!0,this.children.length&&(r=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),("boolean"==typeof t?t:null==t?void 0:t.children)&&r)for(let e=0;e<r.length;++e)r[e].destroy(t);null==(e=this.renderGroup)||e.destroy(),this.renderGroup=null}}Zt.mixin(yt),Zt.mixin(Vt),Zt.mixin(Nt),Zt.mixin(jt),Zt.mixin(Ot),Zt.mixin(Mt),Zt.mixin(zt),Zt.mixin(J);class Jt{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=Jt.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new nt,this.page=new nt,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,r,n,i){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}var te,ee=/iPhone/i,re=/iPod/i,ne=/iPad/i,ie=/\biOS-universal(?:.+)Mac\b/i,se=/\bAndroid(?:.+)Mobile\b/i,oe=/Android/i,ae=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,le=/Silk/i,_e=/Windows Phone/i,ue=/\bWindows(?:.+)ARM\b/i,ce=/BlackBerry/i,he=/BB10/i,de=/Opera Mini/i,pe=/\b(CriOS|Chrome)(?:.+)Mobile/i,ye=/Mobile(?:.+)Firefox\b/i,ve=function(t){return void 0!==t&&"MacIntel"===t.platform&&"number"==typeof t.maxTouchPoints&&t.maxTouchPoints>1&&"undefined"==typeof MSStream};function fe(t){var e={userAgent:"",platform:"",maxTouchPoints:0};t||"undefined"==typeof navigator?"string"==typeof t?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0}):e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var r=e.userAgent,n=r.split("[FBAN");void 0!==n[1]&&(r=n[0]),void 0!==(n=r.split("Twitter"))[1]&&(r=n[0]);var i=function(t){return function(e){return e.test(t)}}(r),s={apple:{phone:i(ee)&&!i(_e),ipod:i(re),tablet:!i(ee)&&(i(ne)||ve(e))&&!i(_e),universal:i(ie),device:(i(ee)||i(re)||i(ne)||i(ie)||ve(e))&&!i(_e)},amazon:{phone:i(ae),tablet:!i(ae)&&i(le),device:i(ae)||i(le)},android:{phone:!i(_e)&&i(ae)||!i(_e)&&i(se),tablet:!i(_e)&&!i(ae)&&!i(se)&&(i(le)||i(oe)),device:!i(_e)&&(i(ae)||i(le)||i(se)||i(oe))||i(/\bokhttp\b/i)},windows:{phone:i(_e),tablet:i(ue),device:i(_e)||i(ue)},other:{blackberry:i(ce),blackberry10:i(he),opera:i(de),firefox:i(ye),chrome:i(pe),device:i(ce)||i(he)||i(de)||i(ye)||i(pe)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}const me=(null!=(te=fe.default)?te:fe)(globalThis.navigator);class ge{constructor(t,e=me){this._mobileInfo=e,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,(e.tablet||e.phone)&&this._createTouchHook();const r=document.createElement("div");r.style.width="100px",r.style.height="100px",r.style.position="absolute",r.style.top="0px",r.style.left="0px",r.style.zIndex=2..toString(),this._div=r,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}get hookDiv(){return this._hookDiv}_createTouchHook(){const t=document.createElement("button");t.style.width="1px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.left="-1000px",t.style.zIndex=2..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.runners.postrender.add(this),null==(t=this._renderer.view.canvas.parentNode)||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.runners.postrender.remove(this),null==(t=this._div.parentNode)||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 t=0;t<e.length;t++)this._updateAccessibleObjects(e[t])}init(t){var e;this.debug=null!=(e=null==t?void 0:t.debug)?e:this.debug,this._renderer.runners.postrender.remove(this)}postrender(){const t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered);const{x:e,y:r,width:n,height:i}=this._renderer.view.canvas.getBoundingClientRect(),{width:s,height:o,resolution:a}=this._renderer,l=n/s*a,_=i/o*a;let u=this._div;u.style.left=`${e}px`,u.style.top=`${r}px`,u.style.width=`${s}px`,u.style.height=`${o}px`;for(let t=0;t<this._children.length;t++){const e=this._children[t];if(e._renderId!==this._renderId)e._accessibleActive=!1,pt(this._children,t,1),this._div.removeChild(e._accessibleDiv),this._pool.push(e._accessibleDiv),e._accessibleDiv=null,t--;else{u=e._accessibleDiv;let t=e.hitArea;const r=e.worldTransform;e.hitArea?(u.style.left=(r.tx+t.x*r.a)*l+"px",u.style.top=(r.ty+t.y*r.d)*_+"px",u.style.width=t.width*r.a*l+"px",u.style.height=t.height*r.d*_+"px"):(t=e.getBounds().rectangle,this._capHitArea(t),u.style.left=t.x*l+"px",u.style.top=t.y*_+"px",u.style.width=t.width*l+"px",u.style.height=t.height*_+"px",u.title!==e.accessibleTitle&&null!==e.accessibleTitle&&(u.title=e.accessibleTitle||""),u.getAttribute("aria-label")!==e.accessibleHint&&null!==e.accessibleHint&&u.setAttribute("aria-label",e.accessibleHint||"")),(e.accessibleTitle!==u.title||e.tabIndex!==u.tabIndex)&&(u.title=e.accessibleTitle||"",u.tabIndex=e.tabIndex,this.debug&&this._updateDebugHTML(u))}}this._renderId++}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> 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:r}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-t.y)}_addChild(t){let e=this._pool.pop();e||(e=document.createElement("button"),e.style.width="100px",e.style.height="100px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=2..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&&null!==t.accessibleTitle?e.title=t.accessibleTitle:(!t.accessibleHint||null===t.accessibleHint)&&(e.title=`container ${t.tabIndex}`),t.accessibleHint&&null!==t.accessibleHint&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this._updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{container:r}=t.target,n=this._renderer.events.rootBoundary,i=Object.assign(new Jt(n),{target:r});n.rootTarget=this._renderer.lastObjectRendered,e.forEach((t=>n.dispatchEvent(i,t)))}_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){9===t.keyCode&&this._activate()}_onMouseMove(t){0===t.movementX&&0===t.movementY||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}}ge.extension={type:[c.WebGLSystem,c.WebGPUSystem],name:"accessibility"};const xe={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1};p.add(ge),Zt.mixin(xe);class be{static init(t){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(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;let t,e;if(this._cancelResize(),this._resizeTo===globalThis.window)t=globalThis.innerWidth,e=globalThis.innerHeight;else{const{clientWidth:r,clientHeight:n}=this._resizeTo;t=r,e=n}this.renderer.resize(t,e),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}}be.extension=c.Application;var Se=(t=>(t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY",t))(Se||{});class Te{constructor(t,e=null,r=0,n=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=r,this._once=n}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 Pe=class t{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 Te(null,null,1/0),this.deltaMS=1/t.targetFPMS,this.elapsedMS=1/t.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&null===this._requestId&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,r=Se.NORMAL){return this._addListener(new Te(t,e,r))}addOnce(t,e,r=Se.NORMAL){return this._addListener(new Te(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}else t.connect(r);return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r=r.match(t,e)?r.destroy():r.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(e=performance.now()){let r;if(e>this.lastTime){if(r=this.elapsedMS=e-this.lastTime,r>this._maxElapsedMS&&(r=this._maxElapsedMS),r*=this.speed,this._minElapsedMS){const t=e-this._lastFrame|0;if(t<this._minElapsedMS)return;this._lastFrame=e-t%this._minElapsedMS}this.deltaMS=r,this.deltaTime=this.deltaMS*t.targetFPMS;const n=this._head;let i=n.next;for(;i;)i=i.emit(this);n.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const r=Math.min(this.maxFPS,e),n=Math.min(Math.max(0,r)/1e3,t.targetFPMS);this._maxElapsedMS=1/n}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(0===t)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!t._shared){const e=t._shared=new t;e.autoStart=!0,e._protected=!0}return t._shared}static get system(){if(!t._system){const e=t._system=new t;e.autoStart=!0,e._protected=!0}return t._system}};Pe.targetFPMS=.06;let Oe=Pe;class Me{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,Se.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Oe.shared:new Oe,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Me.extension=c.Application,p.add(be),p.add(Me);const we=new 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||(Oe.system.add(this._tickerUpdate,this,Se.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Oe.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove)return void(this._didMove=!1);const t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&"touch"===t.pointerType||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}};class Ce extends Jt{constructor(){super(...arguments),this.client=new nt,this.movement=new nt,this.offset=new nt,this.global=new nt,this.screen=new nt}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,n,i,s,o,a,l,_,u,c,h,d,p){throw new Error("Method not implemented.")}}class Ee extends Ce{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class Ae extends Ce{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}Ae.DOM_DELTA_PIXEL=0,Ae.DOM_DELTA_LINE=1,Ae.DOM_DELTA_PAGE=2;const Re=new nt,Ie=new nt;class De{constructor(t){this.dispatch=new f,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.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 r=0,n=e.length;r<n;r++)e[r].fn(t)}hitTest(t,e){we.pauseUpdate=!0;const r=this[this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive"](this.rootTarget,this.rootTarget.eventMode,Re.set(t,e),this.hitTestFn,this.hitPruneFn);return r&&r[0]}propagate(t,e){if(!t.target)return;const r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let n=0,i=r.length-1;n<i;n++)if(t.currentTarget=r[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){t.eventPhase=t.BUBBLING_PHASE;for(let n=r.length-2;n>=0;n--)if(t.currentTarget=r[n],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(0===r.length)return;t.eventPhase=t.BUBBLING_PHASE;const n=Array.isArray(e)?e:[e];for(let e=r.length-1;e>=0;e--)n.forEach((n=>{t.currentTarget=r[e],this.notifyTarget(t,n)}))}propagationPath(t){const e=[t];for(let r=0;r<2048&&t!==this.rootTarget&&t.parent;r++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,r,n,i,s=!1){let o=!1;if(this._interactivePrune(t))return null;if(("dynamic"===t.eventMode||"dynamic"===e)&&(we.pauseUpdate=!1),t.interactiveChildren&&t.children){const a=t.children;for(let l=a.length-1;l>=0;l--){const _=a[l],u=this.hitTestMoveRecursive(_,this._isInteractive(e)?e:_.eventMode,r,n,i,s||i(t,r));if(u){if(u.length>0&&!u[u.length-1].parent)continue;const e=t.isInteractive();(u.length>0||e)&&(e&&this._allInteractiveElements.push(t),u.push(t)),0===this._hitElements.length&&(this._hitElements=u),o=!0}}}const a=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),s||this._hitElements.length>0?null:o?this._hitElements:a&&!i(t,r)&&n(t,r)?l?[t]:[]:null}hitTestRecursive(t,e,r,n,i){if(this._interactivePrune(t)||i(t,r))return null;if(("dynamic"===t.eventMode||"dynamic"===e)&&(we.pauseUpdate=!1),t.interactiveChildren&&t.children){const s=t.children,o=r;for(let r=s.length-1;r>=0;r--){const a=s[r],l=this.hitTestRecursive(a,this._isInteractive(e)?e:a.eventMode,o,n,i);if(l){if(l.length>0&&!l[l.length-1].parent)continue;const e=t.isInteractive();return(l.length>0||e)&&l.push(t),l}}}const s=this._isInteractive(e),o=t.isInteractive();return s&&n(t,r)?o?[t]:[]:null}_isInteractive(t){return"static"===t||"dynamic"===t}_interactivePrune(t){return!(t&&t.visible&&t.renderable&&t.includeInBuild&&t.measurable&&"none"!==t.eventMode&&("passive"!==t.eventMode||t.interactiveChildren))}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,Ie),!t.hitArea.contains(Ie.x,Ie.y)))return!0;if(t.effects&&t.effects.length)for(let r=0;r<t.effects.length;r++){const n=t.effects[r];if(n.containsPoint&&!n.containsPoint(e,this.hitTestFn))return!0}return!1}hitTestFn(t,e){return!!t.hitArea||!(null==t||!t.containsPoint)&&(t.worldTransform.applyInverse(e,Ie),t.containsPoint(Ie))}notifyTarget(t,e){var r,n;if(!t.currentTarget.isInteractive())return;const i=`on${e=null!=e?e:t.type}`;null==(n=(r=t.currentTarget)[i])||n.call(r,t);const s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Ee))return;const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType)this.dispatchEvent(e,"touchstart");else if("mouse"===e.pointerType||"pen"===e.pointerType){const t=2===e.button;this.dispatchEvent(e,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var e,r,n;if(!(t instanceof Ee))return;this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const i=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const s="mouse"===i.pointerType||"pen"===i.pointerType,o=this.trackingData(t.pointerId),a=this.findMountedTarget(o.overTargets);if((null==(e=o.overTargets)?void 0:e.length)>0&&a!==i.target){const e="mousemove"===t.type?"mouseout":"pointerout",r=this.createPointerEvent(t,e,a);if(this.dispatchEvent(r,"pointerout"),s&&this.dispatchEvent(r,"mouseout"),!i.composedPath().includes(a)){const e=this.createPointerEvent(t,"pointerleave",a);for(e.eventPhase=e.AT_TARGET;e.target&&!i.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),s&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(r)}if(a!==i.target){const e="mousemove"===t.type?"mouseover":"pointerover",r=this.clonePointerEvent(i,e);this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover");let n=null==a?void 0:a.parent;for(;n&&n!==this.rootTarget.parent&&n!==i.target;)n=n.parent;if(!n||n===this.rootTarget.parent){const t=this.clonePointerEvent(i,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==a&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),s&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(r)}const l=[],_=null==(r=this.enableGlobalMoveEvents)||r;this.moveOnAll?l.push("pointermove"):this.dispatchEvent(i,"pointermove"),_&&l.push("globalpointermove"),"touch"===i.pointerType&&(this.moveOnAll?l.splice(1,0,"touchmove"):this.dispatchEvent(i,"touchmove"),_&&l.push("globaltouchmove")),s&&(this.moveOnAll?l.splice(1,0,"mousemove"):this.dispatchEvent(i,"mousemove"),_&&l.push("globalmousemove"),this.cursor=null==(n=i.target)?void 0:n.cursor),l.length>0&&this.all(i,l),this._allInteractiveElements.length=0,this._hitElements.length=0,o.overTargets=i.composedPath(),this.freeEvent(i)}mapPointerOver(t){var e;if(!(t instanceof Ee))return;const r=this.trackingData(t.pointerId),n=this.createPointerEvent(t),i="mouse"===n.pointerType||"pen"===n.pointerType;this.dispatchEvent(n,"pointerover"),i&&this.dispatchEvent(n,"mouseover"),"mouse"===n.pointerType&&(this.cursor=null==(e=n.target)?void 0:e.cursor);const s=this.clonePointerEvent(n,"pointerenter");for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),i&&this.notifyTarget(s,"mouseenter"),s.target=s.target.parent;r.overTargets=n.composedPath(),this.freeEvent(n),this.freeEvent(s)}mapPointerOut(t){if(!(t instanceof Ee))return;const e=this.trackingData(t.pointerId);if(e.overTargets){const r="mouse"===t.pointerType||"pen"===t.pointerType,n=this.findMountedTarget(e.overTargets),i=this.createPointerEvent(t,"pointerout",n);this.dispatchEvent(i),r&&this.dispatchEvent(i,"mouseout");const s=this.createPointerEvent(t,"pointerleave",n);for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),r&&this.notifyTarget(s,"mouseleave"),s.target=s.target.parent;e.overTargets=null,this.freeEvent(i),this.freeEvent(s)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Ee))return;const e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),"touch"===r.pointerType)this.dispatchEvent(r,"touchend");else if("mouse"===r.pointerType||"pen"===r.pointerType){const t=2===r.button;this.dispatchEvent(r,t?"rightup":"mouseup")}const n=this.trackingData(t.pointerId),i=this.findMountedTarget(n.pressTargetsByButton[t.button]);let s=i;if(i&&!r.composedPath().includes(i)){let e=i;for(;e&&!r.composedPath().includes(e);){if(r.currentTarget=e,this.notifyTarget(r,"pointerupoutside"),"touch"===r.pointerType)this.notifyTarget(r,"touchendoutside");else if("mouse"===r.pointerType||"pen"===r.pointerType){const t=2===r.button;this.notifyTarget(r,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete n.pressTargetsByButton[t.button],s=e}if(s){const i=this.clonePointerEvent(r,"click");i.target=s,i.path=null,n.clicksByButton[t.button]||(n.clicksByButton[t.button]={clickCount:0,target:i.target,timeStamp:e});const o=n.clicksByButton[t.button];if(o.target===i.target&&e-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=i.target,o.timeStamp=e,i.detail=o.clickCount,"mouse"===i.pointerType){const t=2===i.button;this.dispatchEvent(i,t?"rightclick":"click")}else"touch"===i.pointerType&&this.dispatchEvent(i,"tap");this.dispatchEvent(i,"pointertap"),this.freeEvent(i)}this.freeEvent(r)}mapPointerUpOutside(t){if(!(t instanceof Ee))return;const e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),n=this.createPointerEvent(t);if(r){let i=r;for(;i;)n.currentTarget=i,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):("mouse"===n.pointerType||"pen"===n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),i=i.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(n)}mapWheel(t){if(!(t instanceof Ae))return;const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){var n;const i=this.allocateEvent(Ee);return this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.nativeEvent=t.nativeEvent,i.originalEvent=t,i.target=null!=(n=null!=r?r:this.hitTest(i.global.x,i.global.y))?n:this._hitElements[0],"string"==typeof e&&(i.type=e),i}createWheelEvent(t){const e=this.allocateEvent(Ae);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){const r=this.allocateEvent(Ee);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=null!=e?e:r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Ee&&e instanceof Ee&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof Ce&&e instanceof Ce&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);const e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=!1,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}_notifyListeners(t,e){const r=t.currentTarget._events[e];if(r)if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,!0),r.fn.call(r.context,t);else for(let n=0,i=r.length;n<i&&!t.propagationImmediatelyStopped;n++)r[n].once&&t.currentTarget.removeListener(e,r[n].fn,void 0,!0),r[n].fn.call(r[n].context,t)}}var Be=Object.defineProperty,ke=Object.getOwnPropertySymbols,Ue=Object.prototype.hasOwnProperty,Fe=Object.prototype.propertyIsEnumerable,Le=(t,e,r)=>e in t?Be(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;const Ge={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},je=class t{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new De(null),we.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Ee(null),this._rootWheelEvent=new Ae(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy(((t,e)=>{for(var r in e||(e={}))Ue.call(e,r)&&Le(t,r,e[r]);if(ke)for(var r of ke(e))Fe.call(e,r)&&Le(t,r,e[r]);return t})({},t.defaultEventFeatures),{set:(t,e,r)=>("globalMove"===e&&(this.rootBoundary.enableGlobalMoveEvents=r),t[e]=r,!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(e){var r,n;const{canvas:i,resolution:s}=this.renderer;this.setTargetElement(i),this.resolution=s,t._defaultEventMode=null!=(r=e.eventMode)?r:"passive",Object.assign(this.features,null!=(n=e.eventFeatures)?n:{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=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 r=this.cursorStyles[t];if(r)switch(typeof r){case"string":e&&(this.domElement.style.cursor=r);break;case"function":r(t);break;case"object":e&&Object.assign(this.domElement.style,r)}else e&&"string"==typeof t&&!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 t=0,r=e.length;t<r;t++){const r=e[t],n=this._bootstrapEvent(this._rootPointerEvent,r);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,we.pointerMoved();const e=this._normalizeToPointerData(t);for(let t=0,r=e.length;t<r;t++){const r=this._bootstrapEvent(this._rootPointerEvent,e[t]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);const r=e!==this.domElement?"outside":"",n=this._normalizeToPointerData(t);for(let t=0,e=n.length;t<e;t++){const e=this._bootstrapEvent(this._rootPointerEvent,n[t]);e.type+=r,this.rootBoundary.mapEvent(e)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this._normalizeToPointerData(t);for(let t=0,r=e.length;t<r;t++){const r=this._bootstrapEvent(this._rootPointerEvent,e[t]);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;const e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this._removeEvents(),this.domElement=t,we.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;we.addTickerListener();const t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;we.removeTickerListener();const t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(t,e,r){const n=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},i=1/this.resolution;t.x=(e-n.left)*(this.domElement.width/n.width)*i,t.y=(r-n.top)*(this.domElement.height/n.height)*i}_normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,n=t.changedTouches.length;r<n;r++){const n=t.changedTouches[r];void 0===n.button&&(n.button=0),void 0===n.buttons&&(n.buttons=1),void 0===n.isPrimary&&(n.isPrimary=1===t.touches.length&&"touchstart"===t.type),void 0===n.width&&(n.width=n.radiusX||1),void 0===n.height&&(n.height=n.radiusY||1),void 0===n.tiltX&&(n.tiltX=0),void 0===n.tiltY&&(n.tiltY=0),void 0===n.pointerType&&(n.pointerType="touch"),void 0===n.pointerId&&(n.pointerId=n.identifier||0),void 0===n.pressure&&(n.pressure=n.force||.5),void 0===n.twist&&(n.twist=0),void 0===n.tangentialPressure&&(n.tangentialPressure=0),void 0===n.layerX&&(n.layerX=n.offsetX=n.clientX),void 0===n.layerY&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=t.type,e.push(n)}else if(globalThis.MouseEvent&&(!(t instanceof MouseEvent)||this.supportsPointerEvents&&t instanceof globalThis.PointerEvent))e.push(t);else{const r=t;void 0===r.isPrimary&&(r.isPrimary=!0),void 0===r.width&&(r.width=1),void 0===r.height&&(r.height=1),void 0===r.tiltX&&(r.tiltX=0),void 0===r.tiltY&&(r.tiltY=0),void 0===r.pointerType&&(r.pointerType="mouse"),void 0===r.pointerId&&(r.pointerId=1),void 0===r.pressure&&(r.pressure=.5),void 0===r.twist&&(r.twist=0),void 0===r.tangentialPressure&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}return e}normalizeWheelEvent(t){const e=this._rootWheelEvent;return this._transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}_bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this._transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=Ge[t.type]||t.type),t}_transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};je.extension={name:"events",type:[c.WebGLSystem,c.CanvasSystem,c.WebGPUSystem],priority:-1},je.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let Ne=je;const ze={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return"dynamic"===this.eventMode||"static"===this.eventMode},set interactive(t){this.eventMode=t?"static":"passive"},_internalEventMode:void 0,get eventMode(){var t;return null!=(t=this._internalEventMode)?t:Ne.defaultEventMode},set eventMode(t){this._internalEventMode=t},isInteractive(){return"static"===this.eventMode||"dynamic"===this.eventMode},interactiveChildren:!0,hitArea:null,addEventListener(t,e,r){const n="boolean"==typeof r&&r||"object"==typeof r&&r.capture,i="object"==typeof r?r.signal:void 0,s="object"==typeof r&&!0===r.once,o="function"==typeof e?void 0:e;t=n?`${t}capture`:t;const a="function"==typeof e?e:e.handleEvent,l=this;i&&i.addEventListener("abort",(()=>{l.off(t,a,o)})),s?l.once(t,a,o):l.on(t,a,o)},removeEventListener(t,e,r){const n="function"==typeof e?void 0:e;t="boolean"==typeof r&&r||"object"==typeof r&&r.capture?`${t}capture`:t,e="function"==typeof e?e:e.handleEvent,this.off(t,e,n)},dispatchEvent(t){if(!(t instanceof Jt))throw new Error("Container cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}};p.add(Ne),Zt.mixin(ze);var We=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(We||{});const Ve={createCanvas:(t,e)=>{const r=document.createElement("canvas");return r.width=t,r.height=e,r},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>{var t;return null!=(t=document.baseURI)?t:window.location.href},getFontFaceSet:()=>document.fonts,fetch:(t,e)=>fetch(t,e),parseXML:t=>(new DOMParser).parseFromString(t,"text/xml")};let He=Ve;const Xe={get:()=>He,set(t){He=t}};function Ke(t){if("string"!=typeof t)throw new TypeError(`Path must be a string. Received ${JSON.stringify(t)}`)}function Ye(t){return t.split("?")[0].split("#")[0]}const Qe={toPosix:t=>function(t,e,r){return t.replace(new RegExp(function(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(e),"g"),r)}(t,"\\","/"),isUrl(t){return/^https?:/.test(this.toPosix(t))},isDataUrl:t=>/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t),isBlobUrl:t=>t.startsWith("blob:"),hasProtocol(t){return/^[^/:]+:/.test(this.toPosix(t))},getProtocol(t){Ke(t),t=this.toPosix(t);const e=/^file:\/\/\//.exec(t);if(e)return e[0];const r=/^[^/:]+:\/{0,2}/.exec(t);return r?r[0]:""},toAbsolute(t,e,r){if(Ke(t),this.isDataUrl(t)||this.isBlobUrl(t))return t;const n=Ye(this.toPosix(null!=e?e:Xe.get().getBaseUrl())),i=Ye(this.toPosix(null!=r?r:this.rootname(n)));return(t=this.toPosix(t)).startsWith("/")?Qe.join(i,t.slice(1)):this.isAbsolute(t)?t:this.join(n,t)},normalize(t){if(Ke(t),0===t.length)return".";if(this.isDataUrl(t)||this.isBlobUrl(t))return t;let e="";const r=(t=this.toPosix(t)).startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));const n=t.endsWith("/");return t=function(t,e){let r="",n=0,i=-1,s=0,o=-1;for(let a=0;a<=t.length;++a){if(a<t.length)o=t.charCodeAt(a);else{if(47===o)break;o=47}if(47===o){if(i!==a-1&&1!==s)if(i!==a-1&&2===s){if(r.length<2||2!==n||46!==r.charCodeAt(r.length-1)||46!==r.charCodeAt(r.length-2))if(r.length>2){const t=r.lastIndexOf("/");if(t!==r.length-1){-1===t?(r="",n=0):(r=r.slice(0,t),n=r.length-1-r.lastIndexOf("/")),i=a,s=0;continue}}else if(2===r.length||1===r.length){r="",n=0,i=a,s=0;continue}e&&(r.length>0?r+="/..":r="..",n=2)}else r.length>0?r+=`/${t.slice(i+1,a)}`:r=t.slice(i+1,a),n=a-i-1;i=a,s=0}else 46===o&&-1!==s?++s:s=-1}return r}(t,!1),t.length>0&&n&&(t+="/"),r?`/${t}`:e+t},isAbsolute(t){return Ke(t),t=this.toPosix(t),!!this.hasProtocol(t)||t.startsWith("/")},join(...t){var e;if(0===t.length)return".";let r;for(let n=0;n<t.length;++n){const i=t[n];if(Ke(i),i.length>0)if(void 0===r)r=i;else{const s=null!=(e=t[n-1])?e:"";this.joinExtensions.includes(this.extname(s).toLowerCase())?r+=`/../${i}`:r+=`/${i}`}}return void 0===r?".":this.normalize(r)},dirname(t){if(Ke(t),0===t.length)return".";let e=(t=this.toPosix(t)).charCodeAt(0);const r=47===e;let n=-1,i=!0;const s=this.getProtocol(t),o=t;for(let r=(t=t.slice(s.length)).length-1;r>=1;--r)if(e=t.charCodeAt(r),47===e){if(!i){n=r;break}}else i=!1;return-1===n?r?"/":this.isUrl(o)?s+t:s:r&&1===n?"//":s+t.slice(0,n)},rootname(t){Ke(t);let e="";if(e=(t=this.toPosix(t)).startsWith("/")?"/":this.getProtocol(t),this.isUrl(t)){const r=t.indexOf("/",e.length);e=-1!==r?t.slice(0,r):t,e.endsWith("/")||(e+="/")}return e},basename(t,e){Ke(t),e&&Ke(e),t=Ye(this.toPosix(t));let r,n=0,i=-1,s=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";let o=e.length-1,a=-1;for(r=t.length-1;r>=0;--r){const l=t.charCodeAt(r);if(47===l){if(!s){n=r+1;break}}else-1===a&&(s=!1,a=r+1),o>=0&&(l===e.charCodeAt(o)?-1==--o&&(i=r):(o=-1,i=a))}return n===i?i=a:-1===i&&(i=t.length),t.slice(n,i)}for(r=t.length-1;r>=0;--r)if(47===t.charCodeAt(r)){if(!s){n=r+1;break}}else-1===i&&(s=!1,i=r+1);return-1===i?"":t.slice(n,i)},extname(t){Ke(t);let e=-1,r=0,n=-1,i=!0,s=0;for(let o=(t=Ye(this.toPosix(t))).length-1;o>=0;--o){const a=t.charCodeAt(o);if(47!==a)-1===n&&(i=!1,n=o+1),46===a?-1===e?e=o:1!==s&&(s=1):-1!==e&&(s=-1);else if(!i){r=o+1;break}}return-1===e||-1===n||0===s||1===s&&e===n-1&&e===r+1?"":t.slice(e,n)},parse(t){Ke(t);const e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;let r=(t=Ye(this.toPosix(t))).charCodeAt(0);const n=this.isAbsolute(t);let i;e.root=this.rootname(t),i=n||this.hasProtocol(t)?1:0;let s=-1,o=0,a=-1,l=!0,_=t.length-1,u=0;for(;_>=i;--_)if(r=t.charCodeAt(_),47!==r)-1===a&&(l=!1,a=_+1),46===r?-1===s?s=_:1!==u&&(u=1):-1!==s&&(u=-1);else if(!l){o=_+1;break}return-1===s||-1===a||0===u||1===u&&s===a-1&&s===o+1?-1!==a&&(e.base=e.name=0===o&&n?t.slice(1,a):t.slice(o,a)):(0===o&&n?(e.name=t.slice(1,s),e.base=t.slice(1,a)):(e.name=t.slice(o,s),e.base=t.slice(o,a)),e.ext=t.slice(s,a)),e.dir=this.dirname(t),e},sep:"/",delimiter:":",joinExtensions:[".html"]},$e=(t,e,r=!1)=>(Array.isArray(t)||(t=[t]),e?t.map((t=>"string"==typeof t||r?e(t):t)):t);function qe(t,e,r,n,i){const s=e[r];for(let o=0;o<s.length;o++){const a=s[o];r<e.length-1?qe(t.replace(n[r],a),e,r+1,n,i):i.push(t.replace(n[r],a))}}function Ze(t){const e=t.match(/\{(.*?)\}/g),r=[];if(e){const n=[];e.forEach((t=>{const e=t.substring(1,t.length-1).split(",");n.push(e)})),qe(t,n,0,e,r)}else r.push(t);return r}const Je=t=>!Array.isArray(t);var tr=Object.defineProperty,er=Object.defineProperties,rr=Object.getOwnPropertyDescriptors,nr=Object.getOwnPropertySymbols,ir=Object.prototype.hasOwnProperty,sr=Object.prototype.propertyIsEnumerable,or=(t,e,r)=>e in t?tr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ar=(t,e)=>{for(var r in e||(e={}))ir.call(e,r)&&or(t,r,e[r]);if(nr)for(var r of nr(e))sr.call(e,r)&&or(t,r,e[r]);return t};class lr{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,r,n;if(this._bundleIdConnector=null!=(e=t.connector)?e:this._bundleIdConnector,this._createBundleAssetId=null!=(r=t.createBundleAssetId)?r:this._createBundleAssetId,this._extractAssetIdFromBundle=null!=(n=t.extractAssetIdFromBundle)?n:this._extractAssetIdFromBundle,"bar"!==this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar")))throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach((t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.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("string"==typeof t)this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&")}}getAlias(t){const{alias:e,src:r}=t;return $e(e||r,(t=>"string"==typeof t?t:Array.isArray(t)?t.map((t=>{var e;return null!=(e=null==t?void 0:t.src)?e:t})):null!=t&&t.src?t.src:t),!0)}addManifest(t){this._manifest,this._manifest=t,t.bundles.forEach((t=>{this.addBundle(t.name,t.assets)}))}addBundle(t,e){const r=[];let n=e;Array.isArray(e)||(n=Object.entries(e).map((([t,e])=>"string"==typeof e||Array.isArray(e)?{alias:t,src:e}:ar({alias:t},e)))),n.forEach((e=>{const n=e.src,i=e.alias;let s;if("string"==typeof i){const e=this._createBundleAssetId(t,i);r.push(e),s=[i,e]}else{const e=i.map((e=>this._createBundleAssetId(t,e)));r.push(...e),s=[...i,...e]}this.add(((t,e)=>er(t,rr(e)))(ar({},e),{alias:s,src:n}))})),this._bundles[t]=r}add(t){const e=[];Array.isArray(t)?e.push(...t):e.push(t),$e(e).forEach((t=>{const{src:e}=t;let{data:r,format:n,loadParser:i}=t;const s=$e(e).map((t=>"string"==typeof t?Ze(t):Array.isArray(t)?t:[t])),o=this.getAlias(t),a=[];s.forEach((t=>{t.forEach((t=>{var e,s,l;let _={};if("object"!=typeof t){_.src=t;for(let e=0;e<this._parsers.length;e++){const r=this._parsers[e];if(r.test(t)){_=r.parse(t);break}}}else r=null!=(e=t.data)?e:r,n=null!=(s=t.format)?s:n,i=null!=(l=t.loadParser)?l:i,_=ar(ar({},_),t);if(!o)throw new Error(`[Resolver] alias is undefined for this asset: ${_.src}`);_=this._buildResolvedAsset(_,{aliases:o,data:r,format:n,loadParser:i}),a.push(_)}))})),o.forEach((t=>{this._assetMap[t]=a}))}))}resolveBundle(t){const e=Je(t);t=$e(t);const r={};return t.forEach((t=>{const e=this._bundles[t];if(e){const n=this.resolve(e),i={};for(const e in n){const r=n[e];i[this._extractAssetIdFromBundle(t,e)]=r}r[t]=i}})),e?r[t[0]]:r}resolveUrl(t){const e=this.resolve(t);if("string"!=typeof t){const t={};for(const r in e)t[r]=e[r].src;return t}return e.src}resolve(t){const e=Je(t);t=$e(t);const r={};return t.forEach((t=>{if(!this._resolverHash[t])if(this._assetMap[t]){let e=this._assetMap[t];const r=this._getPreferredOrder(e);null==r||r.priority.forEach((t=>{r.params[t].forEach((r=>{const n=e.filter((e=>!!e[t]&&e[t]===r));n.length&&(e=n)}))})),this._resolverHash[t]=e[0]}else this._resolverHash[t]=this._buildResolvedAsset({alias:[t],src:t},{});r[t]=this._resolverHash[t]})),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const e=t[0],r=this._preferredOrder.find((t=>t.params.format.includes(e.format)));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;return`${t}${/\?/.test(t)?"&":"?"}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){var r,n;const{aliases:i,data:s,loadParser:o,format:a}=e;return(this._basePath||this._rootPath)&&(t.src=Qe.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=null!=(r=null!=i?i:t.alias)?r:[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data=ar(ar({},s||{}),t.data),t.loadParser=null!=o?o:t.loadParser,t.format=null!=(n=null!=a?a:t.format)?n:_r(t.src),t}}function _r(t){return t.split(".").pop().split("?").shift().split("#").shift()}lr.RETINA_PREFIX=/@([0-9\.]+)x/;const ur=(t,e)=>{const r=e.split("?")[1];return r&&(t+=`?${r}`),t},cr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],hr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],dr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],pr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],yr=[],vr=[],fr=Math.sign;!function(){for(let t=0;t<16;t++){const e=[];yr.push(e);for(let r=0;r<16;r++){const n=fr(cr[t]*cr[r]+dr[t]*hr[r]),i=fr(hr[t]*cr[r]+pr[t]*hr[r]),s=fr(cr[t]*dr[r]+dr[t]*pr[r]),o=fr(hr[t]*dr[r]+pr[t]*pr[r]);for(let t=0;t<16;t++)if(cr[t]===n&&hr[t]===i&&dr[t]===s&&pr[t]===o){e.push(t);break}}}for(let t=0;t<16;t++){const e=new st;e.set(cr[t],hr[t],dr[t],pr[t],0,0),vr.push(e)}}();const mr={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:t=>cr[t],uY:t=>hr[t],vX:t=>dr[t],vY:t=>pr[t],inv:t=>8&t?15&t:7&-t,add:(t,e)=>yr[t][e],sub:(t,e)=>yr[t][mr.inv(e)],rotate180:t=>4^t,isVertical:t=>2==(3&t),byDirection:(t,e)=>2*Math.abs(t)<=Math.abs(e)?e>=0?mr.S:mr.N:2*Math.abs(e)<=Math.abs(t)?t>0?mr.E:mr.W:e>0?t>0?mr.SE:mr.SW:t>0?mr.NE:mr.NW,matrixAppendRotationInv:(t,e,r=0,n=0)=>{const i=vr[mr.inv(e)];i.tx=r,i.ty=n,t.append(i)}},gr=()=>{};function xr(t){return t+=0===t?1:0,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1}function br(t){return!(t&t-1||!t)}function Sr(t){const e={};for(const r in t)void 0!==t[r]&&(e[r]=t[r]);return e}var Tr=Object.defineProperty,Pr=Object.getOwnPropertySymbols,Or=Object.prototype.hasOwnProperty,Mr=Object.prototype.propertyIsEnumerable,wr=(t,e,r)=>e in t?Tr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Cr=(t,e)=>{for(var r in e||(e={}))Or.call(e,r)&&wr(t,r,e[r]);if(Pr)for(var r of Pr(e))Mr.call(e,r)&&wr(t,r,e[r]);return t};const Er=Object.create(null);const Ar=class t extends f{constructor(e={}){var r,n,i,s,o,a,l;super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e=Cr(Cr({},t.defaultOptions),e),this.addressMode=e.addressMode,this.addressModeU=null!=(r=e.addressModeU)?r:this.addressModeU,this.addressModeV=null!=(n=e.addressModeV)?n:this.addressModeV,this.addressModeW=null!=(i=e.addressModeW)?i:this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=null!=(s=e.magFilter)?s:this.magFilter,this.minFilter=null!=(o=e.minFilter)?o:this.minFilter,this.mipmapFilter=null!=(a=e.mipmapFilter)?a:this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=null!=(l=e.maxAnisotropy)?l:1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){const t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=function(t){const e=Er[t];return void 0===e&&(Er[t]=ut("resource")),e}(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Ar.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let Rr=Ar;var Ir=Object.defineProperty,Dr=Object.getOwnPropertySymbols,Br=Object.prototype.hasOwnProperty,kr=Object.prototype.propertyIsEnumerable,Ur=(t,e,r)=>e in t?Ir(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Fr=(t,e)=>{for(var r in e||(e={}))Br.call(e,r)&&Ur(t,r,e[r]);if(Dr)for(var r of Dr(e))kr.call(e,r)&&Ur(t,r,e[r]);return t};const Lr=class t extends f{constructor(e={}){var r,n,i;super(),this.options=e,this.uid=ut("textureSource"),this._resourceType="textureSource",this._resourceId=ut("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,e=Fr(Fr({},t.defaultOptions),e),this.label=null!=(r=e.label)?r:"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource&&null!=(n=this.resourceWidth)?n:1,e.height?this.pixelHeight=e.height*this._resolution:this.pixelHeight=this.resource&&null!=(i=this.resourceHeight)?i:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=e.format,this.dimension=e.dimensions,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.alphaMode=e.alphaMode,this.style=new Rr(Sr(e)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){var e,r;this.style!==t&&(null==(e=this._style)||e.off("change",this._onStyleChange,this),this._style=t,null==(r=this._style)||r.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=ut("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,r){r=r||this._resolution,t=t||this.width,e=e||this.height;const n=Math.round(t*r),i=Math.round(e*r);return this.width=n/r,this.height=i/r,this._resolution=r,(this.pixelWidth!==n||this.pixelHeight!==i)&&(this._refreshPOT(),this.pixelWidth=n,this.pixelHeight=i,this.emit("resize",this),this._resourceId=ut("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=br(this.pixelWidth)&&br(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};Lr.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let Gr=Lr;var jr=Object.defineProperty,Nr=Object.defineProperties,zr=Object.getOwnPropertyDescriptors,Wr=Object.getOwnPropertySymbols,Vr=Object.prototype.hasOwnProperty,Hr=Object.prototype.propertyIsEnumerable,Xr=(t,e,r)=>e in t?jr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;class Kr extends Gr{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(Int8Array,r="bgra8unorm")),super(((t,e)=>Nr(t,zr(e)))(((t,e)=>{for(var r in e||(e={}))Vr.call(e,r)&&Xr(t,r,e[r]);if(Wr)for(var r of Wr(e))Hr.call(e,r)&&Xr(t,r,e[r]);return t})({},t),{resource:e,format:r})),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}Kr.extension=c.TextureSource;const Yr=new st;class Qr{constructor(t,e){this.mapCoord=new st,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=void 0===e?t.width<10?0:.5:e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){var e;this.texture!==t&&(null==(e=this._texture)||e.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){void 0===e&&(e=t);const r=this.mapCoord;for(let n=0;n<t.length;n+=2){const i=t[n],s=t[n+1];e[n]=i*r.a+s*r.c+r.tx,e[n+1]=i*r.b+s*r.d+r.ty}return e}update(){const t=this._texture;this._updateID++;const e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);const r=t.orig,n=t.trim;n&&(Yr.set(r.width/n.width,0,0,r.height/n.height,-n.x/n.width,-n.y/n.height),this.mapCoord.append(Yr));const i=t.source,s=this.uClampFrame,o=this.clampMargin/i._resolution,a=this.clampOffset/i._resolution;return s[0]=(t.frame.x+o+a)/i.width,s[1]=(t.frame.y+o+a)/i.height,s[2]=(t.frame.x+t.frame.width-o+a)/i.width,s[3]=(t.frame.y+t.frame.height-o+a)/i.height,this.uClampOffset[0]=this.clampOffset/i.pixelWidth,this.uClampOffset[1]=this.clampOffset/i.pixelHeight,this.isSimple=t.frame.width===i.width&&t.frame.height===i.height&&0===t.rotate,!0}}class $r extends f{constructor({source:t,label:e,frame:r,orig:n,trim:i,defaultAnchor:s,defaultBorders:o,rotate:a,dynamic:l}={}){var _;if(super(),this.uid=ut("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new Ct,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=null!=(_=null==t?void 0:t.source)?_:new Gr,this.noFrame=!r,r)this.frame.copyFrom(r);else{const{width:t,height:e}=this._source;this.frame.width=t,this.frame.height=e}this.orig=n||this.frame,this.trim=i,this.rotate=null!=a?a:0,this.defaultAnchor=s,this.defaultBorders=o,this.destroyed=!1,this.dynamic=l||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new Qr(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:t,frame:e}=this,{width:r,height:n}=this._source,i=e.x/r,s=e.y/n,o=e.width/r,a=e.height/n;let l=this.rotate;if(l){const e=o/2,r=a/2,n=i+e,_=s+r;l=mr.add(l,mr.NW),t.x0=n+e*mr.uX(l),t.y0=_+r*mr.uY(l),l=mr.add(l,2),t.x1=n+e*mr.uX(l),t.y1=_+r*mr.uY(l),l=mr.add(l,2),t.x2=n+e*mr.uX(l),t.y2=_+r*mr.uY(l),l=mr.add(l,2),t.x3=n+e*mr.uX(l),t.y3=_+r*mr.uY(l)}else t.x0=i,t.y0=s,t.x1=i+o,t.y1=s,t.x2=i+o,t.y2=s+a,t.x3=i,t.y3=s+a}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return this._source}}$r.EMPTY=new $r({label:"EMPTY",source:new Gr({label:"EMPTY"})}),$r.EMPTY.destroy=gr,$r.WHITE=new $r({source:new Kr({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),$r.WHITE.destroy=gr;const qr=class t{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof $r?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;const r=parseFloat(e.meta.scale);r?(this.resolution=r,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise((e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=t.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()}))}_processFrames(e){let r=e;const n=t.BATCH_SIZE;for(;r-e<n&&r<this._frameKeys.length;){const t=this._frameKeys[r],e=this._frames[t],n=e.frame;if(n){let r=null,i=null;const s=!1!==e.trimmed&&e.sourceSize?e.sourceSize:e.frame,o=new Ct(0,0,Math.floor(s.w)/this.resolution,Math.floor(s.h)/this.resolution);r=e.rotated?new Ct(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):new Ct(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),!1!==e.trimmed&&e.spriteSourceSize&&(i=new Ct(Math.floor(e.spriteSourceSize.x)/this.resolution,Math.floor(e.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[t]=new $r({source:this.textureSource,frame:r,orig:o,trim:i,rotate:e.rotated?2:0,defaultAnchor:e.anchor,defaultBorders:e.borders,label:t.toString()})}r++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){const n=t[e][r];this.animations[e].push(this.textures[n])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*t.BATCH_SIZE),this._batchIndex++,setTimeout((()=>{this._batchIndex*t.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())}),0)}destroy(t=!1){var e;for(const t in this.textures)this.textures[t].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(null==(e=this._texture)||e.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};qr.BATCH_SIZE=1e3;let Zr=qr;const Jr=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function tn(t,e,r){const n={};if(t.forEach((t=>{n[t]=e})),Object.keys(e.textures).forEach((t=>{n[t]=e.textures[t]})),!r){const r=Qe.dirname(t[0]);e.linkedSheets.forEach(((t,i)=>{const s=tn([`${r}/${e.data.meta.related_multi_packs[i]}`],t,!0);Object.assign(n,s)}))}return n}const en={extension:c.Asset,cache:{test:t=>t instanceof Zr,getCacheableAssets:(t,e)=>tn(t,e,!1)},resolver:{extension:{type:c.ResolveParser,name:"resolveSpritesheet"},test:t=>{const e=t.split("?")[0].split("."),r=e.pop(),n=e.pop();return"json"===r&&Jr.includes(n)},parse:t=>{var e,r;const n=t.split(".");return{resolution:parseFloat(null!=(r=null==(e=lr.RETINA_PREFIX.exec(t))?void 0:e[1])?r:"1"),format:n[n.length-2],src:t}}},loader:{name:"spritesheetLoader",extension:{type:c.LoadParser,priority:We.Normal,name:"spritesheetLoader"},testParse:async(t,e)=>".json"===Qe.extname(e.src).toLowerCase()&&!!t.frames,async parse(t,e,r){var n,i,s;const{texture:o,imageFilename:a}=null!=(n=null==e?void 0:e.data)?n:{};let l,_=Qe.dirname(e.src);if(_&&_.lastIndexOf("/")!==_.length-1&&(_+="/"),o instanceof $r)l=o;else{const n=ur(_+(null!=a?a:t.meta.image),e.src);l=(await r.load([n]))[n]}const u=new Zr(l.source,t);await u.parse();const c=null==(i=null==t?void 0:t.meta)?void 0:i.related_multi_packs;if(Array.isArray(c)){const t=[];for(const n of c){if("string"!=typeof n)continue;let i=_+n;null!=(s=e.data)&&s.ignoreMultiPack||(i=ur(i,e.src),t.push(r.load({src:i,data:{ignoreMultiPack:!0}})))}const n=await Promise.all(t);u.linkedSheets=n,n.forEach((t=>{t.linkedSheets=[u].concat(u.linkedSheets.filter((e=>e!==t)))}))}return u},async unload(t,e,r){await r.unload(t.textureSource._sourceOrigin),t.destroy(!1)}}};function rn(t,e,r,n){const{width:i,height:s}=r.orig,o=r.trim;if(o){const r=o.width,a=o.height;t.minX=o.x-e._x*i-n,t.maxX=t.minX+r,t.minY=o.y-e._y*s-n,t.maxY=t.minY+a}else t.minX=-e._x*i-n,t.maxX=t.minX+i,t.minY=-e._y*s-n,t.maxY=t.minY+s}p.add(en);class nn extends Zt{constructor(){super(...arguments),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=0,this._lastInstructionTick=-1,this._bounds=new At(0,1,0,0),this._boundsDirty=!0}_updateBounds(){}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){const e=this.bounds,{x:r,y:n}=t;return r>=e.minX&&r<=e.maxX&&n>=e.minY&&n<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null}}var sn=Object.defineProperty,on=Object.getOwnPropertySymbols,an=Object.prototype.hasOwnProperty,ln=Object.prototype.propertyIsEnumerable,_n=(t,e,r)=>e in t?sn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;class un extends nn{constructor(t=$r.EMPTY){t instanceof $r&&(t={texture:t});const e=t,{texture:r=$r.EMPTY,anchor:n,roundPixels:i,width:s,height:o}=e,a=((t,e)=>{var r={};for(var n in t)an.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&on)for(var n of on(t))e.indexOf(n)<0&&ln.call(t,n)&&(r[n]=t[n]);return r})(e,["texture","anchor","roundPixels","width","height"]);super(((t,e)=>{for(var r in e||(e={}))an.call(e,r)&&_n(t,r,e[r]);if(on)for(var r of on(e))ln.call(e,r)&&_n(t,r,e[r]);return t})({label:"Sprite"},a)),this.renderPipeId="sprite",this.batched=!0,this._sourceBounds={minX:0,maxX:1,minY:0,maxY:0},this._sourceBoundsDirty=!0,this._anchor=new lt({_onUpdate:()=>{this.onViewUpdate()}}),n?this.anchor=n:r.defaultAnchor&&(this.anchor=r.defaultAnchor),this.texture=r,this.allowChildren=!1,this.roundPixels=null!=i&&i,void 0!==s&&(this.width=s),void 0!==o&&(this.height=o)}static from(t,e=!1){return new un(t instanceof $r?t:$r.from(t,e))}set texture(t){t||(t=$r.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}get sourceBounds(){return this._sourceBoundsDirty&&(this._updateSourceBounds(),this._sourceBoundsDirty=!1),this._sourceBounds}containsPoint(t){const e=this.sourceBounds;return t.x>=e.maxX&&t.x<=e.minX&&t.y>=e.maxY&&t.y<=e.minY}addBounds(t){const e=this._texture.trim?this.sourceBounds:this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}onViewUpdate(){this._sourceBoundsDirty=this._boundsDirty=!0,super.onViewUpdate()}_updateBounds(){rn(this._bounds,this._anchor,this._texture,0)}_updateSourceBounds(){const t=this._anchor,e=this._texture,r=this._sourceBounds,{width:n,height:i}=e.orig;r.maxX=-t._x*n,r.minX=r.maxX+n,r.maxY=-t._y*i,r.minY=r.maxY+i}destroy(t=!1){if(super.destroy(t),"boolean"==typeof t?t:null==t?void 0:t.texture){const e="boolean"==typeof t?t:null==t?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null,this._bounds=null,this._sourceBounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){var r;"object"==typeof t?(e=null!=(r=t.height)?r:t.width,t=t.width):null!=e||(e=t),void 0!==t&&this._setWidth(t,this._texture.orig.width),void 0!==e&&this._setHeight(e,this._texture.orig.height)}}const cn=new At;function hn(t,e,r){const n=cn;t.measurable=!0,Dt(t,r,n),e.addBoundsMask(n),t.measurable=!1}function dn(t,e,r){const n=It.get();t.measurable=!0;const i=Rt.get().identity();Ut(t,n,pn(t,r,i)),t.measurable=!1,e.addBoundsMask(n),Rt.return(i),It.return(n)}function pn(t,e,r){return t&&t!==e&&(pn(t.parent,e,r),t.updateLocalTransform(),r.append(t.localTransform)),r}class yn{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",null!=t&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof un),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){this.inverse||hn(this.mask,t,e)}addLocalBounds(t,e){dn(this.mask,t,e)}containsPoint(t,e){return e(this.mask,t)}destroy(){this.reset()}static test(t){return t instanceof un}}yn.extension=c.MaskEffect;class vn{constructor(t){this.priority=0,this.pipe="colorMask",null!=t&&t.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return"number"==typeof t}}vn.extension=c.MaskEffect;class fn{constructor(t){this.priority=0,this.pipe="stencilMask",null!=t&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){hn(this.mask,t,e)}addLocalBounds(t,e){dn(this.mask,t,e)}containsPoint(t,e){return e(this.mask,t)}destroy(){this.reset()}static test(t){return t instanceof Zt}}fn.extension=c.MaskEffect;class mn extends Gr{constructor(t){t.resource||(t.resource=Xe.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity;const e=t.resource;(this.pixelWidth!==e.width||this.pixelWidth!==e.height)&&this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,r=this._resolution){const n=super.resize(t,e,r);return n&&this.resizeCanvas(),n}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}mn.extension=c.TextureSource;class gn extends Gr{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){const e=Xe.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}}let xn;async function bn(){return null!=xn||(xn=(async()=>{var t;const e=document.createElement("canvas").getContext("webgl");if(!e)return"premultiply-alpha-on-upload";const r=await new Promise((t=>{const e=document.createElement("video");e.onloadeddata=()=>t(e),e.onerror=()=>t(null),e.autoplay=!1,e.crossOrigin="anonymous",e.preload="auto",e.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",e.load()}));if(!r)return"premultiply-alpha-on-upload";const n=e.createTexture();e.bindTexture(e.TEXTURE_2D,n);const i=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,i),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,r);const s=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,s),e.deleteFramebuffer(i),e.deleteTexture(n),null==(t=e.getExtension("WEBGL_lose_context"))||t.loseContext(),s[0]<=s[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),xn}gn.extension=c.TextureSource;var Sn=Object.defineProperty,Tn=Object.defineProperties,Pn=Object.getOwnPropertyDescriptors,On=Object.getOwnPropertySymbols,Mn=Object.prototype.hasOwnProperty,wn=Object.prototype.propertyIsEnumerable,Cn=(t,e,r)=>e in t?Sn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,En=(t,e)=>{for(var r in e||(e={}))Mn.call(e,r)&&Cn(t,r,e[r]);if(On)for(var r of On(e))wn.call(e,r)&&Cn(t,r,e[r]);return t};const An=class t extends Gr{constructor(e){var r;super(e),this.isReady=!1,this.uploadMethodId="video",e=En(En({},t.defaultOptions),e),this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=!1!==e.autoPlay,this.alphaMode=null!=(r=e.alphaMode)?r:"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),!1!==e.autoLoad&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const t=Oe.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;const t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await bn(),this._load=new Promise(((r,n)=>{this.isValid?r(this):(this._resolve=r,this._reject=n,void 0!==e.preloadTimeoutMs&&(this._preloadTimeout=setTimeout((()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))}))),t.load())})),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const t=this.resource;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._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}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.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Oe.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),null===this._videoFrameRequestCallbackHandle&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(null!==this._videoFrameRequestCallbackHandle&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Oe.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(null!==this._videoFrameRequestCallbackHandle&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Oe.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};An.extension=c.TextureSource,An.defaultOptions=((t,e)=>Tn(t,Pn(e)))(En({},Gr.defaultOptions),{autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1}),An.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Rn=An;const In=new 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 r=$e(t);let n;for(let t=0;t<this.parsers.length;t++){const i=this.parsers[t];if(i.test(e)){n=i.getCacheableAssets(r,e);break}}const i=new Map(Object.entries(n||{}));n||r.forEach((t=>{i.set(t,e)}));const s=[...i.keys()],o={cacheKeys:s,keys:r};r.forEach((t=>{this._cacheMap.set(t,o)})),s.forEach((t=>{n&&n[t];this._cache.has(t)&&this._cache.get(t),this._cache.set(t,i.get(t))}))}remove(t){if(!this._cacheMap.has(t))return;const e=this._cacheMap.get(t);e.cacheKeys.forEach((t=>{this._cache.delete(t)})),e.keys.forEach((t=>{this._cacheMap.delete(t)}))}get parsers(){return this._parsers}},Dn=[];function Bn(t={}){const e=t&&t.resource,r=e?t.resource:t,n=e?t:{resource:t};for(let t=0;t<Dn.length;t++){const e=Dn[t];if(e.test(r))return new e(n)}throw new Error(`Could not find a source type for resource: ${n.resource}`)}function kn(t={},e=!1){const r=t&&t.resource,n=r?t.resource:t,i=r?t:{resource:t};if(!e&&In.has(n))return In.get(n);const s=new $r({source:Bn(i)});return s.on("destroy",(()=>{In.has(n)&&In.remove(n)})),e||In.set(n,s),s}function Un(t,e=!1){return"string"==typeof t?In.get(t):t instanceof Gr?new $r({source:t}):kn(t,e)}p.handleByList(c.TextureSource,Dn),$r.from=Un,Gr.from=Bn,p.add(yn,vn,fn,Rn,gn,mn,Kr);class Fn{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const r in t){const n=t[r];this.setResource(n,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|")}setResource(t,e){var r,n;const i=this.resources[e];t!==i&&(i&&(null==(r=t.off)||r.call(t,"change",this.onResourceChange,this)),null==(n=t.on)||n.call(t,"change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){const e=this.resources;for(const r in e)e[r]._touched=t}destroy(){var t;const e=this.resources;for(const r in e){const n=e[r];null==(t=n.off)||t.call(n,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){const e=this.resources;for(const r in e)e[r]===t&&(e[r]=null)}else this._updateKey()}}let Ln;function Gn(){return(!Ln||null!=Ln&&Ln.isContextLost())&&(Ln=Xe.get().createCanvas().getContext("webgl",{})),Ln}const jn=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join("\n\t");function Nn(t){let e="";for(let r=0;r<t;++r)r>0&&(e+="\n\telse "),r<t-1&&(e+=`if(test == ${r}.0){}`);return e}function zn(t,e){if(0===t)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const r=e.createShader(e.FRAGMENT_SHADER);try{for(;;){const n=jn.replace(/%forloop%/gi,Nn(t));if(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS))break;t=t/2|0}}finally{e.deleteShader(r)}return t}let Wn=null;function Vn(){var t;if(Wn)return Wn;const e=Gn();return Wn=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),Wn=zn(Wn,e),null==(t=e.getExtension("WEBGL_lose_context"))||t.loseContext(),Wn}const Hn={};function Xn(t,e){let r=2166136261;for(let n=0;n<e;n++)r^=t[n].uid,r=Math.imul(r,16777619),r>>>=0;return Hn[r]||function(t,e,r){const n={};let i=0;Kn||(Kn=Vn());for(let r=0;r<Kn;r++){const s=r<e?t[r]:$r.EMPTY.source;n[i++]=s.source,n[i++]=s.style}const s=new Fn(n);return Hn[r]=s,s}(t,e,r)}let Kn=0;class Yn{constructor(t){"number"==typeof t?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),this.size=this.rawBinaryData.byteLength}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 int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}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`)}}}function Qn(t,e){const r=t.byteLength/8|0,n=new Float64Array(t,0,r);new Float64Array(e,0,r).set(n);const i=t.byteLength-8*r;if(i>0){const n=new Uint8Array(t,8*r,i);new Uint8Array(e,8*r,i).set(n)}}const $n={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var qn=(t=>(t[t.DISABLED=0]="DISABLED",t[t.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",t[t.MASK_ACTIVE=2]="MASK_ACTIVE",t[t.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",t[t.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",t[t.NONE=5]="NONE",t))(qn||{});function Zn(t,e){return"no-premultiply-alpha"===e.alphaMode&&$n[t]||t}class Jn{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){const e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}var ti=Object.defineProperty,ei=Object.getOwnPropertySymbols,ri=Object.prototype.hasOwnProperty,ni=Object.prototype.propertyIsEnumerable,ii=(t,e,r)=>e in t?ti(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,si=(t,e)=>{for(var r in e||(e={}))ri.call(e,r)&&ii(t,r,e[r]);if(ei)for(var r of ei(e))ni.call(e,r)&&ii(t,r,e[r]);return t};class oi{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Jn,this.blendMode="normal",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}}const ai=[];let li=0;function _i(){return li>0?ai[--li]:new oi}function ui(t){ai[li++]=t}let ci=0;const hi=class t{constructor(e={}){var r;this.uid=ut("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],t.defaultOptions.maxTextures=null!=(r=t.defaultOptions.maxTextures)?r:Vn(),e=si(si({},t.defaultOptions),e);const{maxTextures:n,attributesInitialSize:i,indicesInitialSize:s}=e;this.attributeBuffer=new Yn(4*i),this.indexBuffer=new Uint16Array(s),this.maxTextures=n}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)ui(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){const r=t._batch.textures.ids[e._source.uid];return!(!r&&0!==r)&&(t._textureId=r,t.texture=e,!0)}updateElement(t){this.dirty=!0;const e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){const e=this._elements;if(!e[this.elementStart])return;let r=_i(),n=r.textures;n.clear();const i=e[this.elementStart];let s=Zn(i.blendMode,i.texture._source);4*this.attributeSize>this.attributeBuffer.size&&this._resizeAttributeBuffer(4*this.attributeSize),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const o=this.attributeBuffer.float32View,a=this.attributeBuffer.uint32View,l=this.indexBuffer;let _=this._batchIndexSize,u=this._batchIndexStart,c="startBatch";const h=this.maxTextures;for(let i=this.elementStart;i<this.elementSize;++i){const d=e[i];e[i]=null;const p=d.texture._source,y=Zn(d.blendMode,p),v=s!==y;p._batchTick!==ci||v?(p._batchTick=ci,(n.count>=h||v)&&(this._finishBatch(r,u,_-u,n,s,t,c),c="renderBatch",u=_,s=y,r=_i(),n=r.textures,n.clear(),++ci),d._textureId=p._textureBindLocation=n.count,n.ids[p.uid]=n.count,n.textures[n.count++]=p,d._batch=r,_+=d.indexSize,d.packAsQuad?(this.packQuadAttributes(d,o,a,d._attributeStart,d._textureId),this.packQuadIndex(l,d._indexStart,d._attributeStart/this.vertexSize)):(this.packAttributes(d,o,a,d._attributeStart,d._textureId),this.packIndex(d,l,d._indexStart,d._attributeStart/this.vertexSize))):(d._textureId=p._textureBindLocation,_+=d.indexSize,d.packAsQuad?(this.packQuadAttributes(d,o,a,d._attributeStart,d._textureId),this.packQuadIndex(l,d._indexStart,d._attributeStart/this.vertexSize)):(this.packAttributes(d,o,a,d._attributeStart,d._textureId),this.packIndex(d,l,d._indexStart,d._attributeStart/this.vertexSize)),d._batch=r)}n.count>0&&(this._finishBatch(r,u,_-u,n,s,t,c),u=_,++ci),this.elementStart=this.elementSize,this._batchIndexStart=u,this._batchIndexSize=_}_finishBatch(t,e,r,n,i,s,o){t.gpuBindGroup=null,t.bindGroup=null,t.action=o,t.batcher=this,t.textures=n,t.blendMode=i,t.start=e,t.size=r,++ci,this.batches[this.batchIndex++]=t,s.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){4*t<=this.attributeBuffer.size||this._resizeAttributeBuffer(4*t)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){const e=Math.max(t,2*this.attributeBuffer.size),r=new Yn(e);Qn(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(t){const e=this.indexBuffer;let r=Math.max(t,1.5*e.length);r+=r%2;const n=r>65535?new Uint32Array(r):new Uint16Array(r);if(n.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let t=0;t<e.length;t++)n[t]=e[t];else Qn(e.buffer,n.buffer);this.indexBuffer=n}packQuadIndex(t,e,r){t[e]=r+0,t[e+1]=r+1,t[e+2]=r+2,t[e+3]=r+0,t[e+4]=r+2,t[e+5]=r+3}packIndex(t,e,r,n){const i=t.indices,s=t.indexSize,o=t.indexOffset,a=t.attributeOffset;for(let t=0;t<s;t++)e[r++]=n+i[t+o]-a}destroy(){for(let t=0;t<this.batches.length;t++)ui(this.batches[t]);this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}};hi.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let di=hi;var pi=(t=>(t[t.MAP_READ=1]="MAP_READ",t[t.MAP_WRITE=2]="MAP_WRITE",t[t.COPY_SRC=4]="COPY_SRC",t[t.COPY_DST=8]="COPY_DST",t[t.INDEX=16]="INDEX",t[t.VERTEX=32]="VERTEX",t[t.UNIFORM=64]="UNIFORM",t[t.STORAGE=128]="STORAGE",t[t.INDIRECT=256]="INDIRECT",t[t.QUERY_RESOLVE=512]="QUERY_RESOLVE",t[t.STATIC=1024]="STATIC",t))(pi||{});class yi extends f{constructor(t){let{data:e,size:r}=t;const{usage:n,label:i,shrinkToFit:s}=t;super(),this.uid=ut("buffer"),this._resourceType="buffer",this._resourceId=ut("resource"),this._touched=0,this._updateID=1,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,r=null!=r?r:null==e?void 0:e.byteLength;const o=!!e;this.descriptor={size:r,usage:n,mappedAtCreation:o,label:i},this.shrinkToFit=null==s||s}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get static(){return!!(this.descriptor.usage&pi.STATIC)}set static(t){t?this.descriptor.usage|=pi.STATIC:this.descriptor.usage&=~pi.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t)return void(r&&this.emit("update",this));const n=this._data;this._data=t,n.length===t.length||!this.shrinkToFit&&t.byteLength<n.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=ut("resource"),this.emit("change",this))}update(t){this._updateSize=null!=t?t:this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}function vi(t,e){if(!(t instanceof yi)){let r=e?pi.INDEX:pi.VERTEX;t instanceof Array&&(e?(t=new Uint32Array(t),r=pi.INDEX|pi.COPY_DST):(t=new Float32Array(t),r=pi.VERTEX|pi.COPY_DST)),t=new yi({data:t,label:e?"index-mesh-buffer":"vertex-mesh-buffer",usage:r})}return t}function fi(t,e,r){const n=t.getAttribute(e);if(!n)return r.minX=0,r.minY=0,r.maxX=0,r.maxY=0,r;const i=n.buffer.data;let s=1/0,o=1/0,a=-1/0,l=-1/0;const _=i.BYTES_PER_ELEMENT,u=(n.offset||0)/_,c=(n.stride||8)/_;for(let t=u;t<i.length;t+=c){const e=i[t],r=i[t+1];e>a&&(a=e),r>l&&(l=r),e<s&&(s=e),r<o&&(o=r)}return r.minX=s,r.minY=o,r.maxX=a,r.maxY=l,r}class mi extends f{constructor(t={}){super(),this.uid=ut("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new At,this._boundsDirty=!0;const{attributes:e,indexBuffer:r,topology:n}=t;if(this.buffers=[],this.attributes={},e)for(const t in e)this.addAttribute(t,e[t]);this.instanceCount=t.instanceCount||1,r&&this.addIndex(r),this.topology=n||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(const t in this.attributes){const e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){const r=function(t){return(t instanceof yi||Array.isArray(t)||t.BYTES_PER_ELEMENT)&&(t={buffer:t}),t.buffer=vi(t.buffer,!1),t}(e);-1===this.buffers.indexOf(r.buffer)&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r}addIndex(t){this.indexBuffer=vi(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,fi(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach((t=>t.destroy())),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const gi=new Float32Array(1),xi=new Uint32Array(1);class bi extends mi{constructor(){const t=new yi({data:gi,label:"attribute-batch-buffer",usage:pi.VERTEX|pi.COPY_DST,shrinkToFit:!1});super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:24,offset:0},aUV:{buffer:t,format:"float32x2",stride:24,offset:8},aColor:{buffer:t,format:"unorm8x4",stride:24,offset:16},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:24,offset:20}},indexBuffer:new yi({data:xi,label:"index-batch-buffer",usage:pi.INDEX|pi.COPY_DST,shrinkToFit:!1})})}}const Si=Object.create(null),Ti=Object.create(null);function Pi(t,e){let r=Ti[t];return void 0===r&&(void 0===Si[e]&&(Si[e]=1),Ti[t]=r=Si[e]++),r}let Oi;function Mi(){if(!Oi){Oi="mediump";const t=Gn();t&&t.getShaderPrecisionFormat&&(Oi=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision?"highp":"mediump")}return Oi}function wi(t,e,r){return e?t:r?`\n\t\t\t\n\t\t\t#ifdef GL_ES // This checks if it is WebGL1\n\t\t\t#define in varying\n\t\t\t#define finalColor gl_FragColor\n\t\t\t#define texture texture2D\n\t\t\t#endif\n\t\t\t${t=t.replace("out vec4 finalColor;","")}\n\t\t\t`:`\n\t\t\t\n\t\t\t#ifdef GL_ES // This checks if it is WebGL1\n\t\t\t#define in attribute\n\t\t\t#define out varying\n\t\t\t#endif\n\t\t\t${t}\n\t\t\t`}function Ci(t,e,r){const n=r?e.maxSupportedFragmentPrecision:e.maxSupportedVertexPrecision;if("precision"!==t.substring(0,9)){let i=r?e.requestedFragmentPrecision:e.requestedVertexPrecision;return"highp"===i&&"highp"!==n&&(i="mediump"),`precision ${i} float;\n\t${t}`}return"highp"!==n&&"precision highp"===t.substring(0,15)?t.replace("precision highp","precision mediump"):t}function Ei(t,e){return e?`#version 300 es\n\t${t}`:t}const Ai={},Ri={};function Ii(t,{name:e="pixi-program"},r=!0){e=e.replace(/\s+/g,"-");const n=r?Ai:Ri;return n[e+=r?"-fragment":"-vertex"]?(n[e]++,e+=`-${n[e]}`):n[e]=1,-1!==t.indexOf("#define SHADER_NAME")?t:`#define SHADER_NAME ${e}\n\t${t}`}function Di(t,e){return e?t.replace("#version 300 es",""):t}var Bi=Object.defineProperty,ki=Object.getOwnPropertySymbols,Ui=Object.prototype.hasOwnProperty,Fi=Object.prototype.propertyIsEnumerable,Li=(t,e,r)=>e in t?Bi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Gi=(t,e)=>{for(var r in e||(e={}))Ui.call(e,r)&&Li(t,r,e[r]);if(ki)for(var r of ki(e))Fi.call(e,r)&&Li(t,r,e[r]);return t};const ji={stripVersion:Di,ensurePrecision:Ci,addProgramDefines:wi,setProgramName:Ii,insertVersion:Ei},Ni=Object.create(null),zi=class t{constructor(e){const r=-1!==(e=Gi(Gi({},t.defaultOptions),e)).fragment.indexOf("#version 300 es"),n={stripVersion:r,ensurePrecision:{requestedFragmentPrecision:e.preferredFragmentPrecision,requestedVertexPrecision:e.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Mi()},setProgramName:{name:e.name},addProgramDefines:r,insertVersion:r};let i=e.fragment,s=e.vertex;Object.keys(ji).forEach((t=>{const e=n[t];i=ji[t](i,e,!0),s=ji[t](s,e,!1)})),this.fragment=i,this.vertex=s,this._key=Pi(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null}static from(e){const r=`${e.vertex}:${e.fragment}`;return Ni[r]||(Ni[r]=new t(e)),Ni[r]}};zi.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let Wi=zi;const Vi={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}};function Hi(t){var e;return null!=(e=Vi[t])?e:Vi.float32}const Xi={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"};function Ki({source:t,entryPoint:e}){var r;const n={},i=t.indexOf(`fn ${e}`);if(-1!==i){const e=t.indexOf("->",i);if(-1!==e){const s=t.substring(i,e),o=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g;let a;for(;null!==(a=o.exec(s));){const t=null!=(r=Xi[a[3]])?r:"float32";n[a[2]]={location:parseInt(a[1],10),format:t,stride:Hi(t).stride,offset:0,instance:!1,start:0}}}}return n}function Yi(t){var e,r,n;const i=/@group\((\d+)\)/,s=/@binding\((\d+)\)/,o=/var(<[^>]+>)? (\w+)/,a=/:\s*(\w+)/,l=/(\w+)\s*:\s*([\w\<\>]+)/g,_=/struct\s+(\w+)/,u=null==(e=t.match(/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g))?void 0:e.map((t=>({group:parseInt(t.match(i)[1],10),binding:parseInt(t.match(s)[1],10),name:t.match(o)[2],isUniform:"<uniform>"===t.match(o)[1],type:t.match(a)[1]})));if(!u)return{groups:[],structs:[]};const c=null!=(n=null==(r=t.match(/struct\s+(\w+)\s*{([^}]+)}/g))?void 0:r.map((t=>{const e=t.match(_)[1],r=t.match(l).reduce(((t,e)=>{const[r,n]=e.split(":");return t[r.trim()]=n.trim(),t}),{});return r?{name:e,members:r}:null})).filter((({name:t})=>u.some((e=>e.type===t)))))?n:[];return{groups:u,structs:c}}var Qi=(t=>(t[t.VERTEX=1]="VERTEX",t[t.FRAGMENT=2]="FRAGMENT",t[t.COMPUTE=4]="COMPUTE",t))(Qi||{});function $i({groups:t}){const e=[];for(let r=0;r<t.length;r++){const n=t[r];e[n.group]||(e[n.group]=[]),n.isUniform?e[n.group].push({binding:n.binding,visibility:Qi.VERTEX|Qi.FRAGMENT,buffer:{type:"uniform"}}):"sampler"===n.type?e[n.group].push({binding:n.binding,visibility:Qi.FRAGMENT,sampler:{type:"filtering"}}):"texture_2d"===n.type&&e[n.group].push({binding:n.binding,visibility:Qi.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return e}function qi({groups:t}){const e=[];for(let r=0;r<t.length;r++){const n=t[r];e[n.group]||(e[n.group]={}),e[n.group][n.name]=n.binding}return e}function Zi(t,e){const r=new Set,n=new Set;return{structs:[...t.structs,...e.structs].filter((t=>!r.has(t.name)&&(r.add(t.name),!0))),groups:[...t.groups,...e.groups].filter((t=>{const e=`${t.name}-${t.binding}`;return!n.has(e)&&(n.add(e),!0)}))}}const Ji=Object.create(null);class ts{constructor(t){var e,r;this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:n,vertex:i,layout:s,gpuLayout:o,name:a}=t;if(this.name=a,this.fragment=n,this.vertex=i,n.source===i.source){const t=Yi(n.source);this.structsAndGroups=t}else{const t=Yi(i.source),e=Yi(n.source);this.structsAndGroups=Zi(t,e)}this.layout=null!=s?s:qi(this.structsAndGroups),this.gpuLayout=null!=o?o:$i(this.structsAndGroups),this.autoAssignGlobalUniforms=void 0!==(null==(e=this.layout[0])?void 0:e.globalUniforms),this.autoAssignLocalUniforms=void 0!==(null==(r=this.layout[1])?void 0:r.localUniforms),this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,r=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=Pi(r,"program")}get attributeData(){return null!=this._attributeData||(this._attributeData=Ki(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return Ji[e]||(Ji[e]=new ts(t)),Ji[e]}}function es(t,e,r){if(t)for(const n in t){const i=e[n.toLocaleLowerCase()];if(i){let e=t[n];"header"===n&&(e=e.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),r&&i.push(`//----${r}----//`),i.push(e)}}}const rs=/\{\{(.*?)\}\}/g;function ns(t){var e,r;const n={};return(null!=(r=null==(e=t.match(rs))?void 0:e.map((t=>t.replace(/[{()}]/g,""))))?r:[]).forEach((t=>{n[t]=[]})),n}function is(t,e){let r;const n=/@in\s+([^;]+);/g;for(;null!==(r=n.exec(t));)e.push(r[1])}function ss(t,e,r=!1){const n=[];is(e,n),t.forEach((t=>{t.header&&is(t.header,n)}));const i=n;r&&i.sort();const s=i.map(((t,e)=>` @location(${e}) ${t},`)).join("\n\t");let o=e.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",`\n\t${s}\n\t`),o}function os(t,e){let r;const n=/@out\s+([^;]+);/g;for(;null!==(r=n.exec(t));)e.push(r[1])}function as(t,e){const r=[];os(e,r),t.forEach((t=>{t.header&&os(t.header,r)}));let n=0;const i=r.sort().map((t=>t.indexOf("builtin")>-1?t:`@location(${n++}) ${t}`)).join(",\n\t"),s=r.sort().map((t=>` var ${function(t){return t.replace(/@.*?\s+/g,"")}(t)};`)).join("\n\t"),o=`return VSOutput(\n\t\t\t\t\t${r.sort().map((t=>` ${function(t){const e=/\b(\w+)\s*:/g.exec(t);return e?e[1]:""}(t)}`)).join(",\n\t")});`;let a=e.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`\n\t${i}\n\t`),a=a.replace("{{start}}",`\n\t${s}\n\t`),a=a.replace("{{return}}",`\n\t${o}\n\t`),a}function ls(t,e){let r=t;for(const t in e){const n=e[t];r=n.join("\n\t").length?r.replace(`{{${t}}}`,`//-----${t} START-----//\n\t${n.join("\n\t")}\n\t//----${t} FINISH----//`):r.replace(`{{${t}}}`,"")}return r}const _s=Object.create(null),us=new Map;let cs=0;function hs({template:t,bits:e}){const r=ps(t,e);if(_s[r])return _s[r];const{vertex:n,fragment:i}=function(t,e){const r=e.map((t=>t.vertex)).filter((t=>!!t)),n=e.map((t=>t.fragment)).filter((t=>!!t));let i=ss(r,t.vertex,!0);i=as(r,i);const s=ss(n,t.fragment,!0);return{vertex:i,fragment:s}}(t,e);return _s[r]=ys(n,i,e),_s[r]}function ds({template:t,bits:e}){const r=ps(t,e);return _s[r]||(_s[r]=ys(t.vertex,t.fragment,e)),_s[r]}function ps(t,e){return e.map((t=>(us.has(t)||us.set(t,cs++),us.get(t)))).sort(((t,e)=>t-e)).join("-")+t.vertex+t.fragment}function ys(t,e,r){const n=ns(t),i=ns(e);return r.forEach((t=>{es(t.vertex,n,t.name),es(t.fragment,i,t.name)})),{vertex:ls(t,n),fragment:ls(e,i)}}const vs="\n\t\t@in aPosition: vec2<f32>;\n\t\t@in aUV: vec2<f32>;\n\t\n\t\t@out @builtin(position) vPosition: vec4<f32>;\n\t\t@out vUV : vec2<f32>;\n\t\t@out vColor : vec4<f32>;\n\t\n\t\t{{header}}\n\t\n\t\tstruct VSOutput {\n\t\t\t{{struct}}\n\t\t};\n\t\n\t\t@vertex\n\t\tfn main( {{in}} ) -> VSOutput {\n\t\n\t\t\tvar worldTransformMatrix = globalUniforms.uWorldTransformMatrix;\n\t\t\tvar modelMatrix = mat3x3<f32>(\n\t\t\t\t1.0, 0.0, 0.0,\n\t\t\t\t0.0, 1.0, 0.0,\n\t\t\t\t0.0, 0.0, 1.0\n\t\t\t );\n\t\t\tvar position = aPosition;\n\t\t\tvar uv = aUV;\n\t\n\t\t\t{{start}}\n\t\t\t\n\t\t\tvColor = vec4<f32>(1., 1., 1., 1.);\n\t\n\t\t\t{{main}}\n\t\n\t\t\tvUV = uv;\n\t\n\t\t\tvar modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;\n\t\n\t\t\tvPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);\n\t\t \n\t\t\tvColor *= globalUniforms.uWorldColorAlpha;\n\t\n\t\t\t{{end}}\n\t\n\t\t\t{{return}}\n\t\t};\n\t",fs="\n\t\t@in vUV : vec2<f32>;\n\t\t@in vColor : vec4<f32>;\n\t \n\t\t{{header}}\n\t\n\t\t@fragment\n\t\tfn main(\n\t\t\t{{in}}\n\t\t ) -> @location(0) vec4<f32> {\n\t\t\t\n\t\t\t{{start}}\n\t\n\t\t\tvar outColor:vec4<f32>;\n\t\t \n\t\t\t{{main}}\n\t\t\t\n\t\t\tvar finalColor:vec4<f32> = outColor * vColor;\n\t\n\t\t\t{{end}}\n\t\n\t\t\treturn finalColor;\n\t\t };\n\t",ms="\n\t\tin vec2 aPosition;\n\t\tin vec2 aUV;\n\t\n\t\tout vec4 vColor;\n\t\tout vec2 vUV;\n\t\n\t\t{{header}}\n\t\n\t\tvoid main(void){\n\t\n\t\t\tmat3 worldTransformMatrix = uWorldTransformMatrix;\n\t\t\tmat3 modelMatrix = mat3(\n\t\t\t\t1.0, 0.0, 0.0,\n\t\t\t\t0.0, 1.0, 0.0,\n\t\t\t\t0.0, 0.0, 1.0\n\t\t\t );\n\t\t\tvec2 position = aPosition;\n\t\t\tvec2 uv = aUV;\n\t\t\t\n\t\t\t{{start}}\n\t\t\t\n\t\t\tvColor = vec4(1.);\n\t\t\t\n\t\t\t{{main}}\n\t\t\t\n\t\t\tvUV = uv;\n\t\t\t\n\t\t\tmat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;\n\t\n\t\t\tgl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n\t\n\t\t\tvColor *= uWorldColorAlpha;\n\t\n\t\t\t{{end}}\n\t\t}\n\t",gs="\n\t \n\t\tin vec4 vColor;\n\t\tin vec2 vUV;\n\t\n\t\tout vec4 finalColor;\n\t\n\t\t{{header}}\n\t\n\t\tvoid main(void) {\n\t\t\t\n\t\t\t{{start}}\n\t\n\t\t\tvec4 outColor;\n\t\t \n\t\t\t{{main}}\n\t\t\t\n\t\t\tfinalColor = outColor * vColor;\n\t\t\t\n\t\t\t{{end}}\n\t\t}\n\t",xs={name:"global-uniforms-bit",vertex:{header:"\n\t\t\tstruct GlobalUniforms {\n\t\t\t\tuProjectionMatrix:mat3x3<f32>,\n\t\t\t\tuWorldTransformMatrix:mat3x3<f32>,\n\t\t\t\tuWorldColorAlpha: vec4<f32>,\n\t\t\t\tuResolution: vec2<f32>,\n\t\t\t}\n\t\n\t\t\t@group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;\n\t\t\t"}},bs={name:"global-uniforms-ubo-bit",vertex:{header:"\n\t\t\t uniform globalUniforms {\n\t\t\t\tmat3 uProjectionMatrix;\n\t\t\t\tmat3 uWorldTransformMatrix;\n\t\t\t\tvec4 uWorldColorAlpha;\n\t\t\t\tvec2 uResolution;\n\t\t\t };\n\t\t\t"}},Ss={name:"global-uniforms-bit",vertex:{header:"\n\t\t\t uniform mat3 uProjectionMatrix;\n\t\t\t uniform mat3 uWorldTransformMatrix;\n\t\t\t uniform vec4 uWorldColorAlpha;\n\t\t\t uniform vec2 uResolution;\n\t\t\t"}};var Ts=Object.defineProperty,Ps=Object.getOwnPropertySymbols,Os=Object.prototype.hasOwnProperty,Ms=Object.prototype.propertyIsEnumerable,ws=(t,e,r)=>e in t?Ts(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;function Cs({bits:t,name:e}){const r=hs({template:{fragment:fs,vertex:vs},bits:[xs,...t]});return ts.from({name:e,vertex:{source:r.vertex,entryPoint:"main"},fragment:{source:r.fragment,entryPoint:"main"}})}function Es({bits:t,name:e}){return new Wi(((t,e)=>{for(var r in e||(e={}))Os.call(e,r)&&ws(t,r,e[r]);if(Ps)for(var r of Ps(e))Ms.call(e,r)&&ws(t,r,e[r]);return t})({name:e},ds({template:{vertex:ms,fragment:gs},bits:[Ss,...t]})))}const As={name:"color-bit",vertex:{header:"\n\t\t\t\t@in aColor: vec4<f32>;\n\t\t\t",main:"\n\t\t\t\tvColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);\n\t\t\t"}},Rs={name:"color-bit",vertex:{header:"\n\t\t\t\tin vec4 aColor;\n\t\t\t",main:"\n\t\t\t\tvColor *= vec4(aColor.rgb * aColor.a, aColor.a);\n\t\t\t"}},Is={};function Ds(t){const e=[];if(1===t)e.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),e.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let r=0;for(let n=0;n<t;n++)e.push(`@group(1) @binding(${r++}) var textureSource${n+1}: texture_2d<f32>;`),e.push(`@group(1) @binding(${r++}) var textureSampler${n+1}: sampler;`)}return e.join("\n\t")}function Bs(t){const e=[];if(1===t)e.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{e.push("switch vTextureId {");for(let r=0;r<t;r++)r===t-1?e.push(" default:{"):e.push(` case ${r}:{`),e.push(` outColor = textureSampleGrad(textureSource${r+1}, textureSampler${r+1}, vUV, uvDx, uvDy);`),e.push(" break;}");e.push("}")}return e.join("\n\t")}function ks(t){return Is[t]||(Is[t]={name:"texture-batch-bit",vertex:{header:"\n\t\t\t\t\t@in aTextureIdAndRound: vec2<u32>;\n\t\t\t\t\t@out @interpolate(flat) vTextureId : u32;\n\t\t\t\t",main:"\n\t\t\t\t\tvTextureId = aTextureIdAndRound.y;\n\t\t\t\t",end:"\n\t\t\t\t\tif(aTextureIdAndRound.x == 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tvPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);\n\t\t\t\t\t}\n\t\t\t\t"},fragment:{header:`\n\t\t\t\t\t@in @interpolate(flat) vTextureId: u32;\n\t\n\t\t\t\t\t${Ds(t)}\n\t\t\t\t`,main:`\n\t\t\t\t\tvar uvDx = dpdx(vUV);\n\t\t\t\t\tvar uvDy = dpdy(vUV);\n\t\n\t\t\t\t\t${Bs(t)}\n\t\t\t\t`}}),Is[t]}const Us={};function Fs(t){const e=[];for(let r=0;r<t;r++)r>0&&e.push("else"),r<t-1&&e.push(`if(vTextureId < ${r}.5)`),e.push("{"),e.push(`\toutColor = texture(uTextures[${r}], vUV);`),e.push("}");return e.join("\n\t")}function Ls(t){return Us[t]||(Us[t]={name:"texture-batch-bit",vertex:{header:"\n\t\t\t\t\tin vec2 aTextureIdAndRound;\n\t\t\t\t\tout float vTextureId;\n\t\n\t\t\t\t",main:"\n\t\t\t\t\tvTextureId = aTextureIdAndRound.y;\n\t\t\t\t",end:"\n\t\t\t\t\tif(aTextureIdAndRound.x == 1.)\n\t\t\t\t\t{\n\t\t\t\t\t\tgl_Position.xy = roundPixels(gl_Position.xy, uResolution);\n\t\t\t\t\t}\n\t\t\t\t"},fragment:{header:`\n\t\t\t\t\tin float vTextureId;\n\t\n\t\t\t\t\tuniform sampler2D uTextures[${t}];\n\t\n\t\t\t\t`,main:`\n\t\n\t\t\t\t\t${Fs(t)}\n\t\t\t\t`}}),Us[t]}const Gs={name:"round-pixels-bit",vertex:{header:"\n\t\t\t\tfn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32> \n\t\t\t\t{\n\t\t\t\t\treturn (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;\n\t\t\t\t}\n\t\t\t"}},js={name:"round-pixels-bit",vertex:{header:" \n\t\t\t\tvec2 roundPixels(vec2 position, vec2 targetSize)\n\t\t\t\t{ \n\t\t\t\t\treturn (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;\n\t\t\t\t}\n\t\t\t"}},Ns=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>"],zs=Ns.reduce(((t,e)=>(t[e]=!0,t)),{});function Ws(t,e){switch(t){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*e);case"vec3<f32>":return new Float32Array(3*e);case"vec4<f32>":return new Float32Array(4*e);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Vs=Object.defineProperty,Hs=Object.getOwnPropertySymbols,Xs=Object.prototype.hasOwnProperty,Ks=Object.prototype.propertyIsEnumerable,Ys=(t,e,r)=>e in t?Vs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Qs=(t,e)=>{for(var r in e||(e={}))Xs.call(e,r)&&Ys(t,r,e[r]);if(Hs)for(var r of Hs(e))Ks.call(e,r)&&Ys(t,r,e[r]);return t};const $s=class t{constructor(e,r){var n;this._touched=0,this.uid=ut("uniform"),this._resourceType="uniformGroup",this._resourceId=ut("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,r=Qs(Qs({},t.defaultOptions),r),this.uniformStructures=e;const i={};for(const t in e){const r=e[t];if(r.name=t,r.size=null!=(n=r.size)?n:1,!zs[r.type])throw new Error(`Uniform type ${r.type} is not supported. Supported uniform types are: ${Ns.join(", ")}`);null!=r.value||(r.value=Ws(r.type,r.size)),i[t]=r.value}this.uniforms=i,this._dirtyId=1,this.ubo=r.ubo,this.isStatic=r.isStatic,this._signature=Pi(Object.keys(i).map((t=>`${t}-${e[t].type}`)).join("-"),"uniform-group")}update(){this._dirtyId++}};$s.defaultOptions={ubo:!1,isStatic:!1};let qs=$s;const Zs={};function Js(t){let e=Zs[t];if(e)return e;const r=new Int32Array(t);for(let e=0;e<t;e++)r[e]=e;return e=Zs[t]=new qs({uTextures:{value:r,type:"i32",size:t}},{isStatic:!0}),e}var to=(t=>(t[t.WEBGL=1]="WEBGL",t[t.WEBGPU=2]="WEBGPU",t[t.BOTH=3]="BOTH",t))(to||{}),eo=Object.defineProperty,ro=Object.getOwnPropertySymbols,no=Object.prototype.hasOwnProperty,io=Object.prototype.propertyIsEnumerable,so=(t,e,r)=>e in t?eo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;class oo extends f{constructor(t){super(),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:n,resources:i,compatibleRenderers:s,groupMap:o}=t;this.gpuProgram=e,this.glProgram=r,void 0===s&&(s=0,e&&(s|=to.WEBGPU),r&&(s|=to.WEBGL)),this.compatibleRenderers=s;const a={};if(!i&&!n&&(i={}),i&&n)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&n&&!o)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&n&&o)for(const t in o)for(const e in o[t]){const r=o[t][e];a[r]={group:t,binding:e,name:r}}else if(e&&n&&!o){const t=e.structsAndGroups.groups;o={},t.forEach((t=>{o[t.group]=o[t.group]||{},o[t.group][t.binding]=t.name,a[t.name]=t}))}else if(i){n={},o={},e&&e.structsAndGroups.groups.forEach((t=>{o[t.group]=o[t.group]||{},o[t.group][t.binding]=t.name,a[t.name]=t}));let t=0;for(const e in i)a[e]||(n[99]||(n[99]=new Fn,this._ownedBindGroups.push(n[99])),a[e]={group:99,binding:t,name:e},o[99]=o[99]||{},o[99][t]=e,t++);for(const t in i){const e=t;let r=i[t];!r.source&&!r._resourceType&&(r=new qs(r));const s=a[e];s&&(n[s.group]||(n[s.group]=new Fn,this._ownedBindGroups.push(n[s.group])),n[s.group].setResource(r,s.binding))}}this.groups=n,this._uniformBindMap=o,this.resources=this._buildResourceAccessor(n,a)}addResource(t,e,r){var n,i;(n=this._uniformBindMap)[e]||(n[e]={}),(i=this._uniformBindMap[e])[r]||(i[r]=t),this.groups[e]||(this.groups[e]=new Fn,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const r={};for(const n in e){const i=e[n];Object.defineProperty(r,i.name,{get:()=>t[i.group].getResource(i.binding),set(e){t[i.group].setResource(e,i.binding)}})}return r}destroy(t=!1){var e,r;this.emit("destroy",this),t&&(null==(e=this.gpuProgram)||e.destroy(),null==(r=this.glProgram)||r.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach((t=>{t.destroy()})),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){const e=t,{gpu:r,gl:n}=e,i=((t,e)=>{var r={};for(var n in t)no.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&ro)for(var n of ro(t))e.indexOf(n)<0&&io.call(t,n)&&(r[n]=t[n]);return r})(e,["gpu","gl"]);let s,o;return r&&(s=ts.from(r)),n&&(o=Wi.from(n)),new oo(((t,e)=>{for(var r in e||(e={}))no.call(e,r)&&so(t,r,e[r]);if(ro)for(var r of ro(e))io.call(e,r)&&so(t,r,e[r]);return t})({gpuProgram:s,glProgram:o},i))}}class ao extends oo{constructor(t){super({glProgram:Es({name:"batch",bits:[Rs,Ls(t),js]}),gpuProgram:Cs({name:"batch",bits:[As,ks(t),Gs]}),resources:{batchSamplers:Js(t)}})}}let lo=null;const _o=class t extends di{constructor(){super(...arguments),this.geometry=new bi,this.shader=lo||(lo=new ao(this.maxTextures)),this.name=t.extension.name,this.vertexSize=6}packAttributes(t,e,r,n,i){const s=i<<16|65535&t.roundPixels,o=t.transform,a=o.a,l=o.b,_=o.c,u=o.d,c=o.tx,h=o.ty,{positions:d,uvs:p}=t,y=t.color,v=t.attributeOffset,f=v+t.attributeSize;for(let t=v;t<f;t++){const i=2*t,o=d[i],v=d[i+1];e[n++]=a*o+_*v+c,e[n++]=u*v+l*o+h,e[n++]=p[i],e[n++]=p[i+1],r[n++]=y,r[n++]=s}}packQuadAttributes(t,e,r,n,i){const s=t.texture,o=t.transform,a=o.a,l=o.b,_=o.c,u=o.d,c=o.tx,h=o.ty,d=t.bounds,p=d.maxX,y=d.minX,v=d.maxY,f=d.minY,m=s.uvs,g=t.color,x=i<<16|65535&t.roundPixels;e[n+0]=a*y+_*f+c,e[n+1]=u*f+l*y+h,e[n+2]=m.x0,e[n+3]=m.y0,r[n+4]=g,r[n+5]=x,e[n+6]=a*p+_*f+c,e[n+7]=u*f+l*p+h,e[n+8]=m.x1,e[n+9]=m.y1,r[n+10]=g,r[n+11]=x,e[n+12]=a*p+_*v+c,e[n+13]=u*v+l*p+h,e[n+14]=m.x2,e[n+15]=m.y2,r[n+16]=g,r[n+17]=x,e[n+18]=a*y+_*v+c,e[n+19]=u*v+l*y+h,e[n+20]=m.x3,e[n+21]=m.y3,r[n+22]=g,r[n+23]=x}};_o.extension={type:[c.Batcher],name:"default"};let uo=_o;const co={},ho="8.3.4";function po(t,e,r=3){if(co[e])return;let n=(new Error).stack;void 0===n?console.warn("PixiJS Deprecation Warning: ",`${e}\n\tDeprecated since v${t}`):(n=n.split("\n\t").splice(r).join("\n\t"),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e}\n\tDeprecated since v${t}`),console.warn(n),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e}\n\tDeprecated since v${t}`),console.warn(n))),co[e]=!0}function yo(t,e,r,n,i,s,o,a=null){let l=0;r*=e,i*=s;const _=a.a,u=a.b,c=a.c,h=a.d,d=a.tx,p=a.ty;for(;l<o;){const o=t[r],a=t[r+1];n[i]=_*o+c*a+d,n[i+1]=u*o+h*a+p,i+=s,r+=e,l++}}function vo(t,e,r,n){let i=0;for(e*=r;i<n;)t[e]=0,t[e+1]=0,e+=r,i++}function fo(t,e,r,n,i){const s=e.a,o=e.b,a=e.c,l=e.d,_=e.tx,u=e.ty;r=r||0,n=n||2,i=i||t.length/n-r;let c=r*n;for(let e=0;e<i;e++){const e=t[c],r=t[c+1];t[c]=s*e+a*r+_,t[c+1]=o*e+l*r+u,c+=n}}function mo(t,e){if(16777215===t||!e)return e;if(16777215===e||!t)return t;return((t>>16&255)*(e>>16&255)/255<<16)+((t>>8&255)*(e>>8&255)/255<<8)+(255&t)*(255&e)/255}const go=new st;class xo{constructor(){this.packAsQuad=!1,this.batcherName="default",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){const t=this.baseColor,e=t>>16|65280&t|(255&t)<<16,r=this.renderable;return r?mo(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(255*this.alpha<<24)}get transform(){var t;return(null==(t=this.renderable)?void 0:t.groupTransform)||go}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData}reset(){this.applyTransform=!0,this.renderable=null}}var bo=Object.defineProperty,So=Object.defineProperties,To=Object.getOwnPropertyDescriptors,Po=Object.getOwnPropertySymbols,Oo=Object.prototype.hasOwnProperty,Mo=Object.prototype.propertyIsEnumerable,wo=(t,e,r)=>e in t?bo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Co=(t,e)=>{for(var r in e||(e={}))Oo.call(e,r)&&wo(t,r,e[r]);if(Po)for(var r of Po(e))Mo.call(e,r)&&wo(t,r,e[r]);return t},Eo=(t,e)=>So(t,To(e));const Ao={extension:{type:c.ShapeBuilder,name:"circle"},build(t,e){let r,n,i,s,o,a;if("circle"===t.type){const e=t;r=e.x,n=e.y,o=a=e.radius,i=s=0}else if("ellipse"===t.type){const e=t;r=e.x,n=e.y,o=e.halfWidth,a=e.halfHeight,i=s=0}else{const e=t,l=e.width/2,_=e.height/2;r=e.x+l,n=e.y+_,o=a=Math.max(0,Math.min(e.radius,Math.min(l,_))),i=l-o,s=_-a}if(!(o>=0&&a>=0&&i>=0&&s>=0))return e;const l=Math.ceil(2.3*Math.sqrt(o+a)),_=8*l+(i?4:0)+(s?4:0);if(0===_)return e;if(0===l)return e[0]=e[6]=r+i,e[1]=e[3]=n+s,e[2]=e[4]=r-i,e[5]=e[7]=n-s,e;let u=0,c=4*l+(i?2:0)+2,h=c,d=_,p=i+o,y=s,v=r+p,f=r-p,m=n+y;if(e[u++]=v,e[u++]=m,e[--c]=m,e[--c]=f,s){const t=n-y;e[h++]=f,e[h++]=t,e[--d]=t,e[--d]=v}for(let t=1;t<l;t++){const _=Math.PI/2*(t/l),p=i+Math.cos(_)*o,y=s+Math.sin(_)*a,v=r+p,f=r-p,m=n+y,g=n-y;e[u++]=v,e[u++]=m,e[--c]=m,e[--c]=f,e[h++]=f,e[h++]=g,e[--d]=g,e[--d]=v}p=i,y=s+a,v=r+p,f=r-p,m=n+y;const g=n-y;return e[u++]=v,e[u++]=m,e[--d]=g,e[--d]=v,i&&(e[u++]=f,e[u++]=m,e[--d]=g,e[--d]=f),e},triangulate(t,e,r,n,i,s){if(0===t.length)return;let o=0,a=0;for(let e=0;e<t.length;e+=2)o+=t[e],a+=t[e+1];o/=t.length/2,a/=t.length/2;let l=n;e[l*r]=o,e[l*r+1]=a;const _=l++;for(let n=0;n<t.length;n+=2)e[l*r]=t[n],e[l*r+1]=t[n+1],n>0&&(i[s++]=l,i[s++]=_,i[s++]=l-1),l++;i[s++]=_+1,i[s++]=_,i[s++]=l-1}},Ro=Eo(Co({},Ao),{extension:Eo(Co({},Ao.extension),{name:"ellipse"})}),Io=Eo(Co({},Ao),{extension:Eo(Co({},Ao.extension),{name:"roundedRectangle"})}),Do=1e-4,Bo=1e-4;function ko(t){const e=t.length;if(e<6)return 1;let r=0;for(let n=0,i=t[e-2],s=t[e-1];n<e;n+=2){const e=t[n],o=t[n+1];r+=(e-i)*(o+s),i=e,s=o}return r<0?-1:1}function Uo(t,e,r,n,i,s,o,a){let l,_;o?(l=n,_=-r):(l=-n,_=r);const u=t-r*i+l,c=e-n*i+_,h=t+r*s+l,d=e+n*s+_;return a.push(u,c),a.push(h,d),2}function Fo(t,e,r,n,i,s,o,a){const l=r-t,_=n-e;let u=Math.atan2(l,_),c=Math.atan2(i-t,s-e);a&&u<c?u+=2*Math.PI:!a&&u>c&&(c+=2*Math.PI);let h=u;const d=c-u,p=Math.abs(d),y=Math.sqrt(l*l+_*_),v=1+(15*p*Math.sqrt(y)/Math.PI|0),f=d/v;if(h+=f,a){o.push(t,e),o.push(r,n);for(let r=1,n=h;r<v;r++,n+=f)o.push(t,e),o.push(t+Math.sin(n)*y,e+Math.cos(n)*y);o.push(t,e),o.push(i,s)}else{o.push(r,n),o.push(t,e);for(let r=1,n=h;r<v;r++,n+=f)o.push(t+Math.sin(n)*y,e+Math.cos(n)*y),o.push(t,e);o.push(i,s),o.push(t,e)}return 2*v}function Lo(t,e,r,n,i,s,o,a,l){const _=Do;if(0===t.length)return;const u=e;let c=u.alignment;if(.5!==e.alignment){let e=ko(t);r&&(e*=-1),c=(c-.5)*e+.5}const h=new nt(t[0],t[1]),d=new nt(t[t.length-2],t[t.length-1]),p=n,y=Math.abs(h.x-d.x)<_&&Math.abs(h.y-d.y)<_;if(p){t=t.slice(),y&&(t.pop(),t.pop(),d.set(t[t.length-2],t[t.length-1]));const e=.5*(h.x+d.x),r=.5*(d.y+h.y);t.unshift(e,r),t.push(e,r)}const v=i,f=t.length/2;let m=t.length;const g=v.length/2,x=u.width/2,b=x*x,S=u.miterLimit*u.miterLimit;let T=t[0],P=t[1],O=t[2],M=t[3],w=0,C=0,E=-(P-M),A=T-O,R=0,I=0,D=Math.sqrt(E*E+A*A);E/=D,A/=D,E*=x,A*=x;const B=2*(1-c),k=2*c;p||("round"===u.cap?m+=Fo(T-E*(B-k)*.5,P-A*(B-k)*.5,T-E*B,P-A*B,T+E*k,P+A*k,v,!0)+2:"square"===u.cap&&(m+=Uo(T,P,E,A,B,k,!0,v))),v.push(T-E*B,P-A*B),v.push(T+E*k,P+A*k);for(let e=1;e<f-1;++e){T=t[2*(e-1)],P=t[2*(e-1)+1],O=t[2*e],M=t[2*e+1],w=t[2*(e+1)],C=t[2*(e+1)+1],E=-(P-M),A=T-O,D=Math.sqrt(E*E+A*A),E/=D,A/=D,E*=x,A*=x,R=-(M-C),I=O-w,D=Math.sqrt(R*R+I*I),R/=D,I/=D,R*=x,I*=x;const r=O-T,n=P-M,i=O-w,s=C-M,o=r*i+n*s,a=n*i-s*r,l=a<0;if(Math.abs(a)<.001*Math.abs(o)){v.push(O-E*B,M-A*B),v.push(O+E*k,M+A*k),o>=0&&("round"===u.join?m+=Fo(O,M,O-E*B,M-A*B,O-R*B,M-I*B,v,!1)+4:m+=2,v.push(O-R*k,M-I*k),v.push(O+R*B,M+I*B));continue}const _=(-E+T)*(-A+M)-(-E+O)*(-A+P),c=(-R+w)*(-I+M)-(-R+O)*(-I+C),h=(r*c-i*_)/a,d=(s*_-n*c)/a,p=(h-O)*(h-O)+(d-M)*(d-M),y=O+(h-O)*B,f=M+(d-M)*B,g=O-(h-O)*k,U=M-(d-M)*k,F=l?B:k;p<=Math.min(r*r+n*n,i*i+s*s)+F*F*b?"bevel"===u.join||p/b>S?(l?(v.push(y,f),v.push(O+E*k,M+A*k),v.push(y,f),v.push(O+R*k,M+I*k)):(v.push(O-E*B,M-A*B),v.push(g,U),v.push(O-R*B,M-I*B),v.push(g,U)),m+=2):"round"===u.join?l?(v.push(y,f),v.push(O+E*k,M+A*k),m+=Fo(O,M,O+E*k,M+A*k,O+R*k,M+I*k,v,!0)+4,v.push(y,f),v.push(O+R*k,M+I*k)):(v.push(O-E*B,M-A*B),v.push(g,U),m+=Fo(O,M,O-E*B,M-A*B,O-R*B,M-I*B,v,!1)+4,v.push(O-R*B,M-I*B),v.push(g,U)):(v.push(y,f),v.push(g,U)):(v.push(O-E*B,M-A*B),v.push(O+E*k,M+A*k),"round"===u.join?m+=l?Fo(O,M,O+E*k,M+A*k,O+R*k,M+I*k,v,!0)+2:Fo(O,M,O-E*B,M-A*B,O-R*B,M-I*B,v,!1)+2:"miter"===u.join&&p/b<=S&&(l?(v.push(g,U),v.push(g,U)):(v.push(y,f),v.push(y,f)),m+=2),v.push(O-R*B,M-I*B),v.push(O+R*k,M+I*k),m+=2)}T=t[2*(f-2)],P=t[2*(f-2)+1],O=t[2*(f-1)],M=t[2*(f-1)+1],E=-(P-M),A=T-O,D=Math.sqrt(E*E+A*A),E/=D,A/=D,E*=x,A*=x,v.push(O-E*B,M-A*B),v.push(O+E*k,M+A*k),p||("round"===u.cap?m+=Fo(O-E*(B-k)*.5,M-A*(B-k)*.5,O-E*B,M-A*B,O+E*k,M+A*k,v,!1)+2:"square"===u.cap&&(m+=Uo(O,M,E,A,B,k,!1,v)));for(let t=g;t<m+g-2;++t)T=v[2*t],P=v[2*t+1],O=v[2*(t+1)],M=v[2*(t+1)+1],w=v[2*(t+2)],C=v[2*(t+2)+1],!(Math.abs(T*(M-C)+O*(C-P)+w*(P-M))<1e-8)&&a.push(t,t+1,t+2)}var Go={exports:{}};Go.exports;Go.exports=jo;Go.exports.default=jo;function jo(t,e,r){r=r||2;var n,i,s,o,a,l,_,u=e&&e.length,c=u?e[0]*r:t.length,h=No(t,0,c,r,!0),d=[];if(!h||h.next===h.prev)return d;if(u&&(h=function(t,e,r,n){var i,s,o,a,l,_=[];for(i=0,s=e.length;i<s;i++)o=e[i]*n,a=i<s-1?e[i+1]*n:t.length,(l=No(t,o,a,n,!1))===l.next&&(l.steiner=!0),_.push(Zo(l));for(_.sort(Yo),i=0;i<_.length;i++)r=Qo(_[i],r);return r}(t,e,h,r)),t.length>80*r){n=s=t[0],i=o=t[1];for(var p=r;p<c;p+=r)(a=t[p])<n&&(n=a),(l=t[p+1])<i&&(i=l),a>s&&(s=a),l>o&&(o=l);_=0!==(_=Math.max(s-n,o-i))?32767/_:0}return Wo(h,d,r,n,i,_,0),d}function No(t,e,r,n,i){var s,o;if(i===ca(t,e,r,n)>0)for(s=e;s<r;s+=n)o=la(s,t[s],t[s+1],o);else for(s=r-n;s>=e;s-=n)o=la(s,t[s],t[s+1],o);return o&&ra(o,o.next)&&(_a(o),o=o.next),o}function zo(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!ra(n,n.next)&&0!==ea(n.prev,n,n.next))n=n.next;else{if(_a(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function Wo(t,e,r,n,i,s,o){if(t){!o&&s&&function(t,e,r,n){var i=t;do{0===i.z&&(i.z=qo(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,s,o,a,l,_=1;do{for(r=t,t=null,s=null,o=0;r;){for(o++,n=r,a=0,e=0;e<_&&(a++,n=n.nextZ);e++);for(l=_;a>0||l>0&&n;)0!==a&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,a--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;r=n}s.nextZ=null,_*=2}while(o>1)}(i)}(t,n,i,s);for(var a,l,_=t;t.prev!==t.next;)if(a=t.prev,l=t.next,s?Ho(t,n,i,s):Vo(t))e.push(a.i/r|0),e.push(t.i/r|0),e.push(l.i/r|0),_a(t),t=l.next,_=l.next;else if((t=l)===_){o?1===o?Wo(t=Xo(zo(t),e,r),e,r,n,i,s,2):2===o&&Ko(t,e,r,n,i,s):Wo(zo(t),e,r,n,i,s,1);break}}}function Vo(t){var e=t.prev,r=t,n=t.next;if(ea(e,r,n)>=0)return!1;for(var i=e.x,s=r.x,o=n.x,a=e.y,l=r.y,_=n.y,u=i<s?i<o?i:o:s<o?s:o,c=a<l?a<_?a:_:l<_?l:_,h=i>s?i>o?i:o:s>o?s:o,d=a>l?a>_?a:_:l>_?l:_,p=n.next;p!==e;){if(p.x>=u&&p.x<=h&&p.y>=c&&p.y<=d&&Jo(i,a,s,l,o,_,p.x,p.y)&&ea(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Ho(t,e,r,n){var i=t.prev,s=t,o=t.next;if(ea(i,s,o)>=0)return!1;for(var a=i.x,l=s.x,_=o.x,u=i.y,c=s.y,h=o.y,d=a<l?a<_?a:_:l<_?l:_,p=u<c?u<h?u:h:c<h?c:h,y=a>l?a>_?a:_:l>_?l:_,v=u>c?u>h?u:h:c>h?c:h,f=qo(d,p,e,r,n),m=qo(y,v,e,r,n),g=t.prevZ,x=t.nextZ;g&&g.z>=f&&x&&x.z<=m;){if(g.x>=d&&g.x<=y&&g.y>=p&&g.y<=v&&g!==i&&g!==o&&Jo(a,u,l,c,_,h,g.x,g.y)&&ea(g.prev,g,g.next)>=0||(g=g.prevZ,x.x>=d&&x.x<=y&&x.y>=p&&x.y<=v&&x!==i&&x!==o&&Jo(a,u,l,c,_,h,x.x,x.y)&&ea(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;g&&g.z>=f;){if(g.x>=d&&g.x<=y&&g.y>=p&&g.y<=v&&g!==i&&g!==o&&Jo(a,u,l,c,_,h,g.x,g.y)&&ea(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;x&&x.z<=m;){if(x.x>=d&&x.x<=y&&x.y>=p&&x.y<=v&&x!==i&&x!==o&&Jo(a,u,l,c,_,h,x.x,x.y)&&ea(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Xo(t,e,r){var n=t;do{var i=n.prev,s=n.next.next;!ra(i,s)&&na(i,n,n.next,s)&&oa(i,s)&&oa(s,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(s.i/r|0),_a(n),_a(n.next),n=t=s),n=n.next}while(n!==t);return zo(n)}function Ko(t,e,r,n,i,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&ta(o,a)){var l=aa(o,a);return o=zo(o,o.next),l=zo(l,l.next),Wo(o,e,r,n,i,s,0),void Wo(l,e,r,n,i,s,0)}a=a.next}o=o.next}while(o!==t)}function Yo(t,e){return t.x-e.x}function Qo(t,e){var r=function(t,e){var r,n=e,i=t.x,s=t.y,o=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){var a=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>o&&(o=a,r=n.x<n.next.x?n:n.next,a===i))return r}n=n.next}while(n!==e);if(!r)return null;var l,_=r,u=r.x,c=r.y,h=1/0;n=r;do{i>=n.x&&n.x>=u&&i!==n.x&&Jo(s<c?i:o,s,u,c,s<c?o:i,s,n.x,n.y)&&(l=Math.abs(s-n.y)/(i-n.x),oa(n,t)&&(l<h||l===h&&(n.x>r.x||n.x===r.x&&$o(r,n)))&&(r=n,h=l)),n=n.next}while(n!==_);return r}(t,e);if(!r)return e;var n=aa(r,t);return zo(n,n.next),zo(r,r.next)}function $o(t,e){return ea(t.prev,t,e.prev)<0&&ea(e.next,t,t.next)<0}function qo(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Zo(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function Jo(t,e,r,n,i,s,o,a){return(i-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(n-a)>=(r-o)*(e-a)&&(r-o)*(s-a)>=(i-o)*(n-a)}function ta(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&na(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(oa(t,e)&&oa(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&i<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(ea(t.prev,t,e.prev)||ea(t,e.prev,e))||ra(t,e)&&ea(t.prev,t,t.next)>0&&ea(e.prev,e,e.next)>0)}function ea(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function ra(t,e){return t.x===e.x&&t.y===e.y}function na(t,e,r,n){var i=sa(ea(t,e,r)),s=sa(ea(t,e,n)),o=sa(ea(r,n,t)),a=sa(ea(r,n,e));return!!(i!==s&&o!==a||0===i&&ia(t,r,e)||0===s&&ia(t,n,e)||0===o&&ia(r,t,n)||0===a&&ia(r,e,n))}function ia(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function sa(t){return t>0?1:t<0?-1:0}function oa(t,e){return ea(t.prev,t,t.next)<0?ea(t,e,t.next)>=0&&ea(t,t.prev,e)>=0:ea(t,e,t.prev)<0||ea(t,t.next,e)<0}function aa(t,e){var r=new ua(t.i,t.x,t.y),n=new ua(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,s.next=n,n.prev=s,n}function la(t,e,r,n){var i=new ua(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function _a(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function ua(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ca(t,e,r,n){for(var i=0,s=e,o=r-n;s<r;s+=n)i+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return i}jo.deviation=function(t,e,r,n){var i=e&&e.length,s=i?e[0]*r:t.length,o=Math.abs(ca(t,0,s,r));if(i)for(var a=0,l=e.length;a<l;a++){var _=e[a]*r,u=a<l-1?e[a+1]*r:t.length;o-=Math.abs(ca(t,_,u,r))}var c=0;for(a=0;a<n.length;a+=3){var h=n[a]*r,d=n[a+1]*r,p=n[a+2]*r;c+=Math.abs((t[h]-t[p])*(t[d+1]-t[h+1])-(t[h]-t[d])*(t[p+1]-t[h+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},jo.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var s=0;s<t[i].length;s++)for(var o=0;o<e;o++)r.vertices.push(t[i][s][o]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r};var ha=y(Go.exports);function da(t,e,r,n,i,s,o){const a=ha(t,e,2);if(!a)return;for(let t=0;t<a.length;t+=3)s[o++]=a[t]+i,s[o++]=a[t+1]+i,s[o++]=a[t+2]+i;let l=i*n;for(let e=0;e<t.length;e+=2)r[l]=t[e],r[l+1]=t[e+1],l+=n}const pa=[],ya={extension:{type:c.ShapeBuilder,name:"polygon"},build(t,e){for(let r=0;r<t.points.length;r++)e[r]=t.points[r];return e},triangulate(t,e,r,n,i,s){da(t,pa,e,r,n,i,s)}},va={extension:{type:c.ShapeBuilder,name:"rectangle"},build(t,e){const r=t,n=r.x,i=r.y,s=r.width,o=r.height;return s>=0&&o>=0&&(e[0]=n,e[1]=i,e[2]=n+s,e[3]=i,e[4]=n+s,e[5]=i+o,e[6]=n,e[7]=i+o),e},triangulate(t,e,r,n,i,s){let o=0;e[(n*=r)+o]=t[0],e[n+o+1]=t[1],o+=r,e[n+o]=t[2],e[n+o+1]=t[3],o+=r,e[n+o]=t[6],e[n+o+1]=t[7],o+=r,e[n+o]=t[4],e[n+o+1]=t[5],o+=r;const a=n/r;i[s++]=a,i[s++]=a+1,i[s++]=a+2,i[s++]=a+1,i[s++]=a+3,i[s++]=a+2}},fa={extension:{type:c.ShapeBuilder,name:"triangle"},build:(t,e)=>(e[0]=t.x,e[1]=t.y,e[2]=t.x2,e[3]=t.y2,e[4]=t.x3,e[5]=t.y3,e),triangulate(t,e,r,n,i,s){let o=0;e[(n*=r)+o]=t[0],e[n+o+1]=t[1],o+=r,e[n+o]=t[2],e[n+o+1]=t[3],o+=r,e[n+o]=t[4],e[n+o+1]=t[5];const a=n/r;i[s++]=a,i[s++]=a+1,i[s++]=a+2}},ma={};p.handleByMap(c.ShapeBuilder,ma),p.add(va,ya,fa,Ao,Ro,Io);const ga=new Ct;function xa(t,e){const{geometryData:r,batches:n}=e;n.length=0,r.indices.length=0,r.vertices.length=0,r.uvs.length=0;for(let e=0;e<t.instructions.length;e++){const i=t.instructions[e];if("texture"===i.action)ba(i.data,n,r);else if("fill"===i.action||"stroke"===i.action){const t="stroke"===i.action,e=i.data.path.shapePath,s=i.data.style,o=i.data.hole;t&&o&&Sa(o.shapePath,s,null,!0,n,r),Sa(e,s,o,t,n,r)}}}function ba(t,e,r){const{vertices:n,uvs:i,indices:s}=r,o=s.length,a=n.length/2,l=[],_=ma.rectangle,u=ga,c=t.image;u.x=t.dx,u.y=t.dy,u.width=t.dw,u.height=t.dh;const h=t.transform;_.build(u,l),h&&fo(l,h),_.triangulate(l,n,2,a,s,o);const d=c.uvs;i.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);const p=dt.get(xo);p.indexOffset=o,p.indexSize=s.length-o,p.attributeOffset=a,p.attributeSize=n.length/2-a,p.baseColor=t.style,p.alpha=t.alpha,p.texture=c,p.geometryData=r,e.push(p)}function Sa(t,e,r,n,i,s){const{vertices:o,uvs:a,indices:l}=s,_=t.shapePrimitives.length-1;t.shapePrimitives.forEach((({shape:t,transform:u},c)=>{var h;const d=l.length,p=o.length/2,y=[],v=ma[t.type];if(v.build(t,y),u&&fo(y,u),n){const r=null==(h=t.closePath)||h;Lo(y,e,!1,r,o,0,0,l)}else if(r&&_===c){0!==_&&console.warn("[Pixi Graphics] only the last shape have be cut out");const t=[],e=y.slice();(function(t){if(!t)return[];const e=t.shapePrimitives,r=[];for(let t=0;t<e.length;t++){const n=e[t].shape,i=[];ma[n.type].build(n,i),r.push(i)}return r})(r.shapePath).forEach((r=>{t.push(e.length/2),e.push(...r)})),da(e,t,o,2,p,l,d)}else v.triangulate(y,o,2,p,l,d);const f=a.length/2,m=e.texture;if(m!==$r.WHITE){const t=e.matrix;t&&(u&&t.append(u.clone().invert()),yo(o,2,p,a,f,2,o.length/2-p,t))}else vo(a,f,2,o.length/2-p);const g=dt.get(xo);g.indexOffset=d,g.indexSize=l.length-d,g.attributeOffset=p,g.attributeSize=o.length/2-p,g.baseColor=e.color,g.alpha=e.alpha,g.texture=m,g.geometryData=s,i.push(g)}))}class Ta{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}}class Pa{constructor(){this.batcher=new uo,this.instructions=new Xt}init(){this.instructions.reset()}get geometry(){return po(ho,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}}const Oa=class t{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(e){var r;t.defaultOptions.bezierSmoothness=null!=(r=null==e?void 0:e.bezierSmoothness)?r:t.defaultOptions.bezierSmoothness}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let e=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){e?this._cleanGraphicsContextData(t):e=this._initContext(t),xa(t,e);const r=t.batchMode;t.customShader||"no-batch"===r?e.isBatchable=!1:"auto"===r&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){const e=dt.get(Pa),{batches:r,geometryData:n}=this._gpuContextHash[t.uid],i=n.vertices.length,s=n.indices.length;for(let t=0;t<r.length;t++)r[t].applyTransform=!1;const o=e.batcher;o.ensureAttributeBuffer(i),o.ensureIndexBuffer(s),o.begin();for(let t=0;t<r.length;t++){const e=r[t];o.add(e)}o.finish(e.instructions);const a=o.geometry;a.indexBuffer.setDataWithSize(o.indexBuffer,o.indexSize,!0),a.buffers[0].setDataWithSize(o.attributeBuffer.float32View,o.attributeSize,!0);const l=o.batches;for(let t=0;t<l.length;t++){const e=l[t];e.bindGroup=Xn(e.textures.textures,e.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){const e=new Ta;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null}_cleanGraphicsContextData(t){const e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(dt.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach((t=>{dt.return(t)}))}destroy(){for(const t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};Oa.extension={type:[c.WebGLSystem,c.WebGPUSystem,c.CanvasSystem],name:"graphicsContext"},Oa.defaultOptions={bezierSmoothness:.5};let Ma=Oa;const wa={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},Ca=class t{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(1&this.data)}set blend(t){!!(1&this.data)!==t&&(this.data^=1)}get offsets(){return!!(2&this.data)}set offsets(t){!!(2&this.data)!==t&&(this.data^=2)}set cullMode(t){"none"!==t?(this.culling=!0,this.clockwiseFrontFace="front"===t):this.culling=!1}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(4&this.data)}set culling(t){!!(4&this.data)!==t&&(this.data^=4)}get depthTest(){return!!(8&this.data)}set depthTest(t){!!(8&this.data)!==t&&(this.data^=8)}get depthMask(){return!!(32&this.data)}set depthMask(t){!!(32&this.data)!==t&&(this.data^=32)}get clockwiseFrontFace(){return!!(16&this.data)}set clockwiseFrontFace(t){!!(16&this.data)!==t&&(this.data^=16)}get blendMode(){return this._blendMode}set blendMode(t){this.blend="none"!==t,this._blendMode=t,this._blendModeId=wa[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const e=new t;return e.depthTest=!1,e.blend=!0,e}};Ca.default2d=Ca.for2d();let Ea=Ca;function Aa(t,e,r){const n=(t>>24&255)/255;e[r++]=(255&t)/255*n,e[r++]=(t>>8&255)/255*n,e[r++]=(t>>16&255)/255*n,e[r++]=n}class Ra{constructor(t,e){this.state=Ea.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(t){const e=t.context,r=!!this._graphicsBatchesHash[t.uid],n=this.renderer.graphicsContext.updateGpuContext(e);return!(!n.isBatchable&&r===n.isBatchable)}addRenderable(t,e){const r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){const e=this._graphicsBatchesHash[t.uid];if(e)for(let t=0;t<e.length;t++){const r=e[t];r._batcher.updateElement(r)}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;const e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;const n=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;const i=n.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=e._roundPixels|t._roundPixels,Aa(t.groupColorAlpha,i.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){const e=!!this._graphicsBatchesHash[t.uid],r=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),r.isBatchable&&this._initBatchesForRenderable(t),t.batched=r.isBatchable}_addToBatcher(t,e){const r=this.renderer.renderPipes.batch,n=this._getBatchesForRenderable(t);for(let t=0;t<n.length;t++){const i=n[t];r.addToBatch(i,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){const e=t.context,r=this.renderer.graphicsContext.getGpuContext(e),n=this.renderer._roundPixels|t._roundPixels,i=r.batches.map((e=>{const r=dt.get(xo);return e.copyTo(r),r.renderable=t,r.roundPixels=n,r}));return void 0===this._graphicsBatchesHash[t.uid]&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=i,i}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach((t=>{dt.return(t)})),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(const t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}}Ra.extension={type:[c.WebGLPipes,c.WebGPUPipes,c.CanvasPipes],name:"graphics"},p.add(Ra),p.add(Ma);class Ia{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get uvs(){const t=this.geometry.getBuffer("aUV"),e=t.data;let r=e;const n=this.texture.textureMatrix;return n.isSimple||(r=this._transformedUvs,(this._textureMatrixUpdateId!==n._updateID||this._uvUpdateId!==t._updateID)&&((!r||r.length<e.length)&&(r=this._transformedUvs=new Float32Array(e.length)),this._textureMatrixUpdateId=n._updateID,this._uvUpdateId=t._updateID,n.multiplyUvs(e,r))),r}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}class Da{constructor(t,e){this.localUniforms=new qs({uTransformMatrix:{value:new st,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Fn({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),t.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),t.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(t){const e=this._getMeshData(t),r=e.batched,n=t.batched;if(e.batched=n,r!==n)return!0;if(n){const r=t._geometry;if(r.indices.length!==e.indexSize||r.positions.length!==e.vertexSize)return e.indexSize=r.indices.length,e.vertexSize=r.positions.length,!0;const n=this._getBatchableMesh(t),i=t.texture;if(n.texture._source!==i._source&&n.texture._source!==i._source)return!n._batcher.checkAndUpdateTexture(n,i)}return!1}addRenderable(t,e){const r=this.renderer.renderPipes.batch,{batched:n}=this._getMeshData(t);if(n){const n=this._getBatchableMesh(t);n.texture=t._texture,n.geometry=t._geometry,r.addToBatch(n,e)}else r.break(e),e.add(t)}updateRenderable(t){if(t.batched){const e=this._gpuBatchableMeshHash[t.uid];e.texture=t._texture,e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;const e=this._gpuBatchableMeshHash[t.uid];e&&(dt.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=Zn(t.groupBlendMode,t.texture._source);const e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Aa(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){var e,r;return this._meshDataHash[t.uid]={batched:t.batched,indexSize:null==(e=t._geometry.indices)?void 0:e.length,vertexSize:null==(r=t._geometry.positions)?void 0:r.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){const e=dt.get(Ia);return e.renderable=t,e.texture=t._texture,e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(const t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&dt.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}}Da.extension={type:[c.WebGLPipes,c.WebGPUPipes,c.CanvasPipes],name:"mesh"},p.add(Da);class Ba{execute(t,e){const r=t.state,n=t.renderer,i=e.shader||t.defaultShader;i.resources.uTexture=e.texture._source,i.resources.uniforms=t.localUniforms;const s=n.gl,o=t.getBuffers(e);n.shader.bind(i),n.state.set(r),n.geometry.bind(o.geometry,i.glProgram);const a=2===o.geometry.indexBuffer.data.BYTES_PER_ELEMENT?s.UNSIGNED_SHORT:s.UNSIGNED_INT;s.drawElements(s.TRIANGLES,6*e.particleChildren.length,a,0)}}function ka(t,e=null){const r=6*t;if((e=r>65535?e||new Uint32Array(r):e||new Uint16Array(r)).length!==r)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${r}`);for(let t=0,n=0;t<r;t+=6,n+=4)e[t+0]=n+0,e[t+1]=n+1,e[t+2]=n+2,e[t+3]=n+0,e[t+4]=n+2,e[t+5]=n+3;return e}function Ua(t){return{dynamicUpdate:Fa(t,!0),staticUpdate:Fa(t,!1)}}function Fa(t,e){const r=[];r.push("\n\t\t \n\t\t\tvar index = 0;\n\t\n\t\t\tfor (let i = 0; i < ps.length; ++i)\n\t\t\t{\n\t\t\t\tconst p = ps[i];\n\t\n\t\t\t\t");let n=0;for(const i in t){const s=t[i];if(e!==s.dynamic)continue;r.push(`offset = index + ${n}`),r.push(s.code);n+=Hi(s.format).stride/4}r.push("\n\t\t\t\tindex += stride * 4;\n\t\t\t}\n\t\t"),r.unshift(`\n\t\t\tvar stride = ${n};\n\t\t`);const i=r.join("\n\t");return new Function("ps","f32v","u32v",i)}class La{constructor(t){var e;this._size=0,this._generateParticleUpdateCache={};const r=this._size=null!=(e=t.size)?e:1e3,n=t.properties;let i=0,s=0;for(const t in n){const e=n[t],r=Hi(e.format);e.dynamic?s+=r.stride:i+=r.stride}this._dynamicStride=s/4,this._staticStride=i/4,this.staticAttributeBuffer=new Yn(4*r*i),this.dynamicAttributeBuffer=new Yn(4*r*s),this.indexBuffer=ka(r);const o=new mi;let a=0,l=0;this._staticBuffer=new yi({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:pi.VERTEX|pi.COPY_DST}),this._dynamicBuffer=new yi({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:pi.VERTEX|pi.COPY_DST});for(const t in n){const e=n[t],r=Hi(e.format);e.dynamic?(o.addAttribute(e.attributeName,{buffer:this._dynamicBuffer,stride:4*this._dynamicStride,offset:4*a,format:e.format}),a+=r.size):(o.addAttribute(e.attributeName,{buffer:this._staticBuffer,stride:4*this._staticStride,offset:4*l,format:e.format}),l+=r.size)}o.addIndex(this.indexBuffer);const _=this.getParticleUpdate(n);this._dynamicUpload=_.dynamicUpdate,this._staticUpload=_.staticUpdate,this.geometry=o}getParticleUpdate(t){const e=function(t){const e=[];for(const r in t){const n=t[r];e.push(r,n.code,n.dynamic?"d":"s")}return e.join("_")}(t);return this._generateParticleUpdateCache[e]||(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t)),this._generateParticleUpdateCache[e]}generateParticleUpdate(t){return Ua(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,1.5*this._size|0),this.staticAttributeBuffer=new Yn(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Yn(this._size*this._dynamicStride*4*4),this.indexBuffer=ka(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));const r=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,r.float32View,r.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e){const e=this.staticAttributeBuffer;this._staticUpload(t,e.float32View,e.uint32View),this._staticBuffer.setDataWithSize(e.float32View,t.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}var Ga="varying vec2 vUV;\n\tvarying vec4 vColor;\n\t\n\tuniform sampler2D uTexture;\n\t\n\tvoid main(void){\n\t\tvec4 color = texture2D(uTexture, vUV) * vColor;\n\t\tgl_FragColor = color;\n\t}",ja="attribute vec2 aVertex;\n\tattribute vec2 aUV;\n\tattribute vec4 aColor;\n\t\n\tattribute vec2 aPosition;\n\tattribute float aRotation;\n\t\n\tuniform mat3 uTranslationMatrix;\n\tuniform float uRound;\n\tuniform vec2 uResolution;\n\tuniform vec4 uColor;\n\t\n\tvarying vec2 vUV;\n\tvarying vec4 vColor;\n\t\n\tvec2 roundPixels(vec2 position, vec2 targetSize)\n\t{ \n\t\treturn (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;\n\t}\n\t\n\tvoid main(void){\n\t\tfloat cosRotation = cos(aRotation);\n\t\tfloat sinRotation = sin(aRotation);\n\t\tfloat x = aVertex.x * cosRotation - aVertex.y * sinRotation;\n\t\tfloat y = aVertex.x * sinRotation + aVertex.y * cosRotation;\n\t\n\t\tvec2 v = vec2(x, y);\n\t\tv = v + aPosition;\n\t\n\t\tgl_Position = vec4((uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\t\n\t\tif(uRound == 1.0)\n\t\t{\n\t\t\tgl_Position.xy = roundPixels(gl_Position.xy, uResolution);\n\t\t}\n\t\n\t\tvUV = aUV;\n\t\tvColor = aColor * uColor;\n\t}\n\t",Na="\n\tstruct ParticleUniforms {\n\t uProjectionMatrix:mat3x3<f32>,\n\t uResolution:vec2<f32>,\n\t uRoundPixels:f32,\n\t};\n\t\n\t@group(0) @binding(0) var<uniform> uniforms: ParticleUniforms;\n\t\n\t@group(1) @binding(0) var uTexture: texture_2d<f32>;\n\t@group(1) @binding(1) var uSampler : sampler;\n\t\n\tstruct VSOutput {\n\t\t@builtin(position) position: vec4<f32>,\n\t\t@location(0) uv : vec2<f32>,\n\t\t@location(1) color : vec4<f32>,\n\t };\n\t@vertex\n\tfn mainVertex(\n\t @location(0) aVertex: vec2<f32>,\n\t @location(1) aPosition: vec2<f32>,\n\t @location(2) aUV: vec2<f32>,\n\t @location(3) aColor: vec4<f32>,\n\t @location(4) aRotation: f32,\n\t) -> VSOutput {\n\t \n\t let v = vec2(\n\t\t aVertex.x * cos(aRotation) - aVertex.y * sin(aRotation),\n\t\t aVertex.x * sin(aRotation) + aVertex.y * cos(aRotation)\n\t ) + aPosition;\n\t\n\t let position = vec4((uniforms.uProjectionMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);\n\t\n\t return VSOutput(\n\t position,\n\t aUV,\n\t aColor,\n\t );\n\t}\n\t\n\t@fragment\n\tfn mainFragment(\n\t @location(0) uv: vec2<f32>,\n\t @location(1) color: vec4<f32>,\n\t @builtin(position) position: vec4<f32>,\n\t) -> @location(0) vec4<f32> {\n\t\n\t\tvar sample = textureSample(uTexture, uSampler, uv) * color;\n\t \n\t\treturn sample;\n\t}";class za extends oo{constructor(){super({glProgram:Wi.from({vertex:ja,fragment:Ga}),gpuProgram:ts.from({fragment:{source:Na,entryPoint:"mainFragment"},vertex:{source:Na,entryPoint:"mainVertex"}}),resources:{uTexture:$r.WHITE.source,uSampler:new Rr({}),uniforms:{uTranslationMatrix:{value:new st,type:"mat3x3<f32>"},uColor:{value:new Z(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}class Wa{constructor(t,e){this.state=Ea.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new qs({uTranslationMatrix:{value:new st,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new za,this.state=Ea.for2d()}validateRenderable(t){return!1}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t)}getBuffers(t){return this._gpuBufferHash[t.uid]||this._initBuffer(t)}_initBuffer(t){return this._gpuBufferHash[t.uid]=new La({size:t.particleChildren.length,properties:t._properties}),t.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[t.uid]}updateRenderable(t){}destroyRenderable(t){this._gpuBufferHash[t.uid].destroy(),this._gpuBufferHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}execute(t){const e=t.particleChildren;if(0===e.length)return;const r=this.renderer,n=this.getBuffers(t);t.texture||(t.texture=e[0].texture);const i=this.state;n.update(e,t._childrenDirty),t._childrenDirty=!1,i.blendMode=Zn(t.blendMode,t.texture._source);const s=this.localUniforms.uniforms,o=s.uTranslationMatrix;t.worldTransform.copyTo(o),o.prepend(r.globalUniforms.globalUniformData.projectionMatrix),s.uResolution=r.globalUniforms.globalUniformData.resolution,s.uRound=r._roundPixels|t._roundPixels,Aa(t.groupColorAlpha,s.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}class Va extends Wa{constructor(t){super(t,new Ba)}}Va.extension={type:[c.WebGLPipes],name:"particle"};class Ha{execute(t,e){const r=t.renderer,n=e.shader||t.defaultShader;n.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),n.groups[1]=r.texture.getTextureBindGroup(e.texture);const i=t.state,s=t.getBuffers(e);r.encoder.draw({geometry:s.geometry,shader:e.shader||t.defaultShader,state:i,size:6*e.particleChildren.length})}}class Xa extends Wa{constructor(t){super(t,new Ha)}}Xa.extension={type:[c.WebGPUPipes],name:"particle"},p.add(Va),p.add(Xa);class Ka{constructor(){this.batcherName="default",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}}class Ya{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(const t in this._gpuText){const e=this._gpuText[t];if(!e)continue;const r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){const e=this._getGpuText(t),r=t._getKey();return e.currentKey!==r}addRenderable(t,e){const r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){const e=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),e._batcher.updateElement(e)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){const e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),dt.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){const e=t._getKey(),r=this._getGpuText(t),n=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1;const i=t._style.padding;rn(n.bounds,t._anchor,n.texture,i)}_updateGpuText(t){const e=this._getGpuText(t),r=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=r.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),r.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){const e={texture:null,currentKey:"--",batchableSprite:dt.get(Ka)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}}Ya.extension={type:[c.WebGLPipes,c.WebGPUPipes,c.CanvasPipes],name:"text"};class Qa{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){const r=Xe.get().createCanvas();r.width=t,r.height=e;const n=r.getContext("2d");return{canvas:r,context:n}}getOptimalCanvasAndContext(t,e,r=1){t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6);const n=((t=xr(t))<<17)+((e=xr(e))<<1);this._canvasPool[n]||(this._canvasPool[n]=[]);let i=this._canvasPool[n].pop();return i||(i=this._createCanvasAndContext(t,e)),i}returnCanvasAndContext(t){const e=t.canvas,{width:r,height:n}=e,i=(r<<17)+(n<<1);t.context.clearRect(0,0,r,n),this._canvasPool[i].push(t)}clear(){this._canvasPool={}}}const $a=new Qa;var qa=Object.defineProperty,Za=Object.defineProperties,Ja=Object.getOwnPropertyDescriptors,tl=Object.getOwnPropertySymbols,el=Object.prototype.hasOwnProperty,rl=Object.prototype.propertyIsEnumerable,nl=(t,e,r)=>e in t?qa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;let il=0;class sl{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,r){const n=new Gr(((t,e)=>Za(t,Ja(e)))(((t,e)=>{for(var r in e||(e={}))el.call(e,r)&&nl(t,r,e[r]);if(tl)for(var r of tl(e))rl.call(e,r)&&nl(t,r,e[r]);return t})({},this.textureOptions),{width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!0}));return new $r({source:n,label:"texturePool_"+il++})}getOptimalTexture(t,e,r=1,n){let i=Math.ceil(t*r-1e-6),s=Math.ceil(e*r-1e-6);i=xr(i),s=xr(s);const o=(i<<17)+(s<<1)+(n?1:0);this._texturePool[o]||(this._texturePool[o]=[]);let a=this._texturePool[o].pop();return a||(a=this.createTexture(i,s,n)),a.source._resolution=r,a.source.width=i/r,a.source.height=s/r,a.source.pixelWidth=i,a.source.pixelHeight=s,a.frame.x=0,a.frame.y=0,a.frame.width=t,a.frame.height=e,a.updateUvs(),this._poolKeyHash[a.uid]=o,a}getSameSizeTexture(t,e=!1){const r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t){const e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=!1!==t)for(const t in this._texturePool){const e=this._texturePool[t];if(e)for(let t=0;t<e.length;t++)e[t].destroy(!0)}this._texturePool={}}}const ol=new sl;function al(t,e,r){for(let n=0,i=4*r*e;n<e;++n,i+=4)if(0!==t[i+3])return!1;return!0}function ll(t,e,r,n,i){const s=4*e;for(let e=n,o=n*s+4*r;e<=i;++e,o+=s)if(0!==t[o+3])return!1;return!0}function _l(t,e=1){const{width:r,height:n}=t,i=t.getContext("2d",{willReadFrequently:!0});if(null===i)throw new TypeError("Failed to get canvas 2D context");const s=i.getImageData(0,0,r,n).data;let o=0,a=0,l=r-1,_=n-1;for(;a<n&&al(s,r,a);)++a;if(a===n)return Ct.EMPTY;for(;al(s,r,_);)--_;for(;ll(s,r,o,a,_);)++o;for(;ll(s,r,l,a,_);)--l;return++l,++_,new Ct(o/e,a/e,(l-o)/e,(_-a)/e)}const ul=class t{constructor(t,e,r,n){this.uid=ut("fillGradient"),this.type="linear",this.gradientStops=[],this._styleKey=null,this.x0=t,this.y0=e,this.x1=r,this.y1=n}addColorStop(t,e){return this.gradientStops.push({offset:t,color:Z.shared.setValue(e).toHexa()}),this._styleKey=null,this}buildLinearGradient(){const e=t.defaultTextureSize,{gradientStops:r}=this,n=Xe.get().createCanvas();n.width=e,n.height=e;const i=n.getContext("2d"),s=i.createLinearGradient(0,0,t.defaultTextureSize,1);for(let t=0;t<r.length;t++){const e=r[t];s.addColorStop(e.offset,e.color)}i.fillStyle=s,i.fillRect(0,0,e,e),this.texture=new $r({source:new gn({resource:n,addressModeU:"clamp-to-edge",addressModeV:"repeat"})});const{x0:o,y0:a,x1:l,y1:_}=this,u=new st,c=l-o,h=_-a,d=Math.sqrt(c*c+h*h),p=Math.atan2(h,c);u.translate(-o,-a),u.scale(1/e,1/e),u.rotate(-p),u.scale(256/d,1),this.transform=u,this._styleKey=null}get styleKey(){if(this._styleKey)return this._styleKey;const t=this.gradientStops.map((t=>`${t.offset}-${t.color}`)).join("-"),e=this.texture.uid,r=this.transform.toArray().join("-");return`fill-gradient-${this.uid}-${t}-${e}-${r}-${this.x0}-${this.y0}-${this.x1}-${this.y1}`}};ul.defaultTextureSize=256;let cl=ul;const hl={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};class dl{constructor(t,e){this.uid=ut("fillPattern"),this.transform=new st,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=hl[e].addressModeU,t.source.style.addressModeV=hl[e].addressModeV)}setTransform(t){const e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey||(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`),this._styleKey}}var pl=function(t){var e=[];return t.replace(vl,(function(t,r,n){var i=r.toLowerCase();for(n=function(t){var e=t.match(fl);return e?e.map(Number):[]}(n),"m"==i&&n.length>2&&(e.push([r].concat(n.splice(0,2))),i="l",r="m"==r?"l":"L");;){if(n.length==yl[i])return n.unshift(r),e.push(n);if(n.length<yl[i])throw new Error("malformed path data");e.push([r].concat(n.splice(0,yl[i])))}})),e},yl={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},vl=/([astvzqmhlc])([^astvzqmhlc]*)/gi;var fl=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;var ml=y(pl);function gl(t,e){const r=ml(t),n=[];let i=null,s=0,o=0;for(let t=0;t<r.length;t++){const a=r[t],l=a[0],_=a;switch(l){case"M":s=_[1],o=_[2],e.moveTo(s,o);break;case"m":s+=_[1],o+=_[2],e.moveTo(s,o);break;case"H":s=_[1],e.lineTo(s,o);break;case"h":s+=_[1],e.lineTo(s,o);break;case"V":o=_[1],e.lineTo(s,o);break;case"v":o+=_[1],e.lineTo(s,o);break;case"L":s=_[1],o=_[2],e.lineTo(s,o);break;case"l":s+=_[1],o+=_[2],e.lineTo(s,o);break;case"C":s=_[5],o=_[6],e.bezierCurveTo(_[1],_[2],_[3],_[4],s,o);break;case"c":e.bezierCurveTo(s+_[1],o+_[2],s+_[3],o+_[4],s+_[5],o+_[6]),s+=_[5],o+=_[6];break;case"S":s=_[3],o=_[4],e.bezierCurveToShort(_[1],_[2],s,o);break;case"s":e.bezierCurveToShort(s+_[1],o+_[2],s+_[3],o+_[4]),s+=_[3],o+=_[4];break;case"Q":s=_[3],o=_[4],e.quadraticCurveTo(_[1],_[2],s,o);break;case"q":e.quadraticCurveTo(s+_[1],o+_[2],s+_[3],o+_[4]),s+=_[3],o+=_[4];break;case"T":s=_[1],o=_[2],e.quadraticCurveToShort(s,o);break;case"t":s+=_[1],o+=_[2],e.quadraticCurveToShort(s,o);break;case"A":s=_[6],o=_[7],e.arcToSvg(_[1],_[2],_[3],_[4],_[5],s,o);break;case"a":s+=_[6],o+=_[7],e.arcToSvg(_[1],_[2],_[3],_[4],_[5],s,o);break;case"Z":case"z":e.closePath(),n.length>0&&(i=n.pop(),i?(s=i.startX,o=i.startY):(s=0,o=0)),i=null}"Z"!==l&&"z"!==l&&null===i&&(i={startX:s,startY:o},n.push(i))}return e}class xl{constructor(t=0,e=0,r=0){this.type="circle",this.x=t,this.y=e,this.radius=r}clone(){return new xl(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const r=this.radius*this.radius;let n=this.x-t,i=this.y-e;return n*=n,i*=i,n+i<=r}strokeContains(t,e,r){if(0===this.radius)return!1;const n=this.x-t,i=this.y-e,s=this.radius,o=r/2,a=Math.sqrt(n*n+i*i);return a<s+o&&a>s-o}getBounds(t){return(t=t||new Ct).x=this.x-this.radius,t.y=this.y-this.radius,t.width=2*this.radius,t.height=2*this.radius,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}}class bl{constructor(t=0,e=0,r=0,n=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=r,this.halfHeight=n}clone(){return new bl(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(t-this.x)/this.halfWidth,n=(e-this.y)/this.halfHeight;return r*=r,n*=n,r+n<=1}strokeContains(t,e,r){const{halfWidth:n,halfHeight:i}=this;if(n<=0||i<=0)return!1;const s=r/2,o=n-s,a=i-s,l=n+s,_=i+s,u=t-this.x,c=e-this.y;return u*u/(o*o)+c*c/(a*a)>1&&u*u/(l*l)+c*c/(_*_)<=1}getBounds(t){return(t=t||new Ct).x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=2*this.halfWidth,t.height=2*this.halfHeight,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}}function Sl(t,e,r,n,i,s){const o=i-r,a=s-n,l=o*o+a*a;let _,u,c=-1;0!==l&&(c=((t-r)*o+(e-n)*a)/l),c<0?(_=r,u=n):c>1?(_=i,u=s):(_=r+c*o,u=n+c*a);const h=t-_,d=e-u;return h*h+d*d}class Tl{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if("number"!=typeof e[0]){const t=[];for(let r=0,n=e.length;r<n;r++)t.push(e[r].x,e[r].y);e=t}this.points=e,this.closePath=!0}clone(){const t=this.points.slice(),e=new Tl(t);return e.closePath=this.closePath,e}contains(t,e){let r=!1;const n=this.points.length/2;for(let i=0,s=n-1;i<n;s=i++){const n=this.points[2*i],o=this.points[2*i+1],a=this.points[2*s],l=this.points[2*s+1];o>e!=l>e&&t<(e-o)/(l-o)*(a-n)+n&&(r=!r)}return r}strokeContains(t,e,r){const n=r/2,i=n*n,{points:s}=this,o=s.length-(this.closePath?0:2);for(let r=0;r<o;r+=2){if(Sl(t,e,s[r],s[r+1],s[(r+2)%s.length],s[(r+3)%s.length])<=i)return!0}return!1}getBounds(t){t=t||new Ct;const e=this.points;let r=1/0,n=-1/0,i=1/0,s=-1/0;for(let t=0,o=e.length;t<o;t+=2){const o=e[t],a=e[t+1];r=o<r?o:r,n=o>n?o:n,i=a<i?a:i,s=a>s?a:s}return t.x=r,t.width=n-r,t.y=i,t.height=s-i,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}const Pl=(t,e,r,n,i,s)=>{const o=t-r,a=e-n,l=Math.sqrt(o*o+a*a);return l>=i-s&&l<=i+s};class Ol{constructor(t=0,e=0,r=0,n=0,i=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=r,this.height=n,this.radius=i}getBounds(t){return(t=t||new Ct).x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new Ol(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}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 r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let n=t-(this.x+r),i=e-(this.y+r);const s=r*r;if(n*n+i*i<=s||(n=t-(this.x+this.width-r),n*n+i*i<=s)||(i=e-(this.y+this.height-r),n*n+i*i<=s)||(n=t-(this.x+r),n*n+i*i<=s))return!0}return!1}strokeContains(t,e,r){const{x:n,y:i,width:s,height:o,radius:a}=this,l=r/2,_=n+a,u=i+a,c=n+s,h=i+o;return(t>=n-l&&t<=n+l||t>=c-l&&t<=c+l)&&e>=u&&e<=u+(o-2*a)||(e>=i-l&&e<=i+l||e>=h-l&&e<=h+l)&&t>=_&&t<=_+(s-2*a)||(t<_&&e<u&&Pl(t,e,_,u,a,l)||t>c-a&&e<u&&Pl(t,e,c-a,u,a,l)||t>c-a&&e>h-a&&Pl(t,e,c-a,h-a,a,l)||t<_&&e>h-a&&Pl(t,e,_,h-a,a,l))}}const Ml=1.1920929e-7;function wl(t,e,r,n,i,s,o,a,l,_){let u=(1-Math.min(.99,Math.max(0,null!=_?_:Ma.defaultOptions.bezierSmoothness)))/1;return u*=u,function(t,e,r,n,i,s,o,a,l,_){Cl(t,e,r,n,i,s,o,a,l,_,0),l.push(o,a)}(e,r,n,i,s,o,a,l,t,u),t}function Cl(t,e,r,n,i,s,o,a,l,_,u){if(u>8)return;Math.PI;const c=(t+r)/2,h=(e+n)/2,d=(r+i)/2,p=(n+s)/2,y=(i+o)/2,v=(s+a)/2,f=(c+d)/2,m=(h+p)/2,g=(d+y)/2,x=(p+v)/2,b=(f+g)/2,S=(m+x)/2;if(u>0){let u=o-t,c=a-e;const h=Math.abs((r-o)*c-(n-a)*u),d=Math.abs((i-o)*c-(s-a)*u);if(h>Ml&&d>Ml){if((h+d)*(h+d)<=_*(u*u+c*c))return void l.push(b,S)}else if(h>Ml){if(h*h<=_*(u*u+c*c))return void l.push(b,S)}else if(d>Ml){if(d*d<=_*(u*u+c*c))return void l.push(b,S)}else if(u=b-(t+o)/2,c=S-(e+a)/2,u*u+c*c<=_)return void l.push(b,S)}Cl(t,e,c,h,f,m,b,S,l,_,u+1),Cl(b,S,g,x,y,v,o,a,l,_,u+1)}function El(t,e,r,n,i,s,o,a){let l=(1-Math.min(.99,Math.max(0,null!=a?a:Ma.defaultOptions.bezierSmoothness)))/1;return l*=l,function(t,e,r,n,i,s,o,a){Al(o,t,e,r,n,i,s,a,0),o.push(i,s)}(e,r,n,i,s,o,t,l),t}function Al(t,e,r,n,i,s,o,a,l){if(l>8)return;Math.PI;const _=(e+n)/2,u=(r+i)/2,c=(n+s)/2,h=(i+o)/2,d=(_+c)/2,p=(u+h)/2;let y=s-e,v=o-r;const f=Math.abs((n-s)*v-(i-o)*y);if(f>1.1920929e-7){if(f*f<=a*(y*y+v*v))return void t.push(d,p)}else if(y=d-(e+s)/2,v=p-(r+o)/2,y*y+v*v<=a)return void t.push(d,p);Al(t,e,r,_,u,d,p,a,l+1),Al(t,d,p,c,h,s,o,a,l+1)}function Rl(t,e,r,n,i,s,o,a){let l=Math.abs(i-s);(!o&&i>s||o&&s>i)&&(l=2*Math.PI-l),a=a||Math.max(6,Math.floor(6*Math.pow(n,.3333333333333333)*(l/Math.PI)));let _=l/(a=Math.max(a,3)),u=i;_*=o?-1:1;for(let i=0;i<a+1;i++){const i=e+Math.cos(u)*n,s=r+Math.sin(u)*n;t.push(i,s),u+=_}}function Il(t,e,r,n,i,s){const o=t[t.length-2],a=t[t.length-1]-r,l=o-e,_=i-r,u=n-e,c=Math.abs(a*u-l*_);if(c<1e-8||0===s)return void((t[t.length-2]!==e||t[t.length-1]!==r)&&t.push(e,r));const h=a*a+l*l,d=_*_+u*u,p=a*_+l*u,y=s*Math.sqrt(h)/c,v=s*Math.sqrt(d)/c,f=y*p/h,m=v*p/d,g=y*u+v*l,x=y*_+v*a,b=l*(v+f),S=a*(v+f),T=u*(y+m),P=_*(y+m);Rl(t,g+e,x+r,s,Math.atan2(S-x,b-g),Math.atan2(P-x,T-g),l*_>u*a)}const Dl=2*Math.PI,Bl={centerX:0,centerY:0,ang1:0,ang2:0},kl=({x:t,y:e},r,n,i,s,o,a,l)=>{const _=i*(t*=r)-s*(e*=n),u=s*t+i*e;return l.x=_+o,l.y=u+a,l};function Ul(t,e){const r=-1.5707963267948966===e?-.551915024494:1.3333333333333333*Math.tan(e/4),n=1.5707963267948966===e?.551915024494:r,i=Math.cos(t),s=Math.sin(t),o=Math.cos(t+e),a=Math.sin(t+e);return[{x:i-s*n,y:s+i*n},{x:o+a*n,y:a-o*n},{x:o,y:a}]}const Fl=(t,e,r,n)=>{let i=t*r+e*n;return i>1&&(i=1),i<-1&&(i=-1),(t*n-e*r<0?-1:1)*Math.acos(i)};function Ll(t,e,r,n,i,s,o,a=0,l=0,_=0){if(0===s||0===o)return;const u=Math.sin(a*Dl/360),c=Math.cos(a*Dl/360),h=c*(e-n)/2+u*(r-i)/2,d=-u*(e-n)/2+c*(r-i)/2;if(0===h&&0===d)return;s=Math.abs(s),o=Math.abs(o);const p=Math.pow(h,2)/Math.pow(s,2)+Math.pow(d,2)/Math.pow(o,2);p>1&&(s*=Math.sqrt(p),o*=Math.sqrt(p)),((t,e,r,n,i,s,o,a,l,_,u,c,h)=>{const d=Math.pow(i,2),p=Math.pow(s,2),y=Math.pow(u,2),v=Math.pow(c,2);let f=d*p-d*v-p*y;f<0&&(f=0),f/=d*v+p*y,f=Math.sqrt(f)*(o===a?-1:1);const m=f*i/s*c,g=f*-s/i*u,x=_*m-l*g+(t+r)/2,b=l*m+_*g+(e+n)/2,S=(u-m)/i,T=(c-g)/s,P=(-u-m)/i,O=(-c-g)/s,M=Fl(1,0,S,T);let w=Fl(S,T,P,O);0===a&&w>0&&(w-=Dl),1===a&&w<0&&(w+=Dl),h.centerX=x,h.centerY=b,h.ang1=M,h.ang2=w})(e,r,n,i,s,o,l,_,u,c,h,d,Bl);let{ang1:y,ang2:v}=Bl;const{centerX:f,centerY:m}=Bl;let g=Math.abs(v)/(Dl/4);Math.abs(1-g)<1e-7&&(g=1);const x=Math.max(Math.ceil(g),1);v/=x;let b=t[t.length-2],S=t[t.length-1];const T={x:0,y:0};for(let e=0;e<x;e++){const e=Ul(y,v),{x:r,y:n}=kl(e[0],s,o,c,u,f,m,T),{x:i,y:a}=kl(e[1],s,o,c,u,f,m,T),{x:l,y:_}=kl(e[2],s,o,c,u,f,m,T);wl(t,b,S,r,n,i,a,l,_),b=l,S=_,y+=v}}function Gl(t,e,r){var n;const i=(t,e)=>{const r=e.x-t.x,n=e.y-t.y,i=Math.sqrt(r*r+n*n);return{len:i,nx:r/i,ny:n/i}},s=(e,r)=>{0===e?t.moveTo(r.x,r.y):t.lineTo(r.x,r.y)};let o=e[e.length-1];for(let a=0;a<e.length;a++){const l=e[a%e.length],_=null!=(n=l.radius)?n:r;if(_<=0){s(a,l),o=l;continue}const u=e[(a+1)%e.length],c=i(l,o),h=i(l,u);if(c.len<1e-4||h.len<1e-4){s(a,l),o=l;continue}let d=Math.asin(c.nx*h.ny-c.ny*h.nx),p=1,y=!1;c.nx*h.nx-c.ny*-h.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,p=-1,y=!0):d>0&&(p=-1,y=!0);const v=d/2;let f,m=Math.abs(Math.cos(v)*_/Math.sin(v));m>Math.min(c.len/2,h.len/2)?(m=Math.min(c.len/2,h.len/2),f=Math.abs(m*Math.sin(v)/Math.cos(v))):f=_;const g=l.x+h.nx*m+-h.ny*f*p,x=l.y+h.ny*m+h.nx*f*p,b=Math.atan2(c.ny,c.nx)+Math.PI/2*p,S=Math.atan2(h.ny,h.nx)-Math.PI/2*p;0===a&&t.moveTo(g+Math.cos(b)*f,x+Math.sin(b)*f),t.arc(g,x,f,b,S,y),o=l}}function jl(t,e,r,n){var i;const s=(t,e)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2),o=(t,e,r)=>({x:t.x+(e.x-t.x)*r,y:t.y+(e.y-t.y)*r}),a=e.length;for(let l=0;l<a;l++){const _=e[(l+1)%a],u=null!=(i=_.radius)?i:r;if(u<=0){0===l?t.moveTo(_.x,_.y):t.lineTo(_.x,_.y);continue}const c=e[l],h=e[(l+2)%a],d=s(c,_);let p;if(d<1e-4)p=_;else{p=o(_,c,Math.min(d/2,u)/d)}const y=s(h,_);let v;if(y<1e-4)v=_;else{v=o(_,h,Math.min(y/2,u)/y)}0===l?t.moveTo(p.x,p.y):t.lineTo(p.x,p.y),t.quadraticCurveTo(_.x,_.y,v.x,v.y,n)}}const Nl=new Ct;class zl{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new At,this._graphicsPath2D=t}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();const r=this._currentPoly.points,n=r[r.length-2],i=r[r.length-1];return(n!==t||i!==e)&&r.push(t,e),this}arc(t,e,r,n,i,s){this._ensurePoly(!1);return Rl(this._currentPoly.points,t,e,r,n,i,s),this}arcTo(t,e,r,n,i){this._ensurePoly();return Il(this._currentPoly.points,t,e,r,n,i),this}arcToSvg(t,e,r,n,i,s,o){return Ll(this._currentPoly.points,this._currentPoly.lastX,this._currentPoly.lastY,s,o,t,e,r,n,i),this}bezierCurveTo(t,e,r,n,i,s,o){this._ensurePoly();const a=this._currentPoly;return wl(this._currentPoly.points,a.lastX,a.lastY,t,e,r,n,i,s,o),this}quadraticCurveTo(t,e,r,n,i){this._ensurePoly();const s=this._currentPoly;return El(this._currentPoly.points,s.lastX,s.lastY,t,e,r,n,i),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0)).transform(e);for(let e=0;e<t.instructions.length;e++){const r=t.instructions[e];this[r.action](...r.data)}return this}finish(t=!1){this.endPoly(t)}rect(t,e,r,n,i){return this.drawShape(new Ct(t,e,r,n),i),this}circle(t,e,r,n){return this.drawShape(new xl(t,e,r),n),this}poly(t,e,r){const n=new Tl(t);return n.closePath=e,this.drawShape(n,r),this}regularPoly(t,e,r,n,i=0,s){n=Math.max(0|n,3);const o=-1*Math.PI/2+i,a=2*Math.PI/n,l=[];for(let i=0;i<n;i++){const n=i*a+o;l.push(t+r*Math.cos(n),e+r*Math.sin(n))}return this.poly(l,!0,s),this}roundPoly(t,e,r,n,i,s=0,o){if(n=Math.max(0|n,3),i<=0)return this.regularPoly(t,e,r,n,s);const a=r*Math.sin(Math.PI/n)-.001;i=Math.min(i,a);const l=-1*Math.PI/2+s,_=2*Math.PI/n,u=(n-2)*Math.PI/n/2;for(let s=0;s<n;s++){const n=s*_+l,a=t+r*Math.cos(n),c=e+r*Math.sin(n),h=n+Math.PI+u,d=n-Math.PI-u,p=a+i*Math.cos(h),y=c+i*Math.sin(h),v=a+i*Math.cos(d),f=c+i*Math.sin(d);0===s?this.moveTo(p,y):this.lineTo(p,y),this.quadraticCurveTo(a,c,v,f,o)}return this.closePath()}roundShape(t,e,r=!1,n){return t.length<3?this:(r?jl(this,t,e,n):Gl(this,t,e),this.closePath())}filletRect(t,e,r,n,i){if(0===i)return this.rect(t,e,r,n);const s=Math.min(r,n)/2,o=Math.min(s,Math.max(-s,i)),a=t+r,l=e+n,_=o<0?-o:0,u=Math.abs(o);return this.moveTo(t,e+u).arcTo(t+_,e+_,t+u,e,u).lineTo(a-u,e).arcTo(a-_,e+_,a,e+u,u).lineTo(a,l-u).arcTo(a-_,l-_,t+r-u,l,u).lineTo(t+u,l).arcTo(t+_,l-_,t,l-u,u).closePath()}chamferRect(t,e,r,n,i,s){if(i<=0)return this.rect(t,e,r,n);const o=Math.min(i,Math.min(r,n)/2),a=t+r,l=e+n,_=[t+o,e,a-o,e,a,e+o,a,l-o,a-o,l,t+o,l,t,l-o,t,e+o];for(let t=_.length-1;t>=2;t-=2)_[t]===_[t-2]&&_[t-1]===_[t-3]&&_.splice(t-1,2);return this.poly(_,!0,s)}ellipse(t,e,r,n,i){return this.drawShape(new bl(t,e,r,n),i),this}roundRect(t,e,r,n,i,s){return this.drawShape(new Ol(t,e,r,n,i),s),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let r=this._currentPoly;return r&&this.endPoly(),r=new Tl,r.points.push(t,e),this._currentPoly=r,this}endPoly(t=!1){const e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new Tl,t)){const t=this.shapePrimitives[this.shapePrimitives.length-1];if(t){let e=t.shape.x,r=t.shape.y;if(t.transform&&!t.transform.isIdentity()){const n=t.transform,i=e;e=n.a*e+n.c*r+n.tx,r=n.b*i+n.d*r+n.ty}this._currentPoly.points.push(e,r)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){const r=t.instructions[e];this[r.action](...r.data)}this.finish()}get bounds(){const t=this._bounds;t.clear();const e=this.shapePrimitives;for(let r=0;r<e.length;r++){const n=e[r],i=n.shape.getBounds(Nl);n.transform?t.addRect(i,n.transform):t.addRect(i)}return t}}class Wl{constructor(t){var e;this.instructions=[],this.uid=ut("graphicsPath"),this._dirty=!0,"string"==typeof t?gl(t,this):this.instructions=null!=(e=null==t?void 0:t.slice())?e:[]}get shapePath(){return this._shapePath||(this._shapePath=new zl(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,r,n,i){const s=this.instructions[this.instructions.length-1],o=this.getLastPoint(nt.shared);let a=0,l=0;if(s&&"bezierCurveTo"===s.action){a=s.data[2],l=s.data[3];const t=o.x,e=o.y;a=t+(t-a),l=e+(e-l)}else a=o.x,l=o.y;return this.instructions.push({action:"bezierCurveTo",data:[a,l,t,e,r,n,i]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,r){const n=this.instructions[this.instructions.length-1],i=this.getLastPoint(nt.shared);let s=0,o=0;if(n&&"quadraticCurveTo"===n.action){s=n.data[0],o=n.data[1];const t=i.x,e=i.y;s=t+(t-s),o=e+(e-o)}else s=i.x,o=i.y;return this.instructions.push({action:"quadraticCurveTo",data:[s,o,t,e,r]}),this._dirty=!0,this}rect(t,e,r,n,i){return this.instructions.push({action:"rect",data:[t,e,r,n,i]}),this._dirty=!0,this}circle(t,e,r,n){return this.instructions.push({action:"circle",data:[t,e,r,n]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,r,n,i,s,o){i=i||n/2;const a=-1*Math.PI/2+s,l=2*r,_=2*Math.PI/l,u=[];for(let r=0;r<l;r++){const s=r%2?i:n,o=r*_+a;u.push(t+s*Math.cos(o),e+s*Math.sin(o))}return this.poly(u,!0,o),this}clone(t=!1){const e=new Wl;if(t)for(let t=0;t<this.instructions.length;t++){const r=this.instructions[t];e.instructions.push({action:r.action,data:r.data.slice()})}else e.instructions=this.instructions.slice();return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;const e=t.a,r=t.b,n=t.c,i=t.d,s=t.tx,o=t.ty;let a=0,l=0,_=0,u=0,c=0,h=0,d=0,p=0;for(let y=0;y<this.instructions.length;y++){const v=this.instructions[y],f=v.data;switch(v.action){case"moveTo":case"lineTo":a=f[0],l=f[1],f[0]=e*a+n*l+s,f[1]=r*a+i*l+o;break;case"bezierCurveTo":_=f[0],u=f[1],c=f[2],h=f[3],a=f[4],l=f[5],f[0]=e*_+n*u+s,f[1]=r*_+i*u+o,f[2]=e*c+n*h+s,f[3]=r*c+i*h+o,f[4]=e*a+n*l+s,f[5]=r*a+i*l+o;break;case"quadraticCurveTo":_=f[0],u=f[1],a=f[2],l=f[3],f[0]=e*_+n*u+s,f[1]=r*_+i*u+o,f[2]=e*a+n*l+s,f[3]=r*a+i*l+o;break;case"arcToSvg":a=f[5],l=f[6],d=f[0],p=f[1],f[0]=e*d+n*p,f[1]=r*d+i*p,f[5]=e*a+n*l+s,f[6]=r*a+i*l+o;break;case"circle":f[4]=Vl(f[3],t);break;case"rect":f[4]=Vl(f[4],t);break;case"ellipse":f[8]=Vl(f[8],t);break;case"roundRect":f[5]=Vl(f[5],t);break;case"addPath":f[0].transform(t);break;case"poly":f[2]=Vl(f[2],t)}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,r=this.instructions[e];if(!r)return t.x=0,t.y=0,t;for(;"closePath"===r.action;){if(e--,e<0)return t.x=0,t.y=0,t;r=this.instructions[e]}switch(r.action){case"moveTo":case"lineTo":t.x=r.data[0],t.y=r.data[1];break;case"quadraticCurveTo":t.x=r.data[2],t.y=r.data[3];break;case"bezierCurveTo":t.x=r.data[4],t.y=r.data[5];break;case"arc":case"arcToSvg":t.x=r.data[5],t.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(t)}return t}}function Vl(t,e){return t?t.prepend(e):e.clone()}var Hl=Object.defineProperty,Xl=Object.getOwnPropertySymbols,Kl=Object.prototype.hasOwnProperty,Yl=Object.prototype.propertyIsEnumerable,Ql=(t,e,r)=>e in t?Hl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$l=(t,e)=>{for(var r in e||(e={}))Kl.call(e,r)&&Ql(t,r,e[r]);if(Xl)for(var r of Xl(e))Yl.call(e,r)&&Ql(t,r,e[r]);return t};function ql(t,e){if("string"==typeof t){const e=document.createElement("div");e.innerHTML=t.trim(),t=e.querySelector("svg")}return Zl(t,{context:e,path:new Wl},null,null),e}function Zl(t,e,r,n){const i=t.children,{fillStyle:s,strokeStyle:o}=function(t){const e=t.getAttribute("style"),r={},n={};let i=!1,s=!1;if(e){const t=e.split(";");for(let e=0;e<t.length;e++){const o=t[e],[a,l]=o.split(":");switch(a){case"stroke":"none"!==l&&(r.color=Z.shared.setValue(l).toNumber(),s=!0);break;case"stroke-width":r.width=Number(l);break;case"fill":"none"!==l&&(i=!0,n.color=Z.shared.setValue(l).toNumber());break;case"fill-opacity":n.alpha=Number(l);break;case"stroke-opacity":r.alpha=Number(l);break;case"opacity":n.alpha=Number(l),r.alpha=Number(l)}}}else{const e=t.getAttribute("stroke");e&&"none"!==e&&(s=!0,r.color=Z.shared.setValue(e).toNumber(),r.width=Jl(t,"stroke-width",1));const o=t.getAttribute("fill");o&&"none"!==o&&(i=!0,n.color=Z.shared.setValue(o).toNumber())}return{strokeStyle:s?r:null,fillStyle:i?n:null}}(t);let a,l,_,u,c,h,d,p,y,v,f,m,g,x,b,S,T;switch(s&&r?r=$l($l({},r),s):s&&(r=s),o&&n?n=$l($l({},n),o):o&&(n=o),e.context.fillStyle=r,e.context.strokeStyle=n,t.nodeName.toLowerCase()){case"path":x=t.getAttribute("d"),b=new Wl(x),e.context.path(b),r&&e.context.fill(),n&&e.context.stroke();break;case"circle":d=Jl(t,"cx",0),p=Jl(t,"cy",0),y=Jl(t,"r",0),e.context.ellipse(d,p,y,y),r&&e.context.fill(),n&&e.context.stroke();break;case"rect":a=Jl(t,"x",0),l=Jl(t,"y",0),S=Jl(t,"width",0),T=Jl(t,"height",0),v=Jl(t,"rx",0),f=Jl(t,"ry",0),v||f?e.context.roundRect(a,l,S,T,v||f):e.context.rect(a,l,S,T),r&&e.context.fill(),n&&e.context.stroke();break;case"ellipse":d=Jl(t,"cx",0),p=Jl(t,"cy",0),v=Jl(t,"rx",0),f=Jl(t,"ry",0),e.context.beginPath(),e.context.ellipse(d,p,v,f),r&&e.context.fill(),n&&e.context.stroke();break;case"line":_=Jl(t,"x1",0),u=Jl(t,"y1",0),c=Jl(t,"x2",0),h=Jl(t,"y2",0),e.context.beginPath(),e.context.moveTo(_,u),e.context.lineTo(c,h),n&&e.context.stroke();break;case"polygon":g=t.getAttribute("points"),m=g.match(/\d+/g).map((t=>parseInt(t,10))),e.context.poly(m,!0),r&&e.context.fill(),n&&e.context.stroke();break;case"polyline":g=t.getAttribute("points"),m=g.match(/\d+/g).map((t=>parseInt(t,10))),e.context.poly(m,!1),n&&e.context.stroke();break;case"g":case"svg":break;default:console.info(`[SVG parser] <${t.nodeName}> elements unsupported`)}for(let t=0;t<i.length;t++)Zl(i[t],e,r,n)}function Jl(t,e,r){const n=t.getAttribute(e);return n?Number(n):r}var t_=Object.defineProperty,e_=Object.getOwnPropertySymbols,r_=Object.prototype.hasOwnProperty,n_=Object.prototype.propertyIsEnumerable,i_=(t,e,r)=>e in t?t_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,s_=(t,e)=>{for(var r in e||(e={}))r_.call(e,r)&&i_(t,r,e[r]);if(e_)for(var r of e_(e))n_.call(e,r)&&i_(t,r,e[r]);return t};function o_(t){return t instanceof dl}function a_(t){return t instanceof cl}function l_(t,e,r){return t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,s_(s_({},r),t)}function __(t,e,r){return e.buildLinearGradient(),t.fill=e,t.color=16777215,t.texture=e.texture,t.matrix=e.transform,s_(s_({},r),t)}function u_(t,e){if(null==t)return null;const r={},n=t;return function(t){return Z.isColorLike(t)}(t)?function(t,e,r){const n=Z.shared.setValue(null!=e?e:0);return t.color=n.toNumber(),t.alpha=1===n.alpha?r.alpha:n.alpha,t.texture=$r.WHITE,s_(s_({},r),t)}(r,t,e):o_(t)?l_(r,t,e):a_(t)?__(r,t,e):n.fill&&o_(n.fill)?l_(n,n.fill,e):n.fill&&a_(n.fill)?__(n,n.fill,e):function(t,e){var r;const n=s_(s_({},e),t);if(n.texture){if(n.texture!==$r.WHITE){const t=(null==(r=n.matrix)?void 0:r.invert())||new st;t.translate(n.texture.frame.x,n.texture.frame.y),t.scale(1/n.texture.source.width,1/n.texture.source.height),n.matrix=t}const t=n.texture.source.style;"clamp-to-edge"===t.addressMode&&(t.addressMode="repeat",t.update())}const i=Z.shared.setValue(n.color);return n.alpha*=i.alpha,n.color=i.toNumber(),n.matrix=n.matrix?n.matrix.clone():null,n}(n,e)}function c_(t,e){const r=e,{width:n,alignment:i,miterLimit:s,cap:o,join:a}=r,l=((t,e)=>{var r={};for(var n in t)r_.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&e_)for(var n of e_(t))e.indexOf(n)<0&&n_.call(t,n)&&(r[n]=t[n]);return r})(r,["width","alignment","miterLimit","cap","join"]),_=u_(t,l);return _?s_({width:n,alignment:i,miterLimit:s,cap:o,join:a},_):null}var h_=Object.defineProperty,d_=Object.getOwnPropertySymbols,p_=Object.prototype.hasOwnProperty,y_=Object.prototype.propertyIsEnumerable,v_=(t,e,r)=>e in t?h_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,f_=(t,e)=>{for(var r in e||(e={}))p_.call(e,r)&&v_(t,r,e[r]);if(d_)for(var r of d_(e))y_.call(e,r)&&v_(t,r,e[r]);return t};const m_=new nt,g_=new st,x_=class t extends f{constructor(){super(...arguments),this.uid=ut("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Wl,this._transform=new st,this._fillStyle=f_({},t.defaultFillStyle),this._strokeStyle=f_({},t.defaultStrokeStyle),this._stateStack=[],this._tick=0,this._bounds=new At,this._boundsDirty=!0}clone(){const e=new t;return e.batchMode=this.batchMode,e.instructions=this.instructions.slice(),e._activePath=this._activePath.clone(),e._transform=this._transform.clone(),e._fillStyle=f_({},this._fillStyle),e._strokeStyle=f_({},this._strokeStyle),e._stateStack=this._stateStack.slice(),e._bounds=this._bounds.clone(),e._boundsDirty=!0,e}get fillStyle(){return this._fillStyle}set fillStyle(e){this._fillStyle=u_(e,t.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(e){this._strokeStyle=c_(e,t.defaultStrokeStyle)}setFillStyle(e){return this._fillStyle=u_(e,t.defaultFillStyle),this}setStrokeStyle(e){return this._strokeStyle=u_(e,t.defaultStrokeStyle),this}texture(t,e,r,n,i,s){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:n||0,dw:i||t.frame.width,dh:s||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?Z.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Wl,this}fill(e,r){let n;const i=this.instructions[this.instructions.length-1];return n=0===this._tick&&i&&"stroke"===i.action?i.data.path:this._activePath.clone(),n?(null!=e&&(void 0!==r&&"number"==typeof e&&(e={color:e,alpha:r}),this._fillStyle=u_(e,t.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:n}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(nt.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(e){let r;const n=this.instructions[this.instructions.length-1];return r=0===this._tick&&n&&"fill"===n.action?n.data.path:this._activePath.clone(),r?(null!=e&&(this._strokeStyle=c_(e,t.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){const e=this.instructions[this.instructions.length-1-t],r=this._activePath.clone();if(e&&("stroke"===e.action||"fill"===e.action)){if(!e.data.hole){e.data.hole=r;break}e.data.hole.addPath(r)}}return this._initNextPathLocation(),this}arc(t,e,r,n,i,s){this._tick++;const o=this._transform;return this._activePath.arc(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,r,n,i,s),this}arcTo(t,e,r,n,i){this._tick++;const s=this._transform;return this._activePath.arcTo(s.a*t+s.c*e+s.tx,s.b*t+s.d*e+s.ty,s.a*r+s.c*n+s.tx,s.b*r+s.d*n+s.ty,i),this}arcToSvg(t,e,r,n,i,s,o){this._tick++;const a=this._transform;return this._activePath.arcToSvg(t,e,r,n,i,a.a*s+a.c*o+a.tx,a.b*s+a.d*o+a.ty),this}bezierCurveTo(t,e,r,n,i,s,o){this._tick++;const a=this._transform;return this._activePath.bezierCurveTo(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,a.a*r+a.c*n+a.tx,a.b*r+a.d*n+a.ty,a.a*i+a.c*s+a.tx,a.b*i+a.d*s+a.ty,o),this}closePath(){var t;return this._tick++,null==(t=this._activePath)||t.closePath(),this}ellipse(t,e,r,n){return this._tick++,this._activePath.ellipse(t,e,r,n,this._transform.clone()),this}circle(t,e,r){return this._tick++,this._activePath.circle(t,e,r,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;const r=this._transform;return this._activePath.lineTo(r.a*t+r.c*e+r.tx,r.b*t+r.d*e+r.ty),this}moveTo(t,e){this._tick++;const r=this._transform,n=this._activePath.instructions,i=r.a*t+r.c*e+r.tx,s=r.b*t+r.d*e+r.ty;return 1===n.length&&"moveTo"===n[0].action?(n[0].data[0]=i,n[0].data[1]=s,this):(this._activePath.moveTo(i,s),this)}quadraticCurveTo(t,e,r,n,i){this._tick++;const s=this._transform;return this._activePath.quadraticCurveTo(s.a*t+s.c*e+s.tx,s.b*t+s.d*e+s.ty,s.a*r+s.c*n+s.tx,s.b*r+s.d*n+s.ty,i),this}rect(t,e,r,n){return this._tick++,this._activePath.rect(t,e,r,n,this._transform.clone()),this}roundRect(t,e,r,n,i){return this._tick++,this._activePath.roundRect(t,e,r,n,i,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,r,n,i=0,s){return this._tick++,this._activePath.regularPoly(t,e,r,n,i,s),this}roundPoly(t,e,r,n,i,s){return this._tick++,this._activePath.roundPoly(t,e,r,n,i,s),this}roundShape(t,e,r,n){return this._tick++,this._activePath.roundShape(t,e,r,n),this}filletRect(t,e,r,n,i){return this._tick++,this._activePath.filletRect(t,e,r,n,i),this}chamferRect(t,e,r,n,i,s){return this._tick++,this._activePath.chamferRect(t,e,r,n,i,s),this}star(t,e,r,n,i=0,s=0){return this._tick++,this._activePath.star(t,e,r,n,i,s,this._transform.clone()),this}svg(t){return this._tick++,ql(t,this),this}restore(){const t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:f_({},this._fillStyle),strokeStyle:f_({},this._strokeStyle)}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,r,n,i,s){return t instanceof st?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,r,n,i,s),this)}transform(t,e,r,n,i,s){return t instanceof st?(this._transform.append(t),this):(g_.set(t,e,r,n,i,s),this._transform.append(g_),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;const t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){const r=this.instructions[e],n=r.action;if("fill"===n){const e=r.data;t.addBounds(e.path.bounds)}else if("texture"===n){const e=r.data;t.addFrame(e.dx,e.dy,e.dx+e.dw,e.dy+e.dh,e.transform)}if("stroke"===n){const e=r.data,n=e.style.width/2,i=e.path.bounds;t.addFrame(i.minX-n,i.minY-n,i.maxX+n,i.maxY+n)}}return t}containsPoint(t){var e;if(!this.bounds.containsPoint(t.x,t.y))return!1;const r=this.instructions;let n=!1;for(let i=0;i<r.length;i++){const s=r[i],o=s.data,a=o.path;if(!s.action||!a)continue;const l=o.style,_=a.shapePath.shapePrimitives;for(let r=0;r<_.length;r++){const i=_[r].shape;if(!l||!i)continue;const a=_[r].transform,u=a?a.applyInverse(t,m_):t;n="fill"===s.action?i.contains(u.x,u.y):i.strokeContains(u.x,u.y,l.width);const c=o.hole;if(c){const t=null==(e=c.shapePath)?void 0:e.shapePrimitives;if(t)for(let e=0;e<t.length;e++)t[e].shape.contains(u.x,u.y)&&(n=!1)}if(n)return!0}}return n}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),"boolean"==typeof t?t:null==t?void 0:t.texture){const e="boolean"==typeof t?t:null==t?void 0:t.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(e),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(e)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};x_.defaultFillStyle={color:16777215,alpha:1,texture:$r.WHITE,matrix:null,fill:null},x_.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:$r.WHITE,matrix:null,fill:null};let b_=x_;const S_=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"];function T_(t){const e=[];let r=0;for(let n=0;n<S_.length;n++){const i=`_${S_[n]}`;e[r++]=t[i]}return r=P_(t._fill,e,r),r=function(t,e,r){return t&&(r=P_(t,e,r),e[r++]=t.width,e[r++]=t.alignment,e[r++]=t.cap,e[r++]=t.join,e[r++]=t.miterLimit),r}(t._stroke,e,r),r=function(t,e,r){return t&&(e[r++]=t.alpha,e[r++]=t.angle,e[r++]=t.blur,e[r++]=t.distance,e[r++]=Z.shared.setValue(t.color).toNumber()),r}(t.dropShadow,e,r),e.join("-")}function P_(t,e,r){var n;return t&&(e[r++]=t.color,e[r++]=t.alpha,e[r++]=null==(n=t.fill)?void 0:n.styleKey),r}var O_=Object.defineProperty,M_=Object.defineProperties,w_=Object.getOwnPropertyDescriptors,C_=Object.getOwnPropertySymbols,E_=Object.prototype.hasOwnProperty,A_=Object.prototype.propertyIsEnumerable,R_=(t,e,r)=>e in t?O_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,I_=(t,e)=>{for(var r in e||(e={}))E_.call(e,r)&&R_(t,r,e[r]);if(C_)for(var r of C_(e))A_.call(e,r)&&R_(t,r,e[r]);return t};const D_=class t extends f{constructor(e={}){super(),function(t){var e,r,n,i,s;const o=t;if("boolean"==typeof o.dropShadow&&o.dropShadow){const a=B_.defaultDropShadow;t.dropShadow={alpha:null!=(e=o.dropShadowAlpha)?e:a.alpha,angle:null!=(r=o.dropShadowAngle)?r:a.angle,blur:null!=(n=o.dropShadowBlur)?n:a.blur,color:null!=(i=o.dropShadowColor)?i:a.color,distance:null!=(s=o.dropShadowDistance)?s:a.distance}}if(void 0!==o.strokeThickness){const e=o.stroke;let r={};if(Z.isColorLike(e))r.color=e;else if(e instanceof cl||e instanceof dl)r.fill=e;else{if(!Object.hasOwnProperty.call(e,"color")&&!Object.hasOwnProperty.call(e,"fill"))throw new Error("Invalid stroke value.");r=e}t.stroke=((t,e)=>M_(t,w_(e)))(I_({},r),{width:o.strokeThickness})}if(Array.isArray(o.fillGradientStops)){let e;null==t.fontSize?t.fontSize=B_.defaultTextStyle.fontSize:e="string"==typeof t.fontSize?parseInt(t.fontSize,10):t.fontSize;const r=new cl(0,0,0,1.7*e),n=o.fillGradientStops.map((t=>Z.shared.setValue(t).toNumber()));n.forEach(((t,e)=>{const i=e/(n.length-1);r.addColorStop(i,t)})),t.fill={fill:r}}}(e);const r=I_(I_({},t.defaultTextStyle),e);for(const t in r){this[t]=r[t]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(e){this._dropShadow=null!==e&&"object"==typeof e?this._createProxy(I_(I_({},t.defaultDropShadow),e)):e?this._createProxy(I_({},t.defaultDropShadow)):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize="string"==typeof t?parseInt(t,10):t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update()}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy(I_(I_({},b_.defaultFillStyle),t),(()=>{this._fill=u_(I_({},this._originalFill),b_.defaultFillStyle)}))),this._fill=u_(0===t?"black":t,b_.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy(I_(I_({},b_.defaultStrokeStyle),t),(()=>{this._stroke=c_(I_({},this._originalStroke),b_.defaultStrokeStyle)}))),this._stroke=c_(t,b_.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=T_(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){const e=t.defaultTextStyle;for(const t in e)this[t]=e[t]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new t({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?I_({},this._dropShadow):null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){var e,r,n,i;if(this.removeAllListeners(),"boolean"==typeof t?t:null==t?void 0:t.texture){const s="boolean"==typeof t?t:null==t?void 0:t.textureSource;null!=(e=this._fill)&&e.texture&&this._fill.texture.destroy(s),null!=(r=this._originalFill)&&r.texture&&this._originalFill.texture.destroy(s),null!=(n=this._stroke)&&n.texture&&this._stroke.texture.destroy(s),null!=(i=this._originalStroke)&&i.texture&&this._originalStroke.texture.destroy(s)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(t,r,n)=>(t[r]=n,null==e||e(r,n),this.update(),!0)})}_isFillStyle(t){return null!==(null!=t?t:null)&&!(Z.isColorLike(t)||t instanceof cl||t instanceof dl)}};D_.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},D_.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let B_=D_;const k_=new At;function U_(t,e,r,n){const i=k_;i.minX=0,i.minY=0,i.maxX=t.width/n|0,i.maxY=t.height/n|0;const s=ol.getOptimalTexture(i.width,i.height,n,!1);return s.source.uploadMethodId="image",s.source.resource=t,s.source.alphaMode="premultiply-alpha-on-upload",s.frame.width=e/n,s.frame.height=r/n,s.source.emit("update",s.source),s.updateUvs(),s}const F_=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function L_(t){const e="number"==typeof t.fontSize?`${t.fontSize}px`:t.fontSize;let r=t.fontFamily;Array.isArray(t.fontFamily)||(r=t.fontFamily.split(","));for(let t=r.length-1;t>=0;t--){let e=r[t].trim();!/([\"\'])[^\'\"]+\1/.test(e)&&!F_.includes(e)&&(e=`"${e}"`),r[t]=e}return`${t.fontStyle} ${t.fontVariant} ${t.fontWeight} ${e} ${r.join(",")}`}const G_={willReadFrequently:!0},j_=class t{static get experimentalLetterSpacingSupported(){let e=t._experimentalLetterSpacingSupported;if(void 0!==e){const r=Xe.get().getCanvasRenderingContext2D().prototype;e=t._experimentalLetterSpacingSupported="letterSpacing"in r||"textLetterSpacing"in r}return e}constructor(t,e,r,n,i,s,o,a,l){this.text=t,this.style=e,this.width=r,this.height=n,this.lines=i,this.lineWidths=s,this.lineHeight=o,this.maxLineWidth=a,this.fontProperties=l}static measureText(e=" ",r,n=t._canvas,i=r.wordWrap){var s;const o=`${e}:${r.styleKey}`;if(t._measurementCache[o])return t._measurementCache[o];const a=L_(r),l=t.measureFont(a);0===l.fontSize&&(l.fontSize=r.fontSize,l.ascent=r.fontSize);const _=t.__context;_.font=a;const u=(i?t._wordWrap(e,r,n):e).split(/(?:\r\n|\r|\n)/),c=new Array(u.length);let h=0;for(let e=0;e<u.length;e++){const n=t._measureText(u[e],r.letterSpacing,_);c[e]=n,h=Math.max(h,n)}const d=(null==(s=r._stroke)?void 0:s.width)||0;let p=h+d;r.dropShadow&&(p+=r.dropShadow.distance);const y=r.lineHeight||l.fontSize;let v=Math.max(y,l.fontSize+d)+(u.length-1)*(y+r.leading);return r.dropShadow&&(v+=r.dropShadow.distance),new t(e,r,p,v,u,c,y+r.leading,h,l)}static _measureText(e,r,n){let i=!1;t.experimentalLetterSpacingSupported&&(t.experimentalLetterSpacing?(n.letterSpacing=`${r}px`,n.textLetterSpacing=`${r}px`,i=!0):(n.letterSpacing="0px",n.textLetterSpacing="0px"));const s=n.measureText(e);let o=s.width;const a=-s.actualBoundingBoxLeft;let l=s.actualBoundingBoxRight-a;if(o>0)if(i)o-=r,l-=r;else{const n=(t.graphemeSegmenter(e).length-1)*r;o+=n,l+=n}return Math.max(o,l)}static _wordWrap(e,r,n=t._canvas){const i=n.getContext("2d",G_);let s=0,o="",a="";const l=Object.create(null),{letterSpacing:_,whiteSpace:u}=r,c=t._collapseSpaces(u),h=t._collapseNewlines(u);let d=!c;const p=r.wordWrapWidth+_,y=t._tokenize(e);for(let e=0;e<y.length;e++){let n=y[e];if(t._isNewline(n)){if(!h){a+=t._addLine(o),d=!c,o="",s=0;continue}n=" "}if(c){const e=t.isBreakingSpace(n),r=t.isBreakingSpace(o[o.length-1]);if(e&&r)continue}const u=t._getFromCache(n,_,l,i);if(u>p)if(""!==o&&(a+=t._addLine(o),o="",s=0),t.canBreakWords(n,r.breakWords)){const e=t.wordWrapSplit(n);for(let u=0;u<e.length;u++){let c=e[u],h=c,y=1;for(;e[u+y];){const i=e[u+y];if(t.canBreakChars(h,i,n,u,r.breakWords))break;c+=i,h=i,y++}u+=y-1;const v=t._getFromCache(c,_,l,i);v+s>p&&(a+=t._addLine(o),d=!1,o="",s=0),o+=c,s+=v}}else{o.length>0&&(a+=t._addLine(o),o="",s=0);const r=e===y.length-1;a+=t._addLine(n,!r),d=!1,o="",s=0}else u+s>p&&(d=!1,a+=t._addLine(o),o="",s=0),(o.length>0||!t.isBreakingSpace(n)||d)&&(o+=n,s+=u)}return a+=t._addLine(o,!1),a}static _addLine(e,r=!0){return e=t._trimRight(e),e=r?`${e}\n\t`:e}static _getFromCache(e,r,n,i){let s=n[e];return"number"!=typeof s&&(s=t._measureText(e,r,i)+r,n[e]=s),s}static _collapseSpaces(t){return"normal"===t||"pre-line"===t}static _collapseNewlines(t){return"normal"===t}static _trimRight(e){if("string"!=typeof e)return"";for(let r=e.length-1;r>=0;r--){const n=e[r];if(!t.isBreakingSpace(n))break;e=e.slice(0,-1)}return e}static _isNewline(e){return"string"==typeof e&&t._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,r){return"string"==typeof e&&t._breakingSpaces.includes(e.charCodeAt(0))}static _tokenize(e){const r=[];let n="";if("string"!=typeof e)return r;for(let i=0;i<e.length;i++){const s=e[i],o=e[i+1];t.isBreakingSpace(s,o)||t._isNewline(s)?(""!==n&&(r.push(n),n=""),r.push(s)):n+=s}return""!==n&&r.push(n),r}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,n,i){return!0}static wordWrapSplit(e){return t.graphemeSegmenter(e)}static measureFont(e){if(t._fonts[e])return t._fonts[e];const r=t._context;r.font=e;const n=r.measureText(t.METRICS_STRING+t.BASELINE_SYMBOL),i={ascent:n.actualBoundingBoxAscent,descent:n.actualBoundingBoxDescent,fontSize:n.actualBoundingBoxAscent+n.actualBoundingBoxDescent};return t._fonts[e]=i,i}static clearMetrics(e=""){e?delete t._fonts[e]:t._fonts={}}static get _canvas(){if(!t.__canvas){let e;try{const r=new OffscreenCanvas(0,0),n=r.getContext("2d",G_);if(null!=n&&n.measureText)return t.__canvas=r,r;e=Xe.get().createCanvas()}catch(t){e=Xe.get().createCanvas()}e.width=e.height=10,t.__canvas=e}return t.__canvas}static get _context(){return t.__context||(t.__context=t._canvas.getContext("2d",G_)),t.__context}};j_.METRICS_STRING="|ÉqÅ",j_.BASELINE_SYMBOL="M",j_.BASELINE_MULTIPLIER=1.4,j_.HEIGHT_MULTIPLIER=2,j_.graphemeSegmenter=(()=>{if("function"==typeof(null==Intl?void 0:Intl.Segmenter)){const t=new Intl.Segmenter;return e=>[...t.segment(e)].map((t=>t.segment))}return t=>[...t]})(),j_.experimentalLetterSpacing=!1,j_._fonts={},j_._newlines=[10,13],j_._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],j_._measurementCache={};let N_=j_;function z_(t,e){var r;if(t.texture===$r.WHITE&&!t.fill)return Z.shared.setValue(t.color).setAlpha(null!=(r=t.alpha)?r:1).toHexa();if(!t.fill){const r=e.createPattern(t.texture.source.resource,"repeat"),n=t.matrix.copyTo(st.shared);return n.scale(t.texture.frame.width,t.texture.frame.height),r.setTransform(n),r}if(t.fill instanceof dl){const r=t.fill,n=e.createPattern(r.texture.source.resource,"repeat"),i=r.transform.copyTo(st.shared);return i.scale(r.texture.frame.width,r.texture.frame.height),n.setTransform(i),n}if(t.fill instanceof cl){const r=t.fill;if("linear"===r.type){const t=e.createLinearGradient(r.x0,r.y0,r.x1,r.y1);return r.gradientStops.forEach((e=>{t.addColorStop(e.offset,Z.shared.setValue(e.color).toHex())})),t}}return"red"}class W_{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,r){const n=N_.measureText(t||" ",r);let i=Math.ceil(Math.ceil(Math.max(1,n.width)+2*r.padding)*e),s=Math.ceil(Math.ceil(Math.max(1,n.height)+2*r.padding)*e);return i=Math.ceil(i-1e-6),s=Math.ceil(s-1e-6),i=xr(i),s=xr(s),{width:i,height:s}}getTexture(t,e,r,n){"string"==typeof t&&(po("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof B_||(t.style=new B_(t.style));const{texture:i,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(i._source),$a.returnCanvasAndContext(s),i}createTextureAndCanvas(t){var e;const{text:r,style:n}=t,i=null!=(e=t.resolution)?e:this._renderer.resolution,s=N_.measureText(r||" ",n),o=Math.ceil(Math.ceil(Math.max(1,s.width)+2*n.padding)*i),a=Math.ceil(Math.ceil(Math.max(1,s.height)+2*n.padding)*i),l=$a.getOptimalCanvasAndContext(o,a),{canvas:_}=l;this.renderTextToCanvas(r,n,i,l);const u=U_(_,o,a,i);if(n.trim){const t=_l(_,i);u.frame.copyFrom(t),u.updateUvs()}return{texture:u,canvasAndContext:l}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;const e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;const{texture:r,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:n,texture:r,usageCount:1},r}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){const e=this._activeTextures[t];if(e.usageCount--,0===e.usageCount){$a.returnCanvasAndContext(e.canvasAndContext),ol.returnTexture(e.texture);const r=e.texture.source;r.resource=null,r.uploadMethodId="unknown",r.alphaMode="no-premultiply-alpha",this._activeTextures[t]=null}}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,r,n){var i,s,o,a,l;const{canvas:_,context:u}=n,c=L_(e),h=N_.measureText(t||" ",e),d=h.lines,p=h.lineHeight,y=h.lineWidths,v=h.maxLineWidth,f=h.fontProperties,m=_.height;if(u.resetTransform(),u.scale(r,r),u.textBaseline=e.textBaseline,null!=(i=e._stroke)&&i.width){const t=e._stroke;u.lineWidth=t.width,u.miterLimit=t.miterLimit,u.lineJoin=t.join,u.lineCap=t.cap}let g,x;u.font=c;const b=e.dropShadow?2:1;for(let t=0;t<b;++t){const i=e.dropShadow&&0===t,_=i?Math.ceil(Math.max(1,m)+2*e.padding):0,c=_*r;if(i){u.fillStyle="black",u.strokeStyle="black";const t=e.dropShadow,n=t.color,i=t.alpha;u.shadowColor=Z.shared.setValue(n).setAlpha(i).toRgbaString();const s=t.blur*r,o=t.distance*r;u.shadowBlur=s,u.shadowOffsetX=Math.cos(t.angle)*o,u.shadowOffsetY=Math.sin(t.angle)*o+c}else u.fillStyle=e._fill?z_(e._fill,u):null,null!=(s=e._stroke)&&s.width&&(u.strokeStyle=z_(e._stroke,u)),u.shadowColor="black";let h=(p-f.fontSize)/2;p-f.fontSize<0&&(h=0);const b=null!=(a=null==(o=e._stroke)?void 0:o.width)?a:0;for(let t=0;t<d.length;t++)g=b/2,x=b/2+t*p+f.ascent+h,"right"===e.align?g+=v-y[t]:"center"===e.align&&(g+=(v-y[t])/2),null!=(l=e._stroke)&&l.width&&this._drawLetterSpacing(d[t],e,n,g+e.padding,x+e.padding-_,!0),void 0!==e._fill&&this._drawLetterSpacing(d[t],e,n,g+e.padding,x+e.padding-_)}}_drawLetterSpacing(t,e,r,n,i,s=!1){const{context:o}=r,a=e.letterSpacing;let l=!1;if(N_.experimentalLetterSpacingSupported&&(N_.experimentalLetterSpacing?(o.letterSpacing=`${a}px`,o.textLetterSpacing=`${a}px`,l=!0):(o.letterSpacing="0px",o.textLetterSpacing="0px")),0===a||l)return void(s?o.strokeText(t,n,i):o.fillText(t,n,i));let _=n;const u=N_.graphemeSegmenter(t);let c=o.measureText(t).width,h=0;for(let t=0;t<u.length;++t){const e=u[t];s?o.strokeText(e,_,i):o.fillText(e,_,i);let r="";for(let e=t+1;e<u.length;++e)r+=u[e];h=o.measureText(r).width,_+=c-h+a,c=h}}destroy(){this._activeTextures=null}}W_.extension={type:[c.WebGLSystem,c.WebGPUSystem,c.CanvasSystem],name:"canvasText"},p.add(W_),p.add(Ya);var V_=Object.defineProperty,H_=Object.getOwnPropertySymbols,X_=Object.prototype.hasOwnProperty,K_=Object.prototype.propertyIsEnumerable,Y_=(t,e,r)=>e in t?V_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;class Q_ extends nn{constructor(t){t instanceof b_&&(t={context:t});const e=t||{},{context:r,roundPixels:n}=e,i=((t,e)=>{var r={};for(var n in t)X_.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&H_)for(var n of H_(t))e.indexOf(n)<0&&K_.call(t,n)&&(r[n]=t[n]);return r})(e,["context","roundPixels"]);super(((t,e)=>{for(var r in e||(e={}))X_.call(e,r)&&Y_(t,r,e[r]);if(H_)for(var r of H_(e))K_.call(e,r)&&Y_(t,r,e[r]);return t})({label:"Graphics"},i)),this.renderPipeId="graphics",this._context=r||(this._ownedContext=new b_),this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=null!=n&&n}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}addBounds(t){t.addBounds(this._context.bounds)}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(!0===t||!0===(null==t?void 0:t.context))&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new Q_(this._context.clone()):(this._ownedContext=null,new Q_(this._context))}lineStyle(t,e,r){const n={};return t&&(n.width=t),e&&(n.color=e),r&&(n.alpha=r),this.context.strokeStyle=n,this}beginFill(t,e){const r={};return t&&(r.color=t),e&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){this.context.fill();const t=this.context.strokeStyle;return(t.width!==b_.defaultStrokeStyle.width||t.color!==b_.defaultStrokeStyle.color||t.alpha!==b_.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return this._callContextMethod("circle",t)}drawEllipse(...t){return this._callContextMethod("ellipse",t)}drawPolygon(...t){return this._callContextMethod("poly",t)}drawRect(...t){return this._callContextMethod("rect",t)}drawRoundedRect(...t){return this._callContextMethod("roundRect",t)}drawStar(...t){return this._callContextMethod("star",t)}}const $_={name:"local-uniform-msdf-bit",vertex:{header:"\n\t\t\t\tstruct LocalUniforms {\n\t\t\t\t\tuColor:vec4<f32>,\n\t\t\t\t\tuTransformMatrix:mat3x3<f32>,\n\t\t\t\t\tuDistance: f32,\n\t\t\t\t\tuRound:f32,\n\t\t\t\t}\n\t\n\t\t\t\t@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;\n\t\t\t",main:"\n\t\t\t\tvColor *= localUniforms.uColor;\n\t\t\t\tmodelMatrix *= localUniforms.uTransformMatrix;\n\t\t\t",end:"\n\t\t\t\tif(localUniforms.uRound == 1)\n\t\t\t\t{\n\t\t\t\t\tvPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);\n\t\t\t\t}\n\t\t\t"},fragment:{header:"\n\t\t\t\tstruct LocalUniforms {\n\t\t\t\t\tuColor:vec4<f32>,\n\t\t\t\t\tuTransformMatrix:mat3x3<f32>,\n\t\t\t\t\tuDistance: f32\n\t\t\t\t}\n\t\n\t\t\t\t@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;\n\t\t\t ",main:" \n\t\t\t\toutColor = vec4<f32>(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance));\n\t\t\t"}},q_={name:"local-uniform-msdf-bit",vertex:{header:"\n\t\t\t\tuniform mat3 uTransformMatrix;\n\t\t\t\tuniform vec4 uColor;\n\t\t\t\tuniform float uRound;\n\t\t\t",main:"\n\t\t\t\tvColor *= uColor;\n\t\t\t\tmodelMatrix *= uTransformMatrix;\n\t\t\t",end:"\n\t\t\t\tif(uRound == 1.)\n\t\t\t\t{\n\t\t\t\t\tgl_Position.xy = roundPixels(gl_Position.xy, uResolution);\n\t\t\t\t}\n\t\t\t"},fragment:{header:"\n\t\t\t\tuniform float uDistance;\n\t\t\t ",main:" \n\t\t\t\toutColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));\n\t\t\t"}},Z_={name:"msdf-bit",fragment:{header:"\n\t\t\t\tfn calculateMSDFAlpha(msdfColor:vec4<f32>, shapeColor:vec4<f32>, distance:f32) -> f32 {\n\t\t\t\t\t\n\t\t\t\t\t// MSDF\n\t\t\t\t\tvar median = msdfColor.r + msdfColor.g + msdfColor.b -\n\t\t\t\t\t\tmin(msdfColor.r, min(msdfColor.g, msdfColor.b)) -\n\t\t\t\t\t\tmax(msdfColor.r, max(msdfColor.g, msdfColor.b));\n\t\t\t\t\n\t\t\t\t\t// SDF\n\t\t\t\t\tmedian = min(median, msdfColor.a);\n\t\n\t\t\t\t\tvar screenPxDistance = distance * (median - 0.5);\n\t\t\t\t\tvar alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\n\t\t\t\t\tif (median < 0.01) {\n\t\t\t\t\t\talpha = 0.0;\n\t\t\t\t\t} else if (median > 0.99) {\n\t\t\t\t\t\talpha = 1.0;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Gamma correction for coverage-like alpha\n\t\t\t\t\tvar luma: f32 = dot(shapeColor.rgb, vec3<f32>(0.299, 0.587, 0.114));\n\t\t\t\t\tvar gamma: f32 = mix(1.0, 1.0 / 2.2, luma);\n\t\t\t\t\tvar coverage: f32 = pow(shapeColor.a * alpha, gamma);\n\t\n\t\t\t\t\treturn coverage;\n\t\t\t\t \n\t\t\t\t}\n\t\t\t"}},J_={name:"msdf-bit",fragment:{header:"\n\t\t\t\tfloat calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {\n\t\t\t\t\t\n\t\t\t\t\t// MSDF\n\t\t\t\t\tfloat median = msdfColor.r + msdfColor.g + msdfColor.b -\n\t\t\t\t\t\t\t\t\tmin(msdfColor.r, min(msdfColor.g, msdfColor.b)) -\n\t\t\t\t\t\t\t\t\tmax(msdfColor.r, max(msdfColor.g, msdfColor.b));\n\t\t\t\t \n\t\t\t\t\t// SDF\n\t\t\t\t\tmedian = min(median, msdfColor.a);\n\t\t\t\t\n\t\t\t\t\tfloat screenPxDistance = distance * (median - 0.5);\n\t\t\t\t\tfloat alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\n\t\t\t \n\t\t\t\t\tif (median < 0.01) {\n\t\t\t\t\t\talpha = 0.0;\n\t\t\t\t\t} else if (median > 0.99) {\n\t\t\t\t\t\talpha = 1.0;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Gamma correction for coverage-like alpha\n\t\t\t\t\tfloat luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114));\n\t\t\t\t\tfloat gamma = mix(1.0, 1.0 / 2.2, luma);\n\t\t\t\t\tfloat coverage = pow(shapeColor.a * alpha, gamma); \n\t\t\t\t \n\t\t\t\t\treturn coverage;\n\t\t\t\t}\n\t\t\t"}};let tu,eu;class ru extends oo{constructor(){const t=new qs({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new st,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=Vn();null!=tu||(tu=Cs({name:"sdf-shader",bits:[As,ks(e),$_,Z_,Gs]})),null!=eu||(eu=Es({name:"sdf-shader",bits:[Rs,Ls(e),q_,J_,js]})),super({glProgram:eu,gpuProgram:tu,resources:{localUniforms:t,batchSamplers:Js(e)}})}}let nu=0;function iu(...t){500!==nu&&(nu++,500===nu?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...t))}class su extends f{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return this.fontFamily}get pageTextures(){return this.pages}get size(){return this.fontMetrics.fontSize}get distanceFieldRange(){return this.distanceField.range}get distanceFieldType(){return this.distanceField.type}destroy(t=!1){var e;this.emit("destroy",this),this.removeAllListeners();for(const t in this.chars)null==(e=this.chars[t].texture)||e.destroy();this.chars=null,t&&(this.pages.forEach((t=>t.texture.destroy(!0))),this.pages=null)}}function ou(t){if(""===t)return[];"string"==typeof t&&(t=[t]);const e=[];for(let r=0,n=t.length;r<n;r++){const n=t[r];if(Array.isArray(n)){if(2!==n.length)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${n.length}.`);if(0===n[0].length||0===n[1].length)throw new Error("[BitmapFont]: Invalid character delimiter.");const t=n[0].charCodeAt(0),r=n[1].charCodeAt(0);if(r<t)throw new Error("[BitmapFont]: Invalid character range.");for(let n=t,i=r;n<=i;n++)e.push(String.fromCharCode(n))}else e.push(...Array.from(n))}if(0===e.length)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}var au=Object.defineProperty,lu=Object.getOwnPropertySymbols,_u=Object.prototype.hasOwnProperty,uu=Object.prototype.propertyIsEnumerable,cu=(t,e,r)=>e in t?au(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,hu=(t,e)=>{for(var r in e||(e={}))_u.call(e,r)&&cu(t,r,e[r]);if(lu)for(var r of lu(e))uu.call(e,r)&&cu(t,r,e[r]);return t};const du=class t extends su{constructor(e){var r,n,i;super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;const s=hu(hu({},t.defaultOptions),e);this._textureSize=s.textureSize,this._mipmap=s.mipmap;const o=s.style.clone();s.overrideFill&&(o._fill.color=16777215,o._fill.alpha=1,o._fill.texture=$r.WHITE,o._fill.fill=null),this.applyFillAsTint=s.overrideFill;const a=o.fontSize;o.fontSize=this.baseMeasurementFontSize;const l=L_(o);s.overrideSize?o._stroke&&(o._stroke.width*=this.baseRenderedFontSize/a):o.fontSize=this.baseRenderedFontSize=a,this._style=o,this._skipKerning=null!=(r=s.skipKerning)&&r,this.resolution=null!=(n=s.resolution)?n:1,this._padding=null!=(i=s.padding)?i:4,this.fontMetrics=N_.measureFont(l),this.lineHeight=o.lineHeight||this.fontMetrics.fontSize||o.fontSize}ensureCharacters(t){var e,r,n,i;const s=ou(t).filter((t=>!this._currentChars.includes(t))).filter(((t,e,r)=>r.indexOf(t)===e));if(!s.length)return;let o;this._currentChars=[...this._currentChars,...s],o=-1===this._currentPageIndex?this._nextPage():this.pages[this._currentPageIndex];let{canvas:a,context:l}=o.canvasAndContext,_=o.texture.source;const u=this._style;let c=this._currentX,h=this._currentY;const d=this.baseRenderedFontSize/this.baseMeasurementFontSize,p=this._padding*d;let y=0,v=!1;for(let t=0;t<s.length;t++){const o=s[t],f=N_.measureText(o,u,a,!1),m=Math.ceil(("italic"===u.fontStyle?2:1)*f.width);f.lineHeight=f.height;const g=f.width*d,x=m+2*p,b=f.height*d+2*p;if(v=!1,"\n\t"!==o&&"\r"!==o&&"\t"!==o&&" "!==o&&(v=!0,y=Math.ceil(Math.max(b,y))),c+x>this._textureSize&&(h+=y,y=b,c=0,h+y>this._textureSize)){_.update();const t=this._nextPage();a=t.canvasAndContext.canvas,l=t.canvasAndContext.context,_=t.texture.source,h=0}const S=g/d-(null!=(r=null==(e=u.dropShadow)?void 0:e.distance)?r:0)-(null!=(i=null==(n=u._stroke)?void 0:n.width)?i:0);if(this.chars[o]={id:o.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:S,kerning:{}},v){this._drawGlyph(l,f,c+p,h+p,d,u);const t=_.width*d,e=_.height*d,r=new Ct(c/t*_.width,h/e*_.height,x/t*_.width,b/e*_.height);this.chars[o].texture=new $r({source:_,frame:r}),c+=Math.ceil(x)}}_.update(),this._currentX=c,this._currentY=h,this._skipKerning&&this._applyKerning(s,l)}get pageTextures(){return this.pages}_applyKerning(t,e){const r=this._measureCache;for(let n=0;n<t.length;n++){const i=t[n];for(let t=0;t<this._currentChars.length;t++){const n=this._currentChars[t];let s=r[i];s||(s=r[i]=e.measureText(i).width);let o=r[n];o||(o=r[n]=e.measureText(n).width);let a=e.measureText(i+n).width,l=a-(s+o);l&&(this.chars[i].kerning[n]=l),a=e.measureText(i+n).width,l=a-(s+o),l&&(this.chars[n].kerning[i]=l)}}}_nextPage(){this._currentPageIndex++;const t=this.resolution,e=$a.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);const r=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),n={canvasAndContext:e,texture:new $r({source:new gn({resource:e.canvas,resolution:r,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})})};return this.pages[this._currentPageIndex]=n,n}_setupContext(t,e,r){var n;e.fontSize=this.baseRenderedFontSize,t.scale(r,r),t.font=L_(e),e.fontSize=this.baseMeasurementFontSize,t.textBaseline=e.textBaseline;const i=e._stroke,s=null!=(n=null==i?void 0:i.width)?n:0;if(i&&(t.lineWidth=s,t.lineJoin=i.join,t.miterLimit=i.miterLimit,t.strokeStyle=z_(i,t)),e._fill&&(t.fillStyle=z_(e._fill,t)),e.dropShadow){const n=e.dropShadow,i=Z.shared.setValue(n.color).toArray(),s=n.blur*r,o=n.distance*r;t.shadowColor=`rgba(${255*i[0]},${255*i[1]},${255*i[2]},${n.alpha})`,t.shadowBlur=s,t.shadowOffsetX=Math.cos(n.angle)*o,t.shadowOffsetY=Math.sin(n.angle)*o}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0}_drawGlyph(t,e,r,n,i,s){var o;const a=e.text,l=e.fontProperties,_=s._stroke,u=(null!=(o=null==_?void 0:_.width)?o:0)*i,c=r+u/2,h=n-u/2,d=l.descent*i,p=e.lineHeight*i;s.stroke&&u&&t.strokeText(a,c,h+p-d),s._fill&&t.fillText(a,c,h+p-d)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){const{canvasAndContext:e,texture:r}=this.pages[t];$a.returnCanvasAndContext(e),r.destroy(!0)}this.pages=null}};du.defaultOptions={textureSize:512,style:new B_,mipmap:!0};let pu=du;function yu(t,e,r,n){const i={width:0,height:0,offsetY:0,scale:e.fontSize/r.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};i.offsetY=r.baseLineOffset;let s=i.lines[0],o=null,a=!0;const l={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},_=t=>{const e=s.width;for(let r=0;r<l.index;r++){const n=t.positions[r];s.chars.push(t.chars[r]),s.charPositions.push(n+e)}s.width+=t.width,a=!1,l.width=0,l.index=0,l.chars.length=0},u=()=>{let t=s.chars.length-1;if(n){let e=s.chars[t];for(;" "===e;)s.width-=r.chars[e].xAdvance,e=s.chars[--t]}i.width=Math.max(i.width,s.width),s={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,i.lines.push(s),i.height+=r.lineHeight},c=r.baseMeasurementFontSize/e.fontSize,h=e.letterSpacing*c,d=e.wordWrapWidth*c;for(let n=0;n<t.length+1;n++){let i;const c=n===t.length;c||(i=t[n]);const p=r.chars[i]||r.chars[" "];if(/(?:\s)/.test(i)||"\r"===i||"\n\t"===i||c){if(!a&&e.wordWrap&&s.width+l.width-h>d?(u(),_(l),c||s.charPositions.push(0)):(l.start=s.width,_(l),c||s.charPositions.push(0)),"\r"===i||"\n\t"===i)0!==s.width&&u();else if(!c){const t=p.xAdvance+(p.kerning[o]||0)+h;s.width+=t,s.spaceWidth=t,s.spacesIndex.push(s.charPositions.length),s.chars.push(i)}}else{const t=p.kerning[o]||0,e=p.xAdvance+t+h;l.positions[l.index++]=l.width+t,l.chars.push(i),l.width+=e}o=i}return u(),"center"===e.align?function(t){for(let e=0;e<t.lines.length;e++){const r=t.lines[e],n=t.width/2-r.width/2;for(let t=0;t<r.charPositions.length;t++)r.charPositions[t]+=n}}(i):"right"===e.align?function(t){for(let e=0;e<t.lines.length;e++){const r=t.lines[e],n=t.width-r.width;for(let t=0;t<r.charPositions.length;t++)r.charPositions[t]+=n}}(i):"justify"===e.align&&function(t){const e=t.width;for(let r=0;r<t.lines.length;r++){const n=t.lines[r];let i=0,s=n.spacesIndex[i++],o=0;const a=n.spacesIndex.length,l=(e-n.width)/a;for(let t=0;t<n.charPositions.length;t++)t===s&&(s=n.spacesIndex[i++],o+=l),n.charPositions[t]+=o}}(i),i}var vu=Object.defineProperty,fu=Object.getOwnPropertySymbols,mu=Object.prototype.hasOwnProperty,gu=Object.prototype.propertyIsEnumerable,xu=(t,e,r)=>e in t?vu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,bu=(t,e)=>{for(var r in e||(e={}))mu.call(e,r)&&xu(t,r,e[r]);if(fu)for(var r of fu(e))gu.call(e,r)&&xu(t,r,e[r]);return t};let Su=0;const Tu=new class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(t,e){var r;let n=`${e.fontFamily}-bitmap`,i=!0;if(e._fill.fill&&!e._stroke)n+=e._fill.fill.styleKey,i=!1;else if(e._stroke||e.dropShadow){let t=e.styleKey;t=t.substring(0,t.lastIndexOf("-")),n=`${t}-bitmap`,i=!1}if(!In.has(n)){const t=new pu(bu({style:e,overrideFill:i,overrideSize:!0},this.defaultOptions));Su++,Su>50&&iu("BitmapText",`You have dynamically created ${Su} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),t.once("destroy",(()=>{Su--,In.remove(n)})),In.set(n,t)}const s=In.get(n);return null==(r=s.ensureCharacters)||r.call(s,t),s}getLayout(t,e,r=!0){const n=this.getFont(t,e);return yu([...t],e,n,r)}measureText(t,e,r=!0){return this.getLayout(t,e,r)}install(...t){var e,r,n,i;let s=t[0];"string"==typeof s&&(s={name:s,style:t[1],chars:null==(e=t[2])?void 0:e.chars,resolution:null==(r=t[2])?void 0:r.resolution,padding:null==(n=t[2])?void 0:n.padding,skipKerning:null==(i=t[2])?void 0:i.skipKerning});const o=null==s?void 0:s.name;if(!o)throw new Error("[BitmapFontManager] Property `name` is required.");s=bu(bu({},this.defaultOptions),s);const a=s.style,l=a instanceof B_?a:new B_(a),_=null!==l._fill.fill&&void 0!==l._fill.fill,u=new pu({style:l,overrideFill:_,skipKerning:s.skipKerning,padding:s.padding,resolution:s.resolution,overrideSize:!1}),c=ou(s.chars);return u.ensureCharacters(c.join("")),In.set(`${o}-bitmap`,u),u.once("destroy",(()=>In.remove(`${o}-bitmap`))),u}uninstall(t){const e=`${t}-bitmap`,r=In.get(e);r&&r.destroy()}};class Pu{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){const e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){const r=this._getGpuBitmapText(t);Ou(t,r),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){const e=this._gpuBitmapText[t].context;e.customShader&&(dt.return(e.customShader),e.customShader=null),dt.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){const e=this._getGpuBitmapText(t);Ou(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){const{context:r}=e,n=Tu.getFont(t.text,t._style);r.clear(),"none"!==n.distanceField.type&&(r.customShader||(r.customShader=dt.get(ru)));const i=Array.from(t.text),s=t._style;let o=n.baseLineOffset;const a=yu(i,s,n,!0);let l=0;const _=s.padding,u=a.scale;let c=a.width,h=a.height+a.offsetY;s._stroke&&(c+=s._stroke.width/u,h+=s._stroke.width/u),r.translate(-t._anchor._x*c-_,-t._anchor._y*h-_).scale(u,u);const d=n.applyFillAsTint?s._fill.color:16777215;for(let t=0;t<a.lines.length;t++){const e=a.lines[t];for(let t=0;t<e.charPositions.length;t++){const s=i[l++],a=n.chars[s];null!=a&&a.texture&&r.texture(a.texture,d||"black",Math.round(e.charPositions[t]+a.xOffset),Math.round(o+a.yOffset))}o+=n.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){const e=dt.get(Q_);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){const e=this._getGpuBitmapText(t).context,r=t._style.fontFamily,n=In.get(`${r}-bitmap`),{a:i,b:s,c:o,d:a}=t.groupTransform,l=Math.sqrt(i*i+s*s),_=Math.sqrt(o*o+a*a),u=(Math.abs(l)+Math.abs(_))/2,c=n.baseRenderedFontSize/t._style.fontSize,h=u*n.distanceField.range*(1/c);e.customShader.resources.localUniforms.uniforms.uDistance=h}destroy(){for(const t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null}}function Ou(t,e){e.groupTransform=t.groupTransform,e.groupColorAlpha=t.groupColorAlpha,e.groupColor=t.groupColor,e.groupBlendMode=t.groupBlendMode,e.globalDisplayStatus=t.globalDisplayStatus,e.groupTransform=t.groupTransform,e.localDisplayStatus=t.localDisplayStatus,e.groupAlpha=t.groupAlpha,e._roundPixels=t._roundPixels}Pu.extension={type:[c.WebGLPipes,c.WebGPUPipes,c.CanvasPipes],name:"bitmapText"},p.add(Pu);class Mu{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(const t in this._gpuText){const e=this._gpuText[t];if(!e)continue;const r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){const e=this._getGpuText(t),r=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==r}addRenderable(t,e){const r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){const e=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),e._batcher.updateElement(e)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){const e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),dt.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){const e=t._getKey(),r=this._getGpuText(t),n=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t).catch((t=>{console.error(t)})),t._didTextUpdate=!1;const i=t._style.padding;rn(n.bounds,t._anchor,n.texture,i)}async _updateGpuText(t){var e;t._didTextUpdate=!1;const r=this._getGpuText(t);if(r.generatingTexture)return;const n=t._getKey();this._renderer.htmlText.decreaseReferenceCount(r.currentKey),r.generatingTexture=!0,r.currentKey=n;const i=null!=(e=t.resolution)?e:this._renderer.resolution,s=await this._renderer.htmlText.getManagedTexture(t.text,i,t._style,t._getKey()),o=r.batchableSprite;o.texture=r.texture=s,r.generatingTexture=!1,r.textureNeedsUploading=!0,t.onViewUpdate();const a=t._style.padding;rn(o.bounds,t._anchor,o.texture,a)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){const e={texture:$r.EMPTY,currentKey:"--",batchableSprite:dt.get(Ka),textureNeedsUploading:!1,generatingTexture:!1},r=e.batchableSprite;return r.renderable=t,r.transform=t.groupTransform,r.texture=$r.EMPTY,r.bounds={minX:0,maxX:1,minY:0,maxY:0},r.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}}function wu(){const{userAgent:t}=Xe.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}Mu.extension={type:[c.WebGLPipes,c.WebGPUPipes,c.CanvasPipes],name:"htmlText"};const Cu="http://www.w3.org/2000/svg",Eu="http://www.w3.org/1999/xhtml";class Au{constructor(){this.svgRoot=document.createElementNS(Cu,"svg"),this.foreignObject=document.createElementNS(Cu,"foreignObject"),this.domElement=document.createElementNS(Eu,"div"),this.styleElement=document.createElementNS(Eu,"style"),this.image=new Image;const{foreignObject:t,svgRoot:e,styleElement:r,domElement:n}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(n)}}function Ru(t){const e=t._stroke,r=t._fill,n=[`div { ${[`color: ${Z.shared.setValue(r.color).toHex()}`,`font-size: ${t.fontSize}px`,`font-family: ${t.fontFamily}`,`font-weight: ${t.fontWeight}`,`font-style: ${t.fontStyle}`,`font-variant: ${t.fontVariant}`,`letter-spacing: ${t.letterSpacing}px`,`text-align: ${t.align}`,`padding: ${t.padding}px`,`white-space: ${"pre"===t.whiteSpace&&t.wordWrap?"pre-wrap":t.whiteSpace}`,...t.lineHeight?[`line-height: ${t.lineHeight}px`]:[],...t.wordWrap?["word-wrap: "+(t.breakWords?"break-all":"break-word"),`max-width: ${t.wordWrapWidth}px`]:[],...e?[Du(e)]:[],...t.dropShadow?[Iu(t.dropShadow)]:[],...t.cssOverrides].join(";")} }`];return function(t,e){for(const r in t){const n=t[r],i=[];for(const t in n)ku[t]?i.push(ku[t](n[t])):Bu[t]&&i.push(Bu[t].replace("{{VALUE}}",n[t]));e.push(`${r} { ${i.join(";")} }`)}}(t.tagStyles,n),n.join(" ")}function Iu(t){const e=Z.shared.setValue(t.color).setAlpha(t.alpha).toHexa(),r=`${Math.round(Math.cos(t.angle)*t.distance)}px ${Math.round(Math.sin(t.angle)*t.distance)}px`;return t.blur>0?`text-shadow: ${r} ${t.blur}px ${e}`:`text-shadow: ${r} ${e}`}function Du(t){return[`-webkit-text-stroke-width: ${t.width}px`,`-webkit-text-stroke-color: ${Z.shared.setValue(t.color).toHex()}`,`text-stroke-width: ${t.width}px`,`text-stroke-color: ${Z.shared.setValue(t.color).toHex()}`,"paint-order: stroke"].join(";")}const Bu={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},ku={fill:t=>`color: ${Z.shared.setValue(t).toHex()}`,breakWords:t=>"word-wrap: "+(t?"break-all":"break-word"),stroke:Du,dropShadow:Iu};var Uu=Object.defineProperty,Fu=Object.getOwnPropertySymbols,Lu=Object.prototype.hasOwnProperty,Gu=Object.prototype.propertyIsEnumerable,ju=(t,e,r)=>e in t?Uu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Nu=(t,e)=>{for(var r in e||(e={}))Lu.call(e,r)&&ju(t,r,e[r]);if(Fu)for(var r of Fu(e))Gu.call(e,r)&&ju(t,r,e[r]);return t};class zu extends B_{constructor(t={}){var e;super(t),this._cssOverrides=[],null!=this.cssOverrides||(this.cssOverrides=t.cssOverrides),this.tagStyles=null!=(e=t.tagStyles)?e:{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=T_(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new zu({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?Nu({},this.dropShadow):null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=Ru(this)),this._cssStyle}addOverride(...t){const e=t.filter((t=>!this.cssOverrides.includes(t)));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){const e=t.filter((t=>this.cssOverrides.includes(t)));e.length>0&&(this.cssOverrides=this.cssOverrides.filter((t=>!e.includes(t))),this.update())}set fill(t){super.fill=t}set stroke(t){super.stroke=t}}function Wu(t,e){const r=e.fontFamily,n=[],i={},s=t.match(/font-family:([^;"\s]+)/g);function o(t){i[t]||(n.push(t),i[t]=!0)}if(Array.isArray(r))for(let t=0;t<r.length;t++)o(r[t]);else o(r);s&&s.forEach((t=>{o(t.split(":")[1].trim())}));for(const t in e.tagStyles){o(e.tagStyles[t].fontFamily)}return n}async function Vu(t){const e=await(await Xe.get().fetch(t)).blob(),r=new FileReader;return await new Promise(((t,n)=>{r.onloadend=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)}))}async function Hu(t,e){const r=await Vu(e);return`@font-face {\n\t\t\tfont-family: "${t.fontFamily}";\n\t\t\tsrc: url('${r}');\n\t\t\tfont-weight: ${t.fontWeight};\n\t\t\tfont-style: ${t.fontStyle};\n\t\t}`}const Xu=new Map;async function Ku(t,e,r){const n=t.filter((t=>In.has(`${t}-and-url`))).map(((t,n)=>{if(!Xu.has(t)){const{url:i}=In.get(`${t}-and-url`);0===n?Xu.set(t,Hu({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:t},i)):Xu.set(t,Hu({fontWeight:r.fontWeight,fontStyle:r.fontStyle,fontFamily:t},i))}return Xu.get(t)}));return(await Promise.all(n)).join("\n\t")}function Yu(t,e,r,n,i){const{domElement:s,styleElement:o,svgRoot:a}=i;s.innerHTML=`<style>${e.cssStyle}</style><div style='padding:0;'>${t}</div>`,s.setAttribute("style",`transform: scale(${r});transform-origin: top left; display: inline-block`),o.textContent=n;const{width:l,height:_}=i.image;return a.setAttribute("width",l.toString()),a.setAttribute("height",_.toString()),(new XMLSerializer).serializeToString(a)}function Qu(t,e){const r=$a.getOptimalCanvasAndContext(t.width,t.height,e),{context:n}=r;return n.clearRect(0,0,t.width,t.height),n.drawImage(t,0,0),r}function $u(t,e,r){return new Promise((async n=>{r&&await new Promise((t=>setTimeout(t,100))),t.onload=()=>{n()},t.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(e)}`,t.crossOrigin="anonymous"}))}let qu;function Zu(t,e,r,n){n=n||qu||(qu=new Au);const{domElement:i,styleElement:s,svgRoot:o}=n;i.innerHTML=`<style>${e.cssStyle};</style><div style='padding:0'>${t}</div>`,i.setAttribute("style","transform-origin: top left; display: inline-block"),r&&(s.textContent=r),document.body.appendChild(o);const a=i.getBoundingClientRect();o.remove();const l=2*e.padding;return{width:a.width-l,height:a.height-l}}class Ju{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===to.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,r,n){if(this._activeTextures[n])return this._increaseReferenceCount(n),this._activeTextures[n].promise;const i=this._buildTexturePromise(t,e,r).then((t=>(this._activeTextures[n].texture=t,t)));return this._activeTextures[n]={texture:null,promise:i,usageCount:1},i}async _buildTexturePromise(t,e,r){const n=dt.get(Au),i=Wu(t,r),s=await Ku(i,r,zu.defaultTextStyle),o=Zu(t,r,s,n),a=Math.ceil(Math.ceil(Math.max(1,o.width)+2*r.padding)*e),l=Math.ceil(Math.ceil(Math.max(1,o.height)+2*r.padding)*e),_=n.image;_.width=2+(0|a),_.height=2+(0|l);const u=Yu(t,r,e,s,n);await $u(_,u,wu()&&i.length>0);const c=_;let h;this._createCanvas&&(h=Qu(_,e));const d=U_(h?h.canvas:c,_.width-2,_.height-2,e);return this._createCanvas&&(this._renderer.texture.initSource(d.source),$a.returnCanvasAndContext(h)),dt.return(n),d}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){const e=this._activeTextures[t];e&&(e.usageCount--,0===e.usageCount&&(e.texture?this._cleanUp(e):e.promise.then((t=>{e.texture=t,this._cleanUp(e)})).catch((()=>{})),this._activeTextures[t]=null))}_cleanUp(t){ol.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}}Ju.extension={type:[c.WebGLSystem,c.WebGPUSystem,c.CanvasSystem],name:"htmlText"},Ju.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"},p.add(Ju),p.add(Mu);var tc=Object.defineProperty,ec=Object.getOwnPropertySymbols,rc=Object.prototype.hasOwnProperty,nc=Object.prototype.propertyIsEnumerable,ic=(t,e,r)=>e in t?tc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,sc=(t,e)=>{for(var r in e||(e={}))rc.call(e,r)&&ic(t,r,e[r]);if(ec)for(var r of ec(e))nc.call(e,r)&&ic(t,r,e[r]);return t};const oc=class t extends mi{constructor(...e){var r;let n=null!=(r=e[0])?r:{};n instanceof Float32Array&&(n={positions:n,uvs:e[1],indices:e[2]}),n=sc(sc({},t.defaultOptions),n);const i=n.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=n.uvs||new Float32Array([0,0,1,0,1,1,0,1]),o=n.indices||new Uint32Array([0,1,2,0,2,3]),a=n.shrinkBuffersToFit;super({attributes:{aPosition:{buffer:new yi({data:i,label:"attribute-mesh-positions",shrinkToFit:a,usage:pi.VERTEX|pi.COPY_DST}),format:"float32x2",stride:8,offset:0},aUV:{buffer:new yi({data:s,label:"attribute-mesh-uvs",shrinkToFit:a,usage:pi.VERTEX|pi.COPY_DST}),format:"float32x2",stride:8,offset:0}},indexBuffer:new yi({data:o,label:"index-mesh-buffer",shrinkToFit:a,usage:pi.INDEX|pi.COPY_DST}),topology:n.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}};oc.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};let ac=oc;var lc=Object.defineProperty,_c=Object.defineProperties,uc=Object.getOwnPropertyDescriptors,cc=Object.getOwnPropertySymbols,hc=Object.prototype.hasOwnProperty,dc=Object.prototype.propertyIsEnumerable,pc=(t,e,r)=>e in t?lc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,yc=(t,e)=>{for(var r in e||(e={}))hc.call(e,r)&&pc(t,r,e[r]);if(cc)for(var r of cc(e))dc.call(e,r)&&pc(t,r,e[r]);return t},vc=(t,e)=>_c(t,uc(e));const fc={name:"local-uniform-bit",vertex:{header:"\n\t\n\t\t\t\tstruct LocalUniforms {\n\t\t\t\t\tuTransformMatrix:mat3x3<f32>,\n\t\t\t\t\tuColor:vec4<f32>,\n\t\t\t\t\tuRound:f32,\n\t\t\t\t}\n\t\n\t\t\t\t@group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;\n\t\t\t",main:"\n\t\t\t\tvColor *= localUniforms.uColor;\n\t\t\t\tmodelMatrix *= localUniforms.uTransformMatrix;\n\t\t\t",end:"\n\t\t\t\tif(localUniforms.uRound == 1)\n\t\t\t\t{\n\t\t\t\t\tvPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);\n\t\t\t\t}\n\t\t\t"}},mc=vc(yc({},fc),{vertex:vc(yc({},fc.vertex),{header:fc.vertex.header.replace("group(1)","group(2)")})}),gc={name:"local-uniform-bit",vertex:{header:"\n\t\n\t\t\t\tuniform mat3 uTransformMatrix;\n\t\t\t\tuniform vec4 uColor;\n\t\t\t\tuniform float uRound;\n\t\t\t",main:"\n\t\t\t\tvColor *= uColor;\n\t\t\t\tmodelMatrix = uTransformMatrix;\n\t\t\t",end:"\n\t\t\t\tif(uRound == 1.)\n\t\t\t\t{\n\t\t\t\t\tgl_Position.xy = roundPixels(gl_Position.xy, uResolution);\n\t\t\t\t}\n\t\t\t"}},xc={name:"tiling-bit",vertex:{header:"\n\t\t\t\tstruct TilingUniforms {\n\t\t\t\t\tuMapCoord:mat3x3<f32>,\n\t\t\t\t\tuClampFrame:vec4<f32>,\n\t\t\t\t\tuClampOffset:vec2<f32>,\n\t\t\t\t\tuTextureTransform:mat3x3<f32>,\n\t\t\t\t\tuSizeAnchor:vec4<f32>\n\t\t\t\t};\n\t\n\t\t\t\t@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;\n\t\t\t\t@group(2) @binding(1) var uTexture: texture_2d<f32>;\n\t\t\t\t@group(2) @binding(2) var uSampler: sampler;\n\t\t\t",main:"\n\t\t\t\tuv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;\n\t\n\t\t\t\tposition = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;\n\t\t\t"},fragment:{header:"\n\t\t\t\tstruct TilingUniforms {\n\t\t\t\t\tuMapCoord:mat3x3<f32>,\n\t\t\t\t\tuClampFrame:vec4<f32>,\n\t\t\t\t\tuClampOffset:vec2<f32>,\n\t\t\t\t\tuTextureTransform:mat3x3<f32>,\n\t\t\t\t\tuSizeAnchor:vec4<f32>\n\t\t\t\t};\n\t\n\t\t\t\t@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;\n\t\t\t\t@group(2) @binding(1) var uTexture: texture_2d<f32>;\n\t\t\t\t@group(2) @binding(2) var uSampler: sampler;\n\t\t\t",main:"\n\t\n\t\t\t\tvar coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);\n\t\t\t\tcoord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;\n\t\t\t\tvar unclamped = coord;\n\t\t\t\tcoord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);\n\t\n\t\t\t\tvar bias = 0.;\n\t\n\t\t\t\tif(unclamped.x == coord.x && unclamped.y == coord.y)\n\t\t\t\t{\n\t\t\t\t\tbias = -32.;\n\t\t\t\t} \n\t\n\t\t\t\toutColor = textureSampleBias(uTexture, uSampler, coord, bias);\n\t\t\t"}},bc={name:"tiling-bit",vertex:{header:"\n\t\t\t\tuniform mat3 uTextureTransform;\n\t\t\t\tuniform vec4 uSizeAnchor;\n\t\t\t\n\t\t\t",main:"\n\t\t\t\tuv = (uTextureTransform * vec3(aUV, 1.0)).xy;\n\t\n\t\t\t\tposition = (position - uSizeAnchor.zw) * uSizeAnchor.xy;\n\t\t\t"},fragment:{header:"\n\t\t\t\tuniform sampler2D uTexture;\n\t\t\t\tuniform mat3 uMapCoord;\n\t\t\t\tuniform vec4 uClampFrame;\n\t\t\t\tuniform vec2 uClampOffset;\n\t\t\t",main:"\n\t\n\t\t\tvec2 coord = vUV + ceil(uClampOffset - vUV);\n\t\t\tcoord = (uMapCoord * vec3(coord, 1.0)).xy;\n\t\t\tvec2 unclamped = coord;\n\t\t\tcoord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\t\t\t\n\t\t\toutColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0\n\t\t\n\t\t\t"}};let Sc,Tc;class Pc extends oo{constructor(){null!=Sc||(Sc=Cs({name:"tiling-sprite-shader",bits:[fc,xc,Gs]})),null!=Tc||(Tc=Es({name:"tiling-sprite-shader",bits:[gc,bc,js]}));const t=new qs({uMapCoord:{value:new st,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new st,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Tc,gpuProgram:Sc,resources:{localUniforms:new qs({uTransformMatrix:{value:new st,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:$r.EMPTY.source,uSampler:$r.EMPTY.source.style}})}updateUniforms(t,e,r,n,i,s){const o=this.resources.tilingUniforms,a=s.width,l=s.height,_=s.textureMatrix,u=o.uniforms.uTextureTransform;u.set(r.a*a/t,r.b*a/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),u.invert(),o.uniforms.uMapCoord=_.mapCoord,o.uniforms.uClampFrame=_.uClampFrame,o.uniforms.uClampOffset=_.uClampOffset,o.uniforms.uTextureTransform=u,o.uniforms.uSizeAnchor[0]=t,o.uniforms.uSizeAnchor[1]=e,o.uniforms.uSizeAnchor[2]=n,o.uniforms.uSizeAnchor[3]=i,s&&(this.resources.uTexture=s.source,this.resources.uSampler=s.source.style)}}class Oc extends ac{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])})}}function Mc(t,e){const r=t.anchor.x,n=t.anchor.y;e[0]=-r*t.width,e[1]=-n*t.height,e[2]=(1-r)*t.width,e[3]=-n*t.height,e[4]=(1-r)*t.width,e[5]=(1-n)*t.height,e[6]=-r*t.width,e[7]=(1-n)*t.height}function wc(t,e,r,n){let i=0;const s=t.length/(e||2),o=n.a,a=n.b,l=n.c,_=n.d,u=n.tx,c=n.ty;for(r*=e;i<s;){const n=t[r],s=t[r+1];t[r]=o*n+l*s+u,t[r+1]=a*n+_*s+c,r+=e,i++}}function Cc(t,e){const r=t.texture,n=r.frame.width,i=r.frame.height;let s=0,o=0;t._applyAnchorToTexture&&(s=t.anchor.x,o=t.anchor.y),e[0]=e[6]=-s,e[2]=e[4]=1-s,e[1]=e[3]=-o,e[5]=e[7]=1-o;const a=st.shared;a.copyFrom(t._tileTransform.matrix),a.tx/=t.width,a.ty/=t.height,a.invert(),a.scale(t.width/n,t.height/i),wc(e,2,0,a)}const Ec=new Oc;class Ac{constructor(t){this._state=Ea.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(t){const e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);const n=e.canBatch;if(n&&n===r){const{batchableMesh:r}=e;if(r&&r.texture._source!==t.texture._source)return!r._batcher.checkAndUpdateTexture(r,t.texture)}return r!==n}addRenderable(t,e){const r=this._renderer.renderPipes.batch;this._updateCanBatch(t);const n=this._getTilingSpriteData(t),{geometry:i,canBatch:s}=n;if(s){n.batchableMesh||(n.batchableMesh=new Ia);const s=n.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),s.geometry=i,s.renderable=t,s.transform=t.groupTransform,s.texture=t._texture),s.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(s,e)}else r.break(e),n.shader||(n.shader=new Pc),this.updateRenderable(t),e.add(t)}execute(t){const{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;const r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Aa(t.groupColorAlpha,r.uColor,0),this._state.blendMode=Zn(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Ec,shader:e,state:this._state})}updateRenderable(t){const e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){const{batchableMesh:r}=e;t.didViewUpdate&&this._updateBatchableMesh(t),r._batcher.updateElement(r)}else if(t.didViewUpdate){const{shader:r}=e;r.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}destroyRenderable(t){var e;const r=this._getTilingSpriteData(t);r.batchableMesh=null,null==(e=r.shader)||e.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){const e=new ac({indices:Ec.indices,positions:Ec.positions.slice(),uvs:Ec.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:!0,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){const e=this._getTilingSpriteData(t),{geometry:r}=e,n=t.texture.source.style;"repeat"!==n.addressMode&&(n.addressMode="repeat",n.update()),Cc(t,r.uvs),Mc(t,r.positions)}destroy(){for(const t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){const e=this._getTilingSpriteData(t),r=t.texture;let n=!0;return this._renderer.type===to.WEBGL&&(n=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(n||r.source.isPowerOfTwo),e.canBatch}}Ac.extension={type:[c.WebGLPipes,c.WebGPUPipes,c.CanvasPipes],name:"tilingSprite"},p.add(Ac);var Rc=Object.defineProperty,Ic=Object.getOwnPropertySymbols,Dc=Object.prototype.hasOwnProperty,Bc=Object.prototype.propertyIsEnumerable,kc=(t,e,r)=>e in t?Rc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Uc=(t,e)=>{for(var r in e||(e={}))Dc.call(e,r)&&kc(t,r,e[r]);if(Ic)for(var r of Ic(e))Bc.call(e,r)&&kc(t,r,e[r]);return t};const Fc=class t extends ac{constructor(...t){var e;super({});let r=null!=(e=t[0])?e:{};"number"==typeof r&&(r={width:r,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(r)}build(e){var r,n,i,s;e=Uc(Uc({},t.defaultOptions),e),this.verticesX=null!=(r=this.verticesX)?r:e.verticesX,this.verticesY=null!=(n=this.verticesY)?n:e.verticesY,this.width=null!=(i=this.width)?i:e.width,this.height=null!=(s=this.height)?s:e.height;const o=this.verticesX*this.verticesY,a=[],l=[],_=[],u=this.verticesX-1,c=this.verticesY-1,h=this.width/u,d=this.height/c;for(let t=0;t<o;t++){const e=t%this.verticesX,r=t/this.verticesX|0;a.push(e*h,r*d),l.push(e/u,r/c)}const p=u*c;for(let t=0;t<p;t++){const e=t%u,r=t/u|0,n=r*this.verticesX+e,i=r*this.verticesX+e+1,s=(r+1)*this.verticesX+e,o=(r+1)*this.verticesX+e+1;_.push(n,i,s,i,o,s)}this.buffers[0].data=new Float32Array(a),this.buffers[1].data=new Float32Array(l),this.indexBuffer.data=new Uint32Array(_),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};Fc.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};let Lc=Fc;var Gc=Object.defineProperty,jc=Object.getOwnPropertySymbols,Nc=Object.prototype.hasOwnProperty,zc=Object.prototype.propertyIsEnumerable,Wc=(t,e,r)=>e in t?Gc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Vc=(t,e)=>{for(var r in e||(e={}))Nc.call(e,r)&&Wc(t,r,e[r]);if(jc)for(var r of jc(e))zc.call(e,r)&&Wc(t,r,e[r]);return t};const Hc=class t extends Lc{constructor(e={}){super({width:(e=Vc(Vc({},t.defaultOptions),e)).width,height:e.height,verticesX:4,verticesY:4}),this.update(e)}update(t){var e,r,n,i,s,o,a,l;this.width=null!=(e=t.width)?e:this.width,this.height=null!=(r=t.height)?r:this.height,this._originalWidth=null!=(n=t.originalWidth)?n:this._originalWidth,this._originalHeight=null!=(i=t.originalHeight)?i:this._originalHeight,this._leftWidth=null!=(s=t.leftWidth)?s:this._leftWidth,this._rightWidth=null!=(o=t.rightWidth)?o:this._rightWidth,this._topHeight=null!=(a=t.topHeight)?a:this._topHeight,this._bottomHeight=null!=(l=t.bottomHeight)?l:this._bottomHeight,this.updateUvs(),this.updatePositions()}updatePositions(){const t=this.positions,e=this._leftWidth+this._rightWidth,r=this.width>e?1:this.width/e,n=this._topHeight+this._bottomHeight,i=this.height>n?1:this.height/n,s=Math.min(r,i);t[9]=t[11]=t[13]=t[15]=this._topHeight*s,t[17]=t[19]=t[21]=t[23]=this.height-this._bottomHeight*s,t[25]=t[27]=t[29]=t[31]=this.height,t[2]=t[10]=t[18]=t[26]=this._leftWidth*s,t[4]=t[12]=t[20]=t[28]=this.width-this._rightWidth*s,t[6]=t[14]=t[22]=t[30]=this.width,this.getBuffer("aPosition").update()}updateUvs(){const t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;const e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update()}};Hc.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};let Xc=Hc;class Kc{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){const r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){const e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){const e=t._texture,r=this._getGpuSprite(t);return r.texture._source!==e._source&&!r._batcher.checkAndUpdateTexture(r,e)}destroyRenderable(t){const e=this._gpuSpriteHash[t.uid];dt.return(e.geometry),dt.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.geometry.update(t),e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=dt.get(Ia);return e.geometry=dt.get(Xc),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}}Kc.extension={type:[c.WebGLPipes,c.WebGPUPipes,c.CanvasPipes],name:"nineSliceSprite"},p.add(Kc);class Yc{constructor(t){this._renderer=t}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){"pushFilter"===t.action?this._renderer.filter.push(t):"popFilter"===t.action&&this._renderer.filter.pop()}destroy(){this._renderer=null}}Yc.extension={type:[c.WebGLPipes,c.WebGPUPipes,c.CanvasPipes],name:"filter"};const Qc=new st;function $c(t,e){return e.clear(),qc(t,e),e.isValid||e.set(0,0,0,0),t.renderGroup?e.applyMatrix(t.renderGroup.localTransform):e.applyMatrix(t.parentRenderGroup.worldTransform),e}function qc(t,e){if(7!==t.localDisplayStatus||!t.measurable)return;const r=!!t.effects.length;let n=e;if((t.renderGroup||r)&&(n=It.get().clear()),t.boundsArea)e.addRect(t.boundsArea,t.worldTransform);else{if(t.renderPipeId){const e=t.bounds;n.addFrame(e.minX,e.minY,e.maxX,e.maxY,t.groupTransform)}const e=t.children;for(let t=0;t<e.length;t++)qc(e[t],n)}if(r){let r=!1;for(let e=0;e<t.effects.length;e++)t.effects[e].addBounds&&(r||(r=!0,n.applyMatrix(t.parentRenderGroup.worldTransform)),t.effects[e].addBounds(n,!0));r&&(n.applyMatrix(t.parentRenderGroup.worldTransform.copyTo(Qc).invert()),e.addBounds(n,t.relativeGroupTransform)),e.addBounds(n),It.return(n)}else t.renderGroup&&(e.addBounds(n,t.relativeGroupTransform),It.return(n))}function Zc(t,e){e.clear();const r=e.matrix;for(let r=0;r<t.length;r++){const n=t[r];n.globalDisplayStatus<7||(e.matrix=n.worldTransform,n.addBounds(e))}return e.matrix=r,e}const Jc=new mi({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:8,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])});class th{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new qs({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new Fn({}),this.renderer=t}get activeBackTexture(){var t;return null==(t=this._activeFilterData)?void 0:t.backTexture}push(t){var e,r;const n=this.renderer,i=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());const s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,0===i.length)return void(s.skip=!0);const o=s.bounds;t.renderables?Zc(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):$c(t.container,o);const a=n.renderTarget.renderTarget.colorTexture.source;let l=1/0,_=0,u=!0,c=!1,h=!1,d=!0;for(let t=0;t<i.length;t++){const s=i[t];if(l=Math.min(l,"inherit"===s.resolution?a._resolution:s.resolution),_+=s.padding,"off"===s.antialias?u=!1:"inherit"===s.antialias&&u&&(u=a.antialias),s.clipToViewport||(d=!1),!(s.compatibleRenderers&n.type)){h=!1;break}if(s.blendRequired&&null!=(r=null==(e=n.backBuffer)?void 0:e.useBackBuffer)&&!r){h=!1;break}h=s.enabled||h,c=c||s.blendRequired}if(h){if(o.scale(l),d){const t=n.renderTarget.rootViewPort;o.fitBounds(0,t.width,0,t.height)}o.ceil().scale(1/l).pad(0|_),o.isPositive?(s.skip=!1,s.bounds=o,s.blendRequired=c,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=n.renderTarget.renderSurface,s.inputTexture=ol.getOptimalTexture(o.width,o.height,l,u),n.renderTarget.bind(s.inputTexture,!0),n.globalUniforms.push({offset:o})):s.skip=!0}else s.skip=!0}pop(){const t=this.renderer;this._filterStackIndex--;const e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;const r=e.inputTexture,n=e.bounds;let i=$r.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){const r=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,s=t.renderTarget.getRenderTarget(e.previousRenderSurface);i=this.getBackTexture(s,n,r)}e.backTexture=i;const s=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(i.source,3),t.globalUniforms.pop(),1===s.length)s[0].apply(this,r,e.previousRenderSurface,!1),ol.returnTexture(r);else{let t=e.inputTexture,r=ol.getOptimalTexture(n.width,n.height,t.source._resolution,!1),i=0;for(i=0;i<s.length-1;++i){s[i].apply(this,t,r,!0);const e=t;t=r,r=e}s[i].apply(this,t,e.previousRenderSurface,!1),ol.returnTexture(t),ol.returnTexture(r)}e.blendRequired&&ol.returnTexture(i)}getBackTexture(t,e,r){const n=t.colorTexture.source._resolution,i=ol.getOptimalTexture(e.width,e.height,n,!1);let s=e.minX,o=e.minY;r&&(s-=r.minX,o-=r.minY),s=Math.floor(s*n),o=Math.floor(o*n);const a=Math.ceil(e.width*n),l=Math.ceil(e.height*n);return this.renderer.renderTarget.copyToTexture(t,i,{x:s,y:o},{width:a,height:l},{x:0,y:0}),i}applyFilter(t,e,r,n){const i=this.renderer,s=this._filterStack[this._filterStackIndex],o=s.bounds,a=nt.shared,l=s.previousRenderSurface===r;let _=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,u=this._filterStackIndex-1;for(;u>0&&this._filterStack[u].skip;)--u;u>0&&(_=this._filterStack[u].inputTexture.source._resolution);const c=this._filterGlobalUniforms,h=c.uniforms,d=h.uOutputFrame,p=h.uInputSize,y=h.uInputPixel,v=h.uInputClamp,f=h.uGlobalFrame,m=h.uOutputTexture;if(l){let t=this._filterStackIndex;for(;t>0;){t--;const e=this._filterStack[this._filterStackIndex-1];if(!e.skip){a.x=e.bounds.minX,a.y=e.bounds.minY;break}}d[0]=o.minX-a.x,d[1]=o.minY-a.y}else d[0]=0,d[1]=0;d[2]=e.frame.width,d[3]=e.frame.height,p[0]=e.source.width,p[1]=e.source.height,p[2]=1/p[0],p[3]=1/p[1],y[0]=e.source.pixelWidth,y[1]=e.source.pixelHeight,y[2]=1/y[0],y[3]=1/y[1],v[0]=.5*y[2],v[1]=.5*y[3],v[2]=e.frame.width*p[2]-.5*y[2],v[3]=e.frame.height*p[3]-.5*y[3];const g=this.renderer.renderTarget.rootRenderTarget.colorTexture;f[0]=a.x*_,f[1]=a.y*_,f[2]=g.source.width*_,f[3]=g.source.height*_;const x=this.renderer.renderTarget.getRenderTarget(r);if(i.renderTarget.bind(r,!!n),r instanceof $r?(m[0]=r.frame.width,m[1]=r.frame.height):(m[0]=x.width,m[1]=x.height),m[2]=x.isRoot?-1:1,c.update(),i.renderPipes.uniformBatch){const t=i.renderPipes.uniformBatch.getUboResource(c);this._globalFilterBindGroup.setResource(t,0)}else this._globalFilterBindGroup.setResource(c,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,i.encoder.draw({geometry:Jc,shader:t,state:t._state,topology:"triangle-list"}),i.type===to.WEBGL&&i.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new At,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){const r=this._activeFilterData,n=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),i=e.worldTransform.copyTo(st.shared);return i.invert(),n.prepend(i),n.scale(1/e.texture.frame.width,1/e.texture.frame.height),n.translate(e.anchor.x,e.anchor.y),n}}th.extension={type:[c.WebGLSystem,c.WebGPUSystem],name:"filter"},p.add(th),p.add(Yc);var eh={__proto__:null};const rh=[];async function nh(t){if(!t)for(let t=0;t<rh.length;t++){const e=rh[t];if(e.value.test())return void await e.value.load()}}let ih;function sh(){if("boolean"==typeof ih)return ih;try{ih=!0===new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")}catch(t){ih=!1}return ih}p.handleByNamedList(c.Environment,rh);var oh=(t=>(t[t.NONE=0]="NONE",t[t.COLOR=16384]="COLOR",t[t.STENCIL=1024]="STENCIL",t[t.DEPTH=256]="DEPTH",t[t.COLOR_DEPTH=16640]="COLOR_DEPTH",t[t.COLOR_STENCIL=17408]="COLOR_STENCIL",t[t.DEPTH_STENCIL=1280]="DEPTH_STENCIL",t[t.ALL=17664]="ALL",t))(oh||{});class ah{constructor(t){this.items=[],this._name=t}emit(t,e,r,n,i,s,o,a){const{name:l,items:_}=this;for(let u=0,c=_.length;u<c;u++)_[u][l](t,e,r,n,i,s,o,a);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return-1!==e&&this.items.splice(e,1),this}contains(t){return-1!==this.items.indexOf(t)}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return 0===this.items.length}get name(){return this._name}}var lh=Object.defineProperty,_h=Object.getOwnPropertySymbols,uh=Object.prototype.hasOwnProperty,ch=Object.prototype.propertyIsEnumerable,hh=(t,e,r)=>e in t?lh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,dh=(t,e)=>{for(var r in e||(e={}))uh.call(e,r)&&hh(t,r,e[r]);if(_h)for(var r of _h(e))ch.call(e,r)&&hh(t,r,e[r]);return t};const ph=["init","destroy","contextChange","resolutionChange","reset","renderEnd","renderStart","render","update","postrender","prerender"],yh=class t extends f{constructor(t){var e;super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;const r=[...ph,...null!=(e=this.config.runners)?e:[]];this._addRunners(...r),this._unsafeEvalCheck()}async init(e={}){const r=!0===e.skipExtensionImports||!1===e.manageImports;await nh(r),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const t in this._systemsHash){const r=this._systemsHash[t].constructor.defaultOptions;e=dh(dh({},r),e)}e=dh(dh({},t.defaultOptions),e),this._roundPixels=e.roundPixels?1:0;for(let t=0;t<this.runners.init.items.length;t++)await this.runners.init.items[t].init(e);this._initOptions=e}render(t,e){let r=t;if(r instanceof Zt&&(r={container:r},e&&(r.target=e.renderTexture)),r.target||(r.target=this.view.renderTarget),r.target===this.view.renderTarget&&(this._lastObjectRendered=r.container,r.clearColor=this.background.colorRgba),r.clearColor){const t=Array.isArray(r.clearColor)&&4===r.clearColor.length;r.clearColor=t?r.clearColor:Z.shared.setValue(r.clearColor).toArray()}r.transform||(r.container.updateLocalTransform(),r.transform=r.container.localTransform),this.runners.prerender.emit(r),this.runners.renderStart.emit(r),this.runners.render.emit(r),this.runners.renderEnd.emit(r),this.runners.postrender.emit(r)}resize(t,e,r){const n=this.view.resolution;this.view.resize(t,e,r),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),void 0!==r&&r!==n&&this.runners.resolutionChange.emit(r)}clear(t={}){t.target||(t.target=this.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),null!=t.clear||(t.clear=oh.ALL);const{clear:e,clearColor:r,target:n}=t;Z.shared.setValue(null!=r?r:this.background.colorRgba),this.renderTarget.clear(n,e,Z.shared.toArray())}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach((t=>{this.runners[t]=new ah(t)}))}_addSystems(t){let e;for(e in t){const r=t[e];this._addSystem(r.value,r.name)}}_addSystem(t,e){const r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(const t in this.runners)this.runners[t].add(r);return this}_addPipes(t,e){const r=e.reduce(((t,e)=>(t[e.name]=e.value,t)),{});t.forEach((t=>{const e=t.value,n=t.name,i=r[n];this.renderPipes[n]=new e(this,i?new i:null)}))}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach((t=>{t.destroy()})),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!sh())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}};yh.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let vh,fh,mh=yh;function gh(t){return void 0!==vh||(vh=(()=>{var e;const r={stencil:!0,failIfMajorPerformanceCaveat:null!=t?t:mh.defaultOptions.failIfMajorPerformanceCaveat};try{if(!Xe.get().getWebGLRenderingContext())return!1;let t=Xe.get().createCanvas().getContext("webgl",r);const n=!(null==(e=null==t?void 0:t.getContextAttributes())||!e.stencil);if(t){const e=t.getExtension("WEBGL_lose_context");e&&e.loseContext()}return t=null,n}catch(t){return!1}})()),vh}async function xh(t={}){return void 0!==fh||(fh=await(async()=>{const e=Xe.get().getNavigator().gpu;if(!e)return!1;try{return await(await e.requestAdapter(t)).requestDevice(),!0}catch(t){return!1}})()),fh}var bh=Object.defineProperty,Sh=Object.getOwnPropertySymbols,Th=Object.prototype.hasOwnProperty,Ph=Object.prototype.propertyIsEnumerable,Oh=(t,e,r)=>e in t?bh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Mh=(t,e)=>{for(var r in e||(e={}))Th.call(e,r)&&Oh(t,r,e[r]);if(Sh)for(var r of Sh(e))Ph.call(e,r)&&Oh(t,r,e[r]);return t};const wh=["webgl","webgpu","canvas"];async function Ch(t){var e;let r=[];t.preference?(r.push(t.preference),wh.forEach((e=>{e!==t.preference&&r.push(e)}))):r=wh.slice();let n,i={};for(let s=0;s<r.length;s++){const o=r[s];if("webgpu"===o&&await xh()){const{WebGPURenderer:e}=await Promise.resolve().then((function(){return gT}));n=e,i=Mh(Mh({},t),t.webgpu);break}if("webgl"===o&&gh(null!=(e=t.failIfMajorPerformanceCaveat)?e:mh.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:e}=await Promise.resolve().then((function(){return xS}));n=e,i=Mh(Mh({},t),t.webgl);break}if("canvas"===o)throw i=Mh({},t),new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!n)throw new Error("No available renderer for the current environment");const s=new n;return await s.init(i),s}const Eh="8.5.2";class Ah{static init(){var t;null==(t=globalThis.__PIXI_APP_INIT__)||t.call(globalThis,this,Eh)}static destroy(){}}Ah.extension=c.Application;class Rh{constructor(t){this._renderer=t}init(){var t;null==(t=globalThis.__PIXI_RENDERER_INIT__)||t.call(globalThis,this._renderer,Eh)}destroy(){this._renderer=null}}Rh.extension={type:[c.WebGLSystem,c.WebGPUSystem],name:"initHook",priority:-10};var Ih=Object.defineProperty,Dh=Object.getOwnPropertySymbols,Bh=Object.prototype.hasOwnProperty,kh=Object.prototype.propertyIsEnumerable,Uh=(t,e,r)=>e in t?Ih(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;const Fh=class t{constructor(...t){this.stage=new Zt}async init(e){e=((t,e)=>{for(var r in e||(e={}))Bh.call(e,r)&&Uh(t,r,e[r]);if(Dh)for(var r of Dh(e))kh.call(e,r)&&Uh(t,r,e[r]);return t})({},e),this.renderer=await Ch(e),t._plugins.forEach((t=>{t.init.call(this,e)}))}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return this.renderer.canvas}get screen(){return this.renderer.screen}destroy(e=!1,r=!1){const n=t._plugins.slice(0);n.reverse(),n.forEach((t=>{t.destroy.call(this)})),this.stage.destroy(r),this.stage=null,this.renderer.destroy(e),this.renderer=null}};Fh._plugins=[];let Lh=Fh;p.handleByList(c.Application,Lh._plugins),p.add(Ah);class Gh extends su{constructor(t,e){var r;super();const{textures:n,data:i}=t;Object.keys(i.pages).forEach((t=>{const e=i.pages[parseInt(t,10)],r=n[e.id];this.pages.push({texture:r})})),Object.keys(i.chars).forEach((t=>{var e;const r=i.chars[t],{frame:s,source:o}=n[r.page],a=new Ct(r.x+s.x,r.y+s.y,r.width,r.height),l=new $r({source:o,frame:a});this.chars[t]={id:t.codePointAt(0),xOffset:r.xOffset,yOffset:r.yOffset,xAdvance:r.xAdvance,kerning:null!=(e=r.kerning)?e:{},texture:l}})),this.baseRenderedFontSize=i.fontSize,this.baseMeasurementFontSize=i.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:i.fontSize},this.baseLineOffset=i.baseLineOffset,this.lineHeight=i.lineHeight,this.fontFamily=i.fontFamily,this.distanceField=null!=(r=i.distanceField)?r:{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){const{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){Tu.install(t)}static uninstall(t){Tu.uninstall(t)}}const jh={test:t=>"string"==typeof t&&t.startsWith("info face="),parse(t){var e,r,n;const i=t.match(/^[a-z]+\s+.+$/gm),s={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const t in i){const e=i[t].match(/^[a-z]+/gm)[0],r=i[t].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),n={};for(const t in r){const e=r[t].split("="),i=e[0],s=e[1].replace(/"/gm,""),o=parseFloat(s),a=isNaN(o)?s:o;n[i]=a}s[e].push(n)}const o={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[a]=s.info,[l]=s.common,[_]=null!=(e=s.distanceField)?e:[];_&&(o.distanceField={range:parseInt(_.distanceRange,10),type:_.fieldType}),o.fontSize=parseInt(a.size,10),o.fontFamily=a.face,o.lineHeight=parseInt(l.lineHeight,10);const u=s.page;for(let t=0;t<u.length;t++)o.pages.push({id:parseInt(u[t].id,10)||0,file:u[t].file});const c={};o.baseLineOffset=o.lineHeight-parseInt(l.base,10);const h=s.char;for(let t=0;t<h.length;t++){const e=h[t],i=parseInt(e.id,10);let s=null!=(n=null!=(r=e.letter)?r:e.char)?n:String.fromCharCode(i);"space"===s&&(s=" "),c[i]=s,o.chars[s]={id:i,page:parseInt(e.page,10)||0,x:parseInt(e.x,10),y:parseInt(e.y,10),width:parseInt(e.width,10),height:parseInt(e.height,10),xOffset:parseInt(e.xoffset,10),yOffset:parseInt(e.yoffset,10),xAdvance:parseInt(e.xadvance,10),kerning:{}}}const d=s.kerning||[];for(let t=0;t<d.length;t++){const e=parseInt(d[t].first,10),r=parseInt(d[t].second,10),n=parseInt(d[t].amount,10);o.chars[c[r]].kerning[c[e]]=n}return o}},Nh={test(t){const e=t;return"string"!=typeof e&&"getElementsByTagName"in e&&e.getElementsByTagName("page").length&&null!==e.getElementsByTagName("info")[0].getAttribute("face")},parse(t){var e,r;const n={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},i=t.getElementsByTagName("info")[0],s=t.getElementsByTagName("common")[0],o=t.getElementsByTagName("distanceField")[0];o&&(n.distanceField={type:o.getAttribute("fieldType"),range:parseInt(o.getAttribute("distanceRange"),10)});const a=t.getElementsByTagName("page"),l=t.getElementsByTagName("char"),_=t.getElementsByTagName("kerning");n.fontSize=parseInt(i.getAttribute("size"),10),n.fontFamily=i.getAttribute("face"),n.lineHeight=parseInt(s.getAttribute("lineHeight"),10);for(let t=0;t<a.length;t++)n.pages.push({id:parseInt(a[t].getAttribute("id"),10)||0,file:a[t].getAttribute("file")});const u={};n.baseLineOffset=n.lineHeight-parseInt(s.getAttribute("base"),10);for(let t=0;t<l.length;t++){const i=l[t],s=parseInt(i.getAttribute("id"),10);let o=null!=(r=null!=(e=i.getAttribute("letter"))?e:i.getAttribute("char"))?r:String.fromCharCode(s);"space"===o&&(o=" "),u[s]=o,n.chars[o]={id:s,page:parseInt(i.getAttribute("page"),10)||0,x:parseInt(i.getAttribute("x"),10),y:parseInt(i.getAttribute("y"),10),width:parseInt(i.getAttribute("width"),10),height:parseInt(i.getAttribute("height"),10),xOffset:parseInt(i.getAttribute("xoffset"),10),yOffset:parseInt(i.getAttribute("yoffset"),10),xAdvance:parseInt(i.getAttribute("xadvance"),10),kerning:{}}}for(let t=0;t<_.length;t++){const e=parseInt(_[t].getAttribute("first"),10),r=parseInt(_[t].getAttribute("second"),10),i=parseInt(_[t].getAttribute("amount"),10);n.chars[u[r]].kerning[u[e]]=i}return n}},zh={test:t=>!("string"!=typeof t||!t.includes("<font>"))&&Nh.test(Xe.get().parseXML(t)),parse:t=>Nh.parse(Xe.get().parseXML(t))},Wh=[".xml",".fnt"],Vh={extension:{type:c.CacheParser,name:"cacheBitmapFont"},test:t=>t instanceof Gh,getCacheableAssets(t,e){const r={};return t.forEach((t=>{r[t]=e,r[`${t}-bitmap`]=e})),r[`${e.fontFamily}-bitmap`]=e,r}},Hh={extension:{type:c.LoadParser,priority:We.Normal},name:"loadBitmapFont",test:t=>Wh.includes(Qe.extname(t).toLowerCase()),testParse:async t=>jh.test(t)||zh.test(t),async parse(t,e,r){const n=jh.test(t)?jh.parse(t):zh.parse(t),{src:i}=e,{pages:s}=n,o=[],a=n.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let t=0;t<s.length;++t){const e=s[t].file;let r=Qe.join(Qe.dirname(i),e);r=ur(r,i),o.push({src:r,data:a})}const l=await r.load(o),_=o.map((t=>l[t.src]));return new Gh({data:n,textures:_},i)},load:async(t,e)=>await(await Xe.get().fetch(t)).text(),async unload(t,e,r){await Promise.all(t.pages.map((t=>r.unload(t.texture.source._sourceOrigin)))),t.destroy()}};class Xh{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach((t=>{this._assetList.push(t)})),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 r=0;r<e;r++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}const Kh={extension:{type:c.CacheParser,name:"cacheTextureArray"},test:t=>Array.isArray(t)&&t.every((t=>t instanceof $r)),getCacheableAssets:(t,e)=>{const r={};return t.forEach((t=>{e.forEach(((e,n)=>{r[t+(0===n?"":n+1)]=e}))})),r}};async function Yh(t){if("Image"in globalThis)return new Promise((e=>{const r=new Image;r.onload=()=>{e(!0)},r.onerror=()=>{e(!1)},r.src=t}));if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const e=await(await fetch(t)).blob();await createImageBitmap(e)}catch(t){return!1}return!0}return!1}const Qh={extension:{type:c.DetectionParser,priority:1},test:async()=>Yh("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async t=>[...t,"avif"],remove:async t=>t.filter((t=>"avif"!==t))},$h=["png","jpg","jpeg"],qh={extension:{type:c.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async t=>[...t,...$h],remove:async t=>t.filter((t=>!$h.includes(t)))},Zh="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Jh(t){return!Zh&&""!==document.createElement("video").canPlayType(t)}const td={extension:{type:c.DetectionParser,priority:0},test:async()=>Jh("video/mp4"),add:async t=>[...t,"mp4","m4v"],remove:async t=>t.filter((t=>"mp4"!==t&&"m4v"!==t))},ed={extension:{type:c.DetectionParser,priority:0},test:async()=>Jh("video/ogg"),add:async t=>[...t,"ogv"],remove:async t=>t.filter((t=>"ogv"!==t))},rd={extension:{type:c.DetectionParser,priority:0},test:async()=>Jh("video/webm"),add:async t=>[...t,"webm"],remove:async t=>t.filter((t=>"webm"!==t))},nd={extension:{type:c.DetectionParser,priority:0},test:async()=>Yh("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async t=>[...t,"webp"],remove:async t=>t.filter((t=>"webp"!==t))};var id=Object.defineProperty,sd=Object.defineProperties,od=Object.getOwnPropertyDescriptors,ad=Object.getOwnPropertySymbols,ld=Object.prototype.hasOwnProperty,_d=Object.prototype.propertyIsEnumerable,ud=(t,e,r)=>e in t?id(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;class cd{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,r)=>(this._parsersValidated=!1,t[e]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const r={promise:null,parser:null};return r.promise=(async()=>{var n,i;let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser]),!o){for(let r=0;r<this.parsers.length;r++){const i=this.parsers[r];if(i.load&&null!=(n=i.test)&&n.call(i,t,e,this)){o=i;break}}if(!o)return null}s=await o.load(t,e,this),r.parser=o;for(let t=0;t<this.parsers.length;t++){const n=this.parsers[t];n.parse&&n.parse&&await(null==(i=n.testParse)?void 0:i.call(n,s,e,this))&&(s=await n.parse(s,e,this)||s,r.parser=n)}return s})(),r}async load(t,e){this._parsersValidated||this._validateParsers();let r=0;const n={},i=Je(t),s=$e(t,(t=>({alias:[t],src:t,data:{}}))),o=s.length,a=s.map((async t=>{const i=Qe.toAbsolute(t.src);if(!n[t.src])try{this.promiseCache[i]||(this.promiseCache[i]=this._getLoadPromiseAndParser(i,t)),n[t.src]=await this.promiseCache[i].promise,e&&e(++r/o)}catch(e){throw delete this.promiseCache[i],delete n[t.src],new Error(`[Loader.load] Failed to load ${i}.\n\t${e}`)}}));return await Promise.all(a),i?n[s[0].src]:n}async unload(t){const e=$e(t,(t=>({alias:[t],src:t}))).map((async t=>{var e,r;const n=Qe.toAbsolute(t.src),i=this.promiseCache[n];if(i){const s=await i.promise;delete this.promiseCache[n],await(null==(r=null==(e=i.parser)?void 0:e.unload)?void 0:r.call(e,s,t,this))}}));await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter((t=>t.name)).reduce(((t,e)=>(e.name&&t[e.name],((t,e)=>sd(t,od(e)))(((t,e)=>{for(var r in e||(e={}))ld.call(e,r)&&ud(t,r,e[r]);if(ad)for(var r of ad(e))_d.call(e,r)&&ud(t,r,e[r]);return t})({},t),{[e.name]:e}))),{})}}function hd(t,e){if(Array.isArray(e)){for(const r of e)if(t.startsWith(`data:${r}`))return!0;return!1}return t.startsWith(`data:${e}`)}function dd(t,e){const r=t.split("?")[0],n=Qe.extname(r).toLowerCase();return Array.isArray(e)?e.includes(n):n===e}const pd={extension:{type:c.LoadParser,priority:We.Low},name:"loadJson",test:t=>hd(t,"application/json")||dd(t,".json"),load:async t=>await(await Xe.get().fetch(t)).json()},yd={name:"loadTxt",extension:{type:c.LoadParser,priority:We.Low,name:"loadTxt"},test:t=>hd(t,"text/plain")||dd(t,".txt"),load:async t=>await(await Xe.get().fetch(t)).text()};var vd=Object.defineProperty,fd=Object.defineProperties,md=Object.getOwnPropertyDescriptors,gd=Object.getOwnPropertySymbols,xd=Object.prototype.hasOwnProperty,bd=Object.prototype.propertyIsEnumerable,Sd=(t,e,r)=>e in t?vd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Td=(t,e)=>{for(var r in e||(e={}))xd.call(e,r)&&Sd(t,r,e[r]);if(gd)for(var r of gd(e))bd.call(e,r)&&Sd(t,r,e[r]);return t},Pd=(t,e)=>fd(t,md(e));const Od=["normal","bold","100","200","300","400","500","600","700","800","900"],Md=[".ttf",".otf",".woff",".woff2"],wd=["font/ttf","font/otf","font/woff","font/woff2"],Cd=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Ed(t){const e=Qe.extname(t),r=Qe.basename(t,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map((t=>t.charAt(0).toUpperCase()+t.slice(1)));let n=r.length>0;for(const t of r)if(!t.match(Cd)){n=!1;break}let i=r.join(" ");return n||(i=`"${i.replace(/[\\"]/g,"\\$&")}"`),i}const Ad=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Rd(t){return Ad.test(t)?t:encodeURI(t)}const Id={extension:{type:c.LoadParser,priority:We.Low},name:"loadWebFont",test:t=>hd(t,wd)||dd(t,Md),async load(t,e){var r,n,i,s,o,a;const l=Xe.get().getFontFaceSet();if(l){const _=[],u=null!=(n=null==(r=e.data)?void 0:r.family)?n:Ed(t),c=null!=(o=null==(s=null==(i=e.data)?void 0:i.weights)?void 0:s.filter((t=>Od.includes(t))))?o:["normal"],h=null!=(a=e.data)?a:{};for(let e=0;e<c.length;e++){const r=c[e],n=new FontFace(u,`url(${Rd(t)})`,Pd(Td({},h),{weight:r}));await n.load(),l.add(n),_.push(n)}return In.set(`${u}-and-url`,{url:t,fontFaces:_}),1===_.length?_[0]:_}return null},unload(t){(Array.isArray(t)?t:[t]).forEach((t=>{In.remove(t.family),Xe.get().getFontFaceSet().delete(t)}))}};function Dd(t,e=1){var r;const n=null==(r=lr.RETINA_PREFIX)?void 0:r.exec(t);return n?parseFloat(n[1]):e}function Bd(t,e,r){t.label=r,t._sourceOrigin=r;const n=new $r({source:t,label:r}),i=()=>{delete e.promiseCache[r],In.has(r)&&In.remove(r)};return n.source.once("destroy",(()=>{e.promiseCache[r]&&i()})),n.once("destroy",(()=>{t.destroyed||i()})),n}var kd=Object.defineProperty,Ud=Object.getOwnPropertySymbols,Fd=Object.prototype.hasOwnProperty,Ld=Object.prototype.propertyIsEnumerable,Gd=(t,e,r)=>e in t?kd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;const jd={extension:{type:c.LoadParser,priority:We.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test:t=>hd(t,"image/svg+xml")||dd(t,".svg"),async load(t,e,r){var n;return(null!=(n=e.data.parseAsGraphicsContext)?n:this.config.parseAsGraphicsContext)?async function(t){const e=await(await Xe.get().fetch(t)).text(),r=new b_;return r.svg(e),r}(t):async function(t,e,r,n){var i,s,o,a,l;const _=await(await Xe.get().fetch(t)).blob(),u=URL.createObjectURL(_),c=new Image;c.src=u,c.crossOrigin=n,await c.decode(),URL.revokeObjectURL(u);const h=document.createElement("canvas"),d=h.getContext("2d"),p=(null==(i=e.data)?void 0:i.resolution)||Dd(t),y=null!=(o=null==(s=e.data)?void 0:s.width)?o:c.width,v=null!=(l=null==(a=e.data)?void 0:a.height)?l:c.height;h.width=y*p,h.height=v*p,d.drawImage(c,0,0,y*p,v*p);const f=e.data,{parseAsGraphicsContext:m}=f,g=((t,e)=>{var r={};for(var n in t)Fd.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&Ud)for(var n of Ud(t))e.indexOf(n)<0&&Ld.call(t,n)&&(r[n]=t[n]);return r})(f,["parseAsGraphicsContext"]);return Bd(new gn(((t,e)=>{for(var r in e||(e={}))Fd.call(e,r)&&Gd(t,r,e[r]);if(Ud)for(var r of Ud(e))Ld.call(e,r)&&Gd(t,r,e[r]);return t})({resource:h,alphaMode:"premultiply-alpha-on-upload",resolution:p},g)),r,t)}(t,e,r,this.config.crossOrigin)},unload(t){t.destroy(!0)}};let Nd=null,zd=class{constructor(){Nd||(Nd=URL.createObjectURL(new Blob(['(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)})})();\n\t'],{type:"application/javascript"}))),this.worker=new Worker(Nd)}};zd.revokeObjectURL=function(){Nd&&(URL.revokeObjectURL(Nd),Nd=null)};let Wd=null,Vd=class{constructor(){Wd||(Wd=URL.createObjectURL(new Blob(['(function(){"use strict";async function s(a,t){const e=await fetch(a);if(!e.ok)throw new Error(`[WorkerManager.loadImageBitmap] Failed to fetch ${a}: ${e.status} ${e.statusText}`);const i=await e.blob();return t==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}self.onmessage=async a=>{try{const t=await s(a.data.data[0],a.data.data[1]);self.postMessage({data:t,uuid:a.data.uuid,id:a.data.id},[t])}catch(t){self.postMessage({error:t,uuid:a.data.uuid,id:a.data.id})}}})();\n'],{type:"application/javascript"}))),this.worker=new Worker(Wd)}};Vd.revokeObjectURL=function(){Wd&&(URL.revokeObjectURL(Wd),Wd=null)};let Hd,Xd=0;const Kd=new class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return void 0!==this._isImageBitmapSupported||(this._isImageBitmapSupported=new Promise((t=>{const{worker:e}=new zd;e.addEventListener("message",(r=>{e.terminate(),zd.revokeObjectURL(),t(r.data)}))}))),this._isImageBitmapSupported}loadImageBitmap(t,e){var r;return this._run("loadImageBitmap",[t,null==(r=null==e?void 0:e.data)?void 0:r.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){void 0===Hd&&(Hd=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Hd&&(this._createdWorkers++,t=(new Vd).worker,t.addEventListener("message",(t=>{this._complete(t.data),this._returnWorker(t.target),this._next()}))),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){void 0!==t.error?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 r=new Promise(((r,n)=>{this._queue.push({id:t,arguments:e,resolve:r,reject:n})}));return this._next(),r}_next(){if(!this._queue.length)return;const t=this._getWorker();if(!t)return;const e=this._queue.pop(),r=e.id;this._resolveHash[Xd]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Xd++,id:r})}};var Yd=Object.defineProperty,Qd=Object.getOwnPropertySymbols,$d=Object.prototype.hasOwnProperty,qd=Object.prototype.propertyIsEnumerable,Zd=(t,e,r)=>e in t?Yd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;const Jd=[".jpeg",".jpg",".png",".webp",".avif"],tp=["image/jpeg","image/png","image/webp","image/avif"];async function ep(t,e){var r;const n=await Xe.get().fetch(t);if(!n.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${t}: ${n.status} ${n.statusText}`);const i=await n.blob();return"premultiplied-alpha"===(null==(r=null==e?void 0:e.data)?void 0:r.alphaMode)?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}const rp={name:"loadTextures",extension:{type:c.LoadParser,priority:We.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test:t=>hd(t,tp)||dd(t,Jd),async load(t,e,r){var n;let i=null;i=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Kd.isImageBitmapSupported()?await Kd.loadImageBitmap(t,e):await ep(t,e):await new Promise((e=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=t,i.complete?e(i):i.onload=()=>{e(i)}}));const s=new gn(((t,e)=>{for(var r in e||(e={}))$d.call(e,r)&&Zd(t,r,e[r]);if(Qd)for(var r of Qd(e))qd.call(e,r)&&Zd(t,r,e[r]);return t})({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:(null==(n=e.data)?void 0:n.resolution)||Dd(t)},e.data));return Bd(s,r,t)},unload(t){t.destroy(!0)}};var np=Object.defineProperty,ip=Object.defineProperties,sp=Object.getOwnPropertyDescriptors,op=Object.getOwnPropertySymbols,ap=Object.prototype.hasOwnProperty,lp=Object.prototype.propertyIsEnumerable,_p=(t,e,r)=>e in t?np(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,up=(t,e)=>{for(var r in e||(e={}))ap.call(e,r)&&_p(t,r,e[r]);if(op)for(var r of op(e))lp.call(e,r)&&_p(t,r,e[r]);return t},cp=(t,e)=>ip(t,sp(e));const hp=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],dp=hp.map((t=>`video/${t.substring(1)}`));function pp(t,e,r){void 0!==r||e.startsWith("data:")?!1!==r&&(t.crossOrigin="string"==typeof r?r:"anonymous"):t.crossOrigin=vp(e)}function yp(t){return new Promise(((e,r)=>{function n(){s(),e()}function i(t){s(),r(t)}function s(){t.removeEventListener("canplaythrough",n),t.removeEventListener("error",i)}t.addEventListener("canplaythrough",n),t.addEventListener("error",i),t.load()}))}function vp(t,e=globalThis.location){if(t.startsWith("data:"))return"";e=e||globalThis.location;const r=new URL(t,document.baseURI);return r.hostname!==e.hostname||r.port!==e.port||r.protocol!==e.protocol?"anonymous":""}const fp={name:"loadVideo",extension:{type:c.LoadParser,name:"loadVideo"},test(t){const e=hd(t,dp),r=dd(t,hp);return e||r},async load(t,e,r){var n,i;const s=up(cp(up({},Rn.defaultOptions),{resolution:(null==(n=e.data)?void 0:n.resolution)||Dd(t),alphaMode:(null==(i=e.data)?void 0:i.alphaMode)||await bn()}),e.data),o=document.createElement("video"),a={preload:!1!==s.autoLoad?"auto":void 0,"webkit-playsinline":!1!==s.playsinline?"":void 0,playsinline:!1!==s.playsinline?"":void 0,muted:!0===s.muted?"":void 0,loop:!0===s.loop?"":void 0,autoplay:!1!==s.autoPlay?"":void 0};Object.keys(a).forEach((t=>{const e=a[t];void 0!==e&&o.setAttribute(t,e)})),!0===s.muted&&(o.muted=!0),pp(o,t,s.crossorigin);const l=document.createElement("source");let _;if(t.startsWith("data:"))_=t.slice(5,t.indexOf(";"));else if(!t.startsWith("blob:")){const e=t.split("?")[0].slice(t.lastIndexOf(".")+1).toLowerCase();_=Rn.MIME_TYPES[e]||`video/${e}`}return l.src=t,_&&(l.type=_),new Promise((n=>{const i=async()=>{const a=new Rn(cp(up({},s),{resource:o}));o.removeEventListener("canplay",i),e.data.preload&&await yp(o),n(Bd(a,r,t))};o.addEventListener("canplay",i),o.appendChild(l)}))},unload(t){t.destroy(!0)}},mp={extension:{type:c.ResolveParser,name:"resolveTexture"},test:rp.test,parse:t=>{var e,r;return{resolution:parseFloat(null!=(r=null==(e=lr.RETINA_PREFIX.exec(t))?void 0:e[1])?r:"1"),format:t.split(".").pop(),src:t}}},gp={extension:{type:c.ResolveParser,priority:-2,name:"resolveJson"},test:t=>lr.RETINA_PREFIX.test(t)&&t.endsWith(".json"),parse:mp.parse};class xp{constructor(){this._detections=[],this._initialized=!1,this.resolver=new lr,this.loader=new cd,this.cache=In,this._backgroundLoader=new Xh(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var e,r,n;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 e=t.manifest;"string"==typeof e&&(e=await this.load(e)),this.resolver.addManifest(e)}const i=null!=(r=null==(e=t.texturePreference)?void 0:e.resolution)?r:1,s="number"==typeof i?[i]:i,o=await this._detectFormats({preferredFormats:null==(n=t.texturePreference)?void 0:n.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:o,resolution:s}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();const r=Je(t),n=$e(t).map((t=>{if("string"!=typeof t){const e=this.resolver.getAlias(t);return e.some((t=>!this.resolver.hasKey(t)))&&this.add(t),Array.isArray(e)?e[0]:e}return this.resolver.hasKey(t)||this.add({alias:t,src:t}),t})),i=this.resolver.resolve(n),s=await this._mapLoadToResolve(i,e);return r?s[n[0]]:s}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;"string"==typeof t&&(r=!0,t=[t]);const n=this.resolver.resolveBundle(t),i={},s=Object.keys(n);let o=0,a=0;const l=()=>{null==e||e(++o/a)},_=s.map((t=>{const e=n[t];return a+=Object.keys(e).length,this._mapLoadToResolve(e,l).then((e=>{i[t]=e}))}));return await Promise.all(_),r?i[t[0]]:i}async backgroundLoad(t){this._initialized||await this.init(),"string"==typeof t&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),"string"==typeof t&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach((t=>{this._backgroundLoader.add(Object.values(t))}))}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if("string"==typeof t)return In.get(t);const e={};for(let r=0;r<t.length;r++)e[r]=In.get(t[r]);return e}async _mapLoadToResolve(t,e){const r=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;const n=await this.loader.load(r,e);this._backgroundLoader.active=!0;const i={};return r.forEach((t=>{const e=n[t.src],r=[t.src];t.alias&&r.push(...t.alias),r.forEach((t=>{i[t]=e})),In.set(r,e)})),i}async unload(t){this._initialized||await this.init();const e=$e(t).map((t=>"string"!=typeof t?t.src:t)),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=$e(t);const e=this.resolver.resolveBundle(t),r=Object.keys(e).map((t=>this._unloadFromResolved(e[t])));await Promise.all(r)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach((t=>{In.remove(t.src)})),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const r of t.detections)t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter(((t,r)=>e.indexOf(t)===r)),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach((e=>{e.config&&Object.keys(e.config).filter((e=>e in t)).forEach((r=>{e.config[r]=t[r]}))}))}}const bp=new xp;p.handleByList(c.LoadParser,bp.loader.parsers).handleByList(c.ResolveParser,bp.resolver.parsers).handleByList(c.CacheParser,bp.cache.parsers).handleByList(c.DetectionParser,bp.detections),p.add(Kh,qh,Qh,nd,td,ed,rd,pd,yd,Id,jd,rp,fp,Hh,Vh,mp,gp);const Sp={loader:c.LoadParser,resolver:c.ResolveParser,cache:c.CacheParser,detection:c.DetectionParser};p.handle(c.Asset,(t=>{const e=t.ref;Object.entries(Sp).filter((([t])=>!!e[t])).forEach((([t,r])=>{var n;return p.add(Object.assign(e[t],{extension:null!=(n=e[t].extension)?n:r}))}))}),(t=>{const e=t.ref;Object.keys(Sp).filter((t=>!!e[t])).forEach((t=>p.remove(e[t])))}));const Tp={extension:{type:c.DetectionParser,priority:3},test:async()=>!(!await xh()&&!gh()),add:async t=>[...t,"basis"],remove:async t=>t.filter((t=>"basis"!==t))};class Pp extends Gr{constructor(t){super(t),this.uploadMethodId="compressed",this.resource=t.resource,this.mipLevelCount=this.resource.length}}let Op,Mp,wp;function Cp(){if(Op)return Op;const t=document.createElement("canvas").getContext("webgl");return t?(Op=[...t.getExtension("EXT_texture_compression_bptc")?["bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"]:[],...t.getExtension("WEBGL_compressed_texture_s3tc")?["bc1-rgba-unorm","bc2-rgba-unorm","bc3-rgba-unorm"]:[],...t.getExtension("WEBGL_compressed_texture_s3tc_srgb")?["bc1-rgba-unorm-srgb","bc2-rgba-unorm-srgb","bc3-rgba-unorm-srgb"]:[],...t.getExtension("EXT_texture_compression_rgtc")?["bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm"]:[],...t.getExtension("WEBGL_compressed_texture_etc")?["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","eac-r11unorm","eac-rg11unorm"]:[],...t.getExtension("WEBGL_compressed_texture_astc")?["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]:[]],Op):[]}async function Ep(){if(Mp)return Mp;const t=await Xe.get().getNavigator().gpu.requestAdapter();return Mp=[...t.features.has("texture-compression-bc")?["bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb","bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm","bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"]:[],...t.features.has("texture-compression-etc2")?["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm"]:[],...t.features.has("texture-compression-astc")?["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]:[]],Mp}async function Ap(){return void 0!==wp||(wp=await(async()=>{const t=await xh(),e=gh();if(t&&e){const t=await Ep(),e=Cp();return t.filter((t=>e.includes(t)))}return t?await Ep():e?Cp():[]})()),wp}const Rp=["r8unorm","r8snorm","r8uint","r8sint","r16uint","r16sint","r16float","rg8unorm","rg8snorm","rg8uint","rg8sint","r32uint","r32sint","r32float","rg16uint","rg16sint","rg16float","rgba8unorm","rgba8unorm-srgb","rgba8snorm","rgba8uint","rgba8sint","bgra8unorm","bgra8unorm-srgb","rgb9e5ufloat","rgb10a2unorm","rg11b10ufloat","rg32uint","rg32sint","rg32float","rgba16uint","rgba16sint","rgba16float","rgba32uint","rgba32sint","rgba32float","stencil8","depth16unorm","depth24plus","depth24plus-stencil8","depth32float","depth32float-stencil8"];let Ip;async function Dp(){if(void 0!==Ip)return Ip;const t=await Ap();return Ip=[...Rp,...t],Ip}let Bp=null,kp=class{constructor(){Bp||(Bp=URL.createObjectURL(new Blob(['(function(){"use strict";function g(r,a){const t=r.getNumImages(),s=r.getNumLevels(0);if(!r.startTranscoding())throw new Error("startTranscoding failed");const m=[];for(let e=0;e<s;++e)for(let o=0;o<t;++o){const B=r.getImageTranscodedSizeInBytes(o,e,a),f=new Uint8Array(B);if(!r.transcodeImage(f,o,e,a,1,0))throw new Error("transcodeImage failed");m.push(f)}return m}const w={"bc3-rgba-unorm":3,"bc7-rgba-unorm":6,"etc2-rgba8unorm":1,"astc-4x4-unorm":10,rgba8unorm:13,rgba4unorm:16};function d(r){const a=w[r];if(a)return a;throw new Error(`Unsupported transcoderFormat: ${r}`)}const n={jsUrl:"basis/basis_transcoder.js",wasmUrl:"basis/basis_transcoder.wasm"};let u,i,c;async function l(){if(!c){const r=new URL(n.jsUrl,location.origin).href,a=new URL(n.wasmUrl,location.origin).href;importScripts(r),c=new Promise(t=>{BASIS({locateFile:s=>a}).then(s=>{s.initializeBasis(),t(s.BasisFile)})})}return c}async function b(r,a){const t=await fetch(r);if(t.ok){const s=await t.arrayBuffer();return new a(new Uint8Array(s))}throw new Error(`Failed to load Basis texture: ${r}`)}const h=["bc7-rgba-unorm","astc-4x4-unorm","etc2-rgba8unorm","bc3-rgba-unorm","rgba8unorm"];async function p(r){const a=await l(),t=await b(r,a),s=g(t,u);return{width:t.getImageWidth(0,0),height:t.getImageHeight(0,0),format:i,resource:s,alphaMode:"no-premultiply-alpha"}}async function y(r,a,t){r&&(n.jsUrl=r),a&&(n.wasmUrl=a),i=h.filter(s=>t.includes(s))[0],u=d(i),await l()}const U={init:async r=>{const{jsUrl:a,wasmUrl:t,supportedTextures:s}=r;await y(a,t,s)},load:async r=>{var a;try{const t=await p(r.url);return{type:"load",url:r.url,success:!0,textureOptions:t,transferables:(a=t.resource)==null?void 0:a.map(s=>s.buffer)}}catch(t){throw t}}};self.onmessage=async r=>{const a=r.data,t=await U[a.type](a);t&&self.postMessage(t,t.transferables)}})();\n'],{type:"application/javascript"}))),this.worker=new Worker(Bp)}};kp.revokeObjectURL=function(){Bp&&(URL.revokeObjectURL(Bp),Bp=null)};const Up={jsUrl:"https://files.pixijs.download/transcoders/basis/basis_transcoder.js",wasmUrl:"https://files.pixijs.download/transcoders/basis/basis_transcoder.wasm"};let Fp;const Lp={};function Gp(t,e){const r=function(t){return Fp||(Fp=(new kp).worker,Fp.onmessage=t=>{const{success:e,url:r,textureOptions:n}=t.data;e||console.warn("Failed to load Basis texture",r),Lp[r](n)},Fp.postMessage({type:"init",jsUrl:Up.jsUrl,wasmUrl:Up.wasmUrl,supportedTextures:t})),Fp}(e);return new Promise((e=>{Lp[t]=e,r.postMessage({type:"load",url:t})}))}const jp={extension:{type:c.LoadParser,priority:We.High,name:"loadBasis"},name:"loadBasis",test:t=>dd(t,[".basis"]),async load(t,e,r){const n=await Dp(),i=await Gp(t,n);return Bd(new Pp(i),r,t)},unload(t){Array.isArray(t)?t.forEach((t=>t.destroy(!0))):t.destroy(!0)}};const Np={"bc3-rgba-unorm":3,"bc7-rgba-unorm":6,"etc2-rgba8unorm":1,"astc-4x4-unorm":10,rgba8unorm:13,rgba4unorm:16};var zp=(t=>(t[t.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",t[t.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",t[t.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",t[t.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",t[t.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",t[t.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",t[t.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",t[t.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",t[t.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",t[t.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",t[t.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",t[t.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",t[t.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",t[t.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",t[t.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",t[t.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",t[t.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",t[t.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",t[t.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",t[t.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",t[t.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",t[t.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",t[t.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",t[t.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",t[t.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",t[t.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",t[t.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",t[t.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",t[t.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",t[t.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",t[t.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",t[t.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",t[t.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",t[t.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",t[t.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",t[t.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",t[t.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",t[t.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",t[t.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",t[t.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",t[t.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",t[t.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",t[t.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",t[t.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",t[t.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",t[t.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",t[t.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",t[t.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",t[t.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",t[t.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",t[t.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",t[t.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",t[t.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",t[t.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",t[t.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",t[t.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",t[t.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",t[t.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",t[t.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",t[t.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",t[t.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",t[t.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",t[t.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",t[t.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",t[t.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",t[t.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",t[t.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",t[t.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",t[t.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",t[t.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",t[t.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",t[t.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",t[t.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",t[t.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",t[t.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",t[t.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",t[t.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",t[t.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",t[t.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",t[t.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",t[t.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",t[t.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",t[t.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",t[t.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",t[t.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",t[t.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",t[t.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",t[t.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",t[t.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",t[t.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",t[t.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",t[t.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",t[t.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",t[t.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",t[t.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",t[t.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",t[t.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",t[t.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",t[t.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",t[t.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",t[t.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",t[t.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",t[t.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",t[t.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",t[t.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",t[t.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",t[t.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",t[t.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",t[t.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",t[t.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",t[t.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",t[t.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",t[t.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",t[t.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",t[t.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",t[t.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",t[t.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",t[t.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",t[t.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",t[t.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",t[t.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",t[t.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT",t))(zp||{}),Wp=(t=>(t[t.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",t[t.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",t[t.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D",t))(Wp||{});function Vp(t){return t.charCodeAt(0)+(t.charCodeAt(1)<<8)+(t.charCodeAt(2)<<16)+(t.charCodeAt(3)<<24)}var Hp=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.R8G8B8=20]="R8G8B8",t[t.A8R8G8B8=21]="A8R8G8B8",t[t.X8R8G8B8=22]="X8R8G8B8",t[t.R5G6B5=23]="R5G6B5",t[t.X1R5G5B5=24]="X1R5G5B5",t[t.A1R5G5B5=25]="A1R5G5B5",t[t.A4R4G4B4=26]="A4R4G4B4",t[t.R3G3B2=27]="R3G3B2",t[t.A8=28]="A8",t[t.A8R3G3B2=29]="A8R3G3B2",t[t.X4R4G4B4=30]="X4R4G4B4",t[t.A2B10G10R10=31]="A2B10G10R10",t[t.A8B8G8R8=32]="A8B8G8R8",t[t.X8B8G8R8=33]="X8B8G8R8",t[t.G16R16=34]="G16R16",t[t.A2R10G10B10=35]="A2R10G10B10",t[t.A16B16G16R16=36]="A16B16G16R16",t[t.A8P8=40]="A8P8",t[t.P8=41]="P8",t[t.L8=50]="L8",t[t.A8L8=51]="A8L8",t[t.A4L4=52]="A4L4",t[t.V8U8=60]="V8U8",t[t.L6V5U5=61]="L6V5U5",t[t.X8L8V8U8=62]="X8L8V8U8",t[t.Q8W8V8U8=63]="Q8W8V8U8",t[t.V16U16=64]="V16U16",t[t.A2W10V10U10=67]="A2W10V10U10",t[t.Q16W16V16U16=110]="Q16W16V16U16",t[t.R16F=111]="R16F",t[t.G16R16F=112]="G16R16F",t[t.A16B16G16R16F=113]="A16B16G16R16F",t[t.R32F=114]="R32F",t[t.G32R32F=115]="G32R32F",t[t.A32B32G32R32F=116]="A32B32G32R32F",t[t.UYVY=Vp("UYVY")]="UYVY",t[t.R8G8_B8G8=Vp("RGBG")]="R8G8_B8G8",t[t.YUY2=Vp("YUY2")]="YUY2",t[t.D3DFMT_G8R8_G8B8=Vp("GRGB")]="D3DFMT_G8R8_G8B8",t[t.DXT1=Vp("DXT1")]="DXT1",t[t.DXT2=Vp("DXT2")]="DXT2",t[t.DXT3=Vp("DXT3")]="DXT3",t[t.DXT4=Vp("DXT4")]="DXT4",t[t.DXT5=Vp("DXT5")]="DXT5",t[t.ATI1=Vp("ATI1")]="ATI1",t[t.AT1N=Vp("AT1N")]="AT1N",t[t.ATI2=Vp("ATI2")]="ATI2",t[t.AT2N=Vp("AT2N")]="AT2N",t[t.BC4U=Vp("BC4U")]="BC4U",t[t.BC4S=Vp("BC4S")]="BC4S",t[t.BC5U=Vp("BC5U")]="BC5U",t[t.BC5S=Vp("BC5S")]="BC5S",t[t.DX10=Vp("DX10")]="DX10",t))(Hp||{});const Xp={[Hp.DXT1]:"bc1-rgba-unorm",[Hp.DXT2]:"bc2-rgba-unorm",[Hp.DXT3]:"bc2-rgba-unorm",[Hp.DXT4]:"bc3-rgba-unorm",[Hp.DXT5]:"bc3-rgba-unorm",[Hp.ATI1]:"bc4-r-unorm",[Hp.BC4U]:"bc4-r-unorm",[Hp.BC4S]:"bc4-r-snorm",[Hp.ATI2]:"bc5-rg-unorm",[Hp.BC5U]:"bc5-rg-unorm",[Hp.BC5S]:"bc5-rg-snorm",36:"rgba16uint",110:"rgba16sint",111:"r16float",112:"rg16float",113:"rgba16float",114:"r32float",115:"rg32float",116:"rgba32float"},Kp={70:"bc1-rgba-unorm",71:"bc1-rgba-unorm",72:"bc1-rgba-unorm-srgb",73:"bc2-rgba-unorm",74:"bc2-rgba-unorm",75:"bc2-rgba-unorm-srgb",76:"bc3-rgba-unorm",77:"bc3-rgba-unorm",78:"bc3-rgba-unorm-srgb",79:"bc4-r-unorm",80:"bc4-r-unorm",81:"bc4-r-snorm",82:"bc5-rg-unorm",83:"bc5-rg-unorm",84:"bc5-rg-snorm",94:"bc6h-rgb-ufloat",95:"bc6h-rgb-ufloat",96:"bc6h-rgb-float",97:"bc7-rgba-unorm",98:"bc7-rgba-unorm",99:"bc7-rgba-unorm-srgb",28:"rgba8unorm",29:"rgba8unorm-srgb",87:"bgra8unorm",91:"bgra8unorm-srgb",41:"r32float",49:"rg8unorm",56:"r16uint",61:"r8unorm",24:"rgb10a2unorm",11:"rgba16uint",13:"rgba16sint",10:"rgba16float",54:"r16float",34:"rg16float",16:"rg32float",2:"rgba32float"},Yp={MAGIC_VALUE:542327876,MAGIC_SIZE:4,HEADER_SIZE:124,HEADER_DX10_SIZE:20,PIXEL_FORMAT_FLAGS:{ALPHAPIXELS:1,ALPHA:2,FOURCC:4,RGB:64,RGBA:65,YUV:512,LUMINANCE:131072,LUMINANCEA:131073},RESOURCE_MISC_TEXTURECUBE:4,HEADER_FIELDS:{MAGIC:0,SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19,PF_FLAGS:20,FOURCC:21,RGB_BITCOUNT:22,R_BIT_MASK:23,G_BIT_MASK:24,B_BIT_MASK:25,A_BIT_MASK:26},HEADER_DX10_FIELDS:{DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},DXGI_FORMAT:zp,D3D10_RESOURCE_DIMENSION:Wp,D3DFMT:Hp},Qp={"bc1-rgba-unorm":8,"bc1-rgba-unorm-srgb":8,"bc2-rgba-unorm":16,"bc2-rgba-unorm-srgb":16,"bc3-rgba-unorm":16,"bc3-rgba-unorm-srgb":16,"bc4-r-unorm":8,"bc4-r-snorm":8,"bc5-rg-unorm":16,"bc5-rg-snorm":16,"bc6h-rgb-ufloat":16,"bc6h-rgb-float":16,"bc7-rgba-unorm":16,"bc7-rgba-unorm-srgb":16};function $p(t,e){const{format:r,fourCC:n,width:i,height:s,dataOffset:o,mipmapCount:a}=function(t){const e=new Uint32Array(t,0,Yp.HEADER_SIZE/Uint32Array.BYTES_PER_ELEMENT);if(e[Yp.HEADER_FIELDS.MAGIC]!==Yp.MAGIC_VALUE)throw new Error("Invalid magic number in DDS header");const r=e[Yp.HEADER_FIELDS.HEIGHT],n=e[Yp.HEADER_FIELDS.WIDTH],i=Math.max(1,e[Yp.HEADER_FIELDS.MIPMAP_COUNT]),s=e[Yp.HEADER_FIELDS.PF_FLAGS],o=e[Yp.HEADER_FIELDS.FOURCC],a=function(t,e,r,n){if(e&Yp.PIXEL_FORMAT_FLAGS.FOURCC){if(r===Yp.D3DFMT.DX10){const t=new Uint32Array(n,Yp.MAGIC_SIZE+Yp.HEADER_SIZE,Yp.HEADER_DX10_SIZE/Uint32Array.BYTES_PER_ELEMENT);if(t[Yp.HEADER_DX10_FIELDS.MISC_FLAG]===Yp.RESOURCE_MISC_TEXTURECUBE)throw new Error("DDSParser does not support cubemap textures");if(t[Yp.HEADER_DX10_FIELDS.RESOURCE_DIMENSION]===Yp.D3D10_RESOURCE_DIMENSION.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSParser does not supported 3D texture data");const e=t[Yp.HEADER_DX10_FIELDS.DXGI_FORMAT];if(e in Kp)return Kp[e];throw new Error(`DDSParser cannot parse texture data with DXGI format ${e}`)}if(r in Xp)return Xp[r];throw new Error(`DDSParser cannot parse texture data with fourCC format ${r}`)}if(e&Yp.PIXEL_FORMAT_FLAGS.RGB||e&Yp.PIXEL_FORMAT_FLAGS.RGBA)return function(t){const e=t[Yp.HEADER_FIELDS.RGB_BITCOUNT],r=t[Yp.HEADER_FIELDS.R_BIT_MASK],n=t[Yp.HEADER_FIELDS.G_BIT_MASK],i=t[Yp.HEADER_FIELDS.B_BIT_MASK],s=t[Yp.HEADER_FIELDS.A_BIT_MASK];switch(e){case 32:if(255===r&&65280===n&&16711680===i&&4278190080===s)return Kp[Yp.DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM];if(16711680===r&&65280===n&&255===i&&4278190080===s)return Kp[Yp.DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM];if(1072693248===r&&1047552===n&&1023===i&&3221225472===s)return Kp[Yp.DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_UNORM];if(65535===r&&4294901760===n&&0===i&&0===s)return Kp[Yp.DXGI_FORMAT.DXGI_FORMAT_R16G16_UNORM];if(4294967295===r&&0===n&&0===i&&0===s)return Kp[Yp.DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT];break;case 24:break;case 16:if(31744===r&&992===n&&31===i&&32768===s)return Kp[Yp.DXGI_FORMAT.DXGI_FORMAT_B5G5R5A1_UNORM];if(63488===r&&2016===n&&31===i&&0===s)return Kp[Yp.DXGI_FORMAT.DXGI_FORMAT_B5G6R5_UNORM];if(3840===r&&240===n&&15===i&&61440===s)return Kp[Yp.DXGI_FORMAT.DXGI_FORMAT_B4G4R4A4_UNORM];if(255===r&&0===n&&0===i&&65280===s)return Kp[Yp.DXGI_FORMAT.DXGI_FORMAT_R8G8_UNORM];if(65535===r&&0===n&&0===i&&0===s)return Kp[Yp.DXGI_FORMAT.DXGI_FORMAT_R16_UNORM];break;case 8:if(255===r&&0===n&&0===i&&0===s)return Kp[Yp.DXGI_FORMAT.DXGI_FORMAT_R8_UNORM]}throw new Error(`DDSParser does not support uncompressed texture with configuration:\n\t\t\t\t\tbitCount = ${e}, rBitMask = ${r}, gBitMask = ${n}, aBitMask = ${s}`)}(t);throw e&Yp.PIXEL_FORMAT_FLAGS.YUV?new Error("DDSParser does not supported YUV uncompressed texture data."):e&Yp.PIXEL_FORMAT_FLAGS.LUMINANCE||e&Yp.PIXEL_FORMAT_FLAGS.LUMINANCEA?new Error("DDSParser does not support single-channel (lumninance) texture data!"):e&Yp.PIXEL_FORMAT_FLAGS.ALPHA||e&Yp.PIXEL_FORMAT_FLAGS.ALPHAPIXELS?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!")}(e,s,o,t),l=Yp.MAGIC_SIZE+Yp.HEADER_SIZE+(o===Yp.D3DFMT.DX10?Yp.HEADER_DX10_SIZE:0);return{format:a,fourCC:o,width:n,height:r,dataOffset:l,mipmapCount:i}}(t);if(!e.includes(r))throw new Error(`Unsupported texture format: ${n} ${r}, supported: ${e}`);if(a<=1)return{format:r,width:i,height:s,resource:[new Uint8Array(t,o)],alphaMode:"no-premultiply-alpha"};const l=function(t,e,r,n,i,s){const o=[],a=Qp[t];let l=e,_=r,u=n;for(let t=0;t<i;++t){const t=a?Math.max(4,l)/4*Math.max(4,_)/4*a:l*_*4,e=new Uint8Array(s,u,t);o.push(e),u+=t,l=Math.max(l>>1,1),_=Math.max(_>>1,1)}return o}(r,i,s,o,a,t);return{format:r,width:i,height:s,resource:l,alphaMode:"no-premultiply-alpha"}}const qp={extension:{type:c.LoadParser,priority:We.High,name:"loadDDS"},name:"loadDDS",test:t=>dd(t,[".dds"]),async load(t,e,r){const n=await Dp(),i=$p(await(await fetch(t)).arrayBuffer(),n);return Bd(new Pp(i),r,t)},unload(t){Array.isArray(t)?t.forEach((t=>t.destroy(!0))):t.destroy(!0)}};var Zp=(t=>(t[t.RGBA8_SNORM=36759]="RGBA8_SNORM",t[t.RGBA=6408]="RGBA",t[t.RGBA8UI=36220]="RGBA8UI",t[t.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",t[t.RGBA8I=36238]="RGBA8I",t[t.RGBA8=32856]="RGBA8",t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",t[t.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",t[t.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",t[t.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",t[t.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",t[t.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",t[t.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",t[t.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",t[t.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",t[t.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",t))(Zp||{}),Jp=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(Jp||{}),ty=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(ty||{});const ey={FILE_HEADER_SIZE:64,FILE_IDENTIFIER:[171,75,84,88,32,49,49,187,13,10,26,10],FORMATS_TO_COMPONENTS:{6408:4,6407:3,33319:2,6403:1,6409:1,6410:2,6406:1},INTERNAL_FORMAT_TO_BYTES_PER_PIXEL:{33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,36283:.5,36284:.5,36285:1,36286:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,37808:1,37840:1,37809:.8,37841:.8,37810:.64,37842:.64,37811:.53375,37843:.53375,37812:.445,37844:.445,37813:.4,37845:.4,37814:.33375,37846:.33375,37815:.25,37847:.25,37816:.32,37848:.32,37817:.26625,37849:.26625,37818:.2,37850:.2,37819:.16,37851:.16,37820:.13375,37852:.13375,37821:.11125,37853:.11125,36492:1,36493:1,36494:1,36495:1},INTERNAL_FORMAT_TO_TEXTURE_FORMATS:{33776:"bc1-rgba-unorm",33777:"bc1-rgba-unorm",33778:"bc2-rgba-unorm",33779:"bc3-rgba-unorm",35916:"bc1-rgba-unorm-srgb",35917:"bc1-rgba-unorm-srgb",35918:"bc2-rgba-unorm-srgb",35919:"bc3-rgba-unorm-srgb",36283:"bc4-r-unorm",36284:"bc4-r-snorm",36285:"bc5-rg-unorm",36286:"bc5-rg-snorm",37488:"eac-r11unorm",37490:"eac-rg11snorm",37492:"etc2-rgb8unorm",37496:"etc2-rgba8unorm",37493:"etc2-rgb8unorm-srgb",37497:"etc2-rgba8unorm-srgb",37494:"etc2-rgb8a1unorm",37495:"etc2-rgb8a1unorm-srgb",37808:"astc-4x4-unorm",37840:"astc-4x4-unorm-srgb",37809:"astc-5x4-unorm",37841:"astc-5x4-unorm-srgb",37810:"astc-5x5-unorm",37842:"astc-5x5-unorm-srgb",37811:"astc-6x5-unorm",37843:"astc-6x5-unorm-srgb",37812:"astc-6x6-unorm",37844:"astc-6x6-unorm-srgb",37813:"astc-8x5-unorm",37845:"astc-8x5-unorm-srgb",37814:"astc-8x6-unorm",37846:"astc-8x6-unorm-srgb",37815:"astc-8x8-unorm",37847:"astc-8x8-unorm-srgb",37816:"astc-10x5-unorm",37848:"astc-10x5-unorm-srgb",37817:"astc-10x6-unorm",37849:"astc-10x6-unorm-srgb",37818:"astc-10x8-unorm",37850:"astc-10x8-unorm-srgb",37819:"astc-10x10-unorm",37851:"astc-10x10-unorm-srgb",37820:"astc-12x10-unorm",37852:"astc-12x10-unorm-srgb",37821:"astc-12x12-unorm",37853:"astc-12x12-unorm-srgb",36492:"bc7-rgba-unorm",36493:"bc7-rgba-unorm-srgb",36494:"bc6h-rgb-float",36495:"bc6h-rgb-ufloat",35907:"rgba8unorm-srgb",36759:"rgba8snorm",36220:"rgba8uint",36238:"rgba8sint",6408:"rgba8unorm"},FIELDS:{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},TYPES_TO_BYTES_PER_COMPONENT:{5121:1,5123:2,5124:4,5125:4,5126:4,36193:8},TYPES_TO_BYTES_PER_PIXEL:{32819:2,32820:2,33635:2},ENDIANNESS:67305985};function ry(t,e){const r=new DataView(t);if(!function(t){for(let e=0;e<ey.FILE_IDENTIFIER.length;e++)if(t.getUint8(e)!==ey.FILE_IDENTIFIER[e])return!1;return!0}(r))throw new Error("Invalid KTX identifier in header");const{littleEndian:n,glType:i,glFormat:s,glInternalFormat:o,pixelWidth:a,pixelHeight:l,numberOfMipmapLevels:_,offset:u}=function(t){const e=t.getUint32(ey.FIELDS.ENDIANNESS,!0)===ey.ENDIANNESS,r=t.getUint32(ey.FIELDS.GL_TYPE,e),n=t.getUint32(ey.FIELDS.GL_FORMAT,e),i=t.getUint32(ey.FIELDS.GL_INTERNAL_FORMAT,e),s=t.getUint32(ey.FIELDS.PIXEL_WIDTH,e),o=t.getUint32(ey.FIELDS.PIXEL_HEIGHT,e)||1,a=t.getUint32(ey.FIELDS.PIXEL_DEPTH,e)||1,l=t.getUint32(ey.FIELDS.NUMBER_OF_ARRAY_ELEMENTS,e)||1,_=t.getUint32(ey.FIELDS.NUMBER_OF_FACES,e),u=t.getUint32(ey.FIELDS.NUMBER_OF_MIPMAP_LEVELS,e),c=t.getUint32(ey.FIELDS.BYTES_OF_KEY_VALUE_DATA,e);if(0===o||1!==a)throw new Error("Only 2D textures are supported");if(1!==_)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(1!==l)throw new Error("WebGL does not support array textures");return{littleEndian:e,glType:r,glFormat:n,glInternalFormat:i,pixelWidth:s,pixelHeight:o,numberOfMipmapLevels:u,offset:ey.FILE_HEADER_SIZE+c}}(r),c=ey.INTERNAL_FORMAT_TO_TEXTURE_FORMATS[o];if(!c)throw new Error(`Unknown texture format ${o}`);if(!e.includes(c))throw new Error(`Unsupported texture format: ${c}, supportedFormats: ${e}`);const h=function(t,e,r){let n=ey.INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[r];if(0!==t&&(n=ey.TYPES_TO_BYTES_PER_COMPONENT[t]?ey.TYPES_TO_BYTES_PER_COMPONENT[t]*ey.FORMATS_TO_COMPONENTS[e]:ey.TYPES_TO_BYTES_PER_PIXEL[t]),void 0===n)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");return n}(i,s,o),d=function(t,e,r,n,i,s,o,a){const l=n+3&-4,_=i+3&-4;let u=n*i;0===e&&(u=l*_);let c=u*r,h=n,d=i,p=l,y=_,v=s;const f=new Array(o);for(let e=0;e<o;e++){const n=t.getUint32(v,a);let i=v+4;f[e]=new Uint8Array(t.buffer,i,c),i+=c,v+=n+4,v=v%4!=0?v+4-v%4:v,h=h>>1||1,d=d>>1||1,p=h+4-1&-4,y=d+4-1&-4,c=p*y*r}return f}(r,i,h,a,l,u,_,n);return{format:c,width:a,height:l,resource:d,alphaMode:"no-premultiply-alpha"}}const ny={extension:{type:c.LoadParser,priority:We.High,name:"loadKTX"},name:"loadKTX",test:t=>dd(t,".ktx"),async load(t,e,r){const n=await Dp(),i=ry(await(await fetch(t)).arrayBuffer(),n);return Bd(new Pp(i),r,t)},unload(t){Array.isArray(t)?t.forEach((t=>t.destroy(!0))):t.destroy(!0)}};let iy=null;class sy{constructor(){iy||(iy=URL.createObjectURL(new Blob(['(function(){"use strict";const s={rgb8unorm:{convertedFormat:"rgba8unorm",convertFunction:i},"rgb8unorm-srgb":{convertedFormat:"rgba8unorm-srgb",convertFunction:i}};function f(r){const t=r.format;if(s[t]){const n=s[t].convertFunction,o=r.resource;for(let e=0;e<o.length;e++)o[e]=n(o[e]);r.format=s[t].convertedFormat}}function i(r){const t=r.byteLength/3,n=new Uint32Array(t);for(let o=0;o<t;++o)n[o]=r[o*3]+(r[o*3+1]<<8)+(r[o*3+2]<<16)+4278190080;return new Uint8Array(n.buffer)}function d(r){const t=[];for(let n=0;n<r.numLevels;n++){const o=r.getImageData(n,0,0),e=new Uint8Array(o.byteLength);e.set(o),t.push(e)}return t}const w={6408:"rgba8unorm",32856:"bgra8unorm",32857:"rgb10a2unorm",33189:"depth16unorm",33190:"depth24plus",33321:"r8unorm",33323:"rg8unorm",33325:"r16float",33326:"r32float",33327:"rg16float",33328:"rg32float",33329:"r8sint",33330:"r8uint",33331:"r16sint",33332:"r16uint",33333:"r32sint",33334:"r32uint",33335:"rg8sint",33336:"rg8uint",33337:"rg16sint",33338:"rg16uint",33339:"rg32sint",33340:"rg32uint",33778:"bc2-rgba-unorm",33779:"bc3-rgba-unorm",34836:"rgba32float",34842:"rgba16float",35056:"depth24plus-stencil8",35898:"rg11b10ufloat",35901:"rgb9e5ufloat",35907:"rgba8unorm-srgb",36012:"depth32float",36013:"depth32float-stencil8",36168:"stencil8",36208:"rgba32uint",36214:"rgba16uint",36220:"rgba8uint",36226:"rgba32sint",36232:"rgba16sint",36238:"rgba8sint",36492:"bc7-rgba-unorm",36756:"r8snorm",36757:"rg8snorm",36759:"rgba8snorm",37496:"etc2-rgba8unorm",37808:"astc-4x4-unorm"};function p(r){const t=w[r];if(t)return t;throw new Error(`Unsupported glInternalFormat: ${r}`)}const h={23:"rgb8unorm",37:"rgba8unorm",43:"rgba8unorm-srgb"};function F(r){const t=h[r];if(t)return t;throw new Error(`Unsupported VkFormat: ${r}`)}function U(r){return r.classId===2?F(r.vkFormat):p(r.glInternalformat)}const T={"bc3-rgba-unorm":"BC3_RGBA","bc7-rgba-unorm":"BC7_M5_RGBA","etc2-rgba8unorm":"ETC2_RGBA","astc-4x4-unorm":"ASTC_4x4_RGBA",rgba8unorm:"RGBA32",rg11b10ufloat:"R11F_G11F_B10F"};function y(r){const t=T[r];if(t)return t;throw new Error(`Unsupported transcoderFormat: ${r}`)}const a={jsUrl:"",wasmUrl:""};let l,u,c;async function g(){if(!c){const r=new URL(a.jsUrl,location.origin).href,t=new URL(a.wasmUrl,location.origin).href;importScripts(r),c=new Promise(n=>{LIBKTX({locateFile:o=>t}).then(o=>{n(o)})})}return c}async function v(r,t){const n=await fetch(r);if(n.ok){const o=await n.arrayBuffer();return new t.ktxTexture(new Uint8Array(o))}throw new Error(`Failed to load KTX(2) texture: ${r}`)}const x=["bc7-rgba-unorm","astc-4x4-unorm","etc2-rgba8unorm","bc3-rgba-unorm","rgba8unorm"];async function B(r){const t=await g(),n=await v(r,t);let o;if(n.needsTranscoding){o=u;const R=t.TranscodeTarget[l];if(n.transcodeBasis(R,0)!==t.ErrorCode.SUCCESS)throw new Error("Unable to transcode basis texture.")}else o=U(n);const e=d(n),b={width:n.baseWidth,height:n.baseHeight,format:o,mipLevelCount:n.numLevels,resource:e,alphaMode:"no-premultiply-alpha"};return f(b),b}async function A(r,t,n){r&&(a.jsUrl=r),t&&(a.wasmUrl=t),u=x.filter(o=>n.includes(o))[0],l=y(u),await g()}const m={init:async r=>{const{jsUrl:t,wasmUrl:n,supportedTextures:o}=r;await A(t,n,o)},load:async r=>{var t;try{const n=await B(r.url);return{type:"load",url:r.url,success:!0,textureOptions:n,transferables:(t=n.resource)==null?void 0:t.map(o=>o.buffer)}}catch(n){throw n}}};self.onmessage=async r=>{var t;const n=r.data,o=await((t=m[n.type])==null?void 0:t.call(m,n));o&&self.postMessage(o,o.transferables)}})();\n'],{type:"application/javascript"}))),this.worker=new Worker(iy)}}sy.revokeObjectURL=function(){iy&&(URL.revokeObjectURL(iy),iy=null)};const oy={jsUrl:"https://files.pixijs.download/transcoders/ktx/libktx.js",wasmUrl:"https://files.pixijs.download/transcoders/ktx/libktx.wasm"};let ay;const ly={};function _y(t,e){const r=function(t){return ay||(ay=(new sy).worker,ay.onmessage=t=>{const{success:e,url:r,textureOptions:n}=t.data;e||console.warn("Failed to load KTX texture",r),ly[r](n)},ay.postMessage({type:"init",jsUrl:oy.jsUrl,wasmUrl:oy.wasmUrl,supportedTextures:t})),ay}(e);return new Promise((e=>{ly[t]=e,r.postMessage({type:"load",url:t})}))}const uy={extension:{type:c.LoadParser,priority:We.High,name:"loadKTX2"},name:"loadKTX2",test:t=>dd(t,".ktx2"),async load(t,e,r){const n=await Dp(),i=await _y(t,n);return Bd(new Pp(i),r,t)},async unload(t){Array.isArray(t)?t.forEach((t=>t.destroy(!0))):t.destroy(!0)}},cy={rgb8unorm:{convertedFormat:"rgba8unorm",convertFunction:hy},"rgb8unorm-srgb":{convertedFormat:"rgba8unorm-srgb",convertFunction:hy}};function hy(t){const e=t.byteLength/3,r=new Uint32Array(e);for(let n=0;n<e;++n)r[n]=t[3*n]+(t[3*n+1]<<8)+(t[3*n+2]<<16)+4278190080;return new Uint8Array(r.buffer)}const dy={6408:"rgba8unorm",32856:"bgra8unorm",32857:"rgb10a2unorm",33189:"depth16unorm",33190:"depth24plus",33321:"r8unorm",33323:"rg8unorm",33325:"r16float",33326:"r32float",33327:"rg16float",33328:"rg32float",33329:"r8sint",33330:"r8uint",33331:"r16sint",33332:"r16uint",33333:"r32sint",33334:"r32uint",33335:"rg8sint",33336:"rg8uint",33337:"rg16sint",33338:"rg16uint",33339:"rg32sint",33340:"rg32uint",33778:"bc2-rgba-unorm",33779:"bc3-rgba-unorm",34836:"rgba32float",34842:"rgba16float",35056:"depth24plus-stencil8",35898:"rg11b10ufloat",35901:"rgb9e5ufloat",35907:"rgba8unorm-srgb",36012:"depth32float",36013:"depth32float-stencil8",36168:"stencil8",36208:"rgba32uint",36214:"rgba16uint",36220:"rgba8uint",36226:"rgba32sint",36232:"rgba16sint",36238:"rgba8sint",36492:"bc7-rgba-unorm",36756:"r8snorm",36757:"rg8snorm",36759:"rgba8snorm",37496:"etc2-rgba8unorm",37808:"astc-4x4-unorm"};function py(t){const e=dy[t];if(e)return e;throw new Error(`Unsupported glInternalFormat: ${t}`)}const yy={23:"rgb8unorm",37:"rgba8unorm",43:"rgba8unorm-srgb"};function vy(t){const e=yy[t];if(e)return e;throw new Error(`Unsupported VkFormat: ${t}`)}const fy={"bc3-rgba-unorm":"BC3_RGBA","bc7-rgba-unorm":"BC7_M5_RGBA","etc2-rgba8unorm":"ETC2_RGBA","astc-4x4-unorm":"ASTC_4x4_RGBA",rgba8unorm:"RGBA32",rg11b10ufloat:"R11F_G11F_B10F"};const my=["basis","bc7","bc6h","astc","etc2","bc5","bc4","bc3","bc2","bc1","eac"],gy={extension:c.ResolveParser,test:t=>dd(t,[".ktx",".ktx2",".dds"]),parse:t=>{var e,r;let n;const i=t.split(".");if(i.length>2){const t=i[i.length-2];my.includes(t)&&(n=t)}else n=i[i.length-1];return{resolution:parseFloat(null!=(r=null==(e=lr.RETINA_PREFIX.exec(t))?void 0:e[1])?r:"1"),format:n,src:t}}};let xy;const by={extension:{type:c.DetectionParser,priority:2},test:async()=>!(!await xh()&&!gh()),add:async t=>{const e=await Ap();return xy=function(t){const e=["basis"],r={};return t.forEach((t=>{const n=t.split("-")[0];n&&!r[n]&&(r[n]=!0,e.push(n))})),e.sort(((t,e)=>{const r=my.indexOf(t),n=my.indexOf(e);return-1===r?1:-1===n?-1:r-n})),e}(e),[...xy,...t]},remove:async t=>xy?t.filter((t=>!(t in xy))):t};const Sy=new At,Ty=class{cull(t,e,r=!0){this._cullRecursive(t,e,r)}_cullRecursive(t,e,r=!0){var n;if(t.cullable&&t.measurable&&t.includeInBuild){const i=null!=(n=t.cullArea)?n:Dt(t,r,Sy);t.culled=i.x>=e.x+e.width||i.y>=e.y+e.height||i.x+i.width<=e.x||i.y+i.height<=e.y}else t.culled=!1;if(t.cullableChildren&&!t.culled&&t.renderable&&t.measurable&&t.includeInBuild)for(let n=0;n<t.children.length;n++)this._cullRecursive(t.children[n],e,r)}};Ty.shared=new Ty;let Py=Ty;class Oy{static init(){this._renderRef=this.render.bind(this),this.render=()=>{Py.shared.cull(this.stage,this.renderer.screen),this.renderer.render({container:this.stage})}}static destroy(){this.render=this._renderRef}}Oy.extension={priority:10,type:c.Application,name:"culler"};const My={extension:{type:c.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then((function(){return eh}))}};var wy=Object.defineProperty,Cy=Object.getOwnPropertySymbols,Ey=Object.prototype.hasOwnProperty,Ay=Object.prototype.propertyIsEnumerable,Ry=(t,e,r)=>e in t?wy(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Iy=(t,e)=>{for(var r in e||(e={}))Ey.call(e,r)&&Ry(t,r,e[r]);if(Cy)for(var r of Cy(e))Ay.call(e,r)&&Ry(t,r,e[r]);return t};const Dy=class t extends oo{constructor(e){super(e=Iy(Iy({},t.defaultOptions),e)),this.enabled=!0,this._state=Ea.for2d(),this.blendMode=e.blendMode,this.padding=e.padding,"boolean"==typeof e.antialias?this.antialias=e.antialias?"on":"off":this.antialias=e.antialias,this.resolution=e.resolution,this.blendRequired=e.blendRequired,this.clipToViewport=e.clipToViewport,this.addResource("uTexture",0,1)}apply(t,e,r,n){t.applyFilter(this,e,r,n)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(e){const r=e,{gpu:n,gl:i}=r,s=((t,e)=>{var r={};for(var n in t)Ey.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&Cy)for(var n of Cy(t))e.indexOf(n)<0&&Ay.call(t,n)&&(r[n]=t[n]);return r})(r,["gpu","gl"]);let o,a;return n&&(o=ts.from(n)),i&&(a=Wi.from(i)),new t(Iy({gpuProgram:o,glProgram:a},s))}};Dy.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};let By=Dy;var ky="\n\tin vec2 vTextureCoord;\n\tin vec4 vColor;\n\t\n\tout vec4 finalColor;\n\t\n\tuniform float uBlend;\n\t\n\tuniform sampler2D uTexture;\n\tuniform sampler2D uBackTexture;\n\t\n\t{FUNCTIONS}\n\t\n\tvoid main()\n\t{ \n\t\tvec4 back = texture(uBackTexture, vTextureCoord);\n\t\tvec4 front = texture(uTexture, vTextureCoord);\n\t\tfloat blendedAlpha = front.a + back.a * (1.0 - front.a);\n\t\t\n\t\t{MAIN}\n\t}\n\t",Uy="in vec2 aPosition;\n\tout vec2 vTextureCoord;\n\tout vec2 backgroundUv;\n\t\n\tuniform vec4 uInputSize;\n\tuniform vec4 uOutputFrame;\n\tuniform vec4 uOutputTexture;\n\t\n\tvec4 filterVertexPosition( void )\n\t{\n\t\tvec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n\t\t\n\t\tposition.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n\t\tposition.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\t\n\t\treturn vec4(position, 0.0, 1.0);\n\t}\n\t\n\tvec2 filterTextureCoord( void )\n\t{\n\t\treturn aPosition * (uOutputFrame.zw * uInputSize.zw);\n\t}\n\t\n\tvoid main(void)\n\t{\n\t\tgl_Position = filterVertexPosition();\n\t\tvTextureCoord = filterTextureCoord();\n\t}\n\t",Fy="\n\tstruct GlobalFilterUniforms {\n\t uInputSize:vec4<f32>,\n\t uInputPixel:vec4<f32>,\n\t uInputClamp:vec4<f32>,\n\t uOutputFrame:vec4<f32>,\n\t uGlobalFrame:vec4<f32>,\n\t uOutputTexture:vec4<f32>,\n\t};\n\t\n\tstruct BlendUniforms {\n\t uBlend:f32,\n\t};\n\t\n\t@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n\t@group(0) @binding(1) var uTexture: texture_2d<f32>;\n\t@group(0) @binding(2) var uSampler : sampler;\n\t@group(0) @binding(3) var uBackTexture: texture_2d<f32>;\n\t\n\t@group(1) @binding(0) var<uniform> blendUniforms : BlendUniforms;\n\t\n\t\n\tstruct VSOutput {\n\t\t@builtin(position) position: vec4<f32>,\n\t\t@location(0) uv : vec2<f32>\n\t };\n\t\n\tfn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n\t{\n\t\tvar position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\t\n\t\tposition.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n\t\tposition.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\t\n\t\treturn vec4(position, 0.0, 1.0);\n\t}\n\t\n\tfn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n\t{\n\t\treturn aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n\t}\n\t\n\tfn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n\t{\n\t return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \n\t}\n\t \n\t@vertex\n\tfn mainVertex(\n\t @location(0) aPosition : vec2<f32>, \n\t) -> VSOutput {\n\t return VSOutput(\n\t filterVertexPosition(aPosition),\n\t filterTextureCoord(aPosition)\n\t );\n\t}\n\t\n\t{FUNCTIONS}\n\t\n\t@fragment\n\tfn mainFragment(\n\t @location(0) uv: vec2<f32>\n\t) -> @location(0) vec4<f32> {\n\t\n\t\n\t var back = textureSample(uBackTexture, uSampler, uv);\n\t var front = textureSample(uTexture, uSampler, uv);\n\t var blendedAlpha = front.a + back.a * (1.0 - front.a);\n\t \n\t var out = vec4<f32>(0.0,0.0,0.0,0.0);\n\t\n\t {MAIN}\n\t\n\t return out;\n\t}",Ly=Object.defineProperty,Gy=Object.getOwnPropertySymbols,jy=Object.prototype.hasOwnProperty,Ny=Object.prototype.propertyIsEnumerable,zy=(t,e,r)=>e in t?Ly(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Wy=(t,e)=>{for(var r in e||(e={}))jy.call(e,r)&&zy(t,r,e[r]);if(Gy)for(var r of Gy(e))Ny.call(e,r)&&zy(t,r,e[r]);return t};function Vy(t){const{source:e,functions:r,main:n}=t;return e.replace("{FUNCTIONS}",r).replace("{MAIN}",n)}var Hy="in vec2 aPosition;\n\tout vec2 vTextureCoord;\n\t\n\tuniform vec4 uInputSize;\n\tuniform vec4 uOutputFrame;\n\tuniform vec4 uOutputTexture;\n\t\n\tvec4 filterVertexPosition( void )\n\t{\n\t\tvec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n\t\t\n\t\tposition.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n\t\tposition.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\t\n\t\treturn vec4(position, 0.0, 1.0);\n\t}\n\t\n\tvec2 filterTextureCoord( void )\n\t{\n\t\treturn aPosition * (uOutputFrame.zw * uInputSize.zw);\n\t}\n\t\n\tvoid main(void)\n\t{\n\t\tgl_Position = filterVertexPosition();\n\t\tvTextureCoord = filterTextureCoord();\n\t}\n\t",Xy="\n\tin vec2 vTextureCoord;\n\t\n\tout vec4 finalColor;\n\t\n\tuniform float uAlpha;\n\tuniform sampler2D uTexture;\n\t\n\tvoid main()\n\t{\n\t\tfinalColor = texture(uTexture, vTextureCoord) * uAlpha;\n\t}\n\t",Ky="struct GlobalFilterUniforms {\n\t uInputSize:vec4<f32>,\n\t uInputPixel:vec4<f32>,\n\t uInputClamp:vec4<f32>,\n\t uOutputFrame:vec4<f32>,\n\t uGlobalFrame:vec4<f32>,\n\t uOutputTexture:vec4<f32>,\n\t};\n\t\n\tstruct AlphaUniforms {\n\t uAlpha:f32,\n\t};\n\t\n\t@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n\t@group(0) @binding(1) var uTexture: texture_2d<f32>;\n\t@group(0) @binding(2) var uSampler : sampler;\n\t\n\t@group(1) @binding(0) var<uniform> alphaUniforms : AlphaUniforms;\n\t\n\tstruct VSOutput {\n\t\t@builtin(position) position: vec4<f32>,\n\t\t@location(0) uv : vec2<f32>\n\t };\n\t\n\tfn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n\t{\n\t\tvar position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\t\n\t\tposition.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n\t\tposition.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\t\n\t\treturn vec4(position, 0.0, 1.0);\n\t}\n\t\n\tfn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n\t{\n\t\treturn aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n\t}\n\t\n\tfn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n\t{\n\t return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \n\t}\n\t\n\tfn getSize() -> vec2<f32>\n\t{\n\t return gfu.uGlobalFrame.zw;\n\t}\n\t \n\t@vertex\n\tfn mainVertex(\n\t @location(0) aPosition : vec2<f32>, \n\t) -> VSOutput {\n\t return VSOutput(\n\t filterVertexPosition(aPosition),\n\t filterTextureCoord(aPosition)\n\t );\n\t}\n\t\n\t@fragment\n\tfn mainFragment(\n\t @location(0) uv: vec2<f32>,\n\t @builtin(position) position: vec4<f32>\n\t) -> @location(0) vec4<f32> {\n\t \n\t\tvar sample = textureSample(uTexture, uSampler, uv);\n\t\t\n\t\treturn sample * alphaUniforms.uAlpha;\n\t}",Yy=Object.defineProperty,Qy=Object.defineProperties,$y=Object.getOwnPropertyDescriptors,qy=Object.getOwnPropertySymbols,Zy=Object.prototype.hasOwnProperty,Jy=Object.prototype.propertyIsEnumerable,tv=(t,e,r)=>e in t?Yy(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ev=(t,e)=>{for(var r in e||(e={}))Zy.call(e,r)&&tv(t,r,e[r]);if(qy)for(var r of qy(e))Jy.call(e,r)&&tv(t,r,e[r]);return t};const rv=class t extends By{constructor(e){e=ev(ev({},t.defaultOptions),e);const r=ts.from({vertex:{source:Ky,entryPoint:"mainVertex"},fragment:{source:Ky,entryPoint:"mainFragment"}}),n=Wi.from({vertex:Hy,fragment:Xy,name:"alpha-filter"}),i=e,{alpha:s}=i,o=((t,e)=>{var r={};for(var n in t)Zy.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&qy)for(var n of qy(t))e.indexOf(n)<0&&Jy.call(t,n)&&(r[n]=t[n]);return r})(i,["alpha"]),a=new qs({uAlpha:{value:s,type:"f32"}});super(((t,e)=>Qy(t,$y(e)))(ev({},o),{gpuProgram:r,glProgram:n,resources:{alphaUniforms:a}}))}get alpha(){return this.resources.alphaUniforms.uniforms.uAlpha}set alpha(t){this.resources.alphaUniforms.uniforms.uAlpha=t}};rv.defaultOptions={alpha:1};let nv=rv;const iv={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},sv=["in vec2 vBlurTexCoords[%size%];","uniform sampler2D uTexture;","out vec4 finalColor;","void main(void)","{"," finalColor = vec4(0.0);"," %blur%","}"].join("\n\t");function ov(t){const e=iv[t],r=e.length;let n=sv,i="";let s;for(let n=0;n<t;n++){let o="finalColor += texture(uTexture, vBlurTexCoords[%index%]) * %value%;".replace("%index%",n.toString());s=n,n>=r&&(s=t-n-1),o=o.replace("%value%",e[s].toString()),i+=o,i+="\n\t"}return n=n.replace("%blur%",i),n=n.replace("%size%",t.toString()),n}function av(t,e){const r=Math.ceil(t/2);let n,i="\n\t\tin vec2 aPosition;\n\t\n\t\tuniform float uStrength;\n\t\n\t\tout vec2 vBlurTexCoords[%size%];\n\t\n\t\tuniform vec4 uInputSize;\n\t\tuniform vec4 uOutputFrame;\n\t\tuniform vec4 uOutputTexture;\n\t\n\t\tvec4 filterVertexPosition( void )\n\t{\n\t\tvec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n\t\t\n\t\tposition.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n\t\tposition.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\t\n\t\treturn vec4(position, 0.0, 1.0);\n\t}\n\t\n\t\tvec2 filterTextureCoord( void )\n\t\t{\n\t\t\treturn aPosition * (uOutputFrame.zw * uInputSize.zw);\n\t\t}\n\t\n\t\tvoid main(void)\n\t\t{\n\t\t\tgl_Position = filterVertexPosition();\n\t\n\t\t\tfloat pixelStrength = uInputSize.%dimension% * uStrength;\n\t\n\t\t\tvec2 textureCoord = filterTextureCoord();\n\t\t\t%blur%\n\t\t}",s="";n=e?"vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * pixelStrength, 0.0);":"vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * pixelStrength);";for(let e=0;e<t;e++){let t=n.replace("%index%",e.toString());t=t.replace("%sampleIndex%",e-(r-1)+".0"),s+=t,s+="\n\t"}return i=i.replace("%blur%",s),i=i.replace("%size%",t.toString()),i=i.replace("%dimension%",e?"z":"w"),i}function lv(t,e){const r=av(e,t),n=ov(e);return Wi.from({vertex:r,fragment:n,name:`blur-${t?"horizontal":"vertical"}-pass-filter`})}var _v="\n\t\n\tstruct GlobalFilterUniforms {\n\t uInputSize:vec4<f32>,\n\t uInputPixel:vec4<f32>,\n\t uInputClamp:vec4<f32>,\n\t uOutputFrame:vec4<f32>,\n\t uGlobalFrame:vec4<f32>,\n\t uOutputTexture:vec4<f32>,\n\t};\n\t\n\tstruct BlurUniforms {\n\t uStrength:f32,\n\t};\n\t\n\t@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n\t@group(0) @binding(1) var uTexture: texture_2d<f32>;\n\t@group(0) @binding(2) var uSampler : sampler;\n\t\n\t@group(1) @binding(0) var<uniform> blurUniforms : BlurUniforms;\n\t\n\t\n\tstruct VSOutput {\n\t\t@builtin(position) position: vec4<f32>,\n\t\t%blur-struct%\n\t };\n\t\n\tfn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n\t{\n\t\tvar position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\t\n\t\tposition.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n\t\tposition.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\t\n\t\treturn vec4(position, 0.0, 1.0);\n\t}\n\t\n\tfn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n\t{\n\t\treturn aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n\t}\n\t\n\tfn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n\t{\n\t return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \n\t}\n\t\n\tfn getSize() -> vec2<f32>\n\t{\n\t return gfu.uGlobalFrame.zw;\n\t}\n\t\n\t\n\t@vertex\n\tfn mainVertex(\n\t @location(0) aPosition : vec2<f32>, \n\t) -> VSOutput {\n\t\n\t let filteredCord = filterTextureCoord(aPosition);\n\t\n\t let pixelStrength = gfu.uInputSize.%dimension% * blurUniforms.uStrength;\n\t\n\t return VSOutput(\n\t filterVertexPosition(aPosition),\n\t\t%blur-vertex-out%\n\t );\n\t}\n\t\n\t@fragment\n\tfn mainFragment(\n\t @builtin(position) position: vec4<f32>,\n\t %blur-fragment-in%\n\t) -> @location(0) vec4<f32> {\n\t\n\t\tvar finalColor = vec4(0.0);\n\t\n\t\t%blur-sampling%\n\t\n\t\treturn finalColor;\n\t}";function uv(t,e){const r=iv[e],n=r.length,i=[],s=[],o=[];for(let a=0;a<e;a++){i[a]=`@location(${a}) offset${a}: vec2<f32>,`,s[a]=t?`filteredCord + vec2(${a-n+1} * pixelStrength, 0.0),`:`filteredCord + vec2(0.0, ${a-n+1} * pixelStrength),`;const l=r[a<n?a:e-a-1].toString();o[a]=`finalColor += textureSample(uTexture, uSampler, offset${a}) * ${l};`}const a=i.join("\n\t"),l=s.join("\n\t"),_=o.join("\n\t"),u=_v.replace("%blur-struct%",a).replace("%blur-vertex-out%",l).replace("%blur-fragment-in%",a).replace("%blur-sampling%",_).replace("%dimension%",t?"z":"w");return ts.from({vertex:{source:u,entryPoint:"mainVertex"},fragment:{source:u,entryPoint:"mainFragment"}})}var cv=Object.defineProperty,hv=Object.getOwnPropertySymbols,dv=Object.prototype.hasOwnProperty,pv=Object.prototype.propertyIsEnumerable,yv=(t,e,r)=>e in t?cv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vv=(t,e)=>{for(var r in e||(e={}))dv.call(e,r)&&yv(t,r,e[r]);if(hv)for(var r of hv(e))pv.call(e,r)&&yv(t,r,e[r]);return t};const fv=class t extends By{constructor(e){const r=lv((e=vv(vv({},t.defaultOptions),e)).horizontal,e.kernelSize),n=uv(e.horizontal,e.kernelSize);super(vv({glProgram:r,gpuProgram:n,resources:{blurUniforms:{uStrength:{value:0,type:"f32"}}}},e)),this.horizontal=e.horizontal,this._quality=0,this.quality=e.quality,this.blur=e.strength,this._uniforms=this.resources.blurUniforms.uniforms}apply(t,e,r,n){if(this._uniforms.uStrength=this.strength/this.passes,1===this.passes)t.applyFilter(this,e,r,n);else{const i=ol.getSameSizeTexture(e);let s=e,o=i;this._state.blend=!1;const a=t.renderer.type===to.WEBGPU;for(let e=0;e<this.passes-1;e++){t.applyFilter(this,s,o,0===e||a);const r=o;o=s,s=r}this._state.blend=!0,t.applyFilter(this,s,r,n),ol.returnTexture(i)}}get blur(){return this.strength}set blur(t){this.padding=1+2*Math.abs(t),this.strength=t}get quality(){return this._quality}set quality(t){this._quality=t,this.passes=t}};fv.defaultOptions={strength:8,quality:4,kernelSize:5};let mv=fv;var gv=Object.defineProperty,xv=Object.defineProperties,bv=Object.getOwnPropertyDescriptors,Sv=Object.getOwnPropertySymbols,Tv=Object.prototype.hasOwnProperty,Pv=Object.prototype.propertyIsEnumerable,Ov=(t,e,r)=>e in t?gv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Mv=(t,e)=>{for(var r in e||(e={}))Tv.call(e,r)&&Ov(t,r,e[r]);if(Sv)for(var r of Sv(e))Pv.call(e,r)&&Ov(t,r,e[r]);return t};class wv extends By{constructor(...t){var e;let r=null!=(e=t[0])?e:{};"number"==typeof r&&(r={strength:r},void 0!==t[1]&&(r.quality=t[1]),void 0!==t[2]&&(r.resolution=t[2]||"inherit"),void 0!==t[3]&&(r.kernelSize=t[3])),r=Mv(Mv({},mv.defaultOptions),r);const n=r,{strength:i,strengthX:s,strengthY:o,quality:a}=n,l=((t,e)=>{var r={};for(var n in t)Tv.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&Sv)for(var n of Sv(t))e.indexOf(n)<0&&Pv.call(t,n)&&(r[n]=t[n]);return r})(n,["strength","strengthX","strengthY","quality"]);super(((t,e)=>xv(t,bv(e)))(Mv({},l),{compatibleRenderers:to.BOTH,resources:{}})),this._repeatEdgePixels=!1,this.blurXFilter=new mv(Mv({horizontal:!0},r)),this.blurYFilter=new mv(Mv({horizontal:!1},r)),this.quality=a,this.strengthX=null!=s?s:i,this.strengthY=null!=o?o:i,this.repeatEdgePixels=!1}apply(t,e,r,n){const i=Math.abs(this.blurXFilter.strength),s=Math.abs(this.blurYFilter.strength);if(i&&s){const i=ol.getSameSizeTexture(e);this.blurXFilter.blendMode="normal",this.blurXFilter.apply(t,e,i,!0),this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(t,i,r,n),ol.returnTexture(i)}else s?(this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(t,e,r,n)):(this.blurXFilter.blendMode=this.blendMode,this.blurXFilter.apply(t,e,r,n))}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=2*Math.max(Math.abs(this.blurXFilter.blur),Math.abs(this.blurYFilter.blur))}get strength(){if(this.strengthX!==this.strengthY)throw new Error("BlurFilter's strengthX and strengthY are different");return this.strengthX}set strength(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get strengthX(){return this.blurXFilter.blur}set strengthX(t){this.blurXFilter.blur=t,this.updatePadding()}get strengthY(){return this.blurYFilter.blur}set strengthY(t){this.blurYFilter.blur=t,this.updatePadding()}get blur(){return this.strength}set blur(t){this.strength=t}get blurX(){return this.strengthX}set blurX(t){this.strengthX=t}get blurY(){return this.strengthY}set blurY(t){this.strengthY=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}}wv.defaultOptions={strength:8,quality:4,kernelSize:5};var Cv="\n\tin vec2 vTextureCoord;\n\tin vec4 vColor;\n\t\n\tout vec4 finalColor;\n\t\n\tuniform float uColorMatrix[20];\n\tuniform float uAlpha;\n\t\n\tuniform sampler2D uTexture;\n\t\n\tfloat rand(vec2 co)\n\t{\n\t\treturn fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n\t}\n\t\n\tvoid main()\n\t{\n\t\tvec4 color = texture(uTexture, vTextureCoord);\n\t\tfloat randomValue = rand(gl_FragCoord.xy * 0.2);\n\t\tfloat diff = (randomValue - 0.5) * 0.5;\n\t\n\t\tif (uAlpha == 0.0) {\n\t\t\tfinalColor = color;\n\t\t\treturn;\n\t\t}\n\t\n\t\tif (color.a > 0.0) {\n\t\t\tcolor.rgb /= color.a;\n\t\t}\n\t\n\t\tvec4 result;\n\t\n\t\tresult.r = (uColorMatrix[0] * color.r);\n\t\t\tresult.r += (uColorMatrix[1] * color.g);\n\t\t\tresult.r += (uColorMatrix[2] * color.b);\n\t\t\tresult.r += (uColorMatrix[3] * color.a);\n\t\t\tresult.r += uColorMatrix[4];\n\t\n\t\tresult.g = (uColorMatrix[5] * color.r);\n\t\t\tresult.g += (uColorMatrix[6] * color.g);\n\t\t\tresult.g += (uColorMatrix[7] * color.b);\n\t\t\tresult.g += (uColorMatrix[8] * color.a);\n\t\t\tresult.g += uColorMatrix[9];\n\t\n\t\tresult.b = (uColorMatrix[10] * color.r);\n\t\t result.b += (uColorMatrix[11] * color.g);\n\t\t result.b += (uColorMatrix[12] * color.b);\n\t\t result.b += (uColorMatrix[13] * color.a);\n\t\t result.b += uColorMatrix[14];\n\t\n\t\tresult.a = (uColorMatrix[15] * color.r);\n\t\t result.a += (uColorMatrix[16] * color.g);\n\t\t result.a += (uColorMatrix[17] * color.b);\n\t\t result.a += (uColorMatrix[18] * color.a);\n\t\t result.a += uColorMatrix[19];\n\t\n\t\tvec3 rgb = mix(color.rgb, result.rgb, uAlpha);\n\t\n\t\t// Premultiply alpha again.\n\t\trgb *= result.a;\n\t\n\t\tfinalColor = vec4(rgb, result.a);\n\t}\n\t",Ev="struct GlobalFilterUniforms {\n\t uInputSize:vec4<f32>,\n\t uInputPixel:vec4<f32>,\n\t uInputClamp:vec4<f32>,\n\t uOutputFrame:vec4<f32>,\n\t uGlobalFrame:vec4<f32>,\n\t uOutputTexture:vec4<f32>,\n\t};\n\t\n\tstruct ColorMatrixUniforms {\n\t uColorMatrix:array<vec4<f32>, 5>,\n\t uAlpha:f32,\n\t};\n\t\n\t\n\t@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n\t@group(0) @binding(1) var uTexture: texture_2d<f32>;\n\t@group(0) @binding(2) var uSampler : sampler;\n\t@group(1) @binding(0) var<uniform> colorMatrixUniforms : ColorMatrixUniforms;\n\t\n\t\n\tstruct VSOutput {\n\t\t@builtin(position) position: vec4<f32>,\n\t\t@location(0) uv : vec2<f32>,\n\t };\n\t \n\tfn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n\t{\n\t\tvar position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\t\n\t\tposition.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n\t\tposition.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\t\n\t\treturn vec4(position, 0.0, 1.0);\n\t}\n\t\n\tfn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n\t{\n\t return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n\t}\n\t\n\t@vertex\n\tfn mainVertex(\n\t @location(0) aPosition : vec2<f32>, \n\t) -> VSOutput {\n\t return VSOutput(\n\t filterVertexPosition(aPosition),\n\t filterTextureCoord(aPosition),\n\t );\n\t}\n\t\n\t\n\t@fragment\n\tfn mainFragment(\n\t @location(0) uv: vec2<f32>,\n\t) -> @location(0) vec4<f32> {\n\t\n\t\n\t var c = textureSample(uTexture, uSampler, uv);\n\t \n\t if (colorMatrixUniforms.uAlpha == 0.0) {\n\t\treturn c;\n\t }\n\t\n\t \n\t\t// Un-premultiply alpha before applying the color matrix. See issue #3539.\n\t\tif (c.a > 0.0) {\n\t\t c.r /= c.a;\n\t\t c.g /= c.a;\n\t\t c.b /= c.a;\n\t\t}\n\t\n\t\tvar cm = colorMatrixUniforms.uColorMatrix;\n\t\n\t\n\t\tvar result = vec4<f32>(0.);\n\t\n\t\tresult.r = (cm[0][0] * c.r);\n\t\tresult.r += (cm[0][1] * c.g);\n\t\tresult.r += (cm[0][2] * c.b);\n\t\tresult.r += (cm[0][3] * c.a);\n\t\tresult.r += cm[1][0];\n\t\n\t\tresult.g = (cm[1][1] * c.r);\n\t\tresult.g += (cm[1][2] * c.g);\n\t\tresult.g += (cm[1][3] * c.b);\n\t\tresult.g += (cm[2][0] * c.a);\n\t\tresult.g += cm[2][1];\n\t\n\t\tresult.b = (cm[2][2] * c.r);\n\t\tresult.b += (cm[2][3] * c.g);\n\t\tresult.b += (cm[3][0] * c.b);\n\t\tresult.b += (cm[3][1] * c.a);\n\t\tresult.b += cm[3][2];\n\t\n\t\tresult.a = (cm[3][3] * c.r);\n\t\tresult.a += (cm[4][0] * c.g);\n\t\tresult.a += (cm[4][1] * c.b);\n\t\tresult.a += (cm[4][2] * c.a);\n\t\tresult.a += cm[4][3];\n\t\n\t\tvar rgb = mix(c.rgb, result.rgb, colorMatrixUniforms.uAlpha);\n\t\n\t\trgb.r *= result.a;\n\t\trgb.g *= result.a;\n\t\trgb.b *= result.a;\n\t\n\t\treturn vec4(rgb, result.a);\n\t}",Av=Object.defineProperty,Rv=Object.defineProperties,Iv=Object.getOwnPropertyDescriptors,Dv=Object.getOwnPropertySymbols,Bv=Object.prototype.hasOwnProperty,kv=Object.prototype.propertyIsEnumerable,Uv=(t,e,r)=>e in t?Av(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Fv="\n\tin vec2 vTextureCoord;\n\tin vec2 vFilterUv;\n\t\n\tout vec4 finalColor;\n\t\n\tuniform sampler2D uTexture;\n\tuniform sampler2D uMapTexture;\n\t\n\tuniform vec4 uInputClamp;\n\tuniform highp vec4 uInputSize;\n\tuniform mat2 uRotation;\n\tuniform vec2 uScale;\n\t\n\tvoid main()\n\t{\n\t\tvec4 map = texture(uMapTexture, vFilterUv);\n\t\t\n\t\tvec2 offset = uInputSize.zw * (uRotation * (map.xy - 0.5)) * uScale; \n\t\n\t\tfinalColor = texture(uTexture, clamp(vTextureCoord + offset, uInputClamp.xy, uInputClamp.zw));\n\t}\n\t",Lv="in vec2 aPosition;\n\tout vec2 vTextureCoord;\n\tout vec2 vFilterUv;\n\t\n\t\n\tuniform vec4 uInputSize;\n\tuniform vec4 uOutputFrame;\n\tuniform vec4 uOutputTexture;\n\t\n\tuniform mat3 uFilterMatrix;\n\t\n\tvec4 filterVertexPosition( void )\n\t{\n\t\tvec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n\t\t\n\t\tposition.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n\t\tposition.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\t\n\t\treturn vec4(position, 0.0, 1.0);\n\t}\n\t\n\tvec2 filterTextureCoord( void )\n\t{\n\t\treturn aPosition * (uOutputFrame.zw * uInputSize.zw);\n\t}\n\t\n\tvec2 getFilterCoord( void )\n\t{\n\t return ( uFilterMatrix * vec3( filterTextureCoord(), 1.0) ).xy;\n\t}\n\t\n\t\n\tvoid main(void)\n\t{\n\t\tgl_Position = filterVertexPosition();\n\t\tvTextureCoord = filterTextureCoord();\n\t\tvFilterUv = getFilterCoord();\n\t}\n\t",Gv="\n\tstruct GlobalFilterUniforms {\n\t uInputSize:vec4<f32>,\n\t uInputPixel:vec4<f32>,\n\t uInputClamp:vec4<f32>,\n\t uOutputFrame:vec4<f32>,\n\t uGlobalFrame:vec4<f32>,\n\t uOutputTexture:vec4<f32>,\n\t};\n\t\n\tstruct DisplacementUniforms {\n\t uFilterMatrix:mat3x3<f32>,\n\t uScale:vec2<f32>,\n\t uRotation:mat2x2<f32>\n\t};\n\t\n\t\n\t\n\t@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n\t@group(0) @binding(1) var uTexture: texture_2d<f32>;\n\t@group(0) @binding(2) var uSampler : sampler;\n\t\n\t@group(1) @binding(0) var<uniform> filterUniforms : DisplacementUniforms;\n\t@group(1) @binding(1) var uMapTexture: texture_2d<f32>;\n\t@group(1) @binding(2) var uMapSampler : sampler;\n\t\n\tstruct VSOutput {\n\t\t@builtin(position) position: vec4<f32>,\n\t\t@location(0) uv : vec2<f32>,\n\t\t@location(1) filterUv : vec2<f32>,\n\t };\n\t\n\tfn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n\t{\n\t\tvar position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\t\n\t\tposition.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n\t\tposition.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\t\n\t\treturn vec4(position, 0.0, 1.0);\n\t}\n\t\n\tfn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n\t{\n\t\treturn aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n\t}\n\t\n\tfn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n\t{\n\t return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \n\t}\n\t\n\tfn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>\n\t{\n\t return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;\n\t}\n\t\n\tfn getSize() -> vec2<f32>\n\t{\n\t\n\t \n\t return gfu.uGlobalFrame.zw;\n\t}\n\t \n\t@vertex\n\tfn mainVertex(\n\t @location(0) aPosition : vec2<f32>, \n\t) -> VSOutput {\n\t return VSOutput(\n\t filterVertexPosition(aPosition),\n\t filterTextureCoord(aPosition),\n\t getFilterCoord(aPosition)\n\t );\n\t}\n\t\n\t@fragment\n\tfn mainFragment(\n\t @location(0) uv: vec2<f32>,\n\t @location(1) filterUv: vec2<f32>,\n\t @builtin(position) position: vec4<f32>\n\t) -> @location(0) vec4<f32> {\n\t\n\t\tvar map = textureSample(uMapTexture, uMapSampler, filterUv);\n\t\n\t\tvar offset = gfu.uInputSize.zw * (filterUniforms.uRotation * (map.xy - 0.5)) * filterUniforms.uScale; \n\t \n\t\treturn textureSample(uTexture, uSampler, clamp(uv + offset, gfu.uInputClamp.xy, gfu.uInputClamp.zw));\n\t}",jv=Object.defineProperty,Nv=Object.defineProperties,zv=Object.getOwnPropertyDescriptors,Wv=Object.getOwnPropertySymbols,Vv=Object.prototype.hasOwnProperty,Hv=Object.prototype.propertyIsEnumerable,Xv=(t,e,r)=>e in t?jv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Kv="\n\tin vec2 vTextureCoord;\n\tin vec4 vColor;\n\t\n\tout vec4 finalColor;\n\t\n\tuniform float uNoise;\n\tuniform float uSeed;\n\tuniform sampler2D uTexture;\n\t\n\tfloat rand(vec2 co)\n\t{\n\t\treturn fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n\t}\n\t\n\tvoid main()\n\t{\n\t\tvec4 color = texture(uTexture, vTextureCoord);\n\t\tfloat randomValue = rand(gl_FragCoord.xy * uSeed);\n\t\tfloat diff = (randomValue - 0.5) * uNoise;\n\t\n\t\t// Un-premultiply alpha before applying the color matrix. See issue #3539.\n\t\tif (color.a > 0.0) {\n\t\t\tcolor.rgb /= color.a;\n\t\t}\n\t\n\t\tcolor.r += diff;\n\t\tcolor.g += diff;\n\t\tcolor.b += diff;\n\t\n\t\t// Premultiply alpha again.\n\t\tcolor.rgb *= color.a;\n\t\n\t\tfinalColor = color;\n\t}\n\t",Yv="\n\t\n\tstruct GlobalFilterUniforms {\n\t uInputSize:vec4<f32>,\n\t uInputPixel:vec4<f32>,\n\t uInputClamp:vec4<f32>,\n\t uOutputFrame:vec4<f32>,\n\t uGlobalFrame:vec4<f32>,\n\t uOutputTexture:vec4<f32>,\n\t};\n\t\n\tstruct NoiseUniforms {\n\t uNoise:f32,\n\t uSeed:f32,\n\t};\n\t\n\t@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n\t@group(0) @binding(1) var uTexture: texture_2d<f32>;\n\t@group(0) @binding(2) var uSampler : sampler;\n\t\n\t@group(1) @binding(0) var<uniform> noiseUniforms : NoiseUniforms;\n\t\n\tstruct VSOutput {\n\t\t@builtin(position) position: vec4<f32>,\n\t\t@location(0) uv : vec2<f32>\n\t };\n\t\n\tfn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n\t{\n\t\tvar position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\t\n\t\tposition.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n\t\tposition.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\t\n\t\treturn vec4(position, 0.0, 1.0);\n\t}\n\t\n\tfn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n\t{\n\t\treturn aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n\t}\n\t\n\tfn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n\t{\n\t return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); \n\t}\n\t\n\tfn getSize() -> vec2<f32>\n\t{\n\t return gfu.uGlobalFrame.zw;\n\t}\n\t \n\t@vertex\n\tfn mainVertex(\n\t @location(0) aPosition : vec2<f32>, \n\t) -> VSOutput {\n\t return VSOutput(\n\t filterVertexPosition(aPosition),\n\t filterTextureCoord(aPosition)\n\t );\n\t}\n\t\n\tfn rand(co:vec2<f32>) -> f32\n\t{\n\t return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n\t}\n\t\n\t\n\t\n\t@fragment\n\tfn mainFragment(\n\t @location(0) uv: vec2<f32>,\n\t @builtin(position) position: vec4<f32>\n\t) -> @location(0) vec4<f32> {\n\t\n\t\tvar pixelPosition = globalTextureCoord(position.xy);// / (getSize());//- gfu.uOutputFrame.xy);\n\t \n\t\t\n\t\tvar sample = textureSample(uTexture, uSampler, uv);\n\t\tvar randomValue = rand(pixelPosition.xy * noiseUniforms.uSeed);\n\t\tvar diff = (randomValue - 0.5) * noiseUniforms.uNoise;\n\t \n\t\t// Un-premultiply alpha before applying the color matrix. See issue #3539.\n\t\tif (sample.a > 0.0) {\n\t\t sample.r /= sample.a;\n\t\t sample.g /= sample.a;\n\t\t sample.b /= sample.a;\n\t\t}\n\t\n\t\tsample.r += diff;\n\t\tsample.g += diff;\n\t\tsample.b += diff;\n\t\n\t\t// Premultiply alpha again.\n\t\tsample.r *= sample.a;\n\t\tsample.g *= sample.a;\n\t\tsample.b *= sample.a;\n\t\t\n\t\treturn sample;\n\t}",Qv=Object.defineProperty,$v=Object.defineProperties,qv=Object.getOwnPropertyDescriptors,Zv=Object.getOwnPropertySymbols,Jv=Object.prototype.hasOwnProperty,tf=Object.prototype.propertyIsEnumerable,ef=(t,e,r)=>e in t?Qv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,rf=(t,e)=>{for(var r in e||(e={}))Jv.call(e,r)&&ef(t,r,e[r]);if(Zv)for(var r of Zv(e))tf.call(e,r)&&ef(t,r,e[r]);return t};const nf=class t extends By{constructor(e={}){e=rf(rf({},t.defaultOptions),e);const r=ts.from({vertex:{source:Yv,entryPoint:"mainVertex"},fragment:{source:Yv,entryPoint:"mainFragment"}}),n=Wi.from({vertex:Hy,fragment:Kv,name:"noise-filter"}),i=e,{noise:s,seed:o}=i,a=((t,e)=>{var r={};for(var n in t)Jv.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&Zv)for(var n of Zv(t))e.indexOf(n)<0&&tf.call(t,n)&&(r[n]=t[n]);return r})(i,["noise","seed"]);super(((t,e)=>$v(t,qv(e)))(rf({},a),{gpuProgram:r,glProgram:n,resources:{noiseUniforms:new qs({uNoise:{value:1,type:"f32"},uSeed:{value:1,type:"f32"}})}})),this.noise=s,this.seed=null!=o?o:Math.random()}get noise(){return this.resources.noiseUniforms.uniforms.uNoise}set noise(t){this.resources.noiseUniforms.uniforms.uNoise=t}get seed(){return this.resources.noiseUniforms.uniforms.uSeed}set seed(t){this.resources.noiseUniforms.uniforms.uSeed=t}};nf.defaultOptions={noise:.5};let sf=nf;var of="in vec2 vMaskCoord;\n\tin vec2 vTextureCoord;\n\t\n\tuniform sampler2D uTexture;\n\tuniform sampler2D uMaskTexture;\n\t\n\tuniform float uAlpha;\n\tuniform vec4 uMaskClamp;\n\tuniform float uInverse;\n\t\n\tout vec4 finalColor;\n\t\n\tvoid main(void)\n\t{\n\t\tfloat clip = step(3.5,\n\t\t\tstep(uMaskClamp.x, vMaskCoord.x) +\n\t\t\tstep(uMaskClamp.y, vMaskCoord.y) +\n\t\t\tstep(vMaskCoord.x, uMaskClamp.z) +\n\t\t\tstep(vMaskCoord.y, uMaskClamp.w));\n\t\n\t\t// TODO look into why this is needed\n\t\tfloat npmAlpha = uAlpha;\n\t\tvec4 original = texture(uTexture, vTextureCoord);\n\t\tvec4 masky = texture(uMaskTexture, vMaskCoord);\n\t\tfloat alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\t\n\t\tfloat a = alphaMul * masky.r * npmAlpha * clip;\n\t\n\t\tif (uInverse == 1.0) {\n\t\t\ta = 1.0 - a;\n\t\t}\n\t\n\t\tfinalColor = original * a;\n\t}\n\t",af="in vec2 aPosition;\n\t\n\tout vec2 vTextureCoord;\n\tout vec2 vMaskCoord;\n\t\n\t\n\tuniform vec4 uInputSize;\n\tuniform vec4 uOutputFrame;\n\tuniform vec4 uOutputTexture;\n\tuniform mat3 uFilterMatrix;\n\t\n\tvec4 filterVertexPosition( vec2 aPosition )\n\t{\n\t\tvec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n\t\t \n\t\tposition.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n\t\tposition.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\t\n\t\treturn vec4(position, 0.0, 1.0);\n\t}\n\t\n\tvec2 filterTextureCoord( vec2 aPosition )\n\t{\n\t\treturn aPosition * (uOutputFrame.zw * uInputSize.zw);\n\t}\n\t\n\tvec2 getFilterCoord( vec2 aPosition )\n\t{\n\t\treturn ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;\n\t} \n\t\n\tvoid main(void)\n\t{\n\t\tgl_Position = filterVertexPosition(aPosition);\n\t\tvTextureCoord = filterTextureCoord(aPosition);\n\t\tvMaskCoord = getFilterCoord(aPosition);\n\t}\n\t",lf="struct GlobalFilterUniforms {\n\t uInputSize:vec4<f32>,\n\t uInputPixel:vec4<f32>,\n\t uInputClamp:vec4<f32>,\n\t uOutputFrame:vec4<f32>,\n\t uGlobalFrame:vec4<f32>,\n\t uOutputTexture:vec4<f32>,\n\t};\n\t\n\tstruct MaskUniforms {\n\t uFilterMatrix:mat3x3<f32>,\n\t uMaskClamp:vec4<f32>,\n\t uAlpha:f32,\n\t uInverse:f32,\n\t};\n\t\n\t@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n\t@group(0) @binding(1) var uTexture: texture_2d<f32>;\n\t@group(0) @binding(2) var uSampler : sampler;\n\t\n\t@group(1) @binding(0) var<uniform> filterUniforms : MaskUniforms;\n\t@group(1) @binding(1) var uMaskTexture: texture_2d<f32>;\n\t\n\tstruct VSOutput {\n\t\t@builtin(position) position: vec4<f32>,\n\t\t@location(0) uv : vec2<f32>,\n\t\t@location(1) filterUv : vec2<f32>,\n\t};\n\t\n\tfn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n\t{\n\t\tvar position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\t\n\t\tposition.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n\t\tposition.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\t\n\t\treturn vec4(position, 0.0, 1.0);\n\t}\n\t\n\tfn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n\t{\n\t\treturn aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n\t}\n\t\n\tfn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n\t{\n\t return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);\n\t}\n\t\n\tfn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>\n\t{\n\t return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;\n\t}\n\t\n\tfn getSize() -> vec2<f32>\n\t{\n\t return gfu.uGlobalFrame.zw;\n\t}\n\t\n\t@vertex\n\tfn mainVertex(\n\t @location(0) aPosition : vec2<f32>,\n\t) -> VSOutput {\n\t return VSOutput(\n\t filterVertexPosition(aPosition),\n\t filterTextureCoord(aPosition),\n\t getFilterCoord(aPosition)\n\t );\n\t}\n\t\n\t@fragment\n\tfn mainFragment(\n\t @location(0) uv: vec2<f32>,\n\t @location(1) filterUv: vec2<f32>,\n\t @builtin(position) position: vec4<f32>\n\t) -> @location(0) vec4<f32> {\n\t\n\t\tvar maskClamp = filterUniforms.uMaskClamp;\n\t\tvar uAlpha = filterUniforms.uAlpha;\n\t\n\t\tvar clip = step(3.5,\n\t\t step(maskClamp.x, filterUv.x) +\n\t\t step(maskClamp.y, filterUv.y) +\n\t\t step(filterUv.x, maskClamp.z) +\n\t\t step(filterUv.y, maskClamp.w));\n\t\n\t\tvar mask = textureSample(uMaskTexture, uSampler, filterUv);\n\t\tvar source = textureSample(uTexture, uSampler, uv);\n\t\tvar alphaMul = 1.0 - uAlpha * (1.0 - mask.a);\n\t\n\t\tvar a: f32 = alphaMul * mask.r * uAlpha * clip;\n\t\n\t\tif (filterUniforms.uInverse == 1.0) {\n\t\t\ta = 1.0 - a;\n\t\t}\n\t\n\t\treturn source * a;\n\t}\n\t",_f=Object.defineProperty,uf=Object.defineProperties,cf=Object.getOwnPropertyDescriptors,hf=Object.getOwnPropertySymbols,df=Object.prototype.hasOwnProperty,pf=Object.prototype.propertyIsEnumerable,yf=(t,e,r)=>e in t?_f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;class vf extends By{constructor(t){const e=t,{sprite:r}=e,n=((t,e)=>{var r={};for(var n in t)df.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&hf)for(var n of hf(t))e.indexOf(n)<0&&pf.call(t,n)&&(r[n]=t[n]);return r})(e,["sprite"]),i=new Qr(r.texture),s=new qs({uFilterMatrix:{value:new st,type:"mat3x3<f32>"},uMaskClamp:{value:i.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),o=ts.from({vertex:{source:lf,entryPoint:"mainVertex"},fragment:{source:lf,entryPoint:"mainFragment"}}),a=Wi.from({vertex:af,fragment:of,name:"mask-filter"});super(((t,e)=>uf(t,cf(e)))(((t,e)=>{for(var r in e||(e={}))df.call(e,r)&&yf(t,r,e[r]);if(hf)for(var r of hf(e))pf.call(e,r)&&yf(t,r,e[r]);return t})({},n),{gpuProgram:o,glProgram:a,resources:{filterUniforms:s,uMaskTexture:r.texture.source}})),this.sprite=r,this._textureMatrix=i}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return 1===this.resources.filterUniforms.uniforms.uInverse}apply(t,e,r,n){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,r,n)}}function ff(t,e,r,n,i,s,o,a){const l=o-r,_=a-n,u=i-r,c=s-n,h=t-r,d=e-n,p=l*l+_*_,y=l*u+_*c,v=l*h+_*d,f=u*u+c*c,m=u*h+c*d,g=1/(p*f-y*y),x=(f*v-y*m)*g,b=(p*m-y*v)*g;return x>=0&&b>=0&&x+b<1}class mf{constructor(t=0,e=0,r=0,n=0,i=0,s=0){this.type="triangle",this.x=t,this.y=e,this.x2=r,this.y2=n,this.x3=i,this.y3=s}contains(t,e){const r=(this.x-this.x3)*(e-this.y3)-(this.y-this.y3)*(t-this.x3),n=(this.x2-this.x)*(e-this.y)-(this.y2-this.y)*(t-this.x);if(r<0!=n<0&&0!==r&&0!==n)return!1;const i=(this.x3-this.x2)*(e-this.y2)-(this.y3-this.y2)*(t-this.x2);return 0===i||i<0==r+n<=0}strokeContains(t,e,r){const n=r/2,i=n*n,{x:s,x2:o,x3:a,y:l,y2:_,y3:u}=this;return Sl(t,e,s,l,o,u)<=i||Sl(t,e,o,_,a,u)<=i||Sl(t,e,a,u,s,l)<=i}clone(){return new mf(this.x,this.y,this.x2,this.y2,this.x3,this.y3)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x2=t.x2,this.y2=t.y2,this.x3=t.x3,this.y3=t.y3,this}copyTo(t){return t.copyFrom(this),t}getBounds(t){t=t||new Ct;const e=Math.min(this.x,this.x2,this.x3),r=Math.max(this.x,this.x2,this.x3),n=Math.min(this.y,this.y2,this.y3),i=Math.max(this.y,this.y2,this.y3);return t.x=e,t.y=n,t.width=r-e,t.height=i-n,t}}const gf=class t{constructor(e){this._tick=()=>{this.timeout=setTimeout(this._processQueue,0)},this._processQueue=()=>{const{queue:e}=this;let r=0;for(;e.length&&r<t.uploadsPerFrame;){const t=e.shift();this.uploadQueueItem(t),r++}e.length?Oe.system.addOnce(this._tick,this,Se.UTILITY):this._resolve()},this.renderer=e,this.queue=[],this.resolves=[]}getQueue(){return[...this.queue]}add(t){const e=Array.isArray(t)?t:[t];for(const t of e)t instanceof Zt?this._addContainer(t):this.resolveQueueItem(t,this.queue);return this}_addContainer(t){this.resolveQueueItem(t,this.queue);for(const e of t.children)this._addContainer(e)}upload(t){return t&&this.add(t),new Promise((t=>{this.queue.length?(this.resolves.push(t),this.dedupeQueue(),Oe.system.addOnce(this._tick,this,Se.UTILITY)):t()}))}dedupeQueue(){const t=Object.create(null);let e=0;for(let r=0;r<this.queue.length;r++){const n=this.queue[r];t[n.uid]||(t[n.uid]=!0,this.queue[e++]=n)}this.queue.length=e}_resolve(){const{resolves:t}=this,e=t.slice(0);t.length=0;for(const t of e)t()}};gf.uploadsPerFrame=4;let xf=gf;var bf=Object.defineProperty,Sf=Object.getOwnPropertySymbols,Tf=Object.prototype.hasOwnProperty,Pf=Object.prototype.propertyIsEnumerable,Of=(t,e,r)=>e in t?bf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;class Mf extends nn{constructor(...t){var e;let r=t[0];r instanceof mi&&(r={geometry:r,shader:t[1]},t[3]&&(r.geometry.topology=t[3]));const n=r,{geometry:i,shader:s,texture:o,roundPixels:a,state:l}=n,_=((t,e)=>{var r={};for(var n in t)Tf.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&Sf)for(var n of Sf(t))e.indexOf(n)<0&&Pf.call(t,n)&&(r[n]=t[n]);return r})(n,["geometry","shader","texture","roundPixels","state"]);super(((t,e)=>{for(var r in e||(e={}))Tf.call(e,r)&&Of(t,r,e[r]);if(Sf)for(var r of Sf(e))Pf.call(e,r)&&Of(t,r,e[r]);return t})({label:"Mesh"},_)),this.renderPipeId="mesh",this._shader=null,this.allowChildren=!1,this.shader=null!=s?s:null,this.texture=null!=(e=null!=o?o:null==s?void 0:s.texture)?e:$r.WHITE,this.state=null!=l?l:Ea.for2d(),this._geometry=i,this._geometry.on("update",this.onViewUpdate,this),this.roundPixels=null!=a&&a}get material(){return this._shader}set shader(t){this._shader!==t&&(this._shader=t,this.onViewUpdate())}get shader(){return this._shader}set geometry(t){var e;this._geometry!==t&&(null==(e=this._geometry)||e.off("update",this.onViewUpdate,this),t.on("update",this.onViewUpdate,this),this._geometry=t,this.onViewUpdate())}get geometry(){return this._geometry}set texture(t){t||(t=$r.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this.shader&&(this.shader.texture=t),this._texture=t,this.onViewUpdate())}get texture(){return this._texture}get batched(){return!(this._shader||12&this.state.data)&&(this._geometry instanceof ac&&("auto"===this._geometry.batchMode?this._geometry.positions.length/2<=100:"batch"===this._geometry.batchMode))}get bounds(){return this._geometry.bounds}addBounds(t){t.addBounds(this.geometry.bounds)}containsPoint(t){const{x:e,y:r}=t;if(!this.bounds.containsPoint(e,r))return!1;const n=this.geometry.getBuffer("aPosition").data,i="triangle-strip"===this.geometry.topology?3:1;if(this.geometry.getIndex()){const t=this.geometry.getIndex().data,s=t.length;for(let o=0;o+2<s;o+=i){const i=2*t[o],s=2*t[o+1],a=2*t[o+2];if(ff(e,r,n[i],n[i+1],n[s],n[s+1],n[a],n[a+1]))return!0}}else{const t=n.length/2;for(let s=0;s+2<t;s+=i){const t=2*s,i=2*(s+1),o=2*(s+2);if(ff(e,r,n[t],n[t+1],n[i],n[i+1],n[o],n[o+1]))return!0}}return!1}destroy(t){var e;if(super.destroy(t),"boolean"==typeof t?t:null==t?void 0:t.texture){const e="boolean"==typeof t?t:null==t?void 0:t.textureSource;this._texture.destroy(e)}null==(e=this._geometry)||e.off("update",this.onViewUpdate,this),this._texture=null,this._geometry=null,this._shader=null}}var wf=Object.defineProperty,Cf=Object.defineProperties,Ef=Object.getOwnPropertyDescriptors,Af=Object.getOwnPropertySymbols,Rf=Object.prototype.hasOwnProperty,If=Object.prototype.propertyIsEnumerable,Df=(t,e,r)=>e in t?wf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;class Bf extends un{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});const r=e,{textures:n,autoUpdate:i}=r,s=((t,e)=>{var r={};for(var n in t)Rf.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&Af)for(var n of Af(t))e.indexOf(n)<0&&If.call(t,n)&&(r[n]=t[n]);return r})(r,["textures","autoUpdate"]),[o]=n;super(((t,e)=>Cf(t,Ef(e)))(((t,e)=>{for(var r in e||(e={}))Rf.call(e,r)&&Df(t,r,e[r]);if(Af)for(var r of Af(e))If.call(e,r)&&Df(t,r,e[r]);return t})({},s),{texture:o instanceof $r?o:o.texture})),this._textures=null,this._durations=null,this._autoUpdate=null==i||i,this._isConnectedToTicker=!1,this.animationSpeed=1,this.loop=!0,this.updateAnchor=!1,this.onComplete=null,this.onFrameChange=null,this.onLoop=null,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=n}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(Oe.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(Oe.shared.add(this.update,this,Se.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;const e=t.deltaTime,r=this.animationSpeed*e,n=this.currentFrame;if(null!==this._durations){let t=this._currentTime%1*this._durations[this.currentFrame];for(t+=r/60*1e3;t<0;)this._currentTime--,t+=this._durations[this.currentFrame];const n=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);t>=this._durations[this.currentFrame];)t-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=t/this._durations[this.currentFrame]}else this._currentTime+=r;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()):n!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<n||this.animationSpeed<0&&this.currentFrame>n)&&this.onLoop(),this._updateTexture())}_updateTexture(){const t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let r=0;r<t.length;++r)e.push($r.from(t[r]));return new Bf(e)}static fromImages(t){const e=[];for(let r=0;r<t.length;++r)e.push($r.from(t[r]));return new Bf(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof $r)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.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?(Oe.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(Oe.shared.add(this.update,this),this._isConnectedToTicker=!0))}}class kf{constructor({matrix:t,observer:e}={}){this.dirty=!0,this._matrix=null!=t?t:new st,this.observer=e,this.position=new lt(this,0,0),this.scale=new lt(this,1,1),this.pivot=new lt(this,0,0),this.skew=new lt(this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1}get matrix(){const t=this._matrix;return this.dirty&&(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.dirty=!1),t}_onUpdate(t){var e;this.dirty=!0,t===this.skew&&this.updateSkew(),null==(e=this.observer)||e._onUpdate(this)}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.dirty=!0}setFromMatrix(t){t.decompose(this),this.dirty=!0}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this.skew))}}var Uf=Object.defineProperty,Ff=Object.getOwnPropertySymbols,Lf=Object.prototype.hasOwnProperty,Gf=Object.prototype.propertyIsEnumerable,jf=(t,e,r)=>e in t?Uf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Nf=(t,e)=>{for(var r in e||(e={}))Lf.call(e,r)&&jf(t,r,e[r]);if(Ff)for(var r of Ff(e))Gf.call(e,r)&&jf(t,r,e[r]);return t};const zf=class t extends nn{constructor(...e){let r=e[0]||{};r instanceof $r&&(r={texture:r}),e.length>1&&(r.width=e[1],r.height=e[2]),r=Nf(Nf({},t.defaultOptions),r);const n=null!=r?r:{},{texture:i,anchor:s,tilePosition:o,tileScale:a,tileRotation:l,width:_,height:u,applyAnchorToTexture:c,roundPixels:h}=n,d=((t,e)=>{var r={};for(var n in t)Lf.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&Ff)for(var n of Ff(t))e.indexOf(n)<0&&Gf.call(t,n)&&(r[n]=t[n]);return r})(n,["texture","anchor","tilePosition","tileScale","tileRotation","width","height","applyAnchorToTexture","roundPixels"]);super(Nf({label:"TilingSprite"},d)),this.renderPipeId="tilingSprite",this.batched=!0,this.allowChildren=!1,this._anchor=new lt({_onUpdate:()=>{this.onViewUpdate()}}),this._applyAnchorToTexture=c,this.texture=i,this._width=null!=_?_:i.width,this._height=null!=u?u:i.height,this._tileTransform=new kf({observer:{_onUpdate:()=>this.onViewUpdate()}}),s&&(this.anchor=s),this.tilePosition=o,this.tileScale=a,this.tileRotation=l,this.roundPixels=null!=h&&h}static from(e,r={}){return new t(Nf("string"==typeof e?{texture:In.get(e)}:{texture:e},r))}get clampMargin(){return this._texture.textureMatrix.clampMargin}set clampMargin(t){this._texture.textureMatrix.clampMargin=t}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}get tilePosition(){return this._tileTransform.position}set tilePosition(t){this._tileTransform.position.copyFrom(t)}get tileScale(){return this._tileTransform.scale}set tileScale(t){"number"==typeof t?this._tileTransform.scale.set(t):this._tileTransform.scale.copyFrom(t)}set tileRotation(t){this._tileTransform.rotation=t}get tileRotation(){return this._tileTransform.rotation}get tileTransform(){return this._tileTransform}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}set texture(t){t||(t=$r.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this.onViewUpdate())}get texture(){return this._texture}set width(t){this._width=t,this.onViewUpdate()}get width(){return this._width}set height(t){this._height=t,this.onViewUpdate()}get height(){return this._height}setSize(t,e){var r;"object"==typeof t&&(e=null!=(r=t.height)?r:t.width,t=t.width),this._width=t,this._height=null!=e?e:t,this.onViewUpdate()}getSize(t){return t||(t={}),t.width=this._width,t.height=this._height,t}_updateBounds(){const t=this._bounds,e=this._anchor,r=this._width,n=this._height;t.maxX=-e._x*r,t.minX=t.maxX+r,t.maxY=-e._y*n,t.minY=t.maxY+n}addBounds(t){const e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}containsPoint(t){const e=this._width,r=this._height,n=-e*this._anchor._x;let i=0;return t.x>=n&&t.x<=n+e&&(i=-r*this._anchor._y,t.y>=i&&t.y<=i+r)}onViewUpdate(){this._boundsDirty=!0,super.onViewUpdate()}destroy(t=!1){if(super.destroy(t),this._anchor=null,this._tileTransform=null,this._bounds=null,"boolean"==typeof t?t:null==t?void 0:t.texture){const e="boolean"==typeof t?t:null==t?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null}};zf.defaultOptions={texture:$r.EMPTY,anchor:{x:0,y:0},tilePosition:{x:0,y:0},tileScale:{x:1,y:1},tileRotation:0,applyAnchorToTexture:!1};let Wf=zf;var Vf=Object.defineProperty,Hf=Object.getOwnPropertySymbols,Xf=Object.prototype.hasOwnProperty,Kf=Object.prototype.propertyIsEnumerable,Yf=(t,e,r)=>e in t?Vf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;class Qf extends nn{constructor(t,e){const r=t,{text:n,resolution:i,style:s,anchor:o,width:a,height:l,roundPixels:_}=r,u=((t,e)=>{var r={};for(var n in t)Xf.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&Hf)for(var n of Hf(t))e.indexOf(n)<0&&Kf.call(t,n)&&(r[n]=t[n]);return r})(r,["text","resolution","style","anchor","width","height","roundPixels"]);super(((t,e)=>{for(var r in e||(e={}))Xf.call(e,r)&&Yf(t,r,e[r]);if(Hf)for(var r of Hf(e))Kf.call(e,r)&&Yf(t,r,e[r]);return t})({},u)),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=null!=n?n:"",this.style=s,this.resolution=null!=i?i:null,this.allowChildren=!1,this._anchor=new lt({_onUpdate:()=>{this.onViewUpdate()}}),o&&(this.anchor=o),this.roundPixels=null!=_&&_,void 0!==a&&(this.width=a),void 0!==l&&(this.height=l)}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=null===t,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){var e;t=t||{},null==(e=this._style)||e.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){var r;"object"==typeof t?(e=null!=(r=t.height)?r:t.width,t=t.width):null!=e||(e=t),void 0!==t&&this._setWidth(t,this.bounds.width),void 0!==e&&this._setHeight(e,this.bounds.height)}addBounds(t){const e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}containsPoint(t){const e=this.bounds.width,r=this.bounds.height,n=-e*this.anchor.x;let i=0;return t.x>=n&&t.x<=n+e&&(i=-r*this.anchor.y,t.y>=i&&t.y<=i+r)}onViewUpdate(){this._boundsDirty=!0,this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,("boolean"==typeof t?t:null!=t&&t.style)&&this._style.destroy(t),this._style=null,this._text=null}}function $f(t,e){var r;let n=null!=(r=t[0])?r:{};return("string"==typeof n||t[1])&&(n={text:n,style:t[1]}),n}class qf extends Qf{constructor(...t){super($f(t),B_),this.renderPipeId="text"}_updateBounds(){const t=this._bounds,e=this._anchor,r=N_.measureText(this._text,this._style),{width:n,height:i}=r;t.minX=-e._x*n,t.maxX=t.minX+n,t.minY=-e._y*i,t.maxY=t.minY+i}}class Zf extends xf{resolveQueueItem(t,e){return t instanceof Zt?this.resolveContainerQueueItem(t,e):t instanceof Gr||t instanceof $r?e.push(t.source):t instanceof b_&&e.push(t),null}resolveContainerQueueItem(t,e){t instanceof un||t instanceof Wf||t instanceof Mf?e.push(t.texture.source):t instanceof qf?e.push(t):t instanceof Q_?e.push(t.context):t instanceof Bf&&t.textures.forEach((t=>{t.source?e.push(t.source):e.push(t.texture.source)}))}resolveGraphicsContextQueueItem(t){this.renderer.graphicsContext.getContextRenderData(t);const{instructions:e}=t;for(const t of e){if("texture"===t.action){const{image:e}=t.data;return e.source}if("fill"===t.action){const{texture:e}=t.data.style;return e.source}}return null}}class Jf extends Qf{constructor(...t){var e;const r=$f(t);null!=r.style||(r.style=r.style||{}),null!=(e=r.style).fill||(e.fill=16777215),super(r,B_),this.renderPipeId="bitmapText"}_updateBounds(){const t=this._bounds,e=this._anchor,r=Tu.measureText(this.text,this._style),n=r.scale,i=r.offsetY*n;let s=r.width*n,o=r.height*n;const a=this._style._stroke;a&&(s+=a.width,o+=a.width),t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*(o+i),t.maxY=t.minY+o}set resolution(t){}get resolution(){return this._resolution}}class tm extends Qf{constructor(...t){super($f(t),zu),this.renderPipeId="htmlText"}_updateBounds(){const t=this._bounds,e=this._anchor,r=Zu(this.text,this._style),{width:n,height:i}=r;t.minX=-e._x*n,t.maxX=t.minX+n,t.minY=-e._y*i,t.maxY=t.minY+i}}class em extends Zf{uploadQueueItem(t){t instanceof Gr?this.uploadTextureSource(t):t instanceof qf?this.uploadText(t):t instanceof tm?this.uploadHTMLText(t):t instanceof Jf?this.uploadBitmapText(t):t instanceof b_&&this.uploadGraphicsContext(t)}uploadTextureSource(t){this.renderer.texture.initSource(t)}uploadText(t){this.renderer.renderPipes.text.initGpuText(t)}uploadBitmapText(t){this.renderer.renderPipes.bitmapText.initGpuText(t)}uploadHTMLText(t){this.renderer.renderPipes.htmlText.initGpuText(t)}uploadGraphicsContext(t){this.renderer.graphicsContext.getContextRenderData(t);const{instructions:e}=t;for(const t of e)if("texture"===t.action){const{image:e}=t.data;this.uploadTextureSource(e.source)}else if("fill"===t.action){const{texture:e}=t.data.style;this.uploadTextureSource(e.source)}return null}}class rm extends em{destroy(){clearTimeout(this.timeout),this.renderer=null,this.queue=null,this.resolves=null}}rm.extension={type:[c.WebGLSystem,c.WebGPUSystem],name:"prepare"};class nm{constructor(){this._didUpload=!1,this._tempState=Ea.for2d()}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUpload=!1}start(t,e,r){const n=t.renderer;n.shader.bind(r,this._didUpload),n.shader.updateUniformGroup(n.globalUniforms.uniformGroup),n.geometry.bind(e,r.glProgram)}execute(t,e){const r=t.renderer;this._didUpload=!0,this._tempState.blendMode=e.blendMode,r.state.set(this._tempState);const n=e.textures.textures;for(let t=0;t<e.textures.count;t++)r.texture.bind(n[t],t);r.geometry.draw("triangle-list",e.size,e.start)}}nm.extension={type:[c.WebGLPipesAdaptor],name:"batch"};const im=Ea.for2d();class sm{start(t,e,r){const n=t.renderer,i=n.encoder,s=r.gpuProgram;this._shader=r,this._geometry=e,i.setGeometry(e,s),im.blendMode="normal",n.pipeline.getPipeline(e,s,im);const o=n.globalUniforms.bindGroup;i.resetBindGroup(1),i.setBindGroup(0,o,s)}execute(t,e){const r=this._shader.gpuProgram,n=t.renderer,i=n.encoder;if(!e.bindGroup){const t=e.textures;e.bindGroup=Xn(t.textures,t.count)}im.blendMode=e.blendMode;const s=n.bindGroup.getBindGroup(e.bindGroup,r,1),o=n.pipeline.getPipeline(this._geometry,r,im);e.bindGroup._touch(n.textureGC.count),i.setPipeline(o),i.renderPassEncoder.setBindGroup(1,s),i.renderPassEncoder.drawIndexed(e.size,1,e.start)}}sm.extension={type:[c.WebGPUPipesAdaptor],name:"batch"};const om=class t{constructor(t,e){var r,n;this.state=Ea.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=t,this._adaptor=e,null==(n=(r=this._adaptor).init)||n.call(r,this)}static getBatcher(t){return new this._availableBatchers[t]}buildStart(t){let e=this._batchersByInstructionSet[t.uid];e||(e=this._batchersByInstructionSet[t.uid]=Object.create(null),e.default||(e.default=new uo)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(const t in this._activeBatches)this._activeBatches[t].begin()}addToBatch(e,r){if(this._activeBatch.name!==e.batcherName){this._activeBatch.break(r);let n=this._activeBatches[e.batcherName];n||(n=this._activeBatches[e.batcherName]=t.getBatcher(e.batcherName),n.begin()),this._activeBatch=n}this._activeBatch.add(e)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);const e=this._activeBatches;for(const t in e){const r=e[t],n=r.geometry;n.indexBuffer.setDataWithSize(r.indexBuffer,r.indexSize,!0),n.buffers[0].setDataWithSize(r.attributeBuffer.float32View,r.attributeSize,!1)}}upload(t){const e=this._batchersByInstructionSet[t.uid];for(const t in e){const r=e[t],n=r.geometry;r.dirty&&(r.dirty=!1,n.buffers[0].update(4*r.attributeSize))}}execute(t){if("startBatch"===t.action){const e=t.batcher,r=e.geometry,n=e.shader;this._adaptor.start(this,r,n)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(const t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};om.extension={type:[c.WebGLPipes,c.WebGPUPipes,c.CanvasPipes],name:"batch"},om._availableBatchers=Object.create(null);let am=om;p.handleByMap(c.Batcher,am._availableBatchers),p.add(uo);const lm={name:"texture-bit",vertex:{header:"\n\t\n\t\t\tstruct TextureUniforms {\n\t\t\t\tuTextureMatrix:mat3x3<f32>,\n\t\t\t}\n\t\n\t\t\t@group(2) @binding(2) var<uniform> textureUniforms : TextureUniforms;\n\t\t\t",main:"\n\t\t\t\tuv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy;\n\t\t\t"},fragment:{header:"\n\t\t\t\t@group(2) @binding(0) var uTexture: texture_2d<f32>;\n\t\t\t\t@group(2) @binding(1) var uSampler: sampler;\n\t\n\t\t\t \n\t\t\t",main:"\n\t\t\t\toutColor = textureSample(uTexture, uSampler, vUV);\n\t\t\t"}},_m={name:"texture-bit",vertex:{header:"\n\t\t\t\tuniform mat3 uTextureMatrix;\n\t\t\t",main:"\n\t\t\t\tuv = (uTextureMatrix * vec3(uv, 1.0)).xy;\n\t\t\t"},fragment:{header:"\n\t\t\tuniform sampler2D uTexture;\n\t\n\t\t\t \n\t\t\t",main:"\n\t\t\t\toutColor = texture(uTexture, vUV);\n\t\t\t"}};function um(t,e){const r=t.root,n=t.instructionSet;n.reset();const i=e.renderPipes?e:e.batch.renderer,s=i.renderPipes;s.batch.buildStart(n),s.blendMode.buildStart(),s.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),hm(r,n,i,!0),s.batch.buildEnd(n),s.blendMode.buildEnd(n)}function cm(t,e,r){const n=r.renderPipes?r:r.batch.renderer;t.globalDisplayStatus<7||!t.includeInBuild||(t.sortableChildren&&t.sortChildren(),t.isSimple?function(t,e,r){if(t.renderPipeId){const n=t,{renderPipes:i,renderableGC:s}=r;i.blendMode.setBlendMode(n,t.groupBlendMode,e),i[n.renderPipeId].addRenderable(n,e),s.addRenderable(n,e),n.didViewUpdate=!1}if(!t.renderGroup){const n=t.children,i=n.length;for(let t=0;t<i;t++)cm(n[t],e,r)}}(t,e,n):hm(t,e,n,!1))}function hm(t,e,r,n){const{renderPipes:i,renderableGC:s}=r;if(!n&&t.renderGroup)i.renderGroup.addRenderGroup(t.renderGroup,e);else{for(let r=0;r<t.effects.length;r++){const n=t.effects[r];i[n.pipe].push(n,t,e)}const n=t,o=n.renderPipeId;o&&(i.blendMode.setBlendMode(n,n.groupBlendMode,e),i[o].addRenderable(n,e),s.addRenderable(n,e),n.didViewUpdate=!1);const a=t.children;if(a.length)for(let t=0;t<a.length;t++)cm(a[t],e,r);for(let r=t.effects.length-1;r>=0;r--){const n=t.effects[r];i[n.pipe].pop(n,t,e)}}}const dm=new At;let pm=class extends vt{constructor(){super(),this.filters=[new vf({sprite:new un($r.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}get inverse(){return this.filters[0].inverse}set inverse(t){this.filters[0].inverse=t}};class ym{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,r){const n=this._renderer;if(n.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){const e=t.mask;e.includeInBuild=!0,cm(e,r,n),e.includeInBuild=!1}n.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){const e=this._renderer,r=t.mask.renderMaskToTexture;if("pushMaskBegin"===t.action){const n=dt.get(pm);if(n.inverse=t.inverse,r){t.mask.mask.measurable=!0;const r=Dt(t.mask.mask,!0,dm);t.mask.mask.measurable=!1,r.ceil();const i=e.renderTarget.renderTarget.colorTexture.source,s=ol.getOptimalTexture(r.width,r.height,i._resolution,i.antialias);e.renderTarget.push(s,!0),e.globalUniforms.push({offset:r,worldColor:4294967295});const o=n.sprite;o.texture=s,o.worldTransform.tx=r.minX,o.worldTransform.ty=r.minY,this._activeMaskStage.push({filterEffect:n,maskedContainer:t.maskedContainer,filterTexture:s})}else n.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:n,maskedContainer:t.maskedContainer})}else if("pushMaskEnd"===t.action){const t=this._activeMaskStage[this._activeMaskStage.length-1];r&&(e.type===to.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:t.maskedContainer,filterEffect:t.filterEffect,canBundle:!1})}else if("popMaskEnd"===t.action){e.filter.pop();const t=this._activeMaskStage.pop();r&&ol.returnTexture(t.filterTexture),dt.return(t.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}}ym.extension={type:[c.WebGLPipes,c.WebGPUPipes,c.CanvasPipes],name:"alphaMask"};class vm{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,r){this._renderer.renderPipes.batch.break(r);const n=this._colorStack;n[this._colorStackIndex]=n[this._colorStackIndex-1]&t.mask;const i=this._colorStack[this._colorStackIndex];i!==this._currentColor&&(this._currentColor=i,r.add({renderPipeId:"colorMask",colorMask:i,canBundle:!1})),this._colorStackIndex++}pop(t,e,r){this._renderer.renderPipes.batch.break(r);const n=this._colorStack;this._colorStackIndex--;const i=n[this._colorStackIndex-1];i!==this._currentColor&&(this._currentColor=i,r.add({renderPipeId:"colorMask",colorMask:i,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}}vm.extension={type:[c.WebGLPipes,c.WebGPUPipes,c.CanvasPipes],name:"colorMask"};class fm{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,r){var n;const i=t,s=this._renderer;s.renderPipes.batch.break(r),s.renderPipes.blendMode.setBlendMode(i.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});const o=i.mask;o.includeInBuild=!0,this._maskHash.has(i)||this._maskHash.set(i,{instructionsStart:0,instructionsLength:0});const a=this._maskHash.get(i);a.instructionsStart=r.instructionSize,cm(o,r,s),o.includeInBuild=!1,s.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});const l=r.instructionSize-a.instructionsStart-1;a.instructionsLength=l;const _=s.renderTarget.renderTarget.uid;null!=(n=this._maskStackHash)[_]||(n[_]=0)}pop(t,e,r){const n=t,i=this._renderer;i.renderPipes.batch.break(r),i.renderPipes.blendMode.setBlendMode(n.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});const s=this._maskHash.get(t);for(let t=0;t<s.instructionsLength;t++)r.instructions[r.instructionSize++]=r.instructions[s.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e,r;const n=this._renderer,i=n.renderTarget.renderTarget.uid;let s=null!=(r=(e=this._maskStackHash)[i])?r:e[i]=0;"pushMaskBegin"===t.action?(n.renderTarget.ensureDepthStencil(),n.stencil.setStencilMode(qn.RENDERING_MASK_ADD,s),s++,n.colorMask.setMask(0)):"pushMaskEnd"===t.action?(t.inverse?n.stencil.setStencilMode(qn.INVERSE_MASK_ACTIVE,s):n.stencil.setStencilMode(qn.MASK_ACTIVE,s),n.colorMask.setMask(15)):"popMaskBegin"===t.action?(n.colorMask.setMask(0),0!==s?n.stencil.setStencilMode(qn.RENDERING_MASK_REMOVE,s):(n.renderTarget.clear(null,oh.STENCIL),n.stencil.setStencilMode(qn.DISABLED,s)),s--):"popMaskEnd"===t.action&&(t.inverse?n.stencil.setStencilMode(qn.INVERSE_MASK_ACTIVE,s):n.stencil.setStencilMode(qn.MASK_ACTIVE,s),n.colorMask.setMask(15)),this._maskStackHash[i]=s}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}}fm.extension={type:[c.WebGLPipes,c.WebGPUPipes,c.CanvasPipes],name:"stencilMask"};var mm=(t=>(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(mm||{});class gm{constructor(t,e){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}class xm{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){this._gpuBuffers=Object.create(null),this._gl=this._renderer.gl}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){const{_gl:e}=this,r=this.getGlBuffer(t);e.bindBuffer(r.type,r.buffer)}bindBufferBase(t,e){const{_gl:r}=this;if(this._boundBufferBases[e]!==t){const n=this.getGlBuffer(t);this._boundBufferBases[e]=t,r.bindBufferBase(r.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,r){const{_gl:n}=this;r=r||0;const i=this.getGlBuffer(t);n.bindBufferRange(n.UNIFORM_BUFFER,e||0,i.buffer,256*r,256)}updateBuffer(t){const{_gl:e}=this,r=this.getGlBuffer(t);if(t._updateID===r.updateID)return r;r.updateID=t._updateID,e.bindBuffer(r.type,r.buffer);const n=t.data;if(r.byteLength>=t.data.byteLength)e.bufferSubData(r.type,0,n,0,t._updateSize/n.BYTES_PER_ELEMENT);else{const i=t.descriptor.usage&pi.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;r.byteLength=n.byteLength,e.bufferData(r.type,n,i)}return r}destroyAll(){const t=this._gl;for(const e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){const r=this._gpuBuffers[t.uid],n=this._gl;e||n.deleteBuffer(r.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){const{_gl:e}=this;let r=mm.ARRAY_BUFFER;t.descriptor.usage&pi.INDEX?r=mm.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&pi.UNIFORM&&(r=mm.UNIFORM_BUFFER);const n=new gm(e.createBuffer(),r);return this._gpuBuffers[t.uid]=n,t.on("destroy",this.onBufferDestroy,this),n}}xm.extension={type:[c.WebGLSystem],name:"buffer"};var bm=Object.defineProperty,Sm=Object.defineProperties,Tm=Object.getOwnPropertyDescriptors,Pm=Object.getOwnPropertySymbols,Om=Object.prototype.hasOwnProperty,Mm=Object.prototype.propertyIsEnumerable,wm=(t,e,r)=>e in t?bm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Cm=(t,e)=>{for(var r in e||(e={}))Om.call(e,r)&&wm(t,r,e[r]);if(Pm)for(var r of Pm(e))Mm.call(e,r)&&wm(t,r,e[r]);return t},Em=(t,e)=>Sm(t,Tm(e));const Am=class t{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this._renderer.gl=t}init(e){var r,n;e=Cm(Cm({},t.defaultOptions),e);let i=this.multiView=e.multiView;if(e.context&&i&&(iu("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),i=!1),this.canvas=i?Xe.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{const t=this._renderer.background.alpha<1,i=null==(r=e.premultipliedAlpha)||r,s=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:t,premultipliedAlpha:i,antialias:s,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:null!=(n=e.powerPreference)?n:"default"})}}ensureCanvasSize(t){if(!this.multiView)return void(t!==this.canvas&&iu("multiView is disabled, but targetCanvas is not the main canvas"));const{canvas:e}=this;(e.width<t.width||e.height<t.height)&&(e.width=Math.max(t.width,t.width),e.height=Math.max(t.height,t.height))}initFromContext(t){this.gl=t,this.webGLVersion=t instanceof Xe.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);const e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let r;const n=this.canvas;if(2===t&&(r=n.getContext("webgl2",e)),!r&&(r=n.getContext("webgl",e),!r))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=r,this.initFromContext(this.gl)}getExtensions(){const{gl:t}=this,e={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"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(1===this.webGLVersion)this.extensions=Em(Cm({},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"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")});else{this.extensions=Em(Cm({},e),{colorBufferFloat:t.getExtension("EXT_color_buffer_float")});const r=t.getExtension("WEBGL_provoking_vertex");r&&r.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout((()=>{var t;this.gl.isContextLost()&&(null==(t=this.extensions.loseContext)||t.restoreContext())}),0))}handleContextRestored(){this._renderer.runners.contextChange.emit(this.gl)}destroy(){var t;const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),null==(t=this.extensions.loseContext)||t.loseContext()}forceContextLoss(){var t;null==(t=this.extensions.loseContext)||t.loseContext(),this._contextLossForced=!0}validateContext(t){const e=t.getContextAttributes();e&&e.stencil;const r=this.supports,n=2===this.webGLVersion,i=this.extensions;r.uint32Indices=n||!!i.uint32ElementIndex,r.uniformBufferObject=n,r.vertexArrayObject=n||!!i.vertexArrayObject,r.srgbTextures=n||!!i.srgb,r.nonPowOf2wrapping=n,r.nonPowOf2mipmaps=n,r.msaa=n,r.uint32Indices}};Am.extension={type:[c.WebGLSystem],name:"context"},Am.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let Rm=Am;function Im(t,e){for(const r in t.attributes){const n=t.attributes[r],i=e[r];i?(null!=n.format||(n.format=i.format),null!=n.offset||(n.offset=i.offset),null!=n.instance||(n.instance=i.instance)):iu(`Attribute ${r} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}!function(t){const{buffers:e,attributes:r}=t,n={},i={};for(const t in e){const r=e[t];n[r.uid]=0,i[r.uid]=0}for(const t in r){const e=r[t];n[e.buffer.uid]+=Hi(e.format).stride}for(const t in r){const e=r[t];null!=e.stride||(e.stride=n[e.buffer.uid]),null!=e.start||(e.start=i[e.buffer.uid]),i[e.buffer.uid]+=Hi(e.format).stride}}(t)}var Dm=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(Dm||{}),Bm=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(Bm||{}),km=(t=>(t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t))(km||{}),Um=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(Um||{});const Fm={uint8x2:Um.UNSIGNED_BYTE,uint8x4:Um.UNSIGNED_BYTE,sint8x2:Um.BYTE,sint8x4:Um.BYTE,unorm8x2:Um.UNSIGNED_BYTE,unorm8x4:Um.UNSIGNED_BYTE,snorm8x2:Um.BYTE,snorm8x4:Um.BYTE,uint16x2:Um.UNSIGNED_SHORT,uint16x4:Um.UNSIGNED_SHORT,sint16x2:Um.SHORT,sint16x4:Um.SHORT,unorm16x2:Um.UNSIGNED_SHORT,unorm16x4:Um.UNSIGNED_SHORT,snorm16x2:Um.SHORT,snorm16x4:Um.SHORT,float16x2:Um.HALF_FLOAT,float16x4:Um.HALF_FLOAT,float32:Um.FLOAT,float32x2:Um.FLOAT,float32x3:Um.FLOAT,float32x4:Um.FLOAT,uint32:Um.UNSIGNED_INT,uint32x2:Um.UNSIGNED_INT,uint32x3:Um.UNSIGNED_INT,uint32x4:Um.UNSIGNED_INT,sint32:Um.INT,sint32x2:Um.INT,sint32x3:Um.INT,sint32x4:Um.INT};function Lm(t){var e;return null!=(e=Fm[t])?e:Fm.float32}const Gm={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class jm{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){const t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");const e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=t=>e.bindVertexArrayOES(t),t.deleteVertexArray=t=>e.deleteVertexArrayOES(t));const r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(t.drawArraysInstanced=(t,e,n,i)=>{r.drawArraysInstancedANGLE(t,e,n,i)},t.drawElementsInstanced=(t,e,n,i,s)=>{r.drawElementsInstancedANGLE(t,e,n,i,s)},t.vertexAttribDivisor=(t,e)=>r.vertexAttribDivisorANGLE(t,e)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){const r=this.gl;this._activeGeometry=t;const n=this.getVao(t,e);this._activeVao!==n&&(this._activeVao=n,r.bindVertexArray(n)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this._renderer.buffer;for(let r=0;r<t.buffers.length;r++){const n=t.buffers[r];e.updateBuffer(n)}}checkCompatibility(t,e){const r=t.attributes,n=e._attributeData;for(const t in n)if(!r[t])throw new Error(`shader and geometry incompatible, geometry missing the "${t}" attribute`)}getSignature(t,e){const r=t.attributes,n=e._attributeData,i=["g",t.uid];for(const t in r)n[t]&&i.push(t,n[t].location);return i.join("-")}getVao(t,e){var r;return(null==(r=this._geometryVaoHash[t.uid])?void 0:r[e._key])||this.initGeometryVao(t,e)}initGeometryVao(t,e,r=!0){const n=this._renderer.gl,i=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);const s=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));const o=this._geometryVaoHash[t.uid];let a=o[s];if(a)return o[e._key]=a,a;Im(t,e._attributeData);const l=t.buffers;a=n.createVertexArray(),n.bindVertexArray(a);for(let t=0;t<l.length;t++){const e=l[t];i.bind(e)}return this.activateVao(t,e),o[e._key]=a,o[s]=a,n.bindVertexArray(null),a}onGeometryDestroy(t,e){const r=this._geometryVaoHash[t.uid],n=this.gl;if(r){if(e)for(const t in r)this._activeVao!==r[t]&&this.unbind(),n.deleteVertexArray(r[t]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){const e=this.gl;for(const r in this._geometryVaoHash){if(t)for(const t in this._geometryVaoHash[r]){const n=this._geometryVaoHash[r];this._activeVao!==n&&this.unbind(),e.deleteVertexArray(n[t])}this._geometryVaoHash[r]=null}}activateVao(t,e){var r,n;const i=this._renderer.gl,s=this._renderer.buffer,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let a=null;for(const t in o){const l=o[t],_=l.buffer,u=s.getGlBuffer(_),c=e._attributeData[t];if(c){a!==u&&(s.bind(_),a=u);const t=c.location;i.enableVertexAttribArray(t);const e=Hi(l.format),o=Lm(l.format);if("int"===(null==(r=c.format)?void 0:r.substring(1,4))?i.vertexAttribIPointer(t,e.size,o,l.stride,l.offset):i.vertexAttribPointer(t,e.size,o,e.normalised,l.stride,l.offset),l.instance){if(!this.hasInstance)throw new Error("geometry error, GPU Instancing is not supported on this device");{const e=null!=(n=l.divisor)?n:1;i.vertexAttribDivisor(t,e)}}}}}draw(t,e,r,n){const{gl:i}=this._renderer,s=this._activeGeometry,o=Gm[s.topology||t];if(n||(n=s.instanceCount),s.indexBuffer){const t=s.indexBuffer.data.BYTES_PER_ELEMENT,a=2===t?i.UNSIGNED_SHORT:i.UNSIGNED_INT;n>1?i.drawElementsInstanced(o,e||s.indexBuffer.data.length,a,(r||0)*t,n):i.drawElements(o,e||s.indexBuffer.data.length,a,(r||0)*t)}else n>1?i.drawArraysInstanced(o,r||0,e||s.getSize(),n):i.drawArrays(o,r||0,e||s.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}}jm.extension={type:[c.WebGLSystem],name:"geometry"};var Nm=Object.defineProperty,zm=Object.getOwnPropertySymbols,Wm=Object.prototype.hasOwnProperty,Vm=Object.prototype.propertyIsEnumerable,Hm=(t,e,r)=>e in t?Nm(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Xm=(t,e)=>{for(var r in e||(e={}))Wm.call(e,r)&&Hm(t,r,e[r]);if(zm)for(var r of zm(e))Vm.call(e,r)&&Hm(t,r,e[r]);return t};const Km=new mi({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),Ym=class t{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(e={}){const{useBackBuffer:r,antialias:n}=Xm(Xm({},t.defaultOptions),e);this.useBackBuffer=r,this._antialias=n,this._renderer.context.supports.msaa||(iu("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Ea.for2d();const i=new Wi({vertex:"\n\t\t\t\t\tattribute vec2 aPosition;\n\t\t\t\t\tout vec2 vUv;\n\t\n\t\t\t\t\tvoid main() {\n\t\t\t\t\t\tgl_Position = vec4(aPosition, 0.0, 1.0);\n\t\n\t\t\t\t\t\tvUv = (aPosition + 1.0) / 2.0;\n\t\n\t\t\t\t\t\t// flip dem UVs\n\t\t\t\t\t\tvUv.y = 1.0 - vUv.y;\n\t\t\t\t\t}",fragment:"\n\t\t\t\t\tin vec2 vUv;\n\t\t\t\t\tout vec4 finalColor;\n\t\n\t\t\t\t\tuniform sampler2D uTexture;\n\t\n\t\t\t\t\tvoid main() {\n\t\t\t\t\t\tfinalColor = texture(uTexture, vUv);\n\t\t\t\t\t}",name:"big-triangle"});this._bigTriangleShader=new oo({glProgram:i,resources:{uTexture:$r.WHITE.source}})}renderStart(t){const e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){const e=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=e.colorTexture,t.target=this._getBackBufferTexture(e.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){const t=this._renderer;t.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(t.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,t.encoder.draw({geometry:Km,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new $r({source:new Gr({width:t.width,height:t.height,resolution:t._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(t.width,t.height,t._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}};Ym.extension={type:[c.WebGLSystem],name:"backBuffer",priority:1},Ym.defaultOptions={useBackBuffer:!1};let Qm=Ym;class $m{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.gl.colorMask(!!(8&t),!!(4&t),!!(2&t),!!(1&t)))}}$m.extension={type:[c.WebGLSystem],name:"colorMask"};class qm{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){const e=this._renderer,{geometry:r,shader:n,state:i,skipSync:s,topology:o,size:a,start:l,instanceCount:_}=t;e.shader.bind(n,s),e.geometry.bind(r,e.shader._activeProgram),i&&e.state.set(i),e.geometry.draw(o,a,l,null!=_?_:r.instanceCount)}destroy(){this._renderer=null}}qm.extension={type:[c.WebGLSystem],name:"encoder"};class Zm{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}const Jm=[];Jm[qn.NONE]=void 0,Jm[qn.DISABLED]={stencilWriteMask:0,stencilReadMask:0},Jm[qn.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},Jm[qn.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},Jm[qn.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}},Jm[qn.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}};class tg{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:qn.NONE},this._renderTargetStencilState=Object.create(null),t.renderTarget.onRenderTargetChange.add(this)}contextChange(t){this._gl=t,this._comparisonFuncMapping={always:t.ALWAYS,never:t.NEVER,equal:t.EQUAL,"not-equal":t.NOTEQUAL,less:t.LESS,"less-equal":t.LEQUAL,greater:t.GREATER,"greater-equal":t.GEQUAL},this._stencilOpsMapping={keep:t.KEEP,zero:t.ZERO,replace:t.REPLACE,invert:t.INVERT,"increment-clamp":t.INCR,"decrement-clamp":t.DECR,"increment-wrap":t.INCR_WRAP,"decrement-wrap":t.DECR_WRAP},this._stencilCache.enabled=!1,this._stencilCache.stencilMode=qn.NONE,this._stencilCache.stencilReference=0}onRenderTargetChange(t){if(this._activeRenderTarget===t)return;this._activeRenderTarget=t;let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:qn.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){const r=this._renderTargetStencilState[this._activeRenderTarget.uid],n=this._gl,i=Jm[t],s=this._stencilCache;r.stencilMode=t,r.stencilReference=e,t!==qn.DISABLED?(this._stencilCache.enabled||(this._stencilCache.enabled=!0,n.enable(n.STENCIL_TEST)),(t!==s.stencilMode||s.stencilReference!==e)&&(s.stencilMode=t,s.stencilReference=e,n.stencilFunc(this._comparisonFuncMapping[i.stencilBack.compare],e,255),n.stencilOp(n.KEEP,n.KEEP,this._stencilOpsMapping[i.stencilBack.passOp]))):this._stencilCache.enabled&&(this._stencilCache.enabled=!1,n.disable(n.STENCIL_TEST))}}tg.extension={type:[c.WebGLSystem],name:"stencil"};class eg{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!sh())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){const e=this.getUniformGroupData(t);t.buffer||(t.buffer=new yi({data:new Float32Array(e.layout.size/4),usage:pi.UNIFORM|pi.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){const e=t._signature;let r=this._syncFunctionHash[e];if(!r){const n=Object.keys(t.uniformStructures).map((e=>t.uniformStructures[e])),i=this._adaptor.createUboElements(n),s=this._generateUboSync(i.uboElements);r=this._syncFunctionHash[e]={layout:i,syncFunction:s}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,r){const n=this.getUniformGroupData(t);return t.buffer||(t.buffer=new yi({data:new Float32Array(n.layout.size/4),usage:pi.UNIFORM|pi.COPY_DST})),e||(e=t.buffer.data),r||(r=0),n.syncFunction(t.uniforms,e,r),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;const e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}const rg={f32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64};function ng(t){const e=t.map((t=>({data:t,offset:0,size:0})));let r=0,n=0,i=0;for(let t=0;t<e.length;t++){const s=e[t];if(r=rg[s.data.type],!r)throw new Error(`Unknown type ${s.data.type}`);if(s.data.size>1&&(r=Math.max(r,16)*s.data.size),s.size=r,n%r!=0&&n<16){const t=n%r%16;n+=t,i+=t}n+r>16?(i=16*Math.ceil(i/16),s.offset=i,i+=r,n=r):(s.offset=i,n+=r,i+=r)}return i=16*Math.ceil(i/16),{uboElements:e,size:i}}const ig=[{type:"mat3x3<f32>",test:t=>void 0!==t.value.a,ubo:"\n\t\t\t\tvar matrix = uv[name].toArray(true);\n\t\t\t\tdata[offset] = matrix[0];\n\t\t\t\tdata[offset + 1] = matrix[1];\n\t\t\t\tdata[offset + 2] = matrix[2];\n\t\t\t\tdata[offset + 4] = matrix[3];\n\t\t\t\tdata[offset + 5] = matrix[4];\n\t\t\t\tdata[offset + 6] = matrix[5];\n\t\t\t\tdata[offset + 8] = matrix[6];\n\t\t\t\tdata[offset + 9] = matrix[7];\n\t\t\t\tdata[offset + 10] = matrix[8];\n\t\t\t",uniform:"\n\t\t\t\tgl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true));\n\t\t\t"},{type:"vec4<f32>",test:t=>"vec4<f32>"===t.type&&1===t.size&&void 0!==t.value.width,ubo:"\n\t\t\t\tv = uv[name];\n\t\t\t\tdata[offset] = v.x;\n\t\t\t\tdata[offset + 1] = v.y;\n\t\t\t\tdata[offset + 2] = v.width;\n\t\t\t\tdata[offset + 3] = v.height;\n\t\t\t",uniform:"\n\t\t\t\tcv = ud[name].value;\n\t\t\t\tv = uv[name];\n\t\t\t\tif (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) {\n\t\t\t\t\tcv[0] = v.x;\n\t\t\t\t\tcv[1] = v.y;\n\t\t\t\t\tcv[2] = v.width;\n\t\t\t\t\tcv[3] = v.height;\n\t\t\t\t\tgl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height);\n\t\t\t\t}\n\t\t\t"},{type:"vec2<f32>",test:t=>"vec2<f32>"===t.type&&1===t.size&&void 0!==t.value.x,ubo:"\n\t\t\t\tv = uv[name];\n\t\t\t\tdata[offset] = v.x;\n\t\t\t\tdata[offset + 1] = v.y;\n\t\t\t",uniform:"\n\t\t\t\tcv = ud[name].value;\n\t\t\t\tv = uv[name];\n\t\t\t\tif (cv[0] !== v.x || cv[1] !== v.y) {\n\t\t\t\t\tcv[0] = v.x;\n\t\t\t\t\tcv[1] = v.y;\n\t\t\t\t\tgl.uniform2f(ud[name].location, v.x, v.y);\n\t\t\t\t}\n\t\t\t"},{type:"vec4<f32>",test:t=>"vec4<f32>"===t.type&&1===t.size&&void 0!==t.value.red,ubo:"\n\t\t\t\tv = uv[name];\n\t\t\t\tdata[offset] = v.red;\n\t\t\t\tdata[offset + 1] = v.green;\n\t\t\t\tdata[offset + 2] = v.blue;\n\t\t\t\tdata[offset + 3] = v.alpha;\n\t\t\t",uniform:"\n\t\t\t\tcv = ud[name].value;\n\t\t\t\tv = uv[name];\n\t\t\t\tif (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) {\n\t\t\t\t\tcv[0] = v.red;\n\t\t\t\t\tcv[1] = v.green;\n\t\t\t\t\tcv[2] = v.blue;\n\t\t\t\t\tcv[3] = v.alpha;\n\t\t\t\t\tgl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha);\n\t\t\t\t}\n\t\t\t"},{type:"vec3<f32>",test:t=>"vec3<f32>"===t.type&&1===t.size&&void 0!==t.value.red,ubo:"\n\t\t\t\tv = uv[name];\n\t\t\t\tdata[offset] = v.red;\n\t\t\t\tdata[offset + 1] = v.green;\n\t\t\t\tdata[offset + 2] = v.blue;\n\t\t\t",uniform:"\n\t\t\t\tcv = ud[name].value;\n\t\t\t\tv = uv[name];\n\t\t\t\tif (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) {\n\t\t\t\t\tcv[0] = v.red;\n\t\t\t\t\tcv[1] = v.green;\n\t\t\t\t\tcv[2] = v.blue;\n\t\t\t\t\tgl.uniform3f(ud[name].location, v.red, v.green, v.blue);\n\t\t\t\t}\n\t\t\t"}];function sg(t,e,r,n){const i=["\n\t\t\tvar v = null;\n\t\t\tvar v2 = null;\n\t\t\tvar t = 0;\n\t\t\tvar index = 0;\n\t\t\tvar name = null;\n\t\t\tvar arrayOffset = null;\n\t\t"];let s=0;for(let o=0;o<t.length;o++){const a=t[o],l=a.data.name;let _=!1,u=0;for(let t=0;t<ig.length;t++)if(ig[t].test(a.data)){u=a.offset/4,i.push(`name = "${l}";`,`offset += ${u-s};`,ig[t][e]||ig[t].ubo),_=!0;break}if(!_)if(a.data.size>1)u=a.offset/4,i.push(r(a,u-s));else{const t=n[a.data.type];u=a.offset/4,i.push(`\n\t\t\t\t\t\tv = uv.${l};\n\t\t\t\t\t\toffset += ${u-s};\n\t\t\t\t\t\t${t};\n\t\t\t\t\t`)}s=u}const o=i.join("\n\t");return new Function("uv","data","offset",o)}var og=Object.defineProperty,ag=Object.defineProperties,lg=Object.getOwnPropertyDescriptors,_g=Object.getOwnPropertySymbols,ug=Object.prototype.hasOwnProperty,cg=Object.prototype.propertyIsEnumerable,hg=(t,e,r)=>e in t?og(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;function dg(t,e){return`\n\t\t\tfor (let i = 0; i < ${t*e}; i++) {\n\t\t\t\tdata[offset + (((i / ${t})|0) * 4) + (i % ${t})] = v[i];\n\t\t\t}\n\t\t`}const pg={f32:"\n\t\t\tdata[offset] = v;",i32:"\n\t\t\tdata[offset] = v;","vec2<f32>":"\n\t\t\tdata[offset] = v[0];\n\t\t\tdata[offset + 1] = v[1];","vec3<f32>":"\n\t\t\tdata[offset] = v[0];\n\t\t\tdata[offset + 1] = v[1];\n\t\t\tdata[offset + 2] = v[2];","vec4<f32>":"\n\t\t\tdata[offset] = v[0];\n\t\t\tdata[offset + 1] = v[1];\n\t\t\tdata[offset + 2] = v[2];\n\t\t\tdata[offset + 3] = v[3];","mat2x2<f32>":"\n\t\t\tdata[offset] = v[0];\n\t\t\tdata[offset + 1] = v[1];\n\t\t\tdata[offset + 4] = v[2];\n\t\t\tdata[offset + 5] = v[3];","mat3x3<f32>":"\n\t\t\tdata[offset] = v[0];\n\t\t\tdata[offset + 1] = v[1];\n\t\t\tdata[offset + 2] = v[2];\n\t\t\tdata[offset + 4] = v[3];\n\t\t\tdata[offset + 5] = v[4];\n\t\t\tdata[offset + 6] = v[5];\n\t\t\tdata[offset + 8] = v[6];\n\t\t\tdata[offset + 9] = v[7];\n\t\t\tdata[offset + 10] = v[8];","mat4x4<f32>":"\n\t\t\tfor (let i = 0; i < 16; i++) {\n\t\t\t\tdata[offset + i] = v[i];\n\t\t\t}","mat3x2<f32>":dg(3,2),"mat4x2<f32>":dg(4,2),"mat2x3<f32>":dg(2,3),"mat4x3<f32>":dg(4,3),"mat2x4<f32>":dg(2,4),"mat3x4<f32>":dg(3,4)},yg=((t,e)=>ag(t,lg(e)))(((t,e)=>{for(var r in e||(e={}))ug.call(e,r)&&hg(t,r,e[r]);if(_g)for(var r of _g(e))cg.call(e,r)&&hg(t,r,e[r]);return t})({},pg),{"mat2x2<f32>":"\n\t\t\tdata[offset] = v[0];\n\t\t\tdata[offset + 1] = v[1];\n\t\t\tdata[offset + 2] = v[2];\n\t\t\tdata[offset + 3] = v[3];\n\t\t"});function vg(t,e){const r=Math.max(rg[t.data.type]/16,1),n=t.data.value.length/t.data.size,i=(4-n%4)%4;return`\n\t\t\tv = uv.${t.data.name};\n\t\t\toffset += ${e};\n\t\n\t\t\tarrayOffset = offset;\n\t\n\t\t\tt = 0;\n\t\n\t\t\tfor(var i=0; i < ${t.data.size*r}; i++)\n\t\t\t{\n\t\t\t\tfor(var j = 0; j < ${n}; j++)\n\t\t\t\t{\n\t\t\t\t\tdata[arrayOffset++] = v[t++];\n\t\t\t\t}\n\t\t\t\t${0!==i?`arrayOffset += ${i};`:""}\n\t\t\t}\n\t\t`}function fg(t){return sg(t,"uboStd40",vg,pg)}class mg extends eg{constructor(){super({createUboElements:ng,generateUboSync:fg})}}mg.extension={type:[c.WebGLSystem],name:"ubo"};class gg{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new Ct}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new Ct}copyToTexture(t,e,r,n,i){const s=this._renderTargetSystem,o=this._renderer,a=s.getGpuRenderTarget(t),l=o.gl;return this.finishRenderPass(t),l.bindFramebuffer(l.FRAMEBUFFER,a.resolveTargetFramebuffer),o.texture.bind(e,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,i.x,i.y,r.x,r.y,n.width,n.height),e}startRenderPass(t,e=!0,r,n){const i=this._renderTargetSystem,s=t.colorTexture,o=i.getGpuRenderTarget(t);let a=n.y;t.isRoot&&(a=s.pixelHeight-n.height),t.colorTextures.forEach((t=>{this._renderer.texture.unbind(t)}));const l=this._renderer.gl;l.bindFramebuffer(l.FRAMEBUFFER,o.framebuffer);const _=this._viewPortCache;(_.x!==n.x||_.y!==a||_.width!==n.width||_.height!==n.height)&&(_.x=n.x,_.y=a,_.width=n.width,_.height=n.height,l.viewport(n.x,a,n.width,n.height)),!o.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(o),this.clear(t,e,r)}finishRenderPass(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);if(!e.msaa)return;const r=this._renderer.gl;r.bindFramebuffer(r.FRAMEBUFFER,e.resolveTargetFramebuffer),r.bindFramebuffer(r.READ_FRAMEBUFFER,e.framebuffer),r.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,r.COLOR_BUFFER_BIT,r.NEAREST),r.bindFramebuffer(r.FRAMEBUFFER,e.framebuffer)}initGpuRenderTarget(t){const e=this._renderer,r=e.gl,n=new Zm;return t.colorTexture.resource===e.canvas?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),n.framebuffer=null,n):(this._initColor(t,n),r.bindFramebuffer(r.FRAMEBUFFER,null),n)}destroyGpuRenderTarget(t){const e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach((t=>{e.deleteRenderbuffer(t)})),t.msaaRenderBuffer=null}clear(t,e,r){if(!e)return;const n=this._renderTargetSystem;"boolean"==typeof e&&(e=e?oh.ALL:oh.NONE);const i=this._renderer.gl;if(e&oh.COLOR){null!=r||(r=n.defaultClearColor);const t=this._clearColorCache,e=r;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3])&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],i.clearColor(e[0],e[1],e[2],e[3]))}i.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;const e=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,e),(t.stencil||t.depth)&&this._resizeStencil(e)}_initColor(t,e){const r=this._renderer,n=r.gl,i=n.createFramebuffer();if(e.resolveTargetFramebuffer=i,n.bindFramebuffer(n.FRAMEBUFFER,i),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach(((t,i)=>{const s=t.source;s.antialias&&(r.context.supports.msaa?e.msaa=!0:iu("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),r.texture.bindSource(s,0);const o=r.texture.getGlSource(s).texture;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+i,3553,o,0)})),e.msaa){const r=n.createFramebuffer();e.framebuffer=r,n.bindFramebuffer(n.FRAMEBUFFER,r),t.colorTextures.forEach(((t,r)=>{const i=n.createRenderbuffer();e.msaaRenderBuffer[r]=i}))}else e.framebuffer=i;this._resizeColor(t,e)}_resizeColor(t,e){const r=t.colorTexture.source;if(e.width=r.pixelWidth,e.height=r.pixelHeight,t.colorTextures.forEach(((t,e)=>{0!==e&&t.source.resize(r.width,r.height,r._resolution)})),e.msaa){const r=this._renderer,n=r.gl,i=e.framebuffer;n.bindFramebuffer(n.FRAMEBUFFER,i),t.colorTextures.forEach(((t,i)=>{const s=t.source;r.texture.bindSource(s,0);const o=r.texture.getGlSource(s).internalFormat,a=e.msaaRenderBuffer[i];n.bindRenderbuffer(n.RENDERBUFFER,a),n.renderbufferStorageMultisample(n.RENDERBUFFER,4,o,s.pixelWidth,s.pixelHeight),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+i,n.RENDERBUFFER,a)}))}}_initStencil(t){if(null===t.framebuffer)return;const e=this._renderer.gl,r=e.createRenderbuffer();t.depthStencilRenderBuffer=r,e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,r),this._resizeStencil(t)}_resizeStencil(t){const e=this._renderer.gl;e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilRenderBuffer),t.msaa?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,2===this._renderer.context.webGLVersion?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}postrender(t){if(this._renderer.context.multiView&&mn.test(t.colorTexture.resource)){const e=this._renderer.context.canvas,r=t.colorTexture;r.context2D.drawImage(e,0,r.pixelHeight-e.height)}}}function xg(t,e,r,n,i,s){const o=s?1:-1;return t.identity(),t.a=1/n*2,t.d=o*(1/i*2),t.tx=-1-e*t.a,t.ty=-o-r*t.d,t}var bg=Object.defineProperty,Sg=Object.getOwnPropertySymbols,Tg=Object.prototype.hasOwnProperty,Pg=Object.prototype.propertyIsEnumerable,Og=(t,e,r)=>e in t?bg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Mg=(t,e)=>{for(var r in e||(e={}))Tg.call(e,r)&&Og(t,r,e[r]);if(Sg)for(var r of Sg(e))Pg.call(e,r)&&Og(t,r,e[r]);return t};const wg=new Map;function Cg(t,e){if(!wg.has(t)){const r=new $r({source:new mn(Mg({resource:t},e))}),n=()=>{wg.get(t)===r&&wg.delete(t)};r.once("destroy",n),r.source.once("destroy",n),wg.set(t,r)}return wg.get(t)}function Eg(t){const e=t.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement&&document.body.contains(e)}var Ag=Object.defineProperty,Rg=Object.getOwnPropertySymbols,Ig=Object.prototype.hasOwnProperty,Dg=Object.prototype.propertyIsEnumerable,Bg=(t,e,r)=>e in t?Ag(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,kg=(t,e)=>{for(var r in e||(e={}))Ig.call(e,r)&&Bg(t,r,e[r]);if(Rg)for(var r of Rg(e))Dg.call(e,r)&&Bg(t,r,e[r]);return t};const Ug=class t{constructor(e={}){if(this.uid=ut("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,e=kg(kg({},t.defaultOptions),e),this.stencil=e.stencil,this.depth=e.depth,this.isRoot=e.isRoot,"number"==typeof e.colorTextures){this._managedColorTextures=!0;for(let t=0;t<e.colorTextures;t++)this.colorTextures.push(new Gr({width:e.width,height:e.height,resolution:e.resolution,antialias:e.antialias}))}else{this.colorTextures=[...e.colorTextures.map((t=>t.source))];const t=this.colorTexture.source;this.resize(t.width,t.height,t._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(e.depthStencilTexture||this.stencil)&&(e.depthStencilTexture instanceof $r||e.depthStencilTexture instanceof Gr?this.depthStencilTexture=e.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){const t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new Gr({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,r=this.resolution,n=!1){this.dirtyId++,this.colorTextures.forEach(((i,s)=>{n&&0===s||i.source.resize(t,e,r)})),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,r)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach((t=>{t.destroy()})),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};Ug.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};let Fg=Ug;class Lg{constructor(t){this.rootViewPort=new Ct,this.viewport=new Ct,this.onRenderTargetChange=new ah("onRenderTargetChange"),this.projectionMatrix=new st,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:r,frame:n}){this._renderTargetStack.length=0,this.push(t,e,r,n),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=Eg(this.rootRenderTarget)}postrender(){var t,e;null==(e=(t=this.adaptor).postrender)||e.call(t,this.rootRenderTarget)}bind(t,e=!0,r,n){const i=this.getRenderTarget(t),s=this.renderTarget!==i;this.renderTarget=i,this.renderSurface=t;const o=this.getGpuRenderTarget(i);(i.pixelWidth!==o.width||i.pixelHeight!==o.height)&&(this.adaptor.resizeGpuRenderTarget(i),o.width=i.pixelWidth,o.height=i.pixelHeight);const a=i.colorTexture,l=this.viewport,_=a.pixelWidth,u=a.pixelHeight;if(!n&&t instanceof $r&&(n=t.frame),n){const t=a._resolution;l.x=n.x*t+.5|0,l.y=n.y*t+.5|0,l.width=n.width*t+.5|0,l.height=n.height*t+.5|0}else l.x=0,l.y=0,l.width=_,l.height=u;return xg(this.projectionMatrix,0,0,l.width/a.resolution,l.height/a.resolution,!i.isRoot),this.adaptor.startRenderPass(i,e,r,l),s&&this.onRenderTargetChange.emit(i),i}clear(t,e=oh.ALL,r){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=oh.ALL,r,n){const i=this.bind(t,e,r,n);return this._renderTargetStack.push({renderTarget:i,frame:n}),i}pop(){this._renderTargetStack.pop();const t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){var e;return t.isTexture&&(t=t.source),null!=(e=this._renderSurfaceToRenderTargetHash.get(t))?e:this._initRenderTarget(t)}copyToTexture(t,e,r,n,i){r.x<0&&(n.width+=r.x,i.x-=r.x,r.x=0),r.y<0&&(n.height+=r.y,i.y-=r.y,r.y=0);const{pixelWidth:s,pixelHeight:o}=t;return n.width=Math.min(n.width,s-r.x),n.height=Math.min(n.height,o-r.y),this.adaptor.copyToTexture(t,e,r,n,i)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach(((t,e)=>{t!==e&&t.destroy()})),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return mn.test(t)&&(t=Cg(t).source),t instanceof Fg?e=t:t instanceof Gr&&(e=new Fg({colorTextures:[t]}),mn.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",(()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);const r=this._gpuRenderTargetHash[e.uid];r&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(r))}))),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}}class Gg extends Lg{constructor(t){super(t),this.adaptor=new gg,this.adaptor.init(t,this)}}Gg.extension={type:[c.WebGLSystem],name:"renderTarget"};class jg extends f{constructor({buffer:t,offset:e,size:r}){super(),this.uid=ut("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=ut("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=0|e,this.size=r,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=ut("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}function Ng(t,e){const r=[],n=["\n\t\t\tvar g = s.groups;\n\t\t\tvar sS = r.shader;\n\t\t\tvar p = s.glProgram;\n\t\t\tvar ugS = r.uniformGroup;\n\t\t\tvar resources;\n\t\t"];let i=!1,s=0,o=0;const a=e._getProgramData(t.glProgram);for(const l in t.groups){const _=t.groups[l];r.push(`\n\t\t\t\tresources = g[${l}].resources;\n\t\t\t`);for(const u in _.resources){const c=_.resources[u];if(c instanceof qs)c.ubo?r.push(`\n\t\t\t\t\t\t\tsS.bindUniformBlock(\n\t\t\t\t\t\t\t\tresources[${u}],\n\t\t\t\t\t\t\t\tsS._uniformBindMap[${l}[${u}],\n\t\t\t\t\t\t\t\t${s++}\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t`):r.push(`\n\t\t\t\t\t\t\tugS.updateUniformGroup(resources[${u}], p, sD);\n\t\t\t\t\t\t`);else if(c instanceof jg)r.push(`\n\t\t\t\t\t\tsS.bindUniformBlock(\n\t\t\t\t\t\t\tresources[${u}],\n\t\t\t\t\t\t\tsS._uniformBindMap[${l}[${u}],\n\t\t\t\t\t\t\t${s++}\n\t\t\t\t\t\t);\n\t\t\t\t\t`);else if(c instanceof Gr){const s=t._uniformBindMap[l][u],_=a.uniformData[s];_&&(i||(i=!0,n.push("\n\t\t\t\t\t\t\tvar tS = r.texture;\n\t\t\t\t\t\t\t")),e._gl.uniform1i(_.location,o),r.push(`\n\t\t\t\t\t\t\ttS.bind(resources[${u}], ${o});\n\t\t\t\t\t\t`),o++)}}}const l=[...n,...r].join("\n\t");return new Function("r","s","sD",l)}class zg{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}function Wg(t,e,r){const n=t.createShader(e);return t.shaderSource(n,r),t.compileShader(n),n}function Vg(t){const e=new Array(t);for(let t=0;t<e.length;t++)e[t]=!1;return e}function Hg(t,e){switch(t){case"float":case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return Vg(2*e);case"bvec3":return Vg(3*e);case"bvec4":return Vg(4*e);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}let Xg=null;const Kg={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"},Yg={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"};function Qg(t,e){if(!Xg){const e=Object.keys(Kg);Xg={};for(let r=0;r<e.length;++r){const n=e[r];Xg[t[n]]=Kg[n]}}return Xg[e]}function $g(t,e){const r=Qg(t,e);return Yg[r]||"float32"}function qg(t,e,r=!1){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=e.getActiveAttrib(t,r);if(i.name.startsWith("gl_"))continue;const s=$g(e,i.type);n[i.name]={location:0,format:s,stride:Hi(s).stride,offset:0,instance:!1,start:0}}const s=Object.keys(n);if(r){s.sort(((t,e)=>t>e?1:-1));for(let r=0;r<s.length;r++)n[s[r]].location=r,e.bindAttribLocation(t,r,s[r]);e.linkProgram(t)}else for(let r=0;r<s.length;r++)n[s[r]].location=e.getAttribLocation(t,s[r]);return n}function Zg(t,e){if(!e.ACTIVE_UNIFORM_BLOCKS)return{};const r={},n=e.getProgramParameter(t,e.ACTIVE_UNIFORM_BLOCKS);for(let i=0;i<n;i++){const n=e.getActiveUniformBlockName(t,i),s=e.getUniformBlockIndex(t,n),o=e.getActiveUniformBlockParameter(t,i,e.UNIFORM_BLOCK_DATA_SIZE);r[n]={name:n,index:s,size:o}}return r}function Jg(t,e){const r={},n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;i++){const n=e.getActiveUniform(t,i),s=n.name.replace(/\[.*?\]$/,""),o=!!n.name.match(/\[.*?\]$/),a=Qg(e,n.type);r[s]={name:s,index:i,type:a,size:n.size,isArray:o,value:Hg(a,n.size)}}return r}function tx(t,e){const r=t.getShaderSource(e).split("\n\t").map(((t,e)=>`${e}: ${t}`)),n=t.getShaderInfoLog(e),i=n.split("\n\t"),s={},o=i.map((t=>parseFloat(t.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1")))).filter((t=>!(!t||s[t])&&(s[t]=!0,!0))),a=[""];o.forEach((t=>{r[t-1]=`%c${r[t-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")}));const l=r.join("\n\t");a[0]=l,console.error(n),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function ex(t,e,r,n){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(r,t.COMPILE_STATUS)||tx(t,r),t.getShaderParameter(n,t.COMPILE_STATUS)||tx(t,n),console.error("PixiJS Error: Could not initialize shader."),""!==t.getProgramInfoLog(e)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}function rx(t,e){const r=Wg(t,t.VERTEX_SHADER,e.vertex),n=Wg(t,t.FRAGMENT_SHADER,e.fragment),i=t.createProgram();t.attachShader(i,r),t.attachShader(i,n);const s=e.transformFeedbackVaryings;s&&("function"!=typeof t.transformFeedbackVaryings||t.transformFeedbackVaryings(i,s.names,"separate"===s.bufferMode?t.SEPARATE_ATTRIBS:t.INTERLEAVED_ATTRIBS)),t.linkProgram(i),t.getProgramParameter(i,t.LINK_STATUS)||ex(t,i,r,n),e._attributeData=qg(i,t,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertex)),e._uniformData=Jg(i,t),e._uniformBlockData=Zg(i,t),t.deleteShader(r),t.deleteShader(n);const o={};for(const r in e._uniformData){const n=e._uniformData[r];o[r]={location:t.getUniformLocation(i,r),value:Hg(n.type,n.size)}}return new zg(i,o)}const nx={textureCount:0,blockIndex:0};class ix{constructor(t){this._activeProgram=null,this._programDataHash=Object.create(null),this._nextIndex=0,this._boundUniformsIdsToIndexHash=Object.create(null),this._boundIndexToUniformsHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_programDataHash")}contextChange(t){this._gl=t,this._maxBindings=t.MAX_UNIFORM_BUFFER_BINDINGS?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0,this._programDataHash=Object.create(null),this._boundUniformsIdsToIndexHash=Object.create(null),this._boundIndexToUniformsHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null,this.maxTextures=Vn()}bind(t,e){if(this._setProgram(t.glProgram),e)return;nx.textureCount=0,nx.blockIndex=0;let r=this._shaderSyncFunctions[t.glProgram._key];r||(r=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),r(this._renderer,t,nx)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,nx)}bindUniformBlock(t,e,r=0){const n=this._renderer.buffer,i=this._getProgramData(this._activeProgram),s=t._bufferResource;s&&this._renderer.ubo.updateUniformGroup(t),n.updateBuffer(t.buffer);let o=this._boundUniformsIdsToIndexHash[t.uid];if(void 0===o){const e=this._nextIndex++%this._maxBindings,r=this._boundIndexToUniformsHash[e];r&&(this._boundUniformsIdsToIndexHash[r.uid]=void 0),o=this._boundUniformsIdsToIndexHash[t.uid]=e,this._boundIndexToUniformsHash[e]=t,s?n.bindBufferRange(t.buffer,e,t.offset):n.bindBufferBase(t.buffer,e)}const a=this._gl,l=this._activeProgram._uniformBlockData[e].index;i.uniformBlockBindings[r]!==o&&(i.uniformBlockBindings[r]=o,a.uniformBlockBinding(i.program,l,o))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;const e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){const e=t._key;return this._programDataHash[e]=rx(this._gl,t),this._programDataHash[e]}destroy(){for(const t of Object.keys(this._programDataHash))this._programDataHash[t].destroy(),this._programDataHash[t]=null;this._programDataHash=null,this._boundUniformsIdsToIndexHash=null}_generateShaderSync(t,e){return Ng(t,e)}}ix.extension={type:[c.WebGLSystem],name:"shader"};const sx={f32:"if (cv !== v) {\n\t\t\t\tcu.value = v;\n\t\t\t\tgl.uniform1f(location, v);\n\t\t\t}","vec2<f32>":"if (cv[0] !== v[0] || cv[1] !== v[1]) {\n\t\t\t\tcv[0] = v[0];\n\t\t\t\tcv[1] = v[1];\n\t\t\t\tgl.uniform2f(location, v[0], v[1]);\n\t\t\t}","vec3<f32>":"if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {\n\t\t\t\tcv[0] = v[0];\n\t\t\t\tcv[1] = v[1];\n\t\t\t\tcv[2] = v[2];\n\t\t\t\tgl.uniform3f(location, v[0], v[1], v[2]);\n\t\t\t}","vec4<f32>":"if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {\n\t\t\t\tcv[0] = v[0];\n\t\t\t\tcv[1] = v[1];\n\t\t\t\tcv[2] = v[2];\n\t\t\t\tcv[3] = v[3];\n\t\t\t\tgl.uniform4f(location, v[0], v[1], v[2], v[3]);\n\t\t\t}",i32:"if (cv !== v) {\n\t\t\t\tcu.value = v;\n\t\t\t\tgl.uniform1i(location, v);\n\t\t\t}","vec2<i32>":"if (cv[0] !== v[0] || cv[1] !== v[1]) {\n\t\t\t\tcv[0] = v[0];\n\t\t\t\tcv[1] = v[1];\n\t\t\t\tgl.uniform2i(location, v[0], v[1]);\n\t\t\t}","vec3<i32>":"if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {\n\t\t\t\tcv[0] = v[0];\n\t\t\t\tcv[1] = v[1];\n\t\t\t\tcv[2] = v[2];\n\t\t\t\tgl.uniform3i(location, v[0], v[1], v[2]);\n\t\t\t}","vec4<i32>":"if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {\n\t\t\t\tcv[0] = v[0];\n\t\t\t\tcv[1] = v[1];\n\t\t\t\tcv[2] = v[2];\n\t\t\t\tcv[3] = v[3];\n\t\t\t\tgl.uniform4i(location, v[0], v[1], v[2], v[3]);\n\t\t\t}",u32:"if (cv !== v) {\n\t\t\t\tcu.value = v;\n\t\t\t\tgl.uniform1ui(location, v);\n\t\t\t}","vec2<u32>":"if (cv[0] !== v[0] || cv[1] !== v[1]) {\n\t\t\t\tcv[0] = v[0];\n\t\t\t\tcv[1] = v[1];\n\t\t\t\tgl.uniform2ui(location, v[0], v[1]);\n\t\t\t}","vec3<u32>":"if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {\n\t\t\t\tcv[0] = v[0];\n\t\t\t\tcv[1] = v[1];\n\t\t\t\tcv[2] = v[2];\n\t\t\t\tgl.uniform3ui(location, v[0], v[1], v[2]);\n\t\t\t}","vec4<u32>":"if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {\n\t\t\t\tcv[0] = v[0];\n\t\t\t\tcv[1] = v[1];\n\t\t\t\tcv[2] = v[2];\n\t\t\t\tcv[3] = v[3];\n\t\t\t\tgl.uniform4ui(location, v[0], v[1], v[2], v[3]);\n\t\t\t}",bool:"if (cv !== v) {\n\t\t\t\tcu.value = v;\n\t\t\t\tgl.uniform1i(location, v);\n\t\t\t}","vec2<bool>":"if (cv[0] !== v[0] || cv[1] !== v[1]) {\n\t\t\t\tcv[0] = v[0];\n\t\t\t\tcv[1] = v[1];\n\t\t\t\tgl.uniform2i(location, v[0], v[1]);\n\t\t\t}","vec3<bool>":"if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {\n\t\t\t\tcv[0] = v[0];\n\t\t\t\tcv[1] = v[1];\n\t\t\t\tcv[2] = v[2];\n\t\t\t\tgl.uniform3i(location, v[0], v[1], v[2]);\n\t\t\t}","vec4<bool>":"if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {\n\t\t\t\tcv[0] = v[0];\n\t\t\t\tcv[1] = v[1];\n\t\t\t\tcv[2] = v[2];\n\t\t\t\tcv[3] = v[3];\n\t\t\t\tgl.uniform4i(location, v[0], v[1], v[2], v[3]);\n\t\t\t}","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},ox={f32:"gl.uniform1fv(location, v);","vec2<f32>":"gl.uniform2fv(location, v);","vec3<f32>":"gl.uniform3fv(location, v);","vec4<f32>":"gl.uniform4fv(location, v);","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2<i32>":"gl.uniform2iv(location, v);","vec3<i32>":"gl.uniform3iv(location, v);","vec4<i32>":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2<u32>":"gl.uniform2iv(location, v);","vec3<u32>":"gl.uniform3iv(location, v);","vec4<u32>":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2<bool>":"gl.uniform2iv(location, v);","vec3<bool>":"gl.uniform3iv(location, v);","vec4<bool>":"gl.uniform4iv(location, v);"};function ax(t,e){const r=["\n\t\t\tvar v = null;\n\t\t\tvar cv = null;\n\t\t\tvar cu = null;\n\t\t\tvar t = 0;\n\t\t\tvar gl = renderer.gl;\n\t\t\tvar name = null;\n\t\t"];for(const n in t.uniforms){if(!e[n]){t.uniforms[n]instanceof qs?t.uniforms[n].ubo?r.push(`\n\t\t\t\t\t\t\trenderer.shader.bindUniformBlock(uv.${n}, "${n}");\n\t\t\t\t\t\t`):r.push(`\n\t\t\t\t\t\t\trenderer.shader.updateUniformGroup(uv.${n});\n\t\t\t\t\t\t`):t.uniforms[n]instanceof jg&&r.push(`\n\t\t\t\t\t\t\trenderer.shader.bindBufferResource(uv.${n}, "${n}");\n\t\t\t\t\t\t`);continue}const i=t.uniformStructures[n];let s=!1;for(let t=0;t<ig.length;t++){const e=ig[t];if(i.type===e.type&&e.test(i)){r.push(`name = "${n}";`,ig[t].uniform),s=!0;break}}if(!s){const t=(1===i.size?sx:ox)[i.type].replace("location",`ud["${n}"].location`);r.push(`\n\t\t\t\tcu = ud["${n}"];\n\t\t\t\tcv = cu.value;\n\t\t\t\tv = uv["${n}"];\n\t\t\t\t${t};`)}}return new Function("ud","uv","renderer","syncData",r.join("\n\t"))}class lx{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){const n=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==n.uniformDirtyGroups[t.uid])&&(n.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(n.uniformData,t.uniforms,this._renderer,r))}_getUniformSyncFunction(t,e){var r;return(null==(r=this._uniformGroupSyncHash[t._signature])?void 0:r[e._key])||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){const r=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),n=this._getSignature(t,e._uniformData,"u");return this._cache[n]||(this._cache[n]=this._generateUniformsSync(t,e._uniformData)),r[e._key]=this._cache[n],r[e._key]}_generateUniformsSync(t,e){return ax(t,e)}_getSignature(t,e,r){const n=t.uniforms,i=[`${r}-`];for(const t in n)i.push(t),e[t]&&i.push(e[t].type);return i.join("-")}destroy(){this._renderer=null,this._cache=null}}lx.extension={type:[c.WebGLSystem],name:"uniformGroup"};const _x={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 ux(t){const e={};if(e.normal=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.add=[t.ONE,t.ONE],e.multiply=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.screen=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.none=[0,0],e["normal-npm"]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e["add-npm"]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e["screen-npm"]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.erase=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],t instanceof Xe.get().getWebGLRenderingContext()){const r=t.getExtension("EXT_blend_minmax");r&&(e.min=[t.ONE,t.ONE,t.ONE,t.ONE,r.MIN_EXT,r.MIN_EXT],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,r.MAX_EXT,r.MAX_EXT])}else e.min=[t.ONE,t.ONE,t.ONE,t.ONE,t.MIN,t.MIN],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,t.MAX,t.MAX];return e}const cx=class t{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[0]=this.setBlend,this.map[1]=this.setOffset,this.map[2]=this.setCullFace,this.map[3]=this.setDepthTest,this.map[4]=this.setFrontFace,this.map[5]=this.setDepthMask,this.checks=[],this.defaultState=Ea.for2d()}contextChange(t){this.gl=t,this.blendModesMap=ux(t),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)1&e&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(e){this._updateCheck(t._checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this._updateCheck(t._checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;const e=this.blendModesMap[t],r=this.gl;2===e.length?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),6===e.length?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){const r=this.checks.indexOf(t);e&&-1===r?this.checks.push(t):!e&&-1!==r&&this.checks.splice(r,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};cx.extension={type:[c.WebGLSystem],name:"state"};let hx=cx;class dx{constructor(t){this.target=Bm.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=Um.UNSIGNED_BYTE,this.internalFormat=Dm.RGBA,this.format=Dm.RGBA,this.samplerType=0}}const px={id:"buffer",upload(t,e,r){e.width===t.width||e.height===t.height?r.texSubImage2D(r.TEXTURE_2D,0,0,0,t.width,t.height,e.format,e.type,t.resource):r.texImage2D(e.target,0,e.internalFormat,t.width,t.height,0,e.format,e.type,t.resource),e.width=t.width,e.height=t.height}},yx={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},vx={id:"compressed",upload(t,e,r){r.pixelStorei(r.UNPACK_ALIGNMENT,4);let n=t.pixelWidth,i=t.pixelHeight;const s=!!yx[t.format];for(let o=0;o<t.resource.length;o++){const a=t.resource[o];s?r.compressedTexImage2D(r.TEXTURE_2D,o,e.internalFormat,n,i,0,a):r.texImage2D(r.TEXTURE_2D,o,e.internalFormat,n,i,0,e.format,e.type,a),n=Math.max(n>>1,1),i=Math.max(i>>1,1)}}},fx={id:"image",upload(t,e,r,n){const i="premultiply-alpha-on-upload"===t.alphaMode;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i);const s=e.width,o=e.height,a=t.pixelWidth,l=t.pixelHeight,_=t.resourceWidth,u=t.resourceHeight;_<a||u<l?((s!==a||o!==l)&&r.texImage2D(e.target,0,e.internalFormat,a,l,0,e.format,e.type,null),2===n?r.texSubImage2D(r.TEXTURE_2D,0,0,0,_,u,e.format,e.type,t.resource):r.texSubImage2D(r.TEXTURE_2D,0,0,0,e.format,e.type,t.resource)):s===a||o===l?r.texSubImage2D(r.TEXTURE_2D,0,0,0,e.format,e.type,t.resource):2===n?r.texImage2D(e.target,0,e.internalFormat,a,l,0,e.format,e.type,t.resource):r.texImage2D(e.target,0,e.internalFormat,e.format,e.type,t.resource),e.width=a,e.height=l}},mx={id:"video",upload(t,e,r,n){t.isValid?fx.upload(t,e,r,n):r.texImage2D(e.target,0,e.internalFormat,1,1,0,e.format,e.type,null)}},gx={linear:9729,nearest:9728},xx={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},bx={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},Sx={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function Tx(t,e,r,n,i,s,o,a){const l=s;if(!a||"repeat"!==t.addressModeU||"repeat"!==t.addressModeV||"repeat"!==t.addressModeW){const r=bx[o?"clamp-to-edge":t.addressModeU],n=bx[o?"clamp-to-edge":t.addressModeV],s=bx[o?"clamp-to-edge":t.addressModeW];e[i](l,e.TEXTURE_WRAP_S,r),e[i](l,e.TEXTURE_WRAP_T,n),e.TEXTURE_WRAP_R&&e[i](l,e.TEXTURE_WRAP_R,s)}if((!a||"linear"!==t.magFilter)&&e[i](l,e.TEXTURE_MAG_FILTER,gx[t.magFilter]),r){if(!a||"linear"!==t.mipmapFilter){const r=xx[t.minFilter][t.mipmapFilter];e[i](l,e.TEXTURE_MIN_FILTER,r)}}else e[i](l,e.TEXTURE_MIN_FILTER,gx[t.minFilter]);if(n&&t.maxAnisotropy>1){const r=Math.min(t.maxAnisotropy,e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));e[i](l,n.TEXTURE_MAX_ANISOTROPY_EXT,r)}t.compare&&e[i](l,e.TEXTURE_COMPARE_FUNC,Sx[t.compare])}function Px(t){return{r8unorm:t.RED,r8snorm:t.RED,r8uint:t.RED,r8sint:t.RED,r16uint:t.RED,r16sint:t.RED,r16float:t.RED,rg8unorm:t.RG,rg8snorm:t.RG,rg8uint:t.RG,rg8sint:t.RG,r32uint:t.RED,r32sint:t.RED,r32float:t.RED,rg16uint:t.RG,rg16sint:t.RG,rg16float:t.RG,rgba8unorm:t.RGBA,"rgba8unorm-srgb":t.RGBA,rgba8snorm:t.RGBA,rgba8uint:t.RGBA,rgba8sint:t.RGBA,bgra8unorm:t.RGBA,"bgra8unorm-srgb":t.RGBA,rgb9e5ufloat:t.RGB,rgb10a2unorm:t.RGBA,rg11b10ufloat:t.RGB,rg32uint:t.RG,rg32sint:t.RG,rg32float:t.RG,rgba16uint:t.RGBA,rgba16sint:t.RGBA,rgba16float:t.RGBA,rgba32uint:t.RGBA,rgba32sint:t.RGBA,rgba32float:t.RGBA,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT,depth24plus:t.DEPTH_COMPONENT,"depth24plus-stencil8":t.DEPTH_STENCIL,depth32float:t.DEPTH_COMPONENT,"depth32float-stencil8":t.DEPTH_STENCIL}}var Ox=Object.defineProperty,Mx=Object.defineProperties,wx=Object.getOwnPropertyDescriptors,Cx=Object.getOwnPropertySymbols,Ex=Object.prototype.hasOwnProperty,Ax=Object.prototype.propertyIsEnumerable,Rx=(t,e,r)=>e in t?Ox(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ix=(t,e)=>{for(var r in e||(e={}))Ex.call(e,r)&&Rx(t,r,e[r]);if(Cx)for(var r of Cx(e))Ax.call(e,r)&&Rx(t,r,e[r]);return t};function Dx(t,e){let r={},n=t.RGBA;return t instanceof Xe.get().getWebGLRenderingContext()?e.srgb&&(r={"rgba8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT}):(r={"rgba8unorm-srgb":t.SRGB8_ALPHA8,"bgra8unorm-srgb":t.SRGB8_ALPHA8},n=t.RGBA8),Ix(Ix(Ix(Ix(Ix(Ix(((t,e)=>Mx(t,wx(e)))(Ix({r8unorm:t.R8,r8snorm:t.R8_SNORM,r8uint:t.R8UI,r8sint:t.R8I,r16uint:t.R16UI,r16sint:t.R16I,r16float:t.R16F,rg8unorm:t.RG8,rg8snorm:t.RG8_SNORM,rg8uint:t.RG8UI,rg8sint:t.RG8I,r32uint:t.R32UI,r32sint:t.R32I,r32float:t.R32F,rg16uint:t.RG16UI,rg16sint:t.RG16I,rg16float:t.RG16F,rgba8unorm:t.RGBA},r),{rgba8snorm:t.RGBA8_SNORM,rgba8uint:t.RGBA8UI,rgba8sint:t.RGBA8I,bgra8unorm:n,rgb9e5ufloat:t.RGB9_E5,rgb10a2unorm:t.RGB10_A2,rg11b10ufloat:t.R11F_G11F_B10F,rg32uint:t.RG32UI,rg32sint:t.RG32I,rg32float:t.RG32F,rgba16uint:t.RGBA16UI,rgba16sint:t.RGBA16I,rgba16float:t.RGBA16F,rgba32uint:t.RGBA32UI,rgba32sint:t.RGBA32I,rgba32float:t.RGBA32F,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT16,depth24plus:t.DEPTH_COMPONENT24,"depth24plus-stencil8":t.DEPTH24_STENCIL8,depth32float:t.DEPTH_COMPONENT32F,"depth32float-stencil8":t.DEPTH32F_STENCIL8}),e.s3tc?{"bc1-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{}),e.s3tc_sRGB?{"bc1-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{}),e.rgtc?{"bc4-r-unorm":e.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":e.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":e.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":e.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{}),e.bptc?{"bc6h-rgb-float":e.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":e.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":e.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":e.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{}),e.etc?{"etc2-rgb8unorm":e.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":e.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":e.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":e.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":e.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":e.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":e.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":e.etc.COMPRESSED_SIGNED_RG11_EAC}:{}),e.astc?{"astc-4x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{})}function Bx(t){return{r8unorm:t.UNSIGNED_BYTE,r8snorm:t.BYTE,r8uint:t.UNSIGNED_BYTE,r8sint:t.BYTE,r16uint:t.UNSIGNED_SHORT,r16sint:t.SHORT,r16float:t.HALF_FLOAT,rg8unorm:t.UNSIGNED_BYTE,rg8snorm:t.BYTE,rg8uint:t.UNSIGNED_BYTE,rg8sint:t.BYTE,r32uint:t.UNSIGNED_INT,r32sint:t.INT,r32float:t.FLOAT,rg16uint:t.UNSIGNED_SHORT,rg16sint:t.SHORT,rg16float:t.HALF_FLOAT,rgba8unorm:t.UNSIGNED_BYTE,"rgba8unorm-srgb":t.UNSIGNED_BYTE,rgba8snorm:t.BYTE,rgba8uint:t.UNSIGNED_BYTE,rgba8sint:t.BYTE,bgra8unorm:t.UNSIGNED_BYTE,"bgra8unorm-srgb":t.UNSIGNED_BYTE,rgb9e5ufloat:t.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:t.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:t.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:t.UNSIGNED_INT,rg32sint:t.INT,rg32float:t.FLOAT,rgba16uint:t.UNSIGNED_SHORT,rgba16sint:t.SHORT,rgba16float:t.HALF_FLOAT,rgba32uint:t.UNSIGNED_INT,rgba32sint:t.INT,rgba32float:t.FLOAT,stencil8:t.UNSIGNED_BYTE,depth16unorm:t.UNSIGNED_SHORT,depth24plus:t.UNSIGNED_INT,"depth24plus-stencil8":t.UNSIGNED_INT_24_8,depth32float:t.FLOAT,"depth32float-stencil8":t.FLOAT_32_UNSIGNED_INT_24_8_REV}}class kx{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:fx,buffer:px,video:mx,compressed:vx},this._useSeparateSamplers=!1,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=Dx(t,this._renderer.context.extensions),this._mapFormatToType=Bx(t),this._mapFormatToFormat=Px(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null);for(let t=0;t<16;t++)this.bind($r.EMPTY,t)}initSource(t){this.bind(t)}bind(t,e=0){const r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){const r=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t=t||$r.EMPTY.source;const n=this.getGlSource(t);r.bindTexture(n.target,n.texture)}}_bindSampler(t,e=0){const r=this._gl;if(!t)return this._boundSamplers[e]=null,void r.bindSampler(e,null);const n=this._getGlSampler(t);this._boundSamplers[e]!==n&&(this._boundSamplers[e]=n,r.bindSampler(e,n))}unbind(t){const e=t.source,r=this._boundTextures,n=this._gl;for(let t=0;t<r.length;t++)if(r[t]===e){this._activateLocation(t);const i=this.getGlSource(e);n.bindTexture(i.target,null),r[t]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){const e=this._gl,r=new dx(e.createTexture());if(r.type=this._mapFormatToType[t.format],r.internalFormat=this._mapFormatToInternalFormat[t.format],r.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){const e=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(e))+1}return this._glTextures[t.uid]=r,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),r}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){const r=this._gl,n=this.getGlSource(t);r.bindTexture(r.TEXTURE_2D,n.texture),this._boundTextures[this._activeTextureLocation]=t,Tx(t.style,r,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){const e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){const e=this._gl,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=t,this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,r,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);const r=this.getGlSource(t);this._gl.generateMipmap(r.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){const e=this._gl,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,Tx(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){const{pixels:e,width:r,height:n}=this.getPixels(t),i=Xe.get().createCanvas();i.width=r,i.height=n;const s=i.getContext("2d");if(s){const t=s.createImageData(r,n);t.data.set(e),s.putImageData(t,0,0)}return i}getPixels(t){const e=t.source.resolution,r=t.frame,n=Math.max(Math.round(r.width*e),1),i=Math.max(Math.round(r.height*e),1),s=new Uint8Array(4*n*i),o=this._renderer,a=o.renderTarget.getRenderTarget(t),l=o.renderTarget.getGpuRenderTarget(a),_=o.gl;return _.bindFramebuffer(_.FRAMEBUFFER,l.resolveTargetFramebuffer),_.readPixels(Math.round(r.x*e),Math.round(r.y*e),n,i,_.RGBA,_.UNSIGNED_BYTE,s),{pixels:new Uint8ClampedArray(s.buffer),width:n,height:i}}destroy(){this.managedTextures.slice().forEach((t=>this.onSourceDestroy(t))),this.managedTextures=null,this._renderer=null}}kx.extension={type:[c.WebGLSystem],name:"texture"};class Ux{init(){const t=new qs({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new st,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=Vn(),r=Es({name:"graphics",bits:[Rs,Ls(e),gc,js]});this.shader=new oo({glProgram:r,resources:{localUniforms:t,batchSamplers:Js(e)}})}execute(t,e){const r=e.context,n=r.customShader||this.shader,i=t.renderer,s=i.graphicsContext,{batcher:o,instructions:a}=s.getContextRenderData(r);n.groups[0]=i.globalUniforms.bindGroup,i.state.set(t.state),i.shader.bind(n),i.geometry.bind(o.geometry,n.glProgram);const l=a.instructions;for(let t=0;t<a.instructionSize;t++){const e=l[t];if(e.size){for(let t=0;t<e.textures.count;t++)i.texture.bind(e.textures.textures[t],t);i.geometry.draw("triangle-list",e.size,e.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}Ux.extension={type:[c.WebGLPipesAdaptor],name:"graphics"};class Fx{init(){const t=Es({name:"mesh",bits:[gc,_m,js]});this._shader=new oo({glProgram:t,resources:{uTexture:$r.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new st}}}})}execute(t,e){const r=t.renderer;let n=e._shader;if(n){if(!n.glProgram)return}else{n=this._shader;const t=e.texture,r=t.source;n.resources.uTexture=r,n.resources.uSampler=r.style,n.resources.textureUniforms.uniforms.uTextureMatrix=t.textureMatrix.mapCoord}n.groups[100]=r.globalUniforms.bindGroup,n.groups[101]=t.localUniformsBindGroup,r.encoder.draw({geometry:e._geometry,shader:n,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}Fx.extension={type:[c.WebGLPipesAdaptor],name:"mesh"};class Lx{constructor(t){this._renderer=t}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}}function Gx(t,e){const r=t.instructionSet,n=r.instructions;for(let t=0;t<r.instructionSize;t++){const r=n[t];e[r.renderPipeId].execute(r)}}Lx.extension={type:[c.WebGLPipes,c.WebGPUPipes,c.CanvasPipes],name:"customRender"};class jx{constructor(t){this._renderer=t}addRenderGroup(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&(this._renderer.globalUniforms.push({worldTransformMatrix:t.worldTransform,worldColor:t.worldColorAlpha}),Gx(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop())}destroy(){this._renderer=null}}function Nx(t,e){e||(e=0);for(let r=e;r<t.length&&t[r];r++)t[r]=null}function zx(t,e=[]){e.push(t);for(let r=0;r<t.renderGroupChildren.length;r++)zx(t.renderGroupChildren[r],e);return e}function Wx(t,e,r){const n=t>>16&255,i=t>>8&255,s=255&t;return(n+((e>>16&255)-n)*r<<16)+(i+((e>>8&255)-i)*r<<8)+(s+((255&e)-s)*r)}jx.extension={type:[c.WebGLPipes,c.WebGPUPipes,c.CanvasPipes],name:"renderGroup"};const Vx=16777215;function Hx(t,e){return t===Vx||e===Vx?t+e-Vx:Wx(t,e,.5)}const Xx=new Zt;function Kx(t,e=!1){Yx(t);const r=t.childrenToUpdate,n=t.updateTick++;for(const e in r){const i=Number(e),s=r[e],o=s.list,a=s.index;for(let e=0;e<a;e++){const r=o[e];r.parentRenderGroup===t&&r.relativeRenderGroupDepth===i&&Qx(r,n,0)}Nx(o,a),s.index=0}if(e)for(let r=0;r<t.renderGroupChildren.length;r++)Kx(t.renderGroupChildren[r],e)}function Yx(t){const e=t.root;let r;if(t.renderGroupParent){const n=t.renderGroupParent;t.worldTransform.appendFrom(e.relativeGroupTransform,n.worldTransform),t.worldColor=Hx(e.groupColor,n.worldColor),r=e.groupAlpha*n.worldAlpha}else t.worldTransform.copyFrom(e.localTransform),t.worldColor=e.localColor,r=e.localAlpha;r=r<0?0:r>1?1:r,t.worldAlpha=r,t.worldColorAlpha=t.worldColor+(255*r<<24)}function Qx(t,e,r){if(e===t.updateTick)return;t.updateTick=e,t.didChange=!1;const n=t.localTransform;t.updateLocalTransform();const i=t.parent;if(i&&!i.renderGroup?(r|=t._updateFlags,t.relativeGroupTransform.appendFrom(n,i.relativeGroupTransform),7&r&&$x(t,i,r)):(r=t._updateFlags,t.relativeGroupTransform.copyFrom(n),7&r&&$x(t,Xx,r)),!t.renderGroup){const n=t.children,i=n.length;for(let t=0;t<i;t++)Qx(n[t],e,r);const s=t.parentRenderGroup,o=t;o.renderPipeId&&!s.structureDidChange&&s.updateRenderable(o)}}function $x(t,e,r){if(1&r){t.groupColor=Hx(t.localColor,e.groupColor);let r=t.localAlpha*e.groupAlpha;r=r<0?0:r>1?1:r,t.groupAlpha=r,t.groupColorAlpha=t.groupColor+(255*r<<24)}2&r&&(t.groupBlendMode="inherit"===t.localBlendMode?e.groupBlendMode:t.localBlendMode),4&r&&(t.globalDisplayStatus=t.localDisplayStatus&e.globalDisplayStatus),t._updateFlags=0}function qx(t,e){const{list:r,index:n}=t.childrenRenderablesToUpdate;let i=!1;for(let t=0;t<n;t++){const n=r[t];if(i=e[n.renderPipeId].validateRenderable(n),i)break}return t.structureDidChange=i,i}const Zx=new st;class Jx{constructor(t){this._renderer=t}render({container:t,transform:e}){t.isRenderGroup=!0;const r=t.parent,n=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;const i=this._renderer,s=zx(t.renderGroup,[]);let o=Zx;e&&(o=o.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));const a=i.renderPipes;for(let t=0;t<s.length;t++){const e=s[t];e.runOnRender(),e.instructionSet.renderPipes=a,e.structureDidChange?Nx(e.childrenRenderablesToUpdate.list,0):qx(e,a),Kx(e),e.structureDidChange?(e.structureDidChange=!1,um(e,i)):tb(e),e.childrenRenderablesToUpdate.index=0,i.renderPipes.batch.upload(e.instructionSet)}i.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),Gx(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(o),t.parent=r,t.renderGroup.renderGroupParent=n}destroy(){this._renderer=null}}function tb(t){const{list:e,index:r}=t.childrenRenderablesToUpdate;for(let n=0;n<r;n++){const r=e[n];r.didViewUpdate&&t.updateRenderable(r)}Nx(e,r)}Jx.extension={type:[c.WebGLSystem,c.WebGPUSystem,c.CanvasSystem],name:"renderGroup"};class eb{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){const r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){const e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){const e=t._texture,r=this._getGpuSprite(t);return r.texture._source!==e._source&&!r._batcher.checkAndUpdateTexture(r,e)}destroyRenderable(t){const e=this._gpuSpriteHash[t.uid];dt.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.bounds=t.bounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=dt.get(Ka);return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.bounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuSpriteHash)dt.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}}eb.extension={type:[c.WebGLPipes,c.WebGPUPipes,c.CanvasPipes],name:"sprite"};var rb=Object.defineProperty,nb=Object.getOwnPropertySymbols,ib=Object.prototype.hasOwnProperty,sb=Object.prototype.propertyIsEnumerable,ob=(t,e,r)=>e in t?rb(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ab=(t,e)=>{for(var r in e||(e={}))ib.call(e,r)&&ob(t,r,e[r]);if(nb)for(var r of nb(e))sb.call(e,r)&&ob(t,r,e[r]);return t};const lb=class t{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new Z(0),this.color=this._backgroundColor,this.alpha=1}init(e){e=ab(ab({},t.defaultOptions),e),this.clearBeforeRender=e.clearBeforeRender,this.color=e.background||e.backgroundColor||this._backgroundColor,this.alpha=e.backgroundAlpha,this._backgroundColor.setAlpha(e.backgroundAlpha)}get color(){return this._backgroundColor}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};lb.extension={type:[c.WebGLSystem,c.WebGPUSystem,c.CanvasSystem],name:"background",priority:0},lb.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let _b=lb;const ub={};p.handle(c.BlendMode,(t=>{if(!t.name)throw new Error("BlendMode extension must have a name property");ub[t.name]=t.ref}),(t=>{delete ub[t.name]}));class cb{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t}setBlendMode(t,e,r){this._activeBlendMode!==e?(this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(r),this._isAdvanced=!!ub[e],this._isAdvanced&&(this._beginAdvancedBlendMode(r),this._renderableList.push(t))):this._isAdvanced&&this._renderableList.push(t)}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);const e=this._activeBlendMode;if(!ub[e])return;let r=this._filterHash[e];r||(r=this._filterHash[e]=new vt,r.filters=[new ub[e]]);const n={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:r,canBundle:!1};this._renderableList=n.renderables,t.add(n)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(const t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}}cb.extension={type:[c.WebGLPipes,c.WebGPUPipes,c.CanvasPipes],name:"blendMode"};var hb=Object.defineProperty,db=Object.getOwnPropertySymbols,pb=Object.prototype.hasOwnProperty,yb=Object.prototype.propertyIsEnumerable,vb=(t,e,r)=>e in t?hb(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,fb=(t,e)=>{for(var r in e||(e={}))pb.call(e,r)&&vb(t,r,e[r]);if(db)for(var r of db(e))yb.call(e,r)&&vb(t,r,e[r]);return t};const mb={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},gb=class t{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof Zt||t instanceof $r?fb({target:t},e):fb(fb({},e),t)}async image(t){const e=new Image;return e.src=await this.base64(t),e}async base64(e){e=this._normalizeOptions(e,t.defaultImageOptions);const{format:r,quality:n}=e,i=this.canvas(e);if(void 0!==i.toBlob)return new Promise(((t,e)=>{i.toBlob((r=>{if(!r)return void e(new Error("ICanvas.toBlob failed!"));const n=new FileReader;n.onload=()=>t(n.result),n.onerror=e,n.readAsDataURL(r)}),mb[r],n)}));if(void 0!==i.toDataURL)return i.toDataURL(mb[r],n);if(void 0!==i.convertToBlob){const t=await i.convertToBlob({type:mb[r],quality:n});return new Promise(((e,r)=>{const n=new FileReader;n.onload=()=>e(n.result),n.onerror=r,n.readAsDataURL(t)}))}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){const e=(t=this._normalizeOptions(t)).target,r=this._renderer;if(e instanceof $r)return r.texture.generateCanvas(e);const n=r.textureGenerator.generateTexture(t),i=r.texture.generateCanvas(n);return n.destroy(),i}pixels(t){const e=(t=this._normalizeOptions(t)).target,r=this._renderer,n=e instanceof $r?e:r.textureGenerator.generateTexture(t),i=r.texture.getPixels(n);return e instanceof Zt&&n.destroy(),i}texture(t){return(t=this._normalizeOptions(t)).target instanceof $r?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){var e;t=this._normalizeOptions(t);const r=this.canvas(t),n=document.createElement("a");n.download=null!=(e=t.filename)?e:"image.png",n.href=r.toDataURL("image/png"),document.body.appendChild(n),n.click(),document.body.removeChild(n)}log(t){var e;const r=null!=(e=t.width)?e:200;t=this._normalizeOptions(t);const n=this.canvas(t),i=n.toDataURL();console.log(`[Pixi Texture] ${n.width}px ${n.height}px`);const s=["font-size: 1px;",`padding: ${r}px 300px;`,`background: url(${i}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",s)}destroy(){this._renderer=null}};gb.extension={type:[c.WebGLSystem,c.WebGPUSystem],name:"extract"},gb.defaultImageOptions={format:"png",quality:1};let xb=gb;class bb extends $r{static create(t){return new bb({source:new Gr(t)})}resize(t,e,r){return this.source.resize(t,e,r),this}}var Sb=Object.defineProperty,Tb=Object.defineProperties,Pb=Object.getOwnPropertyDescriptors,Ob=Object.getOwnPropertySymbols,Mb=Object.prototype.hasOwnProperty,wb=Object.prototype.propertyIsEnumerable,Cb=(t,e,r)=>e in t?Sb(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;const Eb=new Ct,Ab=new At,Rb=[0,0,0,0];class Ib{constructor(t){this._renderer=t}generateTexture(t){var e;t instanceof Zt&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});const r=t.resolution||this._renderer.resolution,n=t.antialias||this._renderer.view.antialias,i=t.target;let s=t.clearColor;s=s?Array.isArray(s)&&4===s.length?s:Z.shared.setValue(s).toArray():Rb;const o=(null==(e=t.frame)?void 0:e.copyTo(Eb))||Ut(i,Ab).rectangle;o.width=0|Math.max(o.width,1/r),o.height=0|Math.max(o.height,1/r);const a=bb.create(((t,e)=>Tb(t,Pb(e)))(((t,e)=>{for(var r in e||(e={}))Mb.call(e,r)&&Cb(t,r,e[r]);if(Ob)for(var r of Ob(e))wb.call(e,r)&&Cb(t,r,e[r]);return t})({},t.textureSourceOptions),{width:o.width,height:o.height,resolution:r,antialias:n})),l=st.shared.translate(-o.x,-o.y);return this._renderer.render({container:i,transform:l,target:a,clearColor:s}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}}Ib.extension={type:[c.WebGLSystem,c.WebGPUSystem],name:"textureGenerator"};class Db{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:r,worldColor:n,offset:i}){const s=this._renderer.renderTarget.renderTarget,o=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:s,worldTransformMatrix:new st,worldColor:4294967295,offset:new nt},a={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||s.size,worldTransformMatrix:r||o.worldTransformMatrix,worldColor:n||o.worldColor,offset:i||o.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);const _=l.uniforms;let u;_.uProjectionMatrix=a.projectionMatrix,_.uResolution=a.resolution,_.uWorldTransformMatrix.copyFrom(a.worldTransformMatrix),_.uWorldTransformMatrix.tx-=a.offset.x,_.uWorldTransformMatrix.ty-=a.offset.y,Aa(a.worldColor,_.uWorldColorAlpha,0),l.update(),this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(u=this._bindGroupPool.pop()||new Fn,this._activeBindGroups.push(u),u.setResource(l,0)),a.bindGroup=u,this._currentGlobalUniformData=a}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===to.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new qs({uProjectionMatrix:{value:new st,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new st,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}}Db.extension={type:[c.WebGLSystem,c.WebGPUSystem,c.CanvasSystem],name:"globalUniforms"};let Bb=1;class kb{constructor(){this._tasks=[],this._offset=0}init(){Oe.system.add(this._update,this)}repeat(t,e,r=!0){const n=Bb++;let i=0;return r&&(this._offset+=1e3,i=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:i,last:performance.now(),repeat:!0,id:n}),n}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t)return void this._tasks.splice(e,1)}_update(){const t=performance.now();for(let e=0;e<this._tasks.length;e++){const r=this._tasks[e];if(t-r.offset-r.last>=r.duration){const e=t-r.start;r.func(e),r.last=t}}}destroy(){Oe.system.remove(this._update,this),this._tasks.length=0}}kb.extension={type:[c.WebGLSystem,c.WebGPUSystem,c.CanvasSystem],name:"scheduler",priority:0};let Ub=!1;function Fb(t){if(!Ub){if(Xe.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const e=[`%c %c %c %c %c PixiJS %c v${Eh} (${t}) http://www.pixijs.com/\n\t\n\t`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...e)}else globalThis.console&&globalThis.console.log(`PixiJS ${Eh} - ${t} - http://www.pixijs.com/`);Ub=!0}}class Lb{constructor(t){this._renderer=t}init(t){if(t.hello){let t=this._renderer.name;this._renderer.type===to.WEBGL&&(t+=` ${this._renderer.context.webGLVersion}`),Fb(t)}}}function Gb(t){let e=!1;for(const r in t)if(null==t[r]){e=!0;break}if(!e)return t;const r=Object.create(null);for(const e in t){const n=t[e];n&&(r[e]=n)}return r}function jb(t){let e=0;for(let r=0;r<t.length;r++)null==t[r]?e++:t[r-e]=t[r];return t.length=t.length-e,t}Lb.extension={type:[c.WebGLSystem,c.WebGPUSystem,c.CanvasSystem],name:"hello",priority:-2},Lb.defaultOptions={hello:!1};var Nb=Object.defineProperty,zb=Object.getOwnPropertySymbols,Wb=Object.prototype.hasOwnProperty,Vb=Object.prototype.propertyIsEnumerable,Hb=(t,e,r)=>e in t?Nb(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Xb=(t,e)=>{for(var r in e||(e={}))Wb.call(e,r)&&Hb(t,r,e[r]);if(zb)for(var r of zb(e))Vb.call(e,r)&&Hb(t,r,e[r]);return t};const Kb=class t{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(e){e=Xb(Xb({},t.defaultOptions),e),this.maxUnusedTime=e.renderableGCMaxUnusedTime,this._frequency=e.renderableGCFrequency,this.enabled=e.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?(this._handler=this._renderer.scheduler.repeat((()=>this.run()),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat((()=>{for(const t of this._managedHashes)t.context[t.hash]=Gb(t.context[t.hash])}),this._frequency),this._arrayHandler=this._renderer.scheduler.repeat((()=>{for(const t of this._managedArrays)jb(t.context[t.hash])}),this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(t,e){this._managedHashes.push({context:t,hash:e})}addManagedArray(t,e){this._managedArrays.push({context:t,hash:e})}prerender(){this._now=performance.now()}addRenderable(t,e){this.enabled&&(t._lastUsed=this._now,-1===t._lastInstructionTick&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastInstructionTick=e.tick)}run(){var t,e,r;const n=performance.now(),i=this._managedRenderables,s=this._renderer.renderPipes;let o=0;for(let a=0;a<i.length;a++){const l=i[a];if(null===l){o++;continue}const _=null!=(t=l.renderGroup)?t:l.parentRenderGroup,u=null!=(r=null==(e=null==_?void 0:_.instructionSet)?void 0:e.tick)?r:-1;l._lastInstructionTick!==u&&n-l._lastUsed>this.maxUnusedTime?(l.destroyed||s[l.renderPipeId].destroyRenderable(l),l._lastInstructionTick=-1,o++,l.off("destroyed",this._removeRenderable,this)):i[a-o]=l}i.length=i.length-o}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){const e=this._managedRenderables.indexOf(t);e>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}};Kb.extension={type:[c.WebGLSystem,c.WebGPUSystem],name:"renderableGC",priority:0},Kb.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};let Yb=Kb;var Qb=Object.defineProperty,$b=Object.getOwnPropertySymbols,qb=Object.prototype.hasOwnProperty,Zb=Object.prototype.propertyIsEnumerable,Jb=(t,e,r)=>e in t?Qb(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,tS=(t,e)=>{for(var r in e||(e={}))qb.call(e,r)&&Jb(t,r,e[r]);if($b)for(var r of $b(e))Zb.call(e,r)&&Jb(t,r,e[r]);return t};const eS=class t{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(e){var r;e=tS(tS({},t.defaultOptions),e),this.checkCountMax=e.textureGCCheckCountMax,this.maxIdle=null!=(r=e.textureGCAMaxIdle)?r:e.textureGCMaxIdle,this.active=e.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){const r=t[e];r.autoGarbageCollect&&r.resource&&r._touched>-1&&this.count-r._touched>this.maxIdle&&(r._touched=-1,r.unload())}}destroy(){this._renderer=null}};eS.extension={type:[c.WebGLSystem,c.WebGPUSystem],name:"textureGC"},eS.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:3600,textureGCCheckCountMax:600};let rS=eS;var nS=Object.defineProperty,iS=Object.getOwnPropertySymbols,sS=Object.prototype.hasOwnProperty,oS=Object.prototype.propertyIsEnumerable,aS=(t,e,r)=>e in t?nS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,lS=(t,e)=>{for(var r in e||(e={}))sS.call(e,r)&&aS(t,r,e[r]);if(iS)for(var r of iS(e))oS.call(e,r)&&aS(t,r,e[r]);return t};const _S=class t{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(t){this.texture.source.autoDensity=t}get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(e){(e=lS(lS({},t.defaultOptions),e)).view&&(e.canvas=e.view),this.screen=new Ct(0,0,e.width,e.height),this.canvas=e.canvas||Xe.get().createCanvas(),this.antialias=!!e.antialias,this.texture=Cg(this.canvas,e),this.renderTarget=new Fg({colorTextures:[this.texture],depth:!!e.depth,isRoot:!0}),this.texture.source.transparent=e.backgroundAlpha<1,this.resolution=e.resolution}resize(t,e,r){this.texture.source.resize(t,e,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){("boolean"==typeof t?t:null!=t&&t.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};_S.extension={type:[c.WebGLSystem,c.WebGPUSystem,c.CanvasSystem],name:"view",priority:0},_S.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};let uS=_S;const cS=[_b,Db,Lb,uS,Jx,rS,Ib,xb,Rh,Yb,kb],hS=[cb,am,eb,jx,ym,fm,vm,Lx],dS=[...cS,mg,Qm,Rm,xm,kx,Gg,jm,lx,ix,qm,hx,tg,$m],pS=[...hS],yS=[nm,Fx,Ux],vS=[],fS=[],mS=[];p.handleByNamedList(c.WebGLSystem,vS),p.handleByNamedList(c.WebGLPipes,fS),p.handleByNamedList(c.WebGLPipesAdaptor,mS),p.add(...dS,...pS,...yS);class gS extends mh{constructor(){super({name:"webgl",type:to.WEBGL,systems:vS,renderPipes:fS,renderPipeAdaptors:mS})}}var xS={__proto__:null,WebGLRenderer:gS};class bS{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,r){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,r)}_createBindGroup(t,e,r){var n;const i=this._gpu.device,s=e.layout[r],o=[],a=this._renderer;for(const e in s){const r=null!=(n=t.resources[e])?n:t.resources[s[e]];let i;if("uniformGroup"===r._resourceType){const t=r;a.ubo.updateUniformGroup(t);const e=t.buffer;i={buffer:a.buffer.getGPUBuffer(e),offset:0,size:e.descriptor.size}}else if("buffer"===r._resourceType){const t=r;i={buffer:a.buffer.getGPUBuffer(t),offset:0,size:t.descriptor.size}}else if("bufferResource"===r._resourceType){const t=r;i={buffer:a.buffer.getGPUBuffer(t.buffer),offset:t.offset,size:t.size}}else if("textureSampler"===r._resourceType){const t=r;i=a.texture.getGpuSampler(t)}else if("textureSource"===r._resourceType){const t=r;i=a.texture.getGpuSource(t).createView({})}o.push({binding:s[e],resource:i})}const l=a.shader.getProgramData(e).bindGroups[r],_=i.createBindGroup({layout:l,entries:o});return this._hash[t._key]=_,_}destroy(){for(const t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}}bS.extension={type:[c.WebGPUSystem],name:"bindGroup"};class SS{constructor(t){this._gpuBuffers=Object.create(null),this._managedBuffers=[],t.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){const e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),r=t.data;return t._updateID&&r&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,r.buffer,0,(t._updateSize||r.byteLength)+3&-4)),e}destroyAll(){for(const t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));const e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(Qn(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach((t=>this._destroyBuffer(t))),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}}SS.extension={type:[c.WebGPUSystem],name:"buffer"};class TS{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error("UniformBufferBatch: array is too large: "+4*t);const e=this.byteIndex;let r=e+4*t;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>4*this.data.length)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,e}addGroup(t){const e=this.addEmptyGroup(t.length);for(let r=0;r<t.length;r++)this.data[e/4+r]=t[r];return e}destroy(){this._buffer.destroy(),this._buffer=null,this.data=null}}class PS{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}}PS.extension={type:[c.WebGPUSystem],name:"colorMask"};class OS{constructor(t){this._renderer=t}async init(t){return this._initPromise||(this._initPromise=this._createDeviceAndAdaptor(t).then((t=>{this.gpu=t,this._renderer.runners.contextChange.emit(this.gpu)}))),this._initPromise}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){const e=await Xe.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter((t=>e.features.has(t))),n=await e.requestDevice({requiredFeatures:r});return{adapter:e,device:n}}destroy(){this.gpu=null,this._renderer=null}}OS.extension={type:[c.WebGPUSystem],name:"device"},OS.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};var MS=Object.defineProperty,wS=Object.getOwnPropertySymbols,CS=Object.prototype.hasOwnProperty,ES=Object.prototype.propertyIsEnumerable,AS=(t,e,r)=>e in t?MS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,RS=(t,e)=>{for(var r in e||(e={}))CS.call(e,r)&&AS(t,r,e[r]);if(wS)for(var r of wS(e))ES.call(e,r)&&AS(t,r,e[r]);return t};class IS{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise((t=>{this._resolveCommandFinished=t})),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,r,n){const i=this._renderer.pipeline.getPipeline(t,e,r,n);this.setPipeline(i)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;const e=2===t.data.BYTES_PER_ELEMENT?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,r){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);const n=this._renderer.bindGroup.getBindGroup(e,r,t);this.renderPassEncoder.setBindGroup(t,n)}setGeometry(t,e){const r=this._renderer.pipeline.getBufferNamesToBind(t,e);for(const e in r)this._setVertexBuffer(e,t.attributes[r[e]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(const r in t.groups){const n=t.groups[r];e||this._syncBindGroup(n),this.setBindGroup(r,n,t.gpuProgram)}}_syncBindGroup(t){for(const e in t.resources){const r=t.resources[e];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(t){const{geometry:e,shader:r,state:n,topology:i,size:s,start:o,instanceCount:a,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,r.gpuProgram,n,i),this.setGeometry(e,r.gpuProgram),this._setShaderBindGroups(r,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(s||e.indexBuffer.data.length,a||e.instanceCount,o||0):this.renderPassEncoder.draw(s||e.getSize(),a||e.instanceCount,o||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);const e=this._boundPipeline,r=RS({},this._boundVertexBuffer),n=this._boundIndexBuffer,i=RS({},this._boundBindGroup);this._clearCache();const s=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(s.x,s.y,s.width,s.height,0,1),this.setPipeline(e);for(const t in r)this._setVertexBuffer(t,r[t]);for(const t in i)this.setBindGroup(t,i[t],null);this._setIndexBuffer(n)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}}IS.extension={type:[c.WebGPUSystem],name:"encoder",priority:1};class DS{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:qn.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){const r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=t,r.stencilReference=e;const n=this._renderer;n.pipeline.setStencilMode(t),n.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}DS.extension={type:[c.WebGPUSystem],name:"stencil"};const BS={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}};function kS(t){const e=t.map((t=>({data:t,offset:0,size:0})));let r=0;for(let t=0;t<e.length;t++){const n=e[t];let i=BS[n.data.type].size;const s=BS[n.data.type].align;if(!BS[n.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${n.data.type}`);n.data.size>1&&(i=Math.max(i,s)*n.data.size),r=Math.ceil(r/s)*s,n.size=i,n.offset=r,r+=i}return r=16*Math.ceil(r/16),{uboElements:e,size:r}}function US(t,e){const{size:r,align:n}=BS[t.data.type],i=(n-r)/4;return`\n\t\t\t v = uv.${t.data.name};\n\t\t\t ${0!==e?`offset += ${e};`:""}\n\t\n\t\t\t arrayOffset = offset;\n\t\n\t\t\t t = 0;\n\t\n\t\t\t for(var i=0; i < ${t.data.size*(r/4)}; i++)\n\t\t\t {\n\t\t\t\t for(var j = 0; j < ${r/4}; j++)\n\t\t\t\t {\n\t\t\t\t\t data[arrayOffset++] = v[t++];\n\t\t\t\t }\n\t\t\t\t ${0!==i?`arrayOffset += ${i};`:""}\n\t\t\t }\n\t\t `}function FS(t){return sg(t,"uboWgsl",US,yg)}class LS extends eg{constructor(){super({createUboElements:kS,generateUboSync:FS})}}LS.extension={type:[c.WebGPUSystem],name:"ubo"};const GS=128;class jS{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new TS({minUniformOffsetAlignment:GS});for(let t=0;t<2;t++){let e=pi.UNIFORM|pi.COPY_DST;0===t&&(e|=pi.COPY_SRC),this._buffers.push(new yi({data:this._batchBuffer.data,usage:e}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(const t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);const r=t.buffer.data,n=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,n/4),this._bindGroupHash[t.uid]=this._getBindGroup(n/GS),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);const e=t.buffer.data,r=this._batchBuffer.addGroup(e);return this._getBufferResource(r/GS)}getArrayBindGroup(t){const e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/GS)}getArrayBufferResource(t){const e=this._batchBuffer.addGroup(t)/GS;return this._getBufferResource(e)}_getBufferResource(t){if(!this._bufferResources[t]){const e=this._buffers[t%2];this._bufferResources[t]=new jg({buffer:e,offset:256*(t/2|0),size:GS})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){const e=new Fn({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){const t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);const r=this._renderer.gpu.device.createCommandEncoder();for(let n=1;n<this._buffers.length;n++){const i=this._buffers[n];r.copyBufferToBuffer(t.getGPUBuffer(e),GS,t.getGPUBuffer(i),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([r.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}}jS.extension={type:[c.WebGPUPipes],name:"uniformBatch"};var NS=Object.defineProperty,zS=Object.defineProperties,WS=Object.getOwnPropertyDescriptors,VS=Object.getOwnPropertySymbols,HS=Object.prototype.hasOwnProperty,XS=Object.prototype.propertyIsEnumerable,KS=(t,e,r)=>e in t?NS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;const YS={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};class QS{constructor(t){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode(qn.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){this._multisampleCount=t.msaaSamples,this._depthStencilAttachment=t.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=Jm[t],this._updatePipeHash())}setPipeline(t,e,r,n){const i=this.getPipeline(t,e,r);n.setPipeline(i)}getPipeline(t,e,r,n){t._layoutKey||(Im(t,e.attributeData),this._generateBufferKey(t)),n=n||t.topology;const i=function(t,e,r,n,i){return t<<24|e<<16|r<<10|n<<5|i}(t._layoutKey,e._layoutKey,r.data,r._blendModeId,YS[n]);return this._pipeCache[i]||(this._pipeCache[i]=this._createPipeline(t,e,r,n)),this._pipeCache[i]}_createPipeline(t,e,r,n){const i=this._gpu.device,s=this._createVertexBufferLayouts(t,e),o=this._renderer.state.getColorTargets(r);o[0].writeMask=this._stencilMode===qn.RENDERING_MASK_ADD?0:this._colorMask;const a=this._renderer.shader.getProgramData(e).pipeline,l={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:s},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:o},primitive:{topology:n,cullMode:r.cullMode},layout:a,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil=((t,e)=>zS(t,WS(e)))(((t,e)=>{for(var r in e||(e={}))HS.call(e,r)&&KS(t,r,e[r]);if(VS)for(var r of VS(e))XS.call(e,r)&&KS(t,r,e[r]);return t})({},this._stencilState),{format:"depth24plus-stencil8",depthWriteEnabled:r.depthTest,depthCompare:r.depthTest?"less":"always"})),i.createRenderPipeline(l)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){const e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){const e=[];let r=0;const n=Object.keys(t.attributes).sort();for(let i=0;i<n.length;i++){const s=t.attributes[n[i]];e[r++]=s.offset,e[r++]=s.format,e[r++]=s.stride,e[r++]=s.instance}const i=e.join("|");return t._layoutKey=Pi(i,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){const e=[];let r=0;const n=Object.keys(t.attributeData).sort();for(let i=0;i<n.length;i++){const s=t.attributeData[n[i]];e[r++]=s.location}const i=e.join("|");return t._attributeLocationsKey=Pi(i,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){const r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[r])return this._bindingNamesCache[r];const n=this._createVertexBufferLayouts(t,e),i=Object.create(null),s=e.attributeData;for(let t=0;t<n.length;t++)for(const e in s)if(s[e].location===t){i[t]=e;break}return this._bindingNamesCache[r]=i,i}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);const r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[r])return this._bufferLayoutsCache[r];const n=[];return t.buffers.forEach((r=>{var i;const s={arrayStride:0,stepMode:"vertex",attributes:[]},o=s.attributes;for(const n in e.attributeData){const a=t.attributes[n];1!==(null!=(i=a.divisor)?i:1)&&iu(`Attribute ${n} has an invalid divisor value of '${a.divisor}'. WebGPU only supports a divisor value of 1`),a.buffer===r&&(s.arrayStride=a.stride,s.stepMode=a.instance?"instance":"vertex",o.push({shaderLocation:e.attributeData[n].location,offset:a.offset,format:a.format}))}o.length&&n.push(s)})),this._bufferLayoutsCache[r]=n,n}_updatePipeHash(){const t=function(t,e,r,n){return r<<6|t<<3|n<<1|e}(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}}QS.extension={type:[c.WebGPUSystem],name:"pipeline"};class $S{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}class qS{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,r,n,i){const s=this._renderer,o=this._getGpuColorTexture(t),a=s.texture.getGpuSource(e.source);return s.encoder.commandEncoder.copyTextureToTexture({texture:o,origin:r},{texture:a,origin:i},n),e}startRenderPass(t,e=!0,r,n){const i=this._renderTargetSystem.getGpuRenderTarget(t),s=this.getDescriptor(t,e,r);i.descriptor=s,this._renderer.pipeline.setRenderTarget(i),this._renderer.encoder.beginRenderPass(i),this._renderer.encoder.setViewport(n)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,r){"boolean"==typeof e&&(e=e?oh.ALL:oh.NONE);const n=this._renderTargetSystem,i=n.getGpuRenderTarget(t),s=t.colorTextures.map(((t,s)=>{const o=i.contexts[s];let a,l;a=o?o.getCurrentTexture().createView():this._renderer.texture.getGpuSource(t).createView({mipLevelCount:1}),i.msaaTextures[s]&&(l=a,a=this._renderer.texture.getTextureView(i.msaaTextures[s]));const _=e&oh.COLOR?"clear":"load";return null!=r||(r=n.defaultClearColor),{view:a,resolveTarget:l,clearValue:r,storeOp:"store",loadOp:_}}));let o;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=i.msaa?4:1),t.depthStencilTexture){const r=e&oh.STENCIL?"clear":"load",n=e&oh.DEPTH?"clear":"load";o={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:r,depthClearValue:1,depthLoadOp:n,depthStoreOp:"store"}}return{colorAttachments:s,depthStencilAttachment:o}}clear(t,e=!0,r,n){if(!e)return;const{gpu:i,encoder:s}=this._renderer,o=i.device;if(null===s.commandEncoder){const i=o.createCommandEncoder(),s=this.getDescriptor(t,e,r),a=i.beginRenderPass(s);a.setViewport(n.x,n.y,n.width,n.height,0,1),a.end();const l=i.finish();o.queue.submit([l])}else this.startRenderPass(t,e,r,n)}initGpuRenderTarget(t){t.isRoot=!0;const e=new $S;return t.colorTextures.forEach(((t,r)=>{if(mn.test(t.resource)){const n=t.resource.getContext("webgpu"),i=t.transparent?"premultiplied":"opaque";try{n.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:i})}catch(t){console.error(t)}e.contexts[r]=n}if(e.msaa=t.source.antialias,t.source.antialias){const t=new Gr({width:0,height:0,sampleCount:4});e.msaaTextures[r]=t}})),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach((t=>{t.unconfigure()})),t.msaaTextures.forEach((t=>{t.destroy()})),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach(((t,r)=>{const n=e.msaaTextures[r];null==n||n.resize(t.source.width,t.source.height,t.source._resolution)}))}}class ZS extends Lg{constructor(t){super(t),this.adaptor=new qS,this.adaptor.init(t,this)}}ZS.extension={type:[c.WebGPUSystem],name:"renderTarget"};class JS{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t,this.maxTextures=t.device.limits.maxSampledTexturesPerShaderStage}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){const e=this._gpu.device,r=t.gpuLayout.map((t=>e.createBindGroupLayout({entries:t}))),n={bindGroupLayouts:r};return this._gpuProgramData[t._layoutKey]={bindGroups:r,pipeline:e.createPipelineLayout(n)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}}JS.extension={type:[c.WebGPUSystem],name:"shader"};const tT={normal:{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},add:{alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}},multiply:{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}},screen:{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},overlay:{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},none:{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}},"normal-npm":{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}},"add-npm":{alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}},"screen-npm":{alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}},erase:{alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}},min:{alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}},max:{alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}};class eT{constructor(){this.defaultState=new Ea,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:tT[t.blendMode]||tT.normal}]}destroy(){this.gpu=null}}eT.extension={type:[c.WebGPUSystem],name:"state"};const rT={type:"image",upload(t,e,r){const n=t.resource,i=(0|t.pixelWidth)*(0|t.pixelHeight),s=n.byteLength/i;r.device.queue.writeTexture({texture:e},n,{offset:0,rowsPerImage:t.pixelHeight,bytesPerRow:t.pixelHeight*s},{width:t.pixelWidth,height:t.pixelHeight,depthOrArrayLayers:1})}},nT={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},iT={blockBytes:4,blockWidth:1,blockHeight:1},sT={type:"compressed",upload(t,e,r){let n=t.pixelWidth,i=t.pixelHeight;const s=nT[t.format]||iT;for(let o=0;o<t.resource.length;o++){const a=t.resource[o],l=Math.ceil(n/s.blockWidth)*s.blockBytes;r.device.queue.writeTexture({texture:e,mipLevel:o},a,{offset:0,bytesPerRow:l},{width:Math.ceil(n/s.blockWidth)*s.blockWidth,height:Math.ceil(i/s.blockHeight)*s.blockHeight,depthOrArrayLayers:1}),n=Math.max(n>>1,1),i=Math.max(i>>1,1)}}},oT={type:"image",upload(t,e,r){const n=t.resource;if(!n)return;const i=Math.min(e.width,t.resourceWidth||t.pixelWidth),s=Math.min(e.height,t.resourceHeight||t.pixelHeight),o="premultiply-alpha-on-upload"===t.alphaMode;r.device.queue.copyExternalImageToTexture({source:n},{texture:e,premultipliedAlpha:o},{width:i,height:s})}},aT={type:"video",upload(t,e,r){oT.upload(t,e,r)}};class lT{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:"\n\t\t\t\t\t\t\tvar<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(\n\t\t\t\t\t\t\tvec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));\n\t\n\t\t\t\t\t\t\tstruct VertexOutput {\n\t\t\t\t\t\t\t@builtin(position) position : vec4<f32>,\n\t\t\t\t\t\t\t@location(0) texCoord : vec2<f32>,\n\t\t\t\t\t\t\t};\n\t\n\t\t\t\t\t\t\t@vertex\n\t\t\t\t\t\t\tfn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {\n\t\t\t\t\t\t\tvar output : VertexOutput;\n\t\t\t\t\t\t\toutput.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);\n\t\t\t\t\t\t\toutput.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);\n\t\t\t\t\t\t\treturn output;\n\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t@group(0) @binding(0) var imgSampler : sampler;\n\t\t\t\t\t\t\t@group(0) @binding(1) var img : texture_2d<f32>;\n\t\n\t\t\t\t\t\t\t@fragment\n\t\t\t\t\t\t\tfn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {\n\t\t\t\t\t\t\treturn textureSample(img, imgSampler, texCoord);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t"})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){const e=this._getMipmapPipeline(t.format);if("3d"===t.dimension||"1d"===t.dimension)throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=t;const n=t.depthOrArrayLayers||1,i=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!i){const e={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:n},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};r=this.device.createTexture(e)}const s=this.device.createCommandEncoder({}),o=e.getBindGroupLayout(0);for(let a=0;a<n;++a){let n=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:a,arrayLayerCount:1}),l=i?1:0;for(let i=1;i<t.mipLevelCount;++i){const t=r.createView({baseMipLevel:l++,mipLevelCount:1,dimension:"2d",baseArrayLayer:a,arrayLayerCount:1}),i=s.beginRenderPass({colorAttachments:[{view:t,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),_=this.device.createBindGroup({layout:o,entries:[{binding:0,resource:this.sampler},{binding:1,resource:n}]});i.setPipeline(e),i.setBindGroup(0,_),i.draw(3,1,0,0),i.end(),n=t}}if(!i){const e={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:n};for(let n=1;n<t.mipLevelCount;++n)s.copyTextureToTexture({texture:r,mipLevel:n-1},{texture:t,mipLevel:n},e),e.width=Math.ceil(e.width/2),e.height=Math.ceil(e.height/2)}return this.device.queue.submit([s.finish()]),i||r.destroy(),t}}class _T{constructor(t){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:oT,buffer:rT,video:aT,compressed:sT},this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuSources"),t.renderableGC.addManagedHash(this,"_gpuSamplers"),t.renderableGC.addManagedHash(this,"_bindGroupHash"),t.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(t){this._gpu=t}initSource(t){if(t.autoGenerateMipmaps){const e=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(e))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;"compressed"!==t.uploadMethodId&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);const r=nT[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},n=Math.ceil(t.pixelWidth/r.blockWidth)*r.blockWidth,i=Math.ceil(t.pixelHeight/r.blockHeight)*r.blockHeight,s={label:t.label,size:{width:n,height:i},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},o=this._gpu.device.createTexture(s);return this._gpuSources[t.uid]=o,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),o}onSourceUpdate(t){const e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){const e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new lT(this._gpu.device));const e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceDestroy(t){t.off("update",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("destroy",this.onSourceDestroy,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}onSourceResize(t){const e=this._gpuSources[t.uid];e?(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(this._textureViewHash[t.uid]=null,this._bindGroupHash[t.uid]=null,this.onSourceUnload(t),this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){return this._gpuSources[t.uid]||this.initSource(t)}getTextureBindGroup(t){var e;return null!=(e=this._bindGroupHash[t.uid])?e:this._createTextureBindGroup(t)}_createTextureBindGroup(t){const e=t.source;return this._bindGroupHash[t.uid]=new Fn({0:e,1:e.style,2:new qs({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){var e;const r=t.source;return null!=(e=this._textureViewHash[r.uid])?e:this._createTextureView(r)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){const e=this._renderer,r=e.gpu.device.createCommandEncoder(),n=Xe.get().createCanvas();n.width=t.source.pixelWidth,n.height=t.source.pixelHeight;const i=n.getContext("webgpu");return i.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:Xe.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:i.getCurrentTexture()},{width:n.width,height:n.height}),e.gpu.device.queue.submit([r.finish()]),n}getPixels(t){const e=this.generateCanvas(t),r=$a.getOptimalCanvasAndContext(e.width,e.height),n=r.context;n.drawImage(e,0,0);const{width:i,height:s}=e,o=n.getImageData(0,0,i,s),a=new Uint8ClampedArray(o.data.buffer);return $a.returnCanvasAndContext(r),{pixels:a,width:i,height:s}}destroy(){this.managedTextures.slice().forEach((t=>this.onSourceDestroy(t))),this.managedTextures=null;for(const t of Object.keys(this._bindGroupHash)){const e=Number(t),r=this._bindGroupHash[e];null==r||r.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}}_T.extension={type:[c.WebGPUSystem],name:"texture"};class uT{init(){const t=new qs({uTransformMatrix:{value:new st,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=Cs({name:"graphics",bits:[As,ks(Vn()),mc,Gs]});this.shader=new oo({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){const r=e.context,n=r.customShader||this.shader,i=t.renderer,s=i.graphicsContext,{batcher:o,instructions:a}=s.getContextRenderData(r),l=i.encoder;l.setPipelineFromGeometryProgramAndState(o.geometry,n.gpuProgram,t.state),l.setGeometry(o.geometry,n.gpuProgram);const _=i.globalUniforms.bindGroup;l.setBindGroup(0,_,n.gpuProgram);const u=i.renderPipes.uniformBatch.getUniformBindGroup(n.resources.localUniforms,!0);l.setBindGroup(2,u,n.gpuProgram);const c=a.instructions;for(let t=0;t<a.instructionSize;t++){const e=c[t];if(n.groups[1]=e.bindGroup,!e.gpuBindGroup){const t=e.textures;e.bindGroup=Xn(t.textures,t.count),e.gpuBindGroup=i.bindGroup.getBindGroup(e.bindGroup,n.gpuProgram,1)}l.setBindGroup(1,e.bindGroup,n.gpuProgram),l.renderPassEncoder.drawIndexed(e.size,1,e.start)}}destroy(){this.shader.destroy(!0),this.shader=null}}uT.extension={type:[c.WebGPUPipesAdaptor],name:"graphics"};class cT{init(){const t=Cs({name:"mesh",bits:[fc,lm,Gs]});this._shader=new oo({gpuProgram:t,resources:{uTexture:$r.EMPTY._source,uSampler:$r.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new st}}}})}execute(t,e){const r=t.renderer;let n=e._shader;if(n){if(!n.gpuProgram)return}else n=this._shader,n.groups[2]=r.texture.getTextureBindGroup(e.texture);const i=n.gpuProgram;if(i.autoAssignGlobalUniforms&&(n.groups[0]=r.globalUniforms.bindGroup),i.autoAssignLocalUniforms){const e=t.localUniforms;n.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(e,!0)}r.encoder.draw({geometry:e._geometry,shader:n,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}cT.extension={type:[c.WebGPUPipesAdaptor],name:"mesh"};const hT=[...cS,LS,IS,OS,SS,_T,ZS,JS,eT,QS,PS,DS,bS],dT=[...hS,jS],pT=[sm,cT,uT],yT=[],vT=[],fT=[];p.handleByNamedList(c.WebGPUSystem,yT),p.handleByNamedList(c.WebGPUPipes,vT),p.handleByNamedList(c.WebGPUPipesAdaptor,fT),p.add(...hT,...dT,...pT);class mT extends mh{constructor(){super({name:"webgpu",type:to.WEBGPU,systems:yT,renderPipes:vT,renderPipeAdaptors:fT})}}var gT={__proto__:null,WebGPURenderer:mT};const xT=new Proxy({POINTS:"point-list",LINES:"line-list",LINE_STRIP:"line-strip",TRIANGLES:"triangle-list",TRIANGLE_STRIP:"triangle-strip"},{get:(t,e)=>t[e]}),bT=new Ct(0,0,1,1);var ST=(t=>(t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH",t))(ST||{}),TT=(t=>(t.CLAMP="clamp-to-edge",t.REPEAT="repeat",t.MIRRORED_REPEAT="mirror-repeat",t))(TT||{});const PT=new Proxy(TT,{get:(t,e)=>t[e]});var OT=(t=>(t.NEAREST="nearest",t.LINEAR="linear",t))(OT||{});const MT=new Proxy(OT,{get:(t,e)=>t[e]});let wT=0;var CT=Object.defineProperty,ET=Object.getOwnPropertySymbols,AT=Object.prototype.hasOwnProperty,RT=Object.prototype.propertyIsEnumerable,IT=(t,e,r)=>e in t?CT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;const DT={rectangle:va,polygon:ya,triangle:fa,circle:Ao,ellipse:Ao,roundedRectangle:Ao};function BT(t,e,r,n){const i=r.buffers[0],s=i.data,{verticesX:o,verticesY:a}=r,l=t/(o-1),_=e/(a-1);let u=0;const c=n[0],h=n[1],d=n[2],p=n[3],y=n[4],v=n[5],f=n[6],m=n[7],g=n[8];for(let t=0;t<s.length;t+=2){const e=u%o*l,r=(u/o|0)*_,n=c*e+h*r+d,i=p*e+y*r+v,a=f*e+m*r+g;s[t]=n/a,s[t+1]=i/a,u++}i.update()}function kT(t,e){const r=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],_=e[7],u=e[8];return t[0]=o*u-a*_,t[1]=i*_-n*u,t[2]=n*a-i*o,t[3]=a*l-s*u,t[4]=r*u-i*l,t[5]=i*s-r*a,t[6]=s*_-o*l,t[7]=n*l-r*_,t[8]=r*o-n*s,t}function UT(t,e,r){const n=e[0],i=e[1],s=e[2],o=e[3],a=e[4],l=e[5],_=e[6],u=e[7],c=e[8],h=r[0],d=r[1],p=r[2],y=r[3],v=r[4],f=r[5],m=r[6],g=r[7],x=r[8];return t[0]=h*n+d*o+p*_,t[1]=h*i+d*a+p*u,t[2]=h*s+d*l+p*c,t[3]=y*n+v*o+f*_,t[4]=y*i+v*a+f*u,t[5]=y*s+v*l+f*c,t[6]=m*n+g*o+x*_,t[7]=m*i+g*a+x*u,t[8]=m*s+g*l+x*c,t}const FT=[0,0,0,0,0,0,0,0,0],LT=[0,0,0],GT=[0,0,0];function jT(t,e,r,n,i,s,o,a,l){const _=FT;_[0]=e,_[1]=n,_[2]=s,_[3]=r,_[4]=i,_[5]=o,_[6]=1,_[7]=1,_[8]=1;const u=kT(t,_);GT[0]=a,GT[1]=l,GT[2]=1;const c=function(t,e,r){const n=r[0],i=r[1],s=r[2];return t[0]=e[0]*n+e[1]*i+e[2]*s,t[1]=e[3]*n+e[4]*i+e[5]*s,t[2]=e[6]*n+e[7]*i+e[8]*s,t}(LT,u,GT),h=t;return t[0]=c[0],t[1]=0,t[2]=0,t[3]=0,t[4]=c[1],t[5]=0,t[6]=0,t[7]=0,t[8]=c[2],UT(t,h,_)}const NT=[0,0,0,0,0,0,0,0,0],zT=[0,0,0,0,0,0,0,0,0];function WT(t,e,r,n,i,s,o,a,l,_,u,c,h,d,p,y,v){const f=jT(NT,e,r,s,o,_,u,d,p),m=jT(zT,n,i,a,l,c,h,y,v);return UT(t,kT(f,f),m)}class VT extends Lc{constructor(t){super(t),this._projectionMatrix=[0,0,0,0,0,0,0,0,0];const{width:e,height:r}=t;this.corners=[0,0,e,0,e,r,0,r]}setCorners(t,e,r,n,i,s,o,a){const l=this.corners;l[0]=t,l[1]=e,l[2]=r,l[3]=n,l[4]=i,l[5]=s,l[6]=o,l[7]=a,this.updateProjection()}updateProjection(){const{width:t,height:e}=this,r=this.corners;BT(t,e,this,WT(this._projectionMatrix,0,0,r[0],r[1],t,0,r[2],r[3],t,e,r[4],r[5],0,e,r[6],r[7]))}}var HT=Object.defineProperty,XT=Object.defineProperties,KT=Object.getOwnPropertyDescriptors,YT=Object.getOwnPropertySymbols,QT=Object.prototype.hasOwnProperty,$T=Object.prototype.propertyIsEnumerable,qT=(t,e,r)=>e in t?HT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ZT=(t,e)=>{for(var r in e||(e={}))QT.call(e,r)&&qT(t,r,e[r]);if(YT)for(var r of YT(e))$T.call(e,r)&&qT(t,r,e[r]);return t};const JT=class t extends Mf{constructor(e){const r=e=ZT(ZT({},t.defaultOptions),e),{texture:n,verticesX:i,verticesY:s}=r,o=((t,e)=>{var r={};for(var n in t)QT.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&YT)for(var n of YT(t))e.indexOf(n)<0&&$T.call(t,n)&&(r[n]=t[n]);return r})(r,["texture","verticesX","verticesY"]),a=new VT(Sr({width:n.width,height:n.height,verticesX:i,verticesY:s}));super(Sr(((t,e)=>XT(t,KT(e)))(ZT({},o),{geometry:a}))),this._texture=n,this.geometry.setCorners(e.x0,e.y0,e.x1,e.y1,e.x2,e.y2,e.x3,e.y3)}textureUpdated(){const t=this.geometry;if(!t)return;const{width:e,height:r}=this.texture;(t.width!==e||t.height!==r)&&(t.width=e,t.height=r,t.updateProjection())}set texture(t){this._texture!==t&&(super.texture=t,this.textureUpdated())}get texture(){return this._texture}setCorners(t,e,r,n,i,s,o,a){this.geometry.setCorners(t,e,r,n,i,s,o,a)}};JT.defaultOptions={texture:$r.WHITE,verticesX:10,verticesY:10,x0:0,y0:0,x1:100,y1:0,x2:100,y2:100,x3:0,y3:100};let tP=JT;var eP=Object.defineProperty,rP=Object.defineProperties,nP=Object.getOwnPropertyDescriptors,iP=Object.getOwnPropertySymbols,sP=Object.prototype.hasOwnProperty,oP=Object.prototype.propertyIsEnumerable,aP=(t,e,r)=>e in t?eP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var lP=Object.defineProperty,_P=Object.getOwnPropertySymbols,uP=Object.prototype.hasOwnProperty,cP=Object.prototype.propertyIsEnumerable,hP=(t,e,r)=>e in t?lP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,dP=(t,e)=>{for(var r in e||(e={}))uP.call(e,r)&&hP(t,r,e[r]);if(_P)for(var r of _P(e))cP.call(e,r)&&hP(t,r,e[r]);return t};const pP=class t extends ac{constructor(e){const{width:r,points:n,textureScale:i}=dP(dP({},t.defaultOptions),e);super({positions:new Float32Array(4*n.length),uvs:new Float32Array(4*n.length),indices:new Uint32Array(6*(n.length-1))}),this.points=n,this._width=r,this.textureScale=i,this._build()}get width(){return this._width}_build(){const t=this.points;if(!t)return;const e=this.getBuffer("aPosition"),r=this.getBuffer("aUV"),n=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(4*t.length),r.data=new Float32Array(4*t.length),n.data=new Uint16Array(6*(t.length-1)));const i=r.data,s=n.data;i[0]=0,i[1]=0,i[2]=0,i[3]=1;let o=0,a=t[0];const l=this._width*this.textureScale,_=t.length;for(let e=0;e<_;e++){const r=4*e;if(this.textureScale>0){const r=a.x-t[e].x,n=a.y-t[e].y,i=Math.sqrt(r*r+n*n);a=t[e],o+=i/l}else o=e/(_-1);i[r]=o,i[r+1]=0,i[r+2]=o,i[r+3]=1}let u=0;for(let t=0;t<_-1;t++){const e=2*t;s[u++]=e,s[u++]=e+1,s[u++]=e+2,s[u++]=e+2,s[u++]=e+1,s[u++]=e+3}r.update(),n.update(),this.updateVertices()}updateVertices(){const t=this.points;if(t.length<1)return;let e,r=t[0],n=0,i=0;const s=this.buffers[0].data,o=t.length,a=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let l=0;l<o;l++){const _=t[l],u=4*l;e=l<t.length-1?t[l+1]:_,i=-(e.x-r.x),n=e.y-r.y;let c=10*(1-l/(o-1));c>1&&(c=1);const h=Math.sqrt(n*n+i*i);h<1e-6?(n=0,i=0):(n/=h,i/=h,n*=a,i*=a),s[u]=_.x+n,s[u+1]=_.y+i,s[u+2]=_.x-n,s[u+3]=_.y-i,r=_}this.buffers[0].update()}update(){this.textureScale>0?this._build():this.updateVertices()}};pP.defaultOptions={width:200,points:[],textureScale:0};let yP=pP;var vP=Object.defineProperty,fP=Object.defineProperties,mP=Object.getOwnPropertyDescriptors,gP=Object.getOwnPropertySymbols,xP=Object.prototype.hasOwnProperty,bP=Object.prototype.propertyIsEnumerable,SP=(t,e,r)=>e in t?vP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,TP=(t,e)=>{for(var r in e||(e={}))xP.call(e,r)&&SP(t,r,e[r]);if(gP)for(var r of gP(e))bP.call(e,r)&&SP(t,r,e[r]);return t};const PP=class t extends Mf{constructor(e){const r=TP(TP({},t.defaultOptions),e),{texture:n,points:i,textureScale:s}=r,o=((t,e)=>{var r={};for(var n in t)xP.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&gP)for(var n of gP(t))e.indexOf(n)<0&&bP.call(t,n)&&(r[n]=t[n]);return r})(r,["texture","points","textureScale"]),a=new yP(Sr({width:n.height,points:i,textureScale:s}));s>0&&(n.source.style.addressMode="repeat"),super(Sr(((t,e)=>fP(t,mP(e)))(TP({},o),{texture:n,geometry:a}))),this.autoUpdate=!0,this.onRender=this._render}_render(){const t=this.geometry;(this.autoUpdate||t._width!==this.texture.height)&&(t._width=this.texture.height,t.update())}};PP.defaultOptions={textureScale:0};let OP=PP;var MP=Object.defineProperty,wP=Object.defineProperties,CP=Object.getOwnPropertyDescriptors,EP=Object.getOwnPropertySymbols,AP=Object.prototype.hasOwnProperty,RP=Object.prototype.propertyIsEnumerable,IP=(t,e,r)=>e in t?MP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var DP=Object.defineProperty,BP=Object.getOwnPropertySymbols,kP=Object.prototype.hasOwnProperty,UP=Object.prototype.propertyIsEnumerable,FP=(t,e,r)=>e in t?DP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,LP=(t,e)=>{for(var r in e||(e={}))kP.call(e,r)&&FP(t,r,e[r]);if(BP)for(var r of BP(e))UP.call(e,r)&&FP(t,r,e[r]);return t};const GP=class t{constructor(e){if(e instanceof $r)this.texture=e,Yt(this,t.defaultOptions,{});else{Yt(this,LP(LP({},t.defaultOptions),e),{})}}get alpha(){return this._alpha}set alpha(t){this._alpha=Math.min(Math.max(t,0),1),this._updateColor()}get tint(){const t=this._tint;return((255&t)<<16)+(65280&t)+(t>>16&255)}set tint(t){this._tint="number"==typeof t?t:Z.shared.setValue(null!=t?t:16777215).toBgrNumber(),this._updateColor()}_updateColor(){this.color=this._tint+(255*this._alpha<<24)}};GP.defaultOptions={anchorX:0,anchorY:0,x:0,y:0,scaleX:1,scaleY:1,rotation:0,tint:16777215,alpha:1};let jP=GP;const NP={vertex:{attributeName:"aVertex",format:"float32x2",code:"\n\t\t\t\tconst texture = p.texture;\n\t\t\t\tconst sx = p.scaleX;\n\t\t\t\tconst sy = p.scaleY;\n\t\t\t\tconst ax = p.anchorX;\n\t\t\t\tconst ay = p.anchorY;\n\t\t\t\tconst trim = texture.trim;\n\t\t\t\tconst orig = texture.orig;\n\t\n\t\t\t\tif (trim)\n\t\t\t\t{\n\t\t\t\t\tw1 = trim.x - (ax * orig.width);\n\t\t\t\t\tw0 = w1 + trim.width;\n\t\n\t\t\t\t\th1 = trim.y - (ay * orig.height);\n\t\t\t\t\th0 = h1 + trim.height;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tw1 = -ax * (orig.width);\n\t\t\t\t\tw0 = w1 + orig.width;\n\t\n\t\t\t\t\th1 = -ay * (orig.height);\n\t\t\t\t\th0 = h1 + orig.height;\n\t\t\t\t}\n\t\n\t\t\t\tf32v[offset] = w1 * sx;\n\t\t\t\tf32v[offset + 1] = h1 * sy;\n\t\n\t\t\t\tf32v[offset + stride] = w0 * sx;\n\t\t\t\tf32v[offset + stride + 1] = h1 * sy;\n\t\n\t\t\t\tf32v[offset + (stride * 2)] = w0 * sx;\n\t\t\t\tf32v[offset + (stride * 2) + 1] = h0 * sy;\n\t\n\t\t\t\tf32v[offset + (stride * 3)] = w1 * sx;\n\t\t\t\tf32v[offset + (stride * 3) + 1] = h0 * sy;\n\t\t\t",dynamic:!1},position:{attributeName:"aPosition",format:"float32x2",code:"\n\t\t\t\tvar x = p.x;\n\t\t\t\tvar y = p.y;\n\t\n\t\t\t\tf32v[offset] = x;\n\t\t\t\tf32v[offset + 1] = y;\n\t\n\t\t\t\tf32v[offset + stride] = x;\n\t\t\t\tf32v[offset + stride + 1] = y;\n\t\n\t\t\t\tf32v[offset + (stride * 2)] = x;\n\t\t\t\tf32v[offset + (stride * 2) + 1] = y;\n\t\n\t\t\t\tf32v[offset + (stride * 3)] = x;\n\t\t\t\tf32v[offset + (stride * 3) + 1] = y;\n\t\t\t",dynamic:!0},rotation:{attributeName:"aRotation",format:"float32",code:"\n\t\t\t\tvar rotation = p.rotation;\n\t\n\t\t\t\tf32v[offset] = rotation;\n\t\t\t\tf32v[offset + stride] = rotation;\n\t\t\t\tf32v[offset + (stride * 2)] = rotation;\n\t\t\t\tf32v[offset + (stride * 3)] = rotation;\n\t\t\t",dynamic:!1},uvs:{attributeName:"aUV",format:"float32x2",code:"\n\t\t\t\tvar uvs = p.texture.uvs;\n\t\n\t\t\t\tf32v[offset] = uvs.x0;\n\t\t\t\tf32v[offset + 1] = uvs.y0;\n\t\n\t\t\t\tf32v[offset + stride] = uvs.x1;\n\t\t\t\tf32v[offset + stride + 1] = uvs.y1;\n\t\n\t\t\t\tf32v[offset + (stride * 2)] = uvs.x2;\n\t\t\t\tf32v[offset + (stride * 2) + 1] = uvs.y2;\n\t\n\t\t\t\tf32v[offset + (stride * 3)] = uvs.x3;\n\t\t\t\tf32v[offset + (stride * 3) + 1] = uvs.y3;\n\t\t\t",dynamic:!1},color:{attributeName:"aColor",format:"unorm8x4",code:"\n\t\t\t\tconst c = p.color;\n\t\n\t\t\t\tu32v[offset] = c;\n\t\t\t\tu32v[offset + stride] = c;\n\t\t\t\tu32v[offset + (stride * 2)] = c;\n\t\t\t\tu32v[offset + (stride * 3)] = c;\n\t\t\t",dynamic:!1}};var zP=Object.defineProperty,WP=Object.defineProperties,VP=Object.getOwnPropertyDescriptors,HP=Object.getOwnPropertySymbols,XP=Object.prototype.hasOwnProperty,KP=Object.prototype.propertyIsEnumerable,YP=(t,e,r)=>e in t?zP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,QP=(t,e)=>{for(var r in e||(e={}))XP.call(e,r)&&YP(t,r,e[r]);if(HP)for(var r of HP(e))KP.call(e,r)&&YP(t,r,e[r]);return t},$P=(t,e)=>WP(t,VP(e));const qP={minX:0,minY:0,maxX:0,maxY:0},ZP=class t extends nn{constructor(e={}){const r=e=$P(QP(QP({},t.defaultOptions),e),{dynamicProperties:QP(QP({},t.defaultOptions.dynamicProperties),null==e?void 0:e.dynamicProperties)}),{dynamicProperties:n,shader:i,roundPixels:s,texture:o,particles:a}=r,l=((t,e)=>{var r={};for(var n in t)XP.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&HP)for(var n of HP(t))e.indexOf(n)<0&&KP.call(t,n)&&(r[n]=t[n]);return r})(r,["dynamicProperties","shader","roundPixels","texture","particles"]);super(QP({label:"ParticleContainer"},l)),this.renderPipeId="particle",this.batched=!1,this._childrenDirty=!1,this.texture=o||null,this.shader=i,this._properties={};for(const t in NP){const e=NP[t],r=n[t];this._properties[t]=$P(QP({},e),{dynamic:r})}this.allowChildren=!0,this.roundPixels=null!=s&&s,this.particleChildren=null!=a?a:[]}addParticle(...t){for(let e=0;e<t.length;e++)this.particleChildren.push(t[e]);return this.onViewUpdate(),t[0]}removeParticle(...t){let e=!1;for(let r=0;r<t.length;r++){const n=this.particleChildren.indexOf(t[r]);n>-1&&(this.particleChildren.splice(n,1),e=!0)}return e&&this.onViewUpdate(),t[0]}update(){this._childrenDirty=!0}onViewUpdate(){this._childrenDirty=!0,super.onViewUpdate()}get bounds(){return qP}addBounds(t){}destroy(t=!1){var e,r,n;if(super.destroy(t),"boolean"==typeof t?t:null==t?void 0:t.texture){const n="boolean"==typeof t?t:null==t?void 0:t.textureSource,i=null!=(r=this.texture)?r:null==(e=this.particleChildren[0])?void 0:e.texture;i&&i.destroy(n)}this.texture=null,null==(n=this.shader)||n.destroy()}removeParticles(t,e){const r=this.particleChildren.splice(t,e);return this.onViewUpdate(),r}removeParticleAt(t){const e=this.particleChildren.splice(t,1);return this.onViewUpdate(),e[0]}addParticleAt(t,e){return this.particleChildren.splice(e,0,t),this.onViewUpdate(),t}addChild(...t){throw new Error("ParticleContainer.addChild() is not available. Please use ParticleContainer.addParticle()")}removeChild(...t){throw new Error("ParticleContainer.removeChild() is not available. Please use ParticleContainer.removeParticle()")}removeChildren(t,e){throw new Error("ParticleContainer.removeChildren() is not available. Please use ParticleContainer.removeParticles()")}removeChildAt(t){throw new Error("ParticleContainer.removeChildAt() is not available. Please use ParticleContainer.removeParticleAt()")}getChildAt(t){throw new Error("ParticleContainer.getChildAt() is not available. Please use ParticleContainer.getParticleAt()")}setChildIndex(t,e){throw new Error("ParticleContainer.setChildIndex() is not available. Please use ParticleContainer.setParticleIndex()")}getChildIndex(t){throw new Error("ParticleContainer.getChildIndex() is not available. Please use ParticleContainer.getParticleIndex()")}addChildAt(t,e){throw new Error("ParticleContainer.addChildAt() is not available. Please use ParticleContainer.addParticleAt()")}swapChildren(t,e){throw new Error("ParticleContainer.swapChildren() is not available. Please use ParticleContainer.swapParticles()")}reparentChild(...t){throw new Error("ParticleContainer.reparentChild() is not available with the particle container")}reparentChildAt(t,e){throw new Error("ParticleContainer.reparentChildAt() is not available with the particle container")}};ZP.defaultOptions={dynamicProperties:{vertex:!1,position:!0,rotation:!1,uvs:!1,color:!1},roundPixels:!1};let JP=ZP;var tO=Object.defineProperty,eO=Object.getOwnPropertySymbols,rO=Object.prototype.hasOwnProperty,nO=Object.prototype.propertyIsEnumerable,iO=(t,e,r)=>e in t?tO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;const sO=class t extends nn{constructor(e){var r,n,i,s,o,a,l,_,u,c;e instanceof $r&&(e={texture:e});const h=e,{width:d,height:p,leftWidth:y,rightWidth:v,topHeight:f,bottomHeight:m,texture:g,roundPixels:x}=h,b=((t,e)=>{var r={};for(var n in t)rO.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&eO)for(var n of eO(t))e.indexOf(n)<0&&nO.call(t,n)&&(r[n]=t[n]);return r})(h,["width","height","leftWidth","rightWidth","topHeight","bottomHeight","texture","roundPixels"]);super(((t,e)=>{for(var r in e||(e={}))rO.call(e,r)&&iO(t,r,e[r]);if(eO)for(var r of eO(e))nO.call(e,r)&&iO(t,r,e[r]);return t})({label:"NineSliceSprite"},b)),this.renderPipeId="nineSliceSprite",this.batched=!0,this._leftWidth=null!=(n=null!=y?y:null==(r=null==g?void 0:g.defaultBorders)?void 0:r.left)?n:Xc.defaultOptions.leftWidth,this._topHeight=null!=(s=null!=f?f:null==(i=null==g?void 0:g.defaultBorders)?void 0:i.top)?s:Xc.defaultOptions.topHeight,this._rightWidth=null!=(a=null!=v?v:null==(o=null==g?void 0:g.defaultBorders)?void 0:o.right)?a:Xc.defaultOptions.rightWidth,this._bottomHeight=null!=(_=null!=m?m:null==(l=null==g?void 0:g.defaultBorders)?void 0:l.bottom)?_:Xc.defaultOptions.bottomHeight,this.bounds.maxX=this._width=null!=(u=null!=d?d:g.width)?u:Xc.defaultOptions.width,this.bounds.maxY=this._height=null!=(c=null!=p?p:g.height)?c:Xc.defaultOptions.height,this.allowChildren=!1,this.texture=null!=g?g:t.defaultOptions.texture,this.roundPixels=null!=x&&x}get bounds(){return this._bounds}get width(){return this._width}set width(t){this.bounds.maxX=this._width=t,this.onViewUpdate()}get height(){return this._height}set height(t){this.bounds.maxY=this._height=t,this.onViewUpdate()}setSize(t,e){var r;"object"==typeof t&&(e=null!=(r=t.height)?r:t.width,t=t.width),this.bounds.maxX=this._width=t,this.bounds.maxY=this._height=null!=e?e:t,this.onViewUpdate()}getSize(t){return t||(t={}),t.width=this._width,t.height=this._height,t}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this.onViewUpdate()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this.onViewUpdate()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this.onViewUpdate()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this.onViewUpdate()}get texture(){return this._texture}set texture(t){t||(t=$r.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this.onViewUpdate())}get originalWidth(){return this._texture.width}get originalHeight(){return this._texture.height}addBounds(t){const e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}destroy(t){if(super.destroy(t),"boolean"==typeof t?t:null==t?void 0:t.texture){const e="boolean"==typeof t?t:null==t?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null}};sO.defaultOptions={texture:$r.EMPTY};let oO=sO;var aO=Object.defineProperty,lO=Object.defineProperties,_O=Object.getOwnPropertyDescriptors,uO=Object.getOwnPropertySymbols,cO=Object.prototype.hasOwnProperty,hO=Object.prototype.propertyIsEnumerable,dO=(t,e,r)=>e in t?aO(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,pO=(t,e)=>{for(var r in e||(e={}))cO.call(e,r)&&dO(t,r,e[r]);if(uO)for(var r of uO(e))hO.call(e,r)&&dO(t,r,e[r]);return t},yO=(t,e)=>lO(t,_O(e));const vO=["#000080","#228B22","#8B0000","#4169E1","#008080","#800000","#9400D3","#FF8C00","#556B2F","#8B008B"];let fO=0;return t.AbstractBitmapFont=su,t.AbstractRenderer=mh,t.AbstractText=Qf,t.AccessibilitySystem=ge,t.AlphaFilter=nv,t.AlphaMask=yn,t.AlphaMaskPipe=ym,t.AnimatedSprite=Bf,t.Application=Lh,t.ApplicationInitHook=Ah,t.Assets=bp,t.AssetsClass=xp,t.BLEND_TO_NPM=$n,t.BUFFER_TYPE=mm,t.BackgroundLoader=Xh,t.BackgroundSystem=_b,t.Batch=oi,t.BatchGeometry=bi,t.BatchTextureArray=Jn,t.BatchableGraphics=xo,t.BatchableMesh=Ia,t.BatchableSprite=Ka,t.Batcher=di,t.BatcherPipe=am,t.BigPool=dt,t.BindGroup=Fn,t.BindGroupSystem=bS,t.BitmapFont=Gh,t.BitmapFontManager=Tu,t.BitmapText=Jf,t.BitmapTextPipe=Pu,t.BlendModeFilter=class extends By{constructor(t){const e=t.gpu,r=Vy(Wy({source:Fy},e)),n=ts.from({vertex:{source:r,entryPoint:"mainVertex"},fragment:{source:r,entryPoint:"mainFragment"}}),i=t.gl,s=Vy(Wy({source:ky},i));super({gpuProgram:n,glProgram:Wi.from({vertex:Uy,fragment:s}),blendRequired:!0,resources:{blendUniforms:new qs({uBlend:{value:1,type:"f32"}}),uBackTexture:$r.EMPTY}})}},t.BlendModePipe=cb,t.BlurFilter=wv,t.BlurFilterPass=mv,t.Bounds=At,t.BrowserAdapter=Ve,t.Buffer=yi,t.BufferImageSource=Kr,t.BufferResource=jg,t.BufferUsage=pi,t.CLEAR=oh,t.Cache=In,t.CanvasPool=$a,t.CanvasPoolClass=Qa,t.CanvasSource=mn,t.CanvasTextMetrics=N_,t.CanvasTextPipe=Ya,t.CanvasTextSystem=W_,t.Circle=xl,t.Color=Z,t.ColorMask=vn,t.ColorMaskPipe=vm,t.ColorMatrixFilter=class extends By{constructor(t={}){const e=new qs({uColorMatrix:{value:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],type:"f32",size:20},uAlpha:{value:1,type:"f32"}}),r=ts.from({vertex:{source:Ev,entryPoint:"mainVertex"},fragment:{source:Ev,entryPoint:"mainFragment"}}),n=Wi.from({vertex:Hy,fragment:Cv,name:"color-matrix-filter"});super(((t,e)=>Rv(t,Iv(e)))(((t,e)=>{for(var r in e||(e={}))Bv.call(e,r)&&Uv(t,r,e[r]);if(Dv)for(var r of Dv(e))kv.call(e,r)&&Uv(t,r,e[r]);return t})({},t),{gpuProgram:r,glProgram:n,resources:{colorMatrixUniforms:e}})),this.alpha=1}_loadMatrix(t,e=!1){let r=t;e&&(this._multiply(r,this.matrix,t),r=this._colorMatrix(r)),this.resources.colorMatrixUniforms.uniforms.uColorMatrix=r,this.resources.colorMatrixUniforms.update()}_multiply(t,e,r){return t[0]=e[0]*r[0]+e[1]*r[5]+e[2]*r[10]+e[3]*r[15],t[1]=e[0]*r[1]+e[1]*r[6]+e[2]*r[11]+e[3]*r[16],t[2]=e[0]*r[2]+e[1]*r[7]+e[2]*r[12]+e[3]*r[17],t[3]=e[0]*r[3]+e[1]*r[8]+e[2]*r[13]+e[3]*r[18],t[4]=e[0]*r[4]+e[1]*r[9]+e[2]*r[14]+e[3]*r[19]+e[4],t[5]=e[5]*r[0]+e[6]*r[5]+e[7]*r[10]+e[8]*r[15],t[6]=e[5]*r[1]+e[6]*r[6]+e[7]*r[11]+e[8]*r[16],t[7]=e[5]*r[2]+e[6]*r[7]+e[7]*r[12]+e[8]*r[17],t[8]=e[5]*r[3]+e[6]*r[8]+e[7]*r[13]+e[8]*r[18],t[9]=e[5]*r[4]+e[6]*r[9]+e[7]*r[14]+e[8]*r[19]+e[9],t[10]=e[10]*r[0]+e[11]*r[5]+e[12]*r[10]+e[13]*r[15],t[11]=e[10]*r[1]+e[11]*r[6]+e[12]*r[11]+e[13]*r[16],t[12]=e[10]*r[2]+e[11]*r[7]+e[12]*r[12]+e[13]*r[17],t[13]=e[10]*r[3]+e[11]*r[8]+e[12]*r[13]+e[13]*r[18],t[14]=e[10]*r[4]+e[11]*r[9]+e[12]*r[14]+e[13]*r[19]+e[14],t[15]=e[15]*r[0]+e[16]*r[5]+e[17]*r[10]+e[18]*r[15],t[16]=e[15]*r[1]+e[16]*r[6]+e[17]*r[11]+e[18]*r[16],t[17]=e[15]*r[2]+e[16]*r[7]+e[17]*r[12]+e[18]*r[17],t[18]=e[15]*r[3]+e[16]*r[8]+e[17]*r[13]+e[18]*r[18],t[19]=e[15]*r[4]+e[16]*r[9]+e[17]*r[14]+e[18]*r[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 r=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(r,e)}tint(t,e){const[r,n,i]=Z.shared.setValue(t).toArray(),s=[r,0,0,0,0,0,n,0,0,0,0,0,i,0,0,0,0,0,1,0];this._loadMatrix(s,e)}greyscale(t,e){const r=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(r,e)}grayscale(t,e){this.greyscale(t,e)}blackAndWhite(t){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],t)}hue(t,e){t=(t||0)/180*Math.PI;const r=Math.cos(t),n=Math.sin(t),i=1/3,s=(0,Math.sqrt)(i),o=[r+(1-r)*i,i*(1-r)-s*n,i*(1-r)+s*n,0,0,i*(1-r)+s*n,r+i*(1-r),i*(1-r)-s*n,0,0,i*(1-r)-s*n,i*(1-r)+s*n,r+i*(1-r),0,0,0,0,0,1,0];this._loadMatrix(o,e)}contrast(t,e){const r=(t||0)+1,n=-.5*(r-1),i=[r,0,0,0,n,0,r,0,0,n,0,0,r,0,n,0,0,0,1,0];this._loadMatrix(i,e)}saturate(t=0,e){const r=2*t/3+1,n=-.5*(r-1),i=[r,n,n,0,0,n,r,n,0,0,n,n,r,0,0,0,0,0,1,0];this._loadMatrix(i,e)}desaturate(){this.saturate(-1)}negative(t){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],t)}sepia(t){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],t)}technicolor(t){this._loadMatrix([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],t)}polaroid(t){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],t)}toBGR(t){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],t)}kodachrome(t){this._loadMatrix([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],t)}browni(t){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],t)}vintage(t){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],t)}colorTone(t,e,r,n,i){t=t||.2,e=e||.15,r=r||16770432,n=n||3375104;const s=Z.shared,[o,a,l]=s.setValue(r).toArray(),[_,u,c]=s.setValue(n).toArray(),h=[.3,.59,.11,0,0,o,a,l,t,0,_,u,c,e,0,o-_,a-u,l-c,0,0];this._loadMatrix(h,i)}night(t,e){const r=[-2*(t=t||.1),-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0];this._loadMatrix(r,e)}predator(t,e){const r=[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(r,e)}lsd(t){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],t)}reset(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)}get matrix(){return this.resources.colorMatrixUniforms.uniforms.uColorMatrix}set matrix(t){this.resources.colorMatrixUniforms.uniforms.uColorMatrix=t}get alpha(){return this.resources.colorMatrixUniforms.uniforms.uAlpha}set alpha(t){this.resources.colorMatrixUniforms.uniforms.uAlpha=t}},t.CompressedSource=Pp,t.Container=Zt,t.Culler=Py,t.CullerPlugin=Oy,t.CustomRenderPipe=Lx,t.D3D10_RESOURCE_DIMENSION=Wp,t.D3DFMT=Hp,t.DATA_URI=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i,t.DDS=Yp,t.DEG_TO_RAD=rt,t.DEPRECATED_SCALE_MODES=OT,t.DEPRECATED_WRAP_MODES=TT,t.DOMAdapter=Xe,t.DRAW_MODES=xT,t.DXGI_FORMAT=zp,t.DXGI_TO_TEXTURE_FORMAT=Kp,t.DefaultBatcher=uo,t.DefaultShader=ao,t.DisplacementFilter=class extends By{constructor(...t){let e=t[0];e instanceof un&&(e={sprite:e,scale:t[1]});const r=e,{sprite:n,scale:i}=r,s=((t,e)=>{var r={};for(var n in t)Vv.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&Wv)for(var n of Wv(t))e.indexOf(n)<0&&Hv.call(t,n)&&(r[n]=t[n]);return r})(r,["sprite","scale"]);let o=null!=i?i:20;"number"==typeof o&&(o=new nt(o,o));const a=new qs({uFilterMatrix:{value:new st,type:"mat3x3<f32>"},uScale:{value:o,type:"vec2<f32>"},uRotation:{value:new Float32Array([0,0,0,0]),type:"mat2x2<f32>"}}),l=Wi.from({vertex:Lv,fragment:Fv,name:"displacement-filter"}),_=ts.from({vertex:{source:Gv,entryPoint:"mainVertex"},fragment:{source:Gv,entryPoint:"mainFragment"}}),u=n.texture.source;super(((t,e)=>Nv(t,zv(e)))(((t,e)=>{for(var r in e||(e={}))Vv.call(e,r)&&Xv(t,r,e[r]);if(Wv)for(var r of Wv(e))Hv.call(e,r)&&Xv(t,r,e[r]);return t})({},s),{gpuProgram:_,glProgram:l,resources:{filterUniforms:a,uMapTexture:u,uMapSampler:u.style}})),this._sprite=e.sprite,this._sprite.renderable=!1}apply(t,e,r,n){const i=this.resources.filterUniforms.uniforms;t.calculateSpriteMatrix(i.uFilterMatrix,this._sprite);const s=this._sprite.worldTransform,o=Math.sqrt(s.a*s.a+s.b*s.b),a=Math.sqrt(s.c*s.c+s.d*s.d);0!==o&&0!==a&&(i.uRotation[0]=s.a/o,i.uRotation[1]=s.b/o,i.uRotation[2]=s.c/a,i.uRotation[3]=s.d/a),this.resources.uMapTexture=this._sprite.texture.source,t.applyFilter(this,e,r,n)}get scale(){return this.resources.filterUniforms.uniforms.uScale}},t.DynamicBitmapFont=pu,t.Ellipse=bl,t.EventBoundary=De,t.EventEmitter=f,t.EventSystem=Ne,t.EventsTicker=we,t.ExtensionType=c,t.ExtractSystem=xb,t.FOURCC_TO_TEXTURE_FORMAT=Xp,t.FederatedContainer=ze,t.FederatedEvent=Jt,t.FederatedMouseEvent=Ce,t.FederatedPointerEvent=Ee,t.FederatedWheelEvent=Ae,t.FillGradient=cl,t.FillPattern=dl,t.Filter=By,t.FilterEffect=vt,t.FilterPipe=Yc,t.FilterSystem=th,t.FontStylePromiseCache=Xu,t.GAUSSIAN_VALUES=iv,t.GL_FORMATS=Dm,t.GL_INTERNAL_FORMAT=Zp,t.GL_TARGETS=Bm,t.GL_TYPES=Um,t.GL_WRAP_MODES=km,t.GenerateTextureSystem=Ib,t.Geometry=mi,t.GlBackBufferSystem=Qm,t.GlBatchAdaptor=nm,t.GlBuffer=gm,t.GlBufferSystem=xm,t.GlColorMaskSystem=$m,t.GlContextSystem=Rm,t.GlEncoderSystem=qm,t.GlGeometrySystem=jm,t.GlGraphicsAdaptor=Ux,t.GlMeshAdaptor=Fx,t.GlParticleContainerAdaptor=Ba,t.GlParticleContainerPipe=Va,t.GlProgram=Wi,t.GlProgramData=zg,t.GlRenderTarget=Zm,t.GlRenderTargetAdaptor=gg,t.GlRenderTargetSystem=Gg,t.GlShaderSystem=ix,t.GlStateSystem=hx,t.GlStencilSystem=tg,t.GlTexture=dx,t.GlTextureSystem=kx,t.GlUboSystem=mg,t.GlUniformGroupSystem=lx,t.GlobalUniformSystem=Db,t.GpuBatchAdaptor=sm,t.GpuBlendModesToPixi=tT,t.GpuBufferSystem=SS,t.GpuColorMaskSystem=PS,t.GpuDeviceSystem=OS,t.GpuEncoderSystem=IS,t.GpuGraphicsAdaptor=uT,t.GpuGraphicsContext=Ta,t.GpuMeshAdapter=cT,t.GpuMipmapGenerator=lT,t.GpuParticleContainerAdaptor=Ha,t.GpuParticleContainerPipe=Xa,t.GpuProgram=ts,t.GpuReadBuffer=function(t,e){const r=t.descriptor.size,n=e.gpu.device,i=new yi({data:new Float32Array(24e5),usage:pi.MAP_READ|pi.COPY_DST}),s=e.buffer.createGPUBuffer(i),o=n.createCommandEncoder();o.copyBufferToBuffer(e.buffer.getGPUBuffer(t),0,s,0,r),n.queue.submit([o.finish()]),s.mapAsync(GPUMapMode.READ,0,r).then((()=>{s.getMappedRange(0,r),s.unmap()}))},t.GpuRenderTarget=$S,t.GpuRenderTargetAdaptor=qS,t.GpuRenderTargetSystem=ZS,t.GpuShaderSystem=JS,t.GpuStateSystem=eT,t.GpuStencilModesToPixi=Jm,t.GpuStencilSystem=DS,t.GpuTextureSystem=_T,t.GpuUboSystem=LS,t.GpuUniformBatchPipe=jS,t.Graphics=Q_,t.GraphicsContext=b_,t.GraphicsContextRenderData=Pa,t.GraphicsContextSystem=Ma,t.GraphicsPath=Wl,t.GraphicsPipe=Ra,t.HTMLText=tm,t.HTMLTextPipe=Mu,t.HTMLTextRenderData=Au,t.HTMLTextStyle=zu,t.HTMLTextSystem=Ju,t.HelloSystem=Lb,t.IGLUniformData=class{},t.ImageSource=gn,t.InstructionSet=Xt,t.KTX=ey,t.Loader=cd,t.LoaderParserPriority=We,t.MSAA_QUALITY=ST,t.MaskEffectManager=mt,t.MaskEffectManagerClass=ft,t.MaskFilter=vf,t.Matrix=st,t.Mesh=Mf,t.MeshGeometry=ac,t.MeshPipe=Da,t.MeshPlane=class extends Mf{constructor(t){const e=t,{texture:r,verticesX:n,verticesY:i}=e,s=((t,e)=>{var r={};for(var n in t)sP.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&iP)for(var n of iP(t))e.indexOf(n)<0&&oP.call(t,n)&&(r[n]=t[n]);return r})(e,["texture","verticesX","verticesY"]),o=new Lc(Sr({width:r.width,height:r.height,verticesX:n,verticesY:i}));super(Sr(((t,e)=>rP(t,nP(e)))(((t,e)=>{for(var r in e||(e={}))sP.call(e,r)&&aP(t,r,e[r]);if(iP)for(var r of iP(e))oP.call(e,r)&&aP(t,r,e[r]);return t})({},s),{geometry:o,texture:r}))),this.texture=r,this.autoResize=!0}textureUpdated(){const t=this.geometry,{width:e,height:r}=this.texture;this.autoResize&&(t.width!==e||t.height!==r)&&(t.width=e,t.height=r,t.build({}))}set texture(t){var e;null==(e=this._texture)||e.off("update",this.textureUpdated,this),super.texture=t,t.on("update",this.textureUpdated,this),this.textureUpdated()}get texture(){return this._texture}destroy(t){this.texture.off("update",this.textureUpdated,this),super.destroy(t)}},t.MeshRope=OP,t.MeshSimple=class extends Mf{constructor(t){const e=t,{texture:r,vertices:n,uvs:i,indices:s,topology:o}=e,a=((t,e)=>{var r={};for(var n in t)AP.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&EP)for(var n of EP(t))e.indexOf(n)<0&&RP.call(t,n)&&(r[n]=t[n]);return r})(e,["texture","vertices","uvs","indices","topology"]),l=new ac(Sr({positions:n,uvs:i,indices:s,topology:o}));super(Sr(((t,e)=>wP(t,CP(e)))(((t,e)=>{for(var r in e||(e={}))AP.call(e,r)&&IP(t,r,e[r]);if(EP)for(var r of EP(e))RP.call(e,r)&&IP(t,r,e[r]);return t})({},a),{texture:r,geometry:l}))),this.autoUpdate=!0,this.onRender=this._render}get vertices(){return this.geometry.getBuffer("aPosition").data}set vertices(t){this.geometry.getBuffer("aPosition").data=t}_render(){this.autoUpdate&&this.geometry.getBuffer("aPosition").update()}},t.NOOP=gr,t.NineSliceGeometry=Xc,t.NineSlicePlane=class extends oO{constructor(...t){let e=t[0];e instanceof $r&&(e={texture:e,leftWidth:t[1],topHeight:t[2],rightWidth:t[3],bottomHeight:t[4]}),super(e)}},t.NineSliceSprite=oO,t.NineSliceSpritePipe=Kc,t.NoiseFilter=sf,t.ObservablePoint=lt,t.PI_2=tt,t.Particle=jP,t.ParticleBuffer=La,t.ParticleContainer=JP,t.ParticleContainerPipe=Wa,t.ParticleShader=za,t.PerspectiveMesh=tP,t.PerspectivePlaneGeometry=VT,t.PipelineSystem=QS,t.PlaneGeometry=Lc,t.Point=nt,t.Polygon=Tl,t.Pool=ct,t.PoolGroupClass=ht,t.PrepareBase=xf,t.PrepareQueue=Zf,t.PrepareSystem=rm,t.PrepareUpload=em,t.QuadGeometry=Oc,t.RAD_TO_DEG=et,t.Rectangle=Ct,t.RenderContainer=class extends Zt{constructor(t){var e,r;"function"==typeof t&&(t={render:t});const n=t,{render:i}=n,s=((t,e)=>{var r={};for(var n in t)AT.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&ET)for(var n of ET(t))e.indexOf(n)<0&&RT.call(t,n)&&(r[n]=t[n]);return r})(n,["render"]);super(((t,e)=>{for(var r in e||(e={}))AT.call(e,r)&&IT(t,r,e[r]);if(ET)for(var r of ET(e))RT.call(e,r)&&IT(t,r,e[r]);return t})({label:"RenderContainer"},s)),this.batched=!1,this._lastUsed=0,this._lastInstructionTick=-1,this.bounds=new At,this.canBundle=!1,this.renderPipeId="customRender",i&&(this.render=i),this.containsPoint=null!=(e=t.containsPoint)?e:()=>!1,this.addBounds=null!=(r=t.addBounds)?r:()=>!1}render(t){}},t.RenderGroup=Kt,t.RenderGroupPipe=jx,t.RenderGroupSystem=Jx,t.RenderTarget=Fg,t.RenderTargetSystem=Lg,t.RenderTexture=bb,t.RenderableGCSystem=Yb,t.RendererInitHook=Rh,t.RendererType=to,t.ResizePlugin=be,t.Resolver=lr,t.RopeGeometry=yP,t.RoundedRectangle=Ol,t.SCALE_MODES=MT,t.STENCIL_MODES=qn,t.SVGParser=ql,t.SVGToGraphicsPath=gl,t.SchedulerSystem=kb,t.ScissorMask=class{constructor(t){this.priority=0,this.pipe="scissorMask",this.mask=t,this.mask.renderable=!1,this.mask.measurable=!1}addBounds(t,e){hn(this.mask,t,e)}addLocalBounds(t,e){dn(this.mask,t,e)}containsPoint(t,e){return e(this.mask,t)}reset(){this.mask.measurable=!0,this.mask=null}destroy(){this.reset()}},t.SdfShader=ru,t.Shader=oo,t.ShaderStage=Qi,t.ShapePath=zl,t.SharedRenderPipes=hS,t.SharedSystems=cS,t.Sprite=un,t.SpritePipe=eb,t.Spritesheet=Zr,t.State=Ea,t.StencilMask=fn,t.StencilMaskPipe=fm,t.SystemRunner=ah,t.TEXTURE_FORMAT_BLOCK_SIZE=Qp,t.Text=qf,t.TextStyle=B_,t.Texture=$r,t.TextureGCSystem=rS,t.TextureMatrix=Qr,t.TexturePool=ol,t.TexturePoolClass=sl,t.TextureSource=Gr,t.TextureStyle=Rr,t.TextureUvs=class{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,r){const n=e.width,i=e.height;if(r){const e=t.width/2/n,s=t.height/2/i,o=t.x/n+e,a=t.y/i+s;r=mr.add(r,mr.NW),this.x0=o+e*mr.uX(r),this.y0=a+s*mr.uY(r),r=mr.add(r,2),this.x1=o+e*mr.uX(r),this.y1=a+s*mr.uY(r),r=mr.add(r,2),this.x2=o+e*mr.uX(r),this.y2=a+s*mr.uY(r),r=mr.add(r,2),this.x3=o+e*mr.uX(r),this.y3=a+s*mr.uY(r)}else this.x0=t.x/n,this.y0=t.y/i,this.x1=(t.x+t.width)/n,this.y1=t.y/i,this.x2=(t.x+t.width)/n,this.y2=(t.y+t.height)/i,this.x3=t.x/n,this.y3=(t.y+t.height)/i;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}},t.Ticker=Oe,t.TickerListener=Te,t.TickerPlugin=Me,t.TilingSprite=Wf,t.TilingSpritePipe=Ac,t.TilingSpriteShader=Pc,t.Transform=kf,t.Triangle=mf,t.UNIFORM_TO_ARRAY_SETTERS=ox,t.UNIFORM_TO_SINGLE_SETTERS=sx,t.UNIFORM_TYPES_MAP=zs,t.UNIFORM_TYPES_VALUES=Ns,t.UPDATE_BLEND=2,t.UPDATE_COLOR=1,t.UPDATE_PRIORITY=Se,t.UPDATE_TRANSFORM=8,t.UPDATE_VISIBLE=4,t.UboBatch=TS,t.UboSystem=eg,t.UniformGroup=qs,t.VERSION=Eh,t.VideoSource=Rn,t.ViewContainer=nn,t.ViewSystem=uS,t.ViewableBuffer=Yn,t.WGSL_ALIGN_SIZE_DATA=BS,t.WGSL_TO_STD40_SIZE=rg,t.WRAP_MODES=PT,t.WebGLRenderer=gS,t.WebGPURenderer=mT,t.WorkerManager=Kd,t._getGlobalBounds=Bt,t._getGlobalBoundsRecursive=qc,t.accessibilityTarget=xe,t.addBits=es,t.addMaskBounds=hn,t.addMaskLocalBounds=dn,t.addProgramDefines=wi,t.alphaFrag=Xy,t.alphaWgsl=Ky,t.applyMatrix=wc,t.applyProjectiveTransformationToPlane=BT,t.applyStyleParams=Tx,t.assignWithIgnore=Yt,t.autoDetectEnvironment=async function(t){return nh(!t)},t.autoDetectRenderer=Ch,t.autoDetectSource=function(t={}){return Bn(t)},t.basisTranscoderUrls=Up,t.bitmapFontCachePlugin=Vh,t.bitmapFontTextParser=jh,t.bitmapFontXMLParser=Nh,t.bitmapFontXMLStringParser=zh,t.blendTemplateFrag=ky,t.blendTemplateVert=Uy,t.blendTemplateWgsl=Fy,t.blockDataMap=nT,t.blurTemplateWgsl=_v,t.boundsPool=It,t.browserExt=My,t.buildAdaptiveBezier=wl,t.buildAdaptiveQuadratic=El,t.buildArc=Rl,t.buildArcTo=Il,t.buildArcToSvg=Ll,t.buildCircle=Ao,t.buildContextBatches=xa,t.buildEllipse=Ro,t.buildGeometryFromPath=function(t){t instanceof Wl&&(t={path:t,textureMatrix:null,out:null});const e=[],r=[],n=[],i=t.path.shapePath,s=t.textureMatrix;i.shapePrimitives.forEach((({shape:t,transform:i})=>{const o=n.length,a=e.length/2,l=[],_=DT[t.type];_.build(t,l),i&&fo(l,i),_.triangulate(l,e,2,a,n,o);const u=r.length/2;s?(i&&s.append(i.clone().invert()),yo(e,2,a,r,u,2,e.length/2-a,s)):vo(r,u,2,e.length/2-a)}));const o=t.out;return o?(o.positions=new Float32Array(e),o.uvs=new Float32Array(r),o.indices=new Uint32Array(n),o):new ac({positions:new Float32Array(e),uvs:new Float32Array(r),indices:new Uint32Array(n)})},t.buildInstructions=um,t.buildLine=Lo,t.buildPolygon=ya,t.buildRectangle=va,t.buildRoundedRectangle=Io,t.buildSimpleUvs=vo,t.buildTriangle=fa,t.buildUvs=yo,t.cacheTextureArray=Kh,t.calculateProjection=xg,t.checkChildrenDidChange=Lt,t.checkDataUrl=hd,t.checkExtension=dd,t.checkMaxIfStatementsInShader=zn,t.childrenHelperMixin=yt,t.cleanArray=jb,t.cleanHash=Gb,t.clearList=Nx,t.closePointEps=Do,t.collectAllRenderables=cm,t.collectRenderGroups=zx,t.color32BitToUniform=Aa,t.colorBit=As,t.colorBitGl=Rs,t.colorMatrixFilterFrag=Cv,t.colorMatrixFilterWgsl=Ev,t.colorToUniform=function(t,e,r,n){r[n++]=(t>>16&255)/255,r[n++]=(t>>8&255)/255,r[n++]=(255&t)/255,r[n++]=e},t.compareModeToGlCompare=Sx,t.compileHighShader=hs,t.compileHighShaderGl=ds,t.compileHighShaderGlProgram=Es,t.compileHighShaderGpuProgram=Cs,t.compileHooks=ns,t.compileInputs=ss,t.compileOutputs=as,t.compileShader=Wg,t.compute2DProjection=WT,t.convertFormatIfRequired=function(t){const e=t.format;if(cy[e]){const r=cy[e].convertFunction,n=t.resource;for(let t=0;t<n.length;t++)n[t]=r(n[t]);t.format=cy[e].convertedFormat}},t.convertToList=$e,t.copySearchParams=ur,t.createIdFromString=Pi,t.createIndicesForQuads=ka,t.createLevelBuffers=function(t,e){const r=t.getNumImages(),n=t.getNumLevels(0);if(!t.startTranscoding())throw new Error("startTranscoding failed");const i=[];for(let s=0;s<n;++s)for(let n=0;n<r;++n){const r=t.getImageTranscodedSizeInBytes(n,s,e),o=new Uint8Array(r);if(!t.transcodeImage(o,n,s,e,1,0))throw new Error("transcodeImage failed");i.push(o)}return i},t.createLevelBuffersFromKTX=function(t){const e=[];for(let r=0;r<t.numLevels;r++){const n=t.getImageData(r,0,0),i=new Uint8Array(n.byteLength);i.set(n),e.push(i)}return e},t.createStringVariations=Ze,t.createTexture=Bd,t.createUboElementsSTD40=ng,t.createUboElementsWGSL=kS,t.createUboSyncFunction=sg,t.createUboSyncFunctionSTD40=fg,t.createUboSyncFunctionWGSL=FS,t.crossOrigin=pp,t.cullingMixin=J,t.curveEps=Bo,t.defaultFilterVert=Hy,t.defaultValue=Hg,t.definedProps=Sr,t.deprecation=po,t.detectAvif=Qh,t.detectBasis=Tp,t.detectCompressed=by,t.detectDefaults=qh,t.detectMp4=td,t.detectOgv=ed,t.detectVideoAlphaMode=bn,t.detectWebm=rd,t.detectWebp=nd,t.determineCrossOrigin=vp,t.displacementFrag=Fv,t.displacementVert=Lv,t.displacementWgsl=Gv,t.earcut=ha,t.effectsMixin=Ot,t.ensureAttributes=Im,t.ensureIsBuffer=vi,t.ensureOptions=$f,t.ensurePrecision=Ci,t.ensureTextStyle=function(t,e){return e instanceof B_||e instanceof zu?e:"html"===t?new zu(e):new B_(e)},t.executeInstructions=Gx,t.extensions=p,t.extractAttributesFromGlProgram=qg,t.extractAttributesFromGpuProgram=Ki,t.extractFontFamilies=Wu,t.extractStructAndGroups=Yi,t.fastCopy=Qn,t.findHooksRx=rs,t.findMixin=Mt,t.fontStringFromTextStyle=L_,t.formatShader=function(t){const e=t.split(/([\n{}])/g).map((t=>t.trim())).filter((t=>t.length));let r="";return e.map((t=>{let e=r+t;return"{"===t?r+=" ":"}"===t&&(r=r.substr(0,r.length-4),e=r+t),e})).join("\n\t")},t.fragmentGPUTemplate=fs,t.fragmentGlTemplate=gs,t.generateArraySyncSTD40=vg,t.generateArraySyncWGSL=US,t.generateBlurFragSource=ov,t.generateBlurGlProgram=lv,t.generateBlurProgram=uv,t.generateBlurVertSource=av,t.generateGPULayout=function(t){const e=[];let r=0;for(let n=0;n<t;n++)e[r]={texture:{sampleType:"float",viewDimension:"2d",multisampled:!1},binding:r,visibility:GPUShaderStage.FRAGMENT},r++,e[r]={sampler:{type:"filtering"},binding:r,visibility:GPUShaderStage.FRAGMENT},r++;return e},t.generateGpuLayoutGroups=$i,t.generateLayout=function(t){const e={};let r=0;for(let n=0;n<t;n++)e[`textureSource${n+1}`]=r++,e[`textureSampler${n+1}`]=r++;return e},t.generateLayoutHash=qi,t.generateParticleUpdateFunction=Ua,t.generateProgram=rx,t.generateShaderSyncCode=Ng,t.generateTextStyleKey=T_,t.generateTextureBatchBit=ks,t.generateTextureBatchBitGl=Ls,t.generateUID=function(){return wT++},t.generateUniformsSync=ax,t.getAdjustedBlendModeBlend=Zn,t.getAttributeInfoFromFormat=Hi,t.getBatchSamplersUniformGroup=Js,t.getBitmapTextLayout=yu,t.getCanvasBoundingBox=_l,t.getCanvasFillStyle=z_,t.getCanvasTexture=Cg,t.getDefaultUniformValue=Ws,t.getFastGlobalBounds=$c,t.getFontCss=Ku,t.getFontFamilyName=Ed,t.getGeometryBounds=fi,t.getGlTypeFromFormat=Lm,t.getGlobalBounds=Dt,t.getGlobalRenderableBounds=Zc,t.getLocalBounds=Ut,t.getMatrixRelativeToParent=pn,t.getMaxFragmentPrecision=Mi,t.getMaxTexturesPerBatch=Vn,t.getOrientationOfPoints=ko,t.getParent=function t(e,r,n){const i=e.parent;i&&i!==r&&(t(i,r,n),i.updateLocalTransform(),n.append(i.localTransform))},t.getPo2TextureFromSource=U_,t.getResolutionOfUrl=Dd,t.getSVGUrl=Yu,t.getSupportedCompressedTextureFormats=Ap,t.getSupportedGPUCompressedTextureFormats=Ep,t.getSupportedGlCompressedTextureFormats=Cp,t.getSupportedTextureFormats=Dp,t.getTemporaryCanvasFromImage=Qu,t.getTestContext=Gn,t.getTextureBatchBindGroup=Xn,t.getTextureDefaultMatrix=function(t,e){const{width:r,height:n}=t.frame;return e.scale(1/r,1/n),e},t.getTextureFormatFromKTXTexture=function(t){return 2===t.classId?vy(t.vkFormat):py(t.glInternalformat)},t.getUboData=Zg,t.getUniformData=Jg,t.getUrlExtension=_r,t.glFormatToGPUFormat=py,t.glUploadBufferImageResource=px,t.glUploadCompressedTextureResource=vx,t.glUploadImageResource=fx,t.glUploadVideoResource=mx,t.globalUniformsBit=xs,t.globalUniformsBitGl=Ss,t.globalUniformsUBOBitGl=bs,t.gpuFormatToBasisTranscoderFormat=function(t){const e=Np[t];if(e)return e;throw new Error(`Unsupported transcoderFormat: ${t}`)},t.gpuFormatToKTXBasisTranscoderFormat=function(t){const e=fy[t];if(e)return e;throw new Error(`Unsupported transcoderFormat: ${t}`)},t.gpuUploadBufferImageResource=rT,t.gpuUploadCompressedTextureResource=sT,t.gpuUploadImageResource=oT,t.gpuUploadVideoResource=aT,t.groupD8=mr,t.hasCachedCanvasTexture=function(t){return wg.has(t)},t.hslWgsl="fn getLuminosity(c: vec3<f32>) -> f32 {\n\t return 0.3 * c.r + 0.59 * c.g + 0.11 * c.b;\n\t}\n\t\n\tfn setLuminosity(c: vec3<f32>, lum: f32) -> vec3<f32> {\n\t let d: f32 = lum - getLuminosity(c);\n\t let newColor: vec3<f32> = c.rgb + vec3<f32>(d, d, d);\n\t\n\t // clip back into legal range\n\t let newLum: f32 = getLuminosity(newColor);\n\t let cMin: f32 = min(newColor.r, min(newColor.g, newColor.b));\n\t let cMax: f32 = max(newColor.r, max(newColor.g, newColor.b));\n\t\n\t let t1: f32 = newLum / (newLum - cMin);\n\t let t2: f32 = (1.0 - newLum) / (cMax - newLum);\n\t\n\t let finalColor = mix(vec3<f32>(newLum, newLum, newLum), newColor, select(select(1.0, t2, cMax > 1.0), t1, cMin < 0.0));\n\t\n\t return finalColor;\n\t}\n\t\n\tfn getSaturation(c: vec3<f32>) -> f32 {\n\t return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b));\n\t}\n\t\n\t// Set saturation if color components are sorted in ascending order.\n\tfn setSaturationMinMidMax(cSorted: vec3<f32>, s: f32) -> vec3<f32> {\n\t var result: vec3<f32>;\n\t if (cSorted.z > cSorted.x) {\n\t\tlet newY = (((cSorted.y - cSorted.x) * s) / (cSorted.z - cSorted.x));\n\t\tresult = vec3<f32>(0.0, newY, s);\n\t } else {\n\t\tresult = vec3<f32>(0.0, 0.0, 0.0);\n\t }\n\t return vec3<f32>(result.x, result.y, result.z);\n\t}\n\t\n\tfn setSaturation(c: vec3<f32>, s: f32) -> vec3<f32> {\n\t\tvar result: vec3<f32> = c;\n\t\n\t\tif (c.r <= c.g && c.r <= c.b) {\n\t\t\tif (c.g <= c.b) {\n\t\t\t\tresult = setSaturationMinMidMax(result, s);\n\t\t\t} else {\n\t\t\t\tvar temp: vec3<f32> = vec3<f32>(result.r, result.b, result.g);\n\t\t\t\ttemp = setSaturationMinMidMax(temp, s);\n\t\t\t\tresult = vec3<f32>(temp.r, temp.b, temp.g);\n\t\t\t}\n\t\t} else if (c.g <= c.r && c.g <= c.b) {\n\t\t\tif (c.r <= c.b) {\n\t\t\t\tvar temp: vec3<f32> = vec3<f32>(result.g, result.r, result.b);\n\t\t\t\ttemp = setSaturationMinMidMax(temp, s);\n\t\t\t\tresult = vec3<f32>(temp.g, temp.r, temp.b);\n\t\t\t} else {\n\t\t\t\tvar temp: vec3<f32> = vec3<f32>(result.g, result.b, result.r);\n\t\t\t\ttemp = setSaturationMinMidMax(temp, s);\n\t\t\t\tresult = vec3<f32>(temp.g, temp.b, temp.r);\n\t\t\t}\n\t\t} else {\n\t\t\tif (c.r <= c.g) {\n\t\t\t\tvar temp: vec3<f32> = vec3<f32>(result.b, result.r, result.g);\n\t\t\t\ttemp = setSaturationMinMidMax(temp, s);\n\t\t\t\tresult = vec3<f32>(temp.b, temp.r, temp.g);\n\t\t\t} else {\n\t\t\t\tvar temp: vec3<f32> = vec3<f32>(result.b, result.g, result.r);\n\t\t\t\ttemp = setSaturationMinMidMax(temp, s);\n\t\t\t\tresult = vec3<f32>(temp.b, temp.g, temp.r);\n\t\t\t}\n\t\t}\n\t\n\t\treturn result;\n\t}",t.hslgl="\n\t\tfloat getLuminosity(vec3 c) {\n\t\t\treturn 0.3 * c.r + 0.59 * c.g + 0.11 * c.b;\n\t\t}\n\t\n\t\tvec3 setLuminosity(vec3 c, float lum) {\n\t\t\tfloat modLum = lum - getLuminosity(c);\n\t\t\tvec3 color = c.rgb + vec3(modLum);\n\t\n\t\t\t// clip back into legal range\n\t\t\tmodLum = getLuminosity(color);\n\t\t\tvec3 modLumVec = vec3(modLum);\n\t\n\t\t\tfloat cMin = min(color.r, min(color.g, color.b));\n\t\t\tfloat cMax = max(color.r, max(color.g, color.b));\n\t\n\t\t\tif(cMin < 0.0) {\n\t\t\t\tcolor = mix(modLumVec, color, modLum / (modLum - cMin));\n\t\t\t}\n\t\n\t\t\tif(cMax > 1.0) {\n\t\t\t\tcolor = mix(modLumVec, color, (1.0 - modLum) / (cMax - modLum));\n\t\t\t}\n\t\n\t\t\treturn color;\n\t\t}\n\t\n\t\tfloat getSaturation(vec3 c) {\n\t\t\treturn max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b));\n\t\t}\n\t\n\t\tvec3 setSaturationMinMidMax(vec3 cSorted, float s) {\n\t\t\tvec3 colorSorted = cSorted;\n\t\n\t\t\tif(colorSorted.z > colorSorted.x) {\n\t\t\t\tcolorSorted.y = (((colorSorted.y - colorSorted.x) * s) / (colorSorted.z - colorSorted.x));\n\t\t\t\tcolorSorted.z = s;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcolorSorted.y = 0.0;\n\t\t\t\tcolorSorted.z = 0.0;\n\t\t\t}\n\t\n\t\t\tcolorSorted.x = 0.0;\n\t\n\t\t\treturn colorSorted;\n\t\t}\n\t\n\t\tvec3 setSaturation(vec3 c, float s) {\n\t\t\tvec3 color = c;\n\t\n\t\t\tif(color.r <= color.g && color.r <= color.b) {\n\t\t\t\tif(color.g <= color.b) {\n\t\t\t\t\tcolor = setSaturationMinMidMax(color.rgb, s).rgb;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tcolor = setSaturationMinMidMax(color.rbg, s).rbg;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(color.g <= color.r && color.g <= color.b) {\n\t\t\t\tif(color.r <= color.b) {\n\t\t\t\t\tcolor = setSaturationMinMidMax(color.grb, s).grb;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tcolor = setSaturationMinMidMax(color.gbr, s).gbr;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Using bgr for both fixes part of hue\n\t\t\t\tif(color.r <= color.g) {\n\t\t\t\t\tcolor = setSaturationMinMidMax(color.brg, s).brg;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tcolor = setSaturationMinMidMax(color.bgr, s).bgr;\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn color;\n\t\t}\n\t\t",t.hslgpu="\n\t\tfn getLuminosity(c: vec3<f32>) -> f32\n\t\t{\n\t\t\treturn 0.3*c.r + 0.59*c.g + 0.11*c.b;\n\t\t}\n\t\n\t\tfn setLuminosity(c: vec3<f32>, lum: f32) -> vec3<f32>\n\t\t{\n\t\t\tvar modLum: f32 = lum - getLuminosity(c);\n\t\t\tvar color: vec3<f32> = c.rgb + modLum;\n\t\n\t\t\t// clip back into legal range\n\t\t\tmodLum = getLuminosity(color);\n\t\t\tlet modLumVec = vec3<f32>(modLum);\n\t\n\t\t\tlet cMin: f32 = min(color.r, min(color.g, color.b));\n\t\t\tlet cMax: f32 = max(color.r, max(color.g, color.b));\n\t\n\t\t\tif(cMin < 0.0)\n\t\t\t{\n\t\t\t\tcolor = mix(modLumVec, color, modLum / (modLum - cMin));\n\t\t\t}\n\t\n\t\t\tif(cMax > 1.0)\n\t\t\t{\n\t\t\t\tcolor = mix(modLumVec, color, (1 - modLum) / (cMax - modLum));\n\t\t\t}\n\t\n\t\t\treturn color;\n\t\t}\n\t\n\t\tfn getSaturation(c: vec3<f32>) -> f32\n\t\t{\n\t\t\treturn max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b));\n\t\t}\n\t\n\t\tfn setSaturationMinMidMax(cSorted: vec3<f32>, s: f32) -> vec3<f32>\n\t\t{\n\t\t\tvar colorSorted = cSorted;\n\t\n\t\t\tif(colorSorted.z > colorSorted.x)\n\t\t\t{\n\t\t\t\tcolorSorted.y = (((colorSorted.y - colorSorted.x) * s) / (colorSorted.z - colorSorted.x));\n\t\t\t\tcolorSorted.z = s;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcolorSorted.y = 0;\n\t\t\t\tcolorSorted.z = 0;\n\t\t\t}\n\t\n\t\t\tcolorSorted.x = 0;\n\t\n\t\t\treturn colorSorted;\n\t\t}\n\t\n\t\tfn setSaturation(c: vec3<f32>, s: f32) -> vec3<f32>\n\t\t{\n\t\t\tvar color = c;\n\t\n\t\t\tif (color.r <= color.g && color.r <= color.b)\n\t\t\t{\n\t\t\t\tif (color.g <= color.b)\n\t\t\t\t{\n\t\t\t\t\tcolor = vec3<f32>(setSaturationMinMidMax(color.rgb, s)).rgb;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcolor = vec3<f32>(setSaturationMinMidMax(color.rbg, s)).rbg;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (color.g <= color.r && color.g <= color.b)\n\t\t\t{\n\t\t\t\tif (color.r <= color.b)\n\t\t\t\t{\n\t\t\t\t\tcolor = vec3<f32>(setSaturationMinMidMax(color.grb, s)).grb;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcolor = vec3<f32>(setSaturationMinMidMax(color.gbr, s)).gbr;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// Using bgr for both fixes part of hue\n\t\t\t\tif (color.r <= color.g)\n\t\t\t\t{\n\t\t\t\t\tcolor = vec3<f32>(setSaturationMinMidMax(color.brg, s)).brg;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcolor = vec3<f32>(setSaturationMinMidMax(color.bgr, s)).bgr;\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn color;\n\t\t}\n\t\t",t.injectBits=ls,t.insertVersion=Ei,t.isMobile=me,t.isPow2=br,t.isRenderingToScreen=Eg,t.isSafari=wu,t.isSingleItem=Je,t.isWebGLSupported=gh,t.isWebGPUSupported=xh,t.ktxTranscoderUrls=oy,t.loadBasis=jp,t.loadBasisOnWorker=Gp,t.loadBitmapFont=Hh,t.loadDDS=qp,t.loadEnvironmentExtensions=nh,t.loadFontAsBase64=Vu,t.loadFontCSS=Hu,t.loadImageBitmap=ep,t.loadJson=pd,t.loadKTX=ny,t.loadKTX2=uy,t.loadKTX2onWorker=_y,t.loadSVGImage=$u,t.loadSvg=jd,t.loadTextures=rp,t.loadTxt=yd,t.loadVideoTextures=fp,t.loadWebFont=Id,t.localUniformBit=fc,t.localUniformBitGl=gc,t.localUniformBitGroup2=mc,t.localUniformMSDFBit=$_,t.localUniformMSDFBitGl=q_,t.log2=function(t){let e=(t>65535?1:0)<<4,r=((t>>>=e)>255?1:0)<<3;return e|=r,r=((t>>>=r)>15?1:0)<<2,e|=r,r=((t>>>=r)>3?1:0)<<1,e|=r,e|(t>>>=r)>>1},t.logDebugTexture=async function(t,e,r=200){const n=await e.extract.base64(t);await e.encoder.commandFinished;const i=r;console.log(`logging texture ${t.source.width}px ${t.source.height}px`);const s=["font-size: 1px;",`padding: ${i}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",s)},t.logProgramError=ex,t.logRenderGroupScene=function t(e,r=0,n={index:0,color:"#000000"}){let i="";for(let t=0;t<r;t++)i+=" ";const s=`%c ${i}- ${n.index}: ${e.root.label} worldX:${e.worldTransform.tx}`;console.log(s,`color:${n.color}; font-weight:bold;`),r++;for(let i=0;i<e.renderGroupChildren.length;i++){t(e.renderGroupChildren[i],r,yO(pO({},n),{index:i}))}},t.logScene=function t(e,r=0,n={color:"#000000"}){e.renderGroup&&(n.color=vO[fO++]);let i="";for(let t=0;t<r;t++)i+=" ";let s=e.label;!s&&e instanceof un&&(s=`sprite:${e.texture.label}`);let o=`%c ${i}|- ${s} (worldX:${e.worldTransform.tx}, relativeRenderX:${e.relativeGroupTransform.tx}, renderX:${e.groupTransform.tx}, localX:${e.x})`;e.renderGroup&&(o+=" (RenderGroup)"),e.filters&&(o+="(*filters)"),console.log(o,`color:${n.color}; font-weight:bold;`),r++;for(let i=0;i<e.children.length;i++){t(e.children[i],r,pO({},n))}},t.mSDFBit=Z_,t.mSDFBitGl=J_,t.mapFormatToGlFormat=Px,t.mapFormatToGlInternalFormat=Dx,t.mapFormatToGlType=Bx,t.mapGlToVertexFormat=$g,t.mapSize=function(t){return _x[t]},t.mapType=Qg,t.mapWebGLBlendModesToPixi=ux,t.maskFrag=of,t.maskVert=af,t.maskWgsl=lf,t.matrixPool=Rt,t.measureHtmlText=Zu,t.measureMixin=jt,t.migrateFragmentFromV7toV8=function(t){return t=`\n\t\t\tout vec4 finalColor;\n\t\t${t=t.replaceAll("texture2D","texture").replaceAll("gl_FragColor","finalColor").replaceAll("varying","in")}\n\t\t`},t.mipmapScaleModeToGlFilter=xx,t.mixColors=Hx,t.mixHexColors=Wx,t.mixStandardAnd32BitColors=function(t,e,r){const n=e*((r>>24&255)/255)*255,i=((255&t)<<16)+(65280&t)+(t>>16&255),s=16777215&r;let o;return o=i===Vx||s===Vx?i+s-Vx:Wx(i,s,.5),o+(n<<24)},t.multiplyHexColors=mo,t.nextPow2=xr,t.noiseFrag=Kv,t.noiseWgsl=Yv,t.nonCompressedFormats=Rp,t.normalizeExtensionPriority=d,t.nssvg=Cu,t.nsxhtml=Eu,t.onRenderMixin=Nt,t.parseDDS=$p,t.parseFunctionBody=function(t){const e=t.toString(),r=e.indexOf("{"),n=e.lastIndexOf("}");if(-1===r||-1===n)throw new Error("getFunctionBody: No body found in function definition");return e.slice(r+1,n).trim()},t.parseKTX=ry,t.particleData=NP,t.particlesFrag=Ga,t.particlesVert=ja,t.particlesWgsl=Na,t.path=Qe,t.pointInTriangle=ff,t.preloadVideo=yp,t.removeItems=pt,t.removeStructAndGroupDuplicates=Zi,t.resetUids=function(){for(const t in _t)delete _t[t]},t.resolveCharacters=ou,t.resolveCompressedTextureUrl=gy,t.resolveJsonUrl=gp,t.resolveTextureUrl=mp,t.resourceToTexture=kn,t.roundPixelsBit=Gs,t.roundPixelsBitGl=js,t.roundedShapeArc=Gl,t.roundedShapeQuadraticCurve=jl,t.sayHello=Fb,t.scaleModeToGlFilter=gx,t.setBasisTranscoderPath=function(t){Object.assign(Up,t)},t.setKTXTranscoderPath=function(t){Object.assign(oy,t)},t.setPositions=Mc,t.setProgramName=Ii,t.setUvs=Cc,t.shapeBuilders=ma,t.sortMixin=zt,t.spritesheetAsset=en,t.squaredDistanceToLineSegment=Sl,t.stripVersion=Di,t.testImageFormat=Yh,t.testVideoFormat=Jh,t.textStyleToCSS=Ru,t.textureBit=lm,t.textureBitGl=_m,t.textureFrom=Un,t.tilingBit=xc,t.tilingBitGl=bc,t.toFillStyle=u_,t.toLocalGlobalMixin=Vt,t.toStrokeStyle=c_,t.transformVertices=fo,t.triangulateWithHoles=da,t.uboSyncFunctionsSTD40=pg,t.uboSyncFunctionsWGSL=yg,t.uid=ut,t.uniformParsers=ig,t.unpremultiplyAlpha=function(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));const e=t.length;for(let r=0;r<e;r+=4){const e=t[r+3];if(0!==e){const n=255.001/e;t[r]=t[r]*n+.5,t[r+1]=t[r+1]*n+.5,t[r+2]=t[r+2]*n+.5}}},t.unsafeEvalSupported=sh,t.updateLocalTransform=function(t,e){const r=e._scale,n=e._pivot,i=e._position,s=r._x,o=r._y,a=n._x,l=n._y;t.a=e._cx*s,t.b=e._sx*s,t.c=e._cy*o,t.d=e._sy*o,t.tx=i._x-(a*t.a+l*t.c),t.ty=i._y-(a*t.b+l*t.d)},t.updateQuadBounds=rn,t.updateRenderGroupTransform=Yx,t.updateRenderGroupTransforms=Kx,t.updateTransformAndChildren=Qx,t.updateTransformBackwards=kt,t.updateWorldTransform=function(t,e,r){const n=t.a,i=t.b,s=t.c,o=t.d,a=t.tx,l=t.ty,_=e.a,u=e.b,c=e.c,h=e.d;r.a=n*_+i*c,r.b=n*u+i*h,r.c=s*_+o*c,r.d=s*u+o*h,r.tx=a*_+l*c+e.tx,r.ty=a*u+l*h+e.ty},t.v8_0_0="8.0.0",t.v8_3_4=ho,t.validFormats=my,t.validateRenderables=qx,t.vertexGPUTemplate=vs,t.vertexGlTemplate=ms,t.viewportFromFrame=function(t,e,r){r||(r=bT);const n=e.pixelWidth,i=e.pixelHeight;return t.x=r.x*n|0,t.y=r.y*i|0,t.width=r.width*n|0,t.height=r.height*i|0,t},t.vkFormatToGPUFormat=vy,t.warn=iu,t.wrapModeToGlAddress=bx,t}({})},673:function(t){t.exports=function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t,e){"object"===(void 0===t?"undefined":s(t))&&(e=t,t=void 0),e=e||{};var r,n=o(t),a=n.source,c=n.id,h=n.path,d=u[c]&&h in u[c].nsps;return e.forceNew||e["force new connection"]||!1===e.multiplex||d?(_("ignoring socket cache for %s",a),r=l(a,e)):(u[c]||(_("new io instance for %s",a),u[c]=l(a,e)),r=u[c]),n.query&&!e.query?e.query=n.query:e&&"object"===s(e.query)&&(e.query=i(e.query)),r.socket(n.path,e)}function i(t){var e=[];for(var r in t)t.hasOwnProperty(r)&&e.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e.join("&")}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=r(1),a=r(7),l=r(13),_=r(3)("socket.io-client");t.exports=e=n;var u=e.managers={};e.protocol=a.protocol,e.connect=n,e.Manager=r(13),e.Socket=r(39)},function(t,e,r){(function(e){"use strict";function n(t,r){var n=t;r=r||e.location,null==t&&(t=r.protocol+"//"+r.host),"string"==typeof t&&("/"===t.charAt(0)&&(t="/"===t.charAt(1)?r.protocol+t:r.host+t),/^(https?|wss?):\/\//.test(t)||(s("protocol-less url %s",t),t=void 0!==r?r.protocol+"//"+t:"https://"+t),s("parse %s",t),n=i(t)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";var o=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+o+":"+n.port,n.href=n.protocol+"://"+o+(r&&r.port===n.port?"":":"+n.port),n}var i=r(2),s=r(3)("socket.io-client:url");t.exports=n}).call(e,function(){return this}())},function(t,e){var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(t){var e=t,i=t.indexOf("["),s=t.indexOf("]");-1!=i&&-1!=s&&(t=t.substring(0,i)+t.substring(i,s).replace(/:/g,";")+t.substring(s,t.length));for(var o=r.exec(t||""),a={},l=14;l--;)a[n[l]]=o[l]||"";return-1!=i&&-1!=s&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a}},function(t,e,r){(function(n){function i(){return!("undefined"==typeof window||!window||void 0===window.process||"renderer"!==window.process.type)||"undefined"!=typeof document&&document&&"WebkitAppearance"in document.documentElement.style||"undefined"!=typeof window&&window&&window.console&&(console.firebug||console.exception&&console.table)||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function s(t){var r=this.useColors;if(t[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+t[0]+(r?"%c ":" ")+"+"+e.humanize(this.diff),r){var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var i=0,s=0;t[0].replace(/%[a-zA-Z%]/g,(function(t){"%%"!==t&&(i++,"%c"===t&&(s=i))})),t.splice(s,0,n)}}function o(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}}function l(){var t;try{t=e.storage.debug}catch(t){}return!t&&void 0!==n&&"env"in n&&(t=n.env.DEBUG),t}function _(){try{return window.localStorage}catch(t){}}(e=t.exports=r(5)).log=o,e.formatArgs=s,e.save=a,e.load=l,e.useColors=i,e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:_(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},e.enable(l())}).call(e,r(4))},function(t,e){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function i(t){if(u===setTimeout)return setTimeout(t,0);if((u===r||!u)&&setTimeout)return u=setTimeout,setTimeout(t,0);try{return u(t,0)}catch(e){try{return u.call(null,t,0)}catch(e){return u.call(this,t,0)}}}function s(t){if(c===clearTimeout)return clearTimeout(t);if((c===n||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(t);try{return c(t)}catch(e){try{return c.call(null,t)}catch(e){return c.call(this,t)}}}function o(){y&&d&&(y=!1,d.length?p=d.concat(p):v=-1,p.length&&a())}function a(){if(!y){var t=i(o);y=!0;for(var e=p.length;e;){for(d=p,p=[];++v<e;)d&&d[v].run();v=-1,e=p.length}d=null,y=!1,s(t)}}function l(t,e){this.fun=t,this.array=e}function _(){}var u,c,h=t.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:r}catch(t){u=r}try{c="function"==typeof clearTimeout?clearTimeout:n}catch(t){c=n}}();var d,p=[],y=!1,v=-1;h.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];p.push(new l(t,e)),1!==p.length||y||i(a)},l.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=_,h.addListener=_,h.once=_,h.off=_,h.removeListener=_,h.removeAllListeners=_,h.emit=_,h.prependListener=_,h.prependOnceListener=_,h.listeners=function(t){return[]},h.binding=function(t){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(t){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},function(t,e,r){function n(t){var r,n=0;for(r in t)n=(n<<5)-n+t.charCodeAt(r),n|=0;return e.colors[Math.abs(n)%e.colors.length]}function i(t){function r(){if(r.enabled){var t=r,n=+new Date,i=n-(_||n);t.diff=i,t.prev=_,t.curr=n,_=n;for(var s=new Array(arguments.length),o=0;o<s.length;o++)s[o]=arguments[o];s[0]=e.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O");var a=0;s[0]=s[0].replace(/%([a-zA-Z%])/g,(function(r,n){if("%%"===r)return r;a++;var i=e.formatters[n];if("function"==typeof i){var o=s[a];r=i.call(t,o),s.splice(a,1),a--}return r})),e.formatArgs.call(t,s),(r.log||e.log||console.log.bind(console)).apply(t,s)}}return r.namespace=t,r.enabled=e.enabled(t),r.useColors=e.useColors(),r.color=n(t),"function"==typeof e.init&&e.init(r),r}function s(t){e.save(t),e.names=[],e.skips=[];for(var r=("string"==typeof t?t:"").split(/[\s,]+/),n=r.length,i=0;i<n;i++)r[i]&&("-"===(t=r[i].replace(/\*/g,".*?"))[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")))}function o(){e.enable("")}function a(t){var r,n;for(r=0,n=e.skips.length;r<n;r++)if(e.skips[r].test(t))return!1;for(r=0,n=e.names.length;r<n;r++)if(e.names[r].test(t))return!0;return!1}function l(t){return t instanceof Error?t.stack||t.message:t}var _;(e=t.exports=i.debug=i.default=i).coerce=l,e.disable=o,e.enable=s,e.enabled=a,e.humanize=r(6),e.names=[],e.skips=[],e.formatters={}},function(t,e){function r(t){if(!((t=String(t)).length>1e4)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*u;case"days":case"day":case"d":return r*_;case"hours":case"hour":case"hrs":case"hr":case"h":return r*l;case"minutes":case"minute":case"mins":case"min":case"m":return r*a;case"seconds":case"second":case"secs":case"sec":case"s":return r*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function n(t){return t>=_?Math.round(t/_)+"d":t>=l?Math.round(t/l)+"h":t>=a?Math.round(t/a)+"m":t>=o?Math.round(t/o)+"s":t+"ms"}function i(t){return s(t,_,"day")||s(t,l,"hour")||s(t,a,"minute")||s(t,o,"second")||t+" ms"}function s(t,e,r){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}var o=1e3,a=60*o,l=60*a,_=24*l,u=365.25*_;t.exports=function(t,e){e=e||{};var s=typeof t;if("string"===s&&t.length>0)return r(t);if("number"===s&&!1===isNaN(t))return e.long?i(t):n(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,r){function n(){}function i(t){var r=""+t.type;return e.BINARY_EVENT!==t.type&&e.BINARY_ACK!==t.type||(r+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(r+=t.nsp+","),null!=t.id&&(r+=t.id),null!=t.data&&(r+=JSON.stringify(t.data)),c("encoded %j as %s",t,r),r}function s(t,e){function r(t){var r=p.deconstructPacket(t),n=i(r.packet),s=r.buffers;s.unshift(n),e(s)}p.removeBlobs(t,r)}function o(){this.reconstructor=null}function a(t){var r=0,n={type:Number(t.charAt(0))};if(null==e.types[n.type])return u();if(e.BINARY_EVENT===n.type||e.BINARY_ACK===n.type){for(var i="";"-"!==t.charAt(++r)&&(i+=t.charAt(r),r!=t.length););if(i!=Number(i)||"-"!==t.charAt(r))throw new Error("Illegal attachments");n.attachments=Number(i)}if("/"===t.charAt(r+1))for(n.nsp="";++r&&","!==(o=t.charAt(r))&&(n.nsp+=o,r!==t.length););else n.nsp="/";var s=t.charAt(r+1);if(""!==s&&Number(s)==s){for(n.id="";++r;){var o;if(null==(o=t.charAt(r))||Number(o)!=o){--r;break}if(n.id+=t.charAt(r),r===t.length)break}n.id=Number(n.id)}return t.charAt(++r)&&(n=l(n,t.substr(r))),c("decoded %s as %j",t,n),n}function l(t,e){try{t.data=JSON.parse(e)}catch(t){return u()}return t}function _(t){this.reconPack=t,this.buffers=[]}function u(){return{type:e.ERROR,data:"parser error"}}var c=r(3)("socket.io-parser"),h=r(8),d=r(9),p=r(11),y=r(12);e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=n,e.Decoder=o,n.prototype.encode=function(t,r){t.type!==e.EVENT&&t.type!==e.ACK||!d(t.data)||(t.type=t.type===e.EVENT?e.BINARY_EVENT:e.BINARY_ACK),c("encoding packet %j",t),e.BINARY_EVENT===t.type||e.BINARY_ACK===t.type?s(t,r):r([i(t)])},h(o.prototype),o.prototype.add=function(t){var r;if("string"==typeof t)r=a(t),e.BINARY_EVENT===r.type||e.BINARY_ACK===r.type?(this.reconstructor=new _(r),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",r)):this.emit("decoded",r);else{if(!y(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(r=this.reconstructor.takeBinaryData(t))&&(this.reconstructor=null,this.emit("decoded",r))}},o.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},_.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e=p.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},_.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(t,e,r){function n(t){if(t)return i(t)}function i(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}t.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},n.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var n,i=0;i<r.length;i++)if((n=r[i])===e||n.fn===e){r.splice(i,1);break}return this},n.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),r=this._callbacks["$"+t];if(r)for(var n=0,i=(r=r.slice(0)).length;n<i;++n)r[n].apply(this,e);return this},n.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},n.prototype.hasListeners=function(t){return!!this.listeners(t).length}},function(t,e,r){(function(e){function n(t){if(!t||"object"!=typeof t)return!1;if(i(t)){for(var r=0,s=t.length;r<s;r++)if(n(t[r]))return!0;return!1}if("function"==typeof e.Buffer&&e.Buffer.isBuffer&&e.Buffer.isBuffer(t)||"function"==typeof e.ArrayBuffer&&t instanceof ArrayBuffer||o&&t instanceof Blob||a&&t instanceof File)return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1===arguments.length)return n(t.toJSON(),!0);for(var l in t)if(Object.prototype.hasOwnProperty.call(t,l)&&n(t[l]))return!0;return!1}var i=r(10),s=Object.prototype.toString,o="function"==typeof e.Blob||"[object BlobConstructor]"===s.call(e.Blob),a="function"==typeof e.File||"[object FileConstructor]"===s.call(e.File);t.exports=n}).call(e,function(){return this}())},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){(function(t){function n(t,e){if(!t)return t;if(o(t)){var r={_placeholder:!0,num:e.length};return e.push(t),r}if(s(t)){for(var i=new Array(t.length),a=0;a<t.length;a++)i[a]=n(t[a],e);return i}if("object"==typeof t&&!(t instanceof Date)){for(var l in i={},t)i[l]=n(t[l],e);return i}return t}function i(t,e){if(!t)return t;if(t&&t._placeholder)return e[t.num];if(s(t))for(var r=0;r<t.length;r++)t[r]=i(t[r],e);else if("object"==typeof t)for(var n in t)t[n]=i(t[n],e);return t}var s=r(10),o=r(12),a=Object.prototype.toString,l="function"==typeof t.Blob||"[object BlobConstructor]"===a.call(t.Blob),_="function"==typeof t.File||"[object FileConstructor]"===a.call(t.File);e.deconstructPacket=function(t){var e=[],r=t.data,i=t;return i.data=n(r,e),i.attachments=e.length,{packet:i,buffers:e}},e.reconstructPacket=function(t,e){return t.data=i(t.data,e),t.attachments=void 0,t},e.removeBlobs=function(t,e){function r(t,a,u){if(!t)return t;if(l&&t instanceof Blob||_&&t instanceof File){n++;var c=new FileReader;c.onload=function(){u?u[a]=this.result:i=this.result,--n||e(i)},c.readAsArrayBuffer(t)}else if(s(t))for(var h=0;h<t.length;h++)r(t[h],h,t);else if("object"==typeof t&&!o(t))for(var d in t)r(t[d],d,t)}var n=0,i=t;r(i),n||e(i)}}).call(e,function(){return this}())},function(t,e){(function(e){function r(t){return e.Buffer&&e.Buffer.isBuffer(t)||e.ArrayBuffer&&t instanceof ArrayBuffer}t.exports=r}).call(e,function(){return this}())},function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);t&&"object"===(void 0===t?"undefined":i(t))&&(e=t,t=void 0),(e=e||{}).path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(!1!==e.reconnection),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new d({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==e.timeout?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var r=e.parser||l;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=!1!==e.autoConnect,this.autoConnect&&this.open()}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s=r(14),o=r(39),a=r(8),l=r(7),_=r(41),u=r(42),c=r(3)("socket.io-client:manager"),h=r(37),d=r(43),p=Object.prototype.hasOwnProperty;t.exports=n,n.prototype.emitAll=function(){for(var t in this.emit.apply(this,arguments),this.nsps)p.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)},n.prototype.updateSocketIds=function(){for(var t in this.nsps)p.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))},n.prototype.generateId=function(t){return("/"===t?"":t+"#")+this.engine.id},a(n.prototype),n.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection},n.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts},n.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay},n.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor},n.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax},n.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout},n.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},n.prototype.open=n.prototype.connect=function(t,e){if(c("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;c("opening %s",this.uri),this.engine=s(this.uri,this.opts);var r=this.engine,n=this;this.readyState="opening",this.skipReconnect=!1;var i=_(r,"open",(function(){n.onopen(),t&&t()})),o=_(r,"error",(function(e){if(c("connect_error"),n.cleanup(),n.readyState="closed",n.emitAll("connect_error",e),t){var r=new Error("Connection error");r.data=e,t(r)}else n.maybeReconnectOnOpen()}));if(!1!==this._timeout){var a=this._timeout;c("connect attempt will timeout after %d",a);var l=setTimeout((function(){c("connect attempt timed out after %d",a),i.destroy(),r.close(),r.emit("error","timeout"),n.emitAll("connect_timeout",a)}),a);this.subs.push({destroy:function(){clearTimeout(l)}})}return this.subs.push(i),this.subs.push(o),this},n.prototype.onopen=function(){c("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(_(t,"data",u(this,"ondata"))),this.subs.push(_(t,"ping",u(this,"onping"))),this.subs.push(_(t,"pong",u(this,"onpong"))),this.subs.push(_(t,"error",u(this,"onerror"))),this.subs.push(_(t,"close",u(this,"onclose"))),this.subs.push(_(this.decoder,"decoded",u(this,"ondecoded")))},n.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},n.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},n.prototype.ondata=function(t){this.decoder.add(t)},n.prototype.ondecoded=function(t){this.emit("packet",t)},n.prototype.onerror=function(t){c("error",t),this.emitAll("error",t)},n.prototype.socket=function(t,e){function r(){~h(i.connecting,n)||i.connecting.push(n)}var n=this.nsps[t];if(!n){n=new o(this,t,e),this.nsps[t]=n;var i=this;n.on("connecting",r),n.on("connect",(function(){n.id=i.generateId(t)})),this.autoConnect&&r()}return n},n.prototype.destroy=function(t){var e=h(this.connecting,t);~e&&this.connecting.splice(e,1),this.connecting.length||this.close()},n.prototype.packet=function(t){c("writing packet %j",t);var e=this;t.query&&0===t.type&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,(function(r){for(var n=0;n<r.length;n++)e.engine.write(r[n],t.options);e.encoding=!1,e.processPacketQueue()})))},n.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},n.prototype.cleanup=function(){c("cleanup");for(var t=this.subs.length,e=0;e<t;e++)this.subs.shift().destroy();this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},n.prototype.close=n.prototype.disconnect=function(){c("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},n.prototype.onclose=function(t){c("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()},n.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)c("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();c("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var r=setTimeout((function(){t.skipReconnect||(c("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open((function(e){e?(c("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):(c("reconnect success"),t.onreconnect())})))}),e);this.subs.push({destroy:function(){clearTimeout(r)}})}},n.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)}},function(t,e,r){t.exports=r(15)},function(t,e,r){t.exports=r(16),t.exports.parser=r(23)},function(t,e,r){(function(e){function n(t,r){if(!(this instanceof n))return new n(t,r);r=r||{},t&&"object"==typeof t&&(r=t,t=null),t?(t=u(t),r.hostname=t.host,r.secure="https"===t.protocol||"wss"===t.protocol,r.port=t.port,t.query&&(r.query=t.query)):r.host&&(r.hostname=u(r.host).host),this.secure=null!=r.secure?r.secure:e.location&&"https:"===location.protocol,r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.agent=r.agent||!1,this.hostname=r.hostname||(e.location?location.hostname:"localhost"),this.port=r.port||(e.location&&location.port?location.port:this.secure?443:80),this.query=r.query||{},"string"==typeof this.query&&(this.query=h.decode(this.query)),this.upgrade=!1!==r.upgrade,this.path=(r.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!r.forceJSONP,this.jsonp=!1!==r.jsonp,this.forceBase64=!!r.forceBase64,this.enablesXDR=!!r.enablesXDR,this.timestampParam=r.timestampParam||"t",this.timestampRequests=r.timestampRequests,this.transports=r.transports||["polling","websocket"],this.transportOptions=r.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=r.policyPort||843,this.rememberUpgrade=r.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=r.onlyBinaryUpgrades,this.perMessageDeflate=!1!==r.perMessageDeflate&&(r.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=r.pfx||null,this.key=r.key||null,this.passphrase=r.passphrase||null,this.cert=r.cert||null,this.ca=r.ca||null,this.ciphers=r.ciphers||null,this.rejectUnauthorized=void 0===r.rejectUnauthorized||r.rejectUnauthorized,this.forceNode=!!r.forceNode;var i="object"==typeof e&&e;i.global===i&&(r.extraHeaders&&Object.keys(r.extraHeaders).length>0&&(this.extraHeaders=r.extraHeaders),r.localAddress&&(this.localAddress=r.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}function i(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}var s=r(17),o=r(8),a=r(3)("engine.io-client:socket"),l=r(37),_=r(23),u=r(2),c=r(38),h=r(31);t.exports=n,n.priorWebsocketSuccess=!1,o(n.prototype),n.protocol=_.protocol,n.Socket=n,n.Transport=r(22),n.transports=r(17),n.parser=r(23),n.prototype.createTransport=function(t){a('creating transport "%s"',t);var e=i(this.query);e.EIO=_.protocol,e.transport=t;var r=this.transportOptions[t]||{};return this.id&&(e.sid=this.id),new s[t]({query:e,socket:this,agent:r.agent||this.agent,hostname:r.hostname||this.hostname,port:r.port||this.port,secure:r.secure||this.secure,path:r.path||this.path,forceJSONP:r.forceJSONP||this.forceJSONP,jsonp:r.jsonp||this.jsonp,forceBase64:r.forceBase64||this.forceBase64,enablesXDR:r.enablesXDR||this.enablesXDR,timestampRequests:r.timestampRequests||this.timestampRequests,timestampParam:r.timestampParam||this.timestampParam,policyPort:r.policyPort||this.policyPort,pfx:r.pfx||this.pfx,key:r.key||this.key,passphrase:r.passphrase||this.passphrase,cert:r.cert||this.cert,ca:r.ca||this.ca,ciphers:r.ciphers||this.ciphers,rejectUnauthorized:r.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:r.perMessageDeflate||this.perMessageDeflate,extraHeaders:r.extraHeaders||this.extraHeaders,forceNode:r.forceNode||this.forceNode,localAddress:r.localAddress||this.localAddress,requestTimeout:r.requestTimeout||this.requestTimeout,protocols:r.protocols||void 0})},n.prototype.open=function(){var t;if(this.rememberUpgrade&&n.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length){var e=this;return void setTimeout((function(){e.emit("error","No transports available")}),0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)},n.prototype.setTransport=function(t){a("setting transport %s",t.name);var e=this;this.transport&&(a("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",(function(){e.onDrain()})).on("packet",(function(t){e.onPacket(t)})).on("error",(function(t){e.onError(t)})).on("close",(function(){e.onClose("transport close")}))},n.prototype.probe=function(t){function e(){if(h.onlyBinaryUpgrades){var e=!this.supportsBinary&&h.transport.supportsBinary;c=c||e}c||(a('probe transport "%s" opened',t),u.send([{type:"ping",data:"probe"}]),u.once("packet",(function(e){if(!c)if("pong"===e.type&&"probe"===e.data){if(a('probe transport "%s" pong',t),h.upgrading=!0,h.emit("upgrading",u),!u)return;n.priorWebsocketSuccess="websocket"===u.name,a('pausing current transport "%s"',h.transport.name),h.transport.pause((function(){c||"closed"!==h.readyState&&(a("changing transport and sending upgrade packet"),_(),h.setTransport(u),u.send([{type:"upgrade"}]),h.emit("upgrade",u),u=null,h.upgrading=!1,h.flush())}))}else{a('probe transport "%s" failed',t);var r=new Error("probe error");r.transport=u.name,h.emit("upgradeError",r)}})))}function r(){c||(c=!0,_(),u.close(),u=null)}function i(e){var n=new Error("probe error: "+e);n.transport=u.name,r(),a('probe transport "%s" failed because of error: %s',t,e),h.emit("upgradeError",n)}function s(){i("transport closed")}function o(){i("socket closed")}function l(t){u&&t.name!==u.name&&(a('"%s" works - aborting "%s"',t.name,u.name),r())}function _(){u.removeListener("open",e),u.removeListener("error",i),u.removeListener("close",s),h.removeListener("close",o),h.removeListener("upgrading",l)}a('probing transport "%s"',t);var u=this.createTransport(t,{probe:1}),c=!1,h=this;n.priorWebsocketSuccess=!1,u.once("open",e),u.once("error",i),u.once("close",s),this.once("close",o),this.once("upgrading",l),u.open()},n.prototype.onOpen=function(){if(a("socket open"),this.readyState="open",n.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){a("starting upgrade probes");for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}},n.prototype.onPacket=function(t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(a('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(c(t.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}else a('packet received with socket readyState "%s"',this.readyState)},n.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},n.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout((function(){"closed"!==e.readyState&&e.onClose("ping timeout")}),t||e.pingInterval+e.pingTimeout)},n.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout((function(){a("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)}),t.pingInterval)},n.prototype.ping=function(){var t=this;this.sendPacket("ping",(function(){t.emit("ping")}))},n.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},n.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(a("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},n.prototype.write=n.prototype.send=function(t,e,r){return this.sendPacket("message",t,e,r),this},n.prototype.sendPacket=function(t,e,r,n){if("function"==typeof e&&(n=e,e=void 0),"function"==typeof r&&(n=r,r=null),"closing"!==this.readyState&&"closed"!==this.readyState){(r=r||{}).compress=!1!==r.compress;var i={type:t,data:e,options:r};this.emit("packetCreate",i),this.writeBuffer.push(i),n&&this.once("flush",n),this.flush()}},n.prototype.close=function(){function t(){n.onClose("forced close"),a("socket closing - telling transport to close"),n.transport.close()}function e(){n.removeListener("upgrade",e),n.removeListener("upgradeError",e),t()}function r(){n.once("upgrade",e),n.once("upgradeError",e)}if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var n=this;this.writeBuffer.length?this.once("drain",(function(){this.upgrading?r():t()})):this.upgrading?r():t()}return this},n.prototype.onError=function(t){a("socket error %j",t),n.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)},n.prototype.onClose=function(t,e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){a('socket close with reason: "%s"',t);var r=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",t,e),r.writeBuffer=[],r.prevBufferLen=0}},n.prototype.filterUpgrades=function(t){for(var e=[],r=0,n=t.length;r<n;r++)~l(this.transports,t[r])&&e.push(t[r]);return e}}).call(e,function(){return this}())},function(t,e,r){(function(t){function n(e){var r=!1,n=!1,a=!1!==e.jsonp;if(t.location){var l="https:"===location.protocol,_=location.port;_||(_=l?443:80),r=e.hostname!==location.hostname||_!==e.port,n=e.secure!==l}if(e.xdomain=r,e.xscheme=n,"open"in new i(e)&&!e.forceJSONP)return new s(e);if(!a)throw new Error("JSONP disabled");return new o(e)}var i=r(18),s=r(20),o=r(34),a=r(35);e.polling=n,e.websocket=a}).call(e,function(){return this}())},function(t,e,r){(function(e){var n=r(19);t.exports=function(t){var r=t.xdomain,i=t.xscheme,s=t.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!r||n))return new XMLHttpRequest}catch(t){}try{if("undefined"!=typeof XDomainRequest&&!i&&s)return new XDomainRequest}catch(t){}if(!r)try{return new(e[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(t){}}}).call(e,function(){return this}())},function(t,e){try{t.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){t.exports=!1}},function(t,e,r){(function(e){function n(){}function i(t){if(l.call(this,t),this.requestTimeout=t.requestTimeout,this.extraHeaders=t.extraHeaders,e.location){var r="https:"===location.protocol,n=location.port;n||(n=r?443:80),this.xd=t.hostname!==e.location.hostname||n!==t.port,this.xs=t.secure!==r}}function s(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=!1!==t.async,this.data=void 0!==t.data?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.requestTimeout=t.requestTimeout,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders,this.create()}function o(){for(var t in s.requests)s.requests.hasOwnProperty(t)&&s.requests[t].abort()}var a=r(18),l=r(21),_=r(8),u=r(32),c=r(3)("engine.io-client:polling-xhr");t.exports=i,t.exports.Request=s,u(i,l),i.prototype.supportsBinary=!0,i.prototype.request=function(t){return(t=t||{}).uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,t.requestTimeout=this.requestTimeout,t.extraHeaders=this.extraHeaders,new s(t)},i.prototype.doWrite=function(t,e){var r="string"!=typeof t&&void 0!==t,n=this.request({method:"POST",data:t,isBinary:r}),i=this;n.on("success",e),n.on("error",(function(t){i.onError("xhr post error",t)})),this.sendXhr=n},i.prototype.doPoll=function(){c("xhr poll");var t=this.request(),e=this;t.on("data",(function(t){e.onData(t)})),t.on("error",(function(t){e.onError("xhr poll error",t)})),this.pollXhr=t},_(s.prototype),s.prototype.create=function(){var t={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized;var r=this.xhr=new a(t),n=this;try{c("xhr open %s: %s",this.method,this.uri),r.open(this.method,this.uri,this.async);try{if(this.extraHeaders)for(var i in r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0),this.extraHeaders)this.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.extraHeaders[i])}catch(t){}if("POST"===this.method)try{this.isBinary?r.setRequestHeader("Content-type","application/octet-stream"):r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(t){}try{r.setRequestHeader("Accept","*/*")}catch(t){}"withCredentials"in r&&(r.withCredentials=!0),this.requestTimeout&&(r.timeout=this.requestTimeout),this.hasXDR()?(r.onload=function(){n.onLoad()},r.onerror=function(){n.onError(r.responseText)}):r.onreadystatechange=function(){if(2===r.readyState){var t;try{t=r.getResponseHeader("Content-Type")}catch(t){}"application/octet-stream"===t&&(r.responseType="arraybuffer")}4===r.readyState&&(200===r.status||1223===r.status?n.onLoad():setTimeout((function(){n.onError(r.status)}),0))},c("xhr data %s",this.data),r.send(this.data)}catch(t){return void setTimeout((function(){n.onError(t)}),0)}e.document&&(this.index=s.requestsCount++,s.requests[this.index]=this)},s.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},s.prototype.onData=function(t){this.emit("data",t),this.onSuccess()},s.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)},s.prototype.cleanup=function(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=n:this.xhr.onreadystatechange=n,t)try{this.xhr.abort()}catch(t){}e.document&&delete s.requests[this.index],this.xhr=null}},s.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type")}catch(t){}t="application/octet-stream"===e&&this.xhr.response||this.xhr.responseText}catch(t){this.onError(t)}null!=t&&this.onData(t)},s.prototype.hasXDR=function(){return void 0!==e.XDomainRequest&&!this.xs&&this.enablesXDR},s.prototype.abort=function(){this.cleanup()},s.requestsCount=0,s.requests={},e.document&&(e.attachEvent?e.attachEvent("onunload",o):e.addEventListener&&e.addEventListener("beforeunload",o,!1))}).call(e,function(){return this}())},function(t,e,r){function n(t){var e=t&&t.forceBase64;u&&!e||(this.supportsBinary=!1),i.call(this,t)}var i=r(22),s=r(31),o=r(23),a=r(32),l=r(33),_=r(3)("engine.io-client:polling");t.exports=n;var u=null!=new(r(18))({xdomain:!1}).responseType;a(n,i),n.prototype.name="polling",n.prototype.doOpen=function(){this.poll()},n.prototype.pause=function(t){function e(){_("paused"),r.readyState="paused",t()}var r=this;if(this.readyState="pausing",this.polling||!this.writable){var n=0;this.polling&&(_("we are currently polling - waiting to pause"),n++,this.once("pollComplete",(function(){_("pre-pause polling complete"),--n||e()}))),this.writable||(_("we are currently writing - waiting to pause"),n++,this.once("drain",(function(){_("pre-pause writing complete"),--n||e()})))}else e()},n.prototype.poll=function(){_("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},n.prototype.onData=function(t){var e=this;_("polling got data %s",t);var r=function(t,r,n){return"opening"===e.readyState&&e.onOpen(),"close"===t.type?(e.onClose(),!1):void e.onPacket(t)};o.decodePayload(t,this.socket.binaryType,r),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():_('ignoring poll - transport state "%s"',this.readyState))},n.prototype.doClose=function(){function t(){_("writing close packet"),e.write([{type:"close"}])}var e=this;"open"===this.readyState?(_("transport open - closing"),t()):(_("transport not open - deferring close"),this.once("open",t))},n.prototype.write=function(t){var e=this;this.writable=!1;var r=function(){e.writable=!0,e.emit("drain")};o.encodePayload(t,this.supportsBinary,(function(t){e.doWrite(t,r)}))},n.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",r="";return!1!==this.timestampRequests&&(t[this.timestampParam]=l()),this.supportsBinary||t.sid||(t.b64=1),t=s.encode(t),this.port&&("https"===e&&443!==Number(this.port)||"http"===e&&80!==Number(this.port))&&(r=":"+this.port),t.length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+r+this.path+t}},function(t,e,r){function n(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.forceNode=t.forceNode,this.extraHeaders=t.extraHeaders,this.localAddress=t.localAddress}var i=r(23),s=r(8);t.exports=n,s(n.prototype),n.prototype.onError=function(t,e){var r=new Error(t);return r.type="TransportError",r.description=e,this.emit("error",r),this},n.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},n.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},n.prototype.send=function(t){if("open"!==this.readyState)throw new Error("Transport not open");this.write(t)},n.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},n.prototype.onData=function(t){var e=i.decodePacket(t,this.socket.binaryType);this.onPacket(e)},n.prototype.onPacket=function(t){this.emit("packet",t)},n.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(t,e,r){(function(t){function n(t,r){return r("b"+e.packets[t.type]+t.data.data)}function i(t,r,n){if(!r)return e.encodeBase64Packet(t,n);var i=t.data,s=new Uint8Array(i),o=new Uint8Array(1+i.byteLength);o[0]=m[t.type];for(var a=0;a<s.length;a++)o[a+1]=s[a];return n(o.buffer)}function s(t,r,n){if(!r)return e.encodeBase64Packet(t,n);var i=new FileReader;return i.onload=function(){t.data=i.result,e.encodePacket(t,r,!0,n)},i.readAsArrayBuffer(t.data)}function o(t,r,n){if(!r)return e.encodeBase64Packet(t,n);if(f)return s(t,r,n);var i=new Uint8Array(1);return i[0]=m[t.type],n(new b([i.buffer,t.data]))}function a(t){try{t=p.decode(t,{strict:!1})}catch(t){return!1}return t}function l(t,e,r){for(var n=new Array(t.length),i=d(t.length,r),s=function(t,r,i){e(r,(function(e,r){n[t]=r,i(e,n)}))},o=0;o<t.length;o++)s(o,t[o],i)}var _,u=r(24),c=r(9),h=r(25),d=r(26),p=r(27);t&&t.ArrayBuffer&&(_=r(29));var y="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),v="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),f=y||v;e.protocol=3;var m=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},g=u(m),x={type:"error",data:"parser error"},b=r(30);e.encodePacket=function(e,r,s,a){"function"==typeof r&&(a=r,r=!1),"function"==typeof s&&(a=s,s=null);var l=void 0===e.data?void 0:e.data.buffer||e.data;if(t.ArrayBuffer&&l instanceof ArrayBuffer)return i(e,r,a);if(b&&l instanceof t.Blob)return o(e,r,a);if(l&&l.base64)return n(e,a);var _=m[e.type];return void 0!==e.data&&(_+=s?p.encode(String(e.data),{strict:!1}):String(e.data)),a(""+_)},e.encodeBase64Packet=function(r,n){var i,s="b"+e.packets[r.type];if(b&&r.data instanceof t.Blob){var o=new FileReader;return o.onload=function(){var t=o.result.split(",")[1];n(s+t)},o.readAsDataURL(r.data)}try{i=String.fromCharCode.apply(null,new Uint8Array(r.data))}catch(t){for(var a=new Uint8Array(r.data),l=new Array(a.length),_=0;_<a.length;_++)l[_]=a[_];i=String.fromCharCode.apply(null,l)}return s+=t.btoa(i),n(s)},e.decodePacket=function(t,r,n){if(void 0===t)return x;if("string"==typeof t){if("b"===t.charAt(0))return e.decodeBase64Packet(t.substr(1),r);if(n&&!1===(t=a(t)))return x;var i=t.charAt(0);return Number(i)==i&&g[i]?t.length>1?{type:g[i],data:t.substring(1)}:{type:g[i]}:x}i=new Uint8Array(t)[0];var s=h(t,1);return b&&"blob"===r&&(s=new b([s])),{type:g[i],data:s}},e.decodeBase64Packet=function(t,e){var r=g[t.charAt(0)];if(!_)return{type:r,data:{base64:!0,data:t.substr(1)}};var n=_.decode(t.substr(1));return"blob"===e&&b&&(n=new b([n])),{type:r,data:n}},e.encodePayload=function(t,r,n){function i(t){return t.length+":"+t}function s(t,n){e.encodePacket(t,!!o&&r,!1,(function(t){n(null,i(t))}))}"function"==typeof r&&(n=r,r=null);var o=c(t);return r&&o?b&&!f?e.encodePayloadAsBlob(t,n):e.encodePayloadAsArrayBuffer(t,n):t.length?void l(t,s,(function(t,e){return n(e.join(""))})):n("0:")},e.decodePayload=function(t,r,n){if("string"!=typeof t)return e.decodePayloadAsBinary(t,r,n);var i;if("function"==typeof r&&(n=r,r=null),""===t)return n(x,0,1);for(var s,o,a="",l=0,_=t.length;l<_;l++){var u=t.charAt(l);if(":"===u){if(""===a||a!=(s=Number(a)))return n(x,0,1);if(a!=(o=t.substr(l+1,s)).length)return n(x,0,1);if(o.length){if(i=e.decodePacket(o,r,!1),x.type===i.type&&x.data===i.data)return n(x,0,1);if(!1===n(i,l+s,_))return}l+=s,a=""}else a+=u}return""!==a?n(x,0,1):void 0},e.encodePayloadAsArrayBuffer=function(t,r){function n(t,r){e.encodePacket(t,!0,!0,(function(t){return r(null,t)}))}return t.length?void l(t,n,(function(t,e){var n=e.reduce((function(t,e){var r;return t+(r="string"==typeof e?e.length:e.byteLength).toString().length+r+2}),0),i=new Uint8Array(n),s=0;return e.forEach((function(t){var e="string"==typeof t,r=t;if(e){for(var n=new Uint8Array(t.length),o=0;o<t.length;o++)n[o]=t.charCodeAt(o);r=n.buffer}i[s++]=e?0:1;var a=r.byteLength.toString();for(o=0;o<a.length;o++)i[s++]=parseInt(a[o]);for(i[s++]=255,n=new Uint8Array(r),o=0;o<n.length;o++)i[s++]=n[o]})),r(i.buffer)})):r(new ArrayBuffer(0))},e.encodePayloadAsBlob=function(t,r){function n(t,r){e.encodePacket(t,!0,!0,(function(t){var e=new Uint8Array(1);if(e[0]=1,"string"==typeof t){for(var n=new Uint8Array(t.length),i=0;i<t.length;i++)n[i]=t.charCodeAt(i);t=n.buffer,e[0]=0}var s=(t instanceof ArrayBuffer?t.byteLength:t.size).toString(),o=new Uint8Array(s.length+1);for(i=0;i<s.length;i++)o[i]=parseInt(s[i]);if(o[s.length]=255,b){var a=new b([e.buffer,o.buffer,t]);r(null,a)}}))}l(t,n,(function(t,e){return r(new b(e))}))},e.decodePayloadAsBinary=function(t,r,n){"function"==typeof r&&(n=r,r=null);for(var i=t,s=[];i.byteLength>0;){for(var o=new Uint8Array(i),a=0===o[0],l="",_=1;255!==o[_];_++){if(l.length>310)return n(x,0,1);l+=o[_]}i=h(i,2+l.length),l=parseInt(l);var u=h(i,0,l);if(a)try{u=String.fromCharCode.apply(null,new Uint8Array(u))}catch(t){var c=new Uint8Array(u);for(u="",_=0;_<c.length;_++)u+=String.fromCharCode(c[_])}s.push(u),i=h(i,l)}var d=s.length;s.forEach((function(t,i){n(e.decodePacket(t,r,!0),i,d)}))}}).call(e,function(){return this}())},function(t,e){t.exports=Object.keys||function(t){var e=[],r=Object.prototype.hasOwnProperty;for(var n in t)r.call(t,n)&&e.push(n);return e}},function(t,e){t.exports=function(t,e,r){var n=t.byteLength;if(e=e||0,r=r||n,t.slice)return t.slice(e,r);if(e<0&&(e+=n),r<0&&(r+=n),r>n&&(r=n),e>=n||e>=r||0===n)return new ArrayBuffer(0);for(var i=new Uint8Array(t),s=new Uint8Array(r-e),o=e,a=0;o<r;o++,a++)s[a]=i[o];return s.buffer}},function(t,e){function r(t,e,r){function i(t,n){if(i.count<=0)throw new Error("after called too many times");--i.count,t?(s=!0,e(t),e=r):0!==i.count||s||e(null,n)}var s=!1;return r=r||n,i.count=t,0===t?e():i}function n(){}t.exports=r},function(t,e,r){var n;(function(t,i){!function(){function s(t){for(var e,r,n=[],i=0,s=t.length;i<s;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<s?56320==(64512&(r=t.charCodeAt(i++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--):n.push(e);return n}function o(t){for(var e,r=t.length,n=-1,i="";++n<r;)(e=t[n])>65535&&(i+=m((e-=65536)>>>10&1023|55296),e=56320|1023&e),i+=m(e);return i}function a(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function l(t,e){return m(t>>e&63|128)}function _(t,e){if(!(4294967168&t))return m(t);var r="";return 4294965248&t?4294901760&t?!(4292870144&t)&&(r=m(t>>18&7|240),r+=l(t,12),r+=l(t,6)):(a(t,e)||(t=65533),r=m(t>>12&15|224),r+=l(t,6)):r=m(t>>6&31|192),r+m(63&t|128)}function u(t,e){for(var r=!1!==(e=e||{}).strict,n=s(t),i=n.length,o=-1,a="";++o<i;)a+=_(n[o],r);return a}function c(){if(f>=v)throw Error("Invalid byte index");var t=255&y[f];if(f++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function h(t){var e,r;if(f>v)throw Error("Invalid byte index");if(f==v)return!1;if(e=255&y[f],f++,!(128&e))return e;if(192==(224&e)){if((r=(31&e)<<6|c())>=128)return r;throw Error("Invalid continuation byte")}if(224==(240&e)){if((r=(15&e)<<12|c()<<6|c())>=2048)return a(r,t)?r:65533;throw Error("Invalid continuation byte")}if(240==(248&e)&&(r=(7&e)<<18|c()<<12|c()<<6|c())>=65536&&r<=1114111)return r;throw Error("Invalid UTF-8 detected")}function d(t,e){var r=!1!==(e=e||{}).strict;y=s(t),v=y.length,f=0;for(var n,i=[];!1!==(n=h(r));)i.push(n);return o(i)}var p=("object"==typeof t&&t&&t.exports,"object"==typeof i&&i);p.global!==p&&p.window;var y,v,f,m=String.fromCharCode,g={version:"2.1.2",encode:u,decode:d};void 0===(n=function(){return g}.call(e,r,e,t))||(t.exports=n)}()}).call(e,r(28)(t),function(){return this}())},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){!function(){"use strict";for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(256),n=0;n<t.length;n++)r[t.charCodeAt(n)]=n;e.encode=function(e){var r,n=new Uint8Array(e),i=n.length,s="";for(r=0;r<i;r+=3)s+=t[n[r]>>2],s+=t[(3&n[r])<<4|n[r+1]>>4],s+=t[(15&n[r+1])<<2|n[r+2]>>6],s+=t[63&n[r+2]];return i%3==2?s=s.substring(0,s.length-1)+"=":i%3==1&&(s=s.substring(0,s.length-2)+"=="),s},e.decode=function(t){var e,n,i,s,o,a=.75*t.length,l=t.length,_=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var u=new ArrayBuffer(a),c=new Uint8Array(u);for(e=0;e<l;e+=4)n=r[t.charCodeAt(e)],i=r[t.charCodeAt(e+1)],s=r[t.charCodeAt(e+2)],o=r[t.charCodeAt(e+3)],c[_++]=n<<2|i>>4,c[_++]=(15&i)<<4|s>>2,c[_++]=(3&s)<<6|63&o;return u}}()},function(t,e){(function(e){function r(t){for(var e=0;e<t.length;e++){var r=t[e];if(r.buffer instanceof ArrayBuffer){var n=r.buffer;if(r.byteLength!==n.byteLength){var i=new Uint8Array(r.byteLength);i.set(new Uint8Array(n,r.byteOffset,r.byteLength)),n=i.buffer}t[e]=n}}}function n(t,e){e=e||{};var n=new s;r(t);for(var i=0;i<t.length;i++)n.append(t[i]);return e.type?n.getBlob(e.type):n.getBlob()}function i(t,e){return r(t),new Blob(t,e||{})}var s=e.BlobBuilder||e.WebKitBlobBuilder||e.MSBlobBuilder||e.MozBlobBuilder,o=function(){try{return 2===new Blob(["hi"]).size}catch(t){return!1}}(),a=o&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(t){return!1}}(),l=s&&s.prototype.append&&s.prototype.getBlob;t.exports=o?a?e.Blob:i:l?n:void 0}).call(e,function(){return this}())},function(t,e){e.encode=function(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e},e.decode=function(t){for(var e={},r=t.split("&"),n=0,i=r.length;n<i;n++){var s=r[n].split("=");e[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return e}},function(t,e){t.exports=function(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},function(t,e){"use strict";function r(t){var e="";do{e=o[t%a]+e,t=Math.floor(t/a)}while(t>0);return e}function n(t){var e=0;for(u=0;u<t.length;u++)e=e*a+l[t.charAt(u)];return e}function i(){var t=r(+new Date);return t!==s?(_=0,s=t):t+"."+r(_++)}for(var s,o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),a=64,l={},_=0,u=0;u<a;u++)l[o[u]]=u;i.encode=r,i.decode=n,t.exports=i},function(t,e,r){(function(e){function n(){}function i(t){s.call(this,t),this.query=this.query||{},a||(e.___eio||(e.___eio=[]),a=e.___eio),this.index=a.length;var r=this;a.push((function(t){r.onData(t)})),this.query.j=this.index,e.document&&e.addEventListener&&e.addEventListener("beforeunload",(function(){r.script&&(r.script.onerror=n)}),!1)}var s=r(21),o=r(32);t.exports=i;var a,l=/\n/g,_=/\\n/g;o(i,s),i.prototype.supportsBinary=!1,i.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),s.prototype.doClose.call(this)},i.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var r=document.getElementsByTagName("script")[0];r?r.parentNode.insertBefore(e,r):(document.head||document.body).appendChild(e),this.script=e,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout((function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)}),100)},i.prototype.doWrite=function(t,e){function r(){n(),e()}function n(){if(i.iframe)try{i.form.removeChild(i.iframe)}catch(t){i.onError("jsonp polling iframe removal error",t)}try{var t='<iframe src="javascript:0" name="'+i.iframeId+'">';s=document.createElement(t)}catch(t){(s=document.createElement("iframe")).name=i.iframeId,s.src="javascript:0"}s.id=i.iframeId,i.form.appendChild(s),i.iframe=s}var i=this;if(!this.form){var s,o=document.createElement("form"),a=document.createElement("textarea"),u=this.iframeId="eio_iframe_"+this.index;o.className="socketio",o.style.position="absolute",o.style.top="-1000px",o.style.left="-1000px",o.target=u,o.method="POST",o.setAttribute("accept-charset","utf-8"),a.name="d",o.appendChild(a),document.body.appendChild(o),this.form=o,this.area=a}this.form.action=this.uri(),n(),t=t.replace(_,"\\\n"),this.area.value=t.replace(l,"\\n");try{this.form.submit()}catch(t){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===i.iframe.readyState&&r()}:this.iframe.onload=r}}).call(e,function(){return this}())},function(t,e,r){(function(e){function n(t){t&&t.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=c&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(h=i),s.call(this,t)}var i,s=r(22),o=r(23),a=r(31),l=r(32),_=r(33),u=r(3)("engine.io-client:websocket"),c=e.WebSocket||e.MozWebSocket;if("undefined"==typeof window)try{i=r(36)}catch(t){}var h=c;h||"undefined"!=typeof window||(h=i),t.exports=n,l(n,s),n.prototype.name="websocket",n.prototype.supportsBinary=!0,n.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,r={agent:this.agent,perMessageDeflate:this.perMessageDeflate};r.pfx=this.pfx,r.key=this.key,r.passphrase=this.passphrase,r.cert=this.cert,r.ca=this.ca,r.ciphers=this.ciphers,r.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(r.headers=this.extraHeaders),this.localAddress&&(r.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket?e?new h(t,e):new h(t):new h(t,e,r)}catch(t){return this.emit("error",t)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},n.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},n.prototype.write=function(t){function r(){n.emit("flush"),setTimeout((function(){n.writable=!0,n.emit("drain")}),0)}var n=this;this.writable=!1;for(var i=t.length,s=0,a=i;s<a;s++)!function(t){o.encodePacket(t,n.supportsBinary,(function(s){if(!n.usingBrowserWebSocket){var o={};t.options&&(o.compress=t.options.compress),n.perMessageDeflate&&("string"==typeof s?e.Buffer.byteLength(s):s.length)<n.perMessageDeflate.threshold&&(o.compress=!1)}try{n.usingBrowserWebSocket?n.ws.send(s):n.ws.send(s,o)}catch(t){u("websocket closed before onclose event")}--i||r()}))}(t[s])},n.prototype.onClose=function(){s.prototype.onClose.call(this)},n.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},n.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",r="";return this.port&&("wss"===e&&443!==Number(this.port)||"ws"===e&&80!==Number(this.port))&&(r=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=_()),this.supportsBinary||(t.b64=1),(t=a.encode(t)).length&&(t="?"+t),e+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+r+this.path+t},n.prototype.check=function(){return!(!h||"__initialize"in h&&this.name===n.prototype.name)}}).call(e,function(){return this}())},function(t,e){},function(t,e){var r=[].indexOf;t.exports=function(t,e){if(r)return t.indexOf(e);for(var n=0;n<t.length;++n)if(t[n]===e)return n;return-1}},function(t,e){(function(e){var r=/^[\],:{}\s]*$/,n=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,i=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,s=/(?:^|:|,)(?:\s*\[)+/g,o=/^\s+/,a=/\s+$/;t.exports=function(t){return"string"==typeof t&&t?(t=t.replace(o,"").replace(a,""),e.JSON&&JSON.parse?JSON.parse(t):r.test(t.replace(n,"@").replace(i,"]").replace(s,""))?new Function("return "+t)():void 0):null}}).call(e,function(){return this}())},function(t,e,r){"use strict";function n(t,e,r){this.io=t,this.nsp=e,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,r&&r.query&&(this.query=r.query),this.io.autoConnect&&this.open()}var i=r(7),s=r(8),o=r(40),a=r(41),l=r(42),_=r(3)("socket.io-client:socket");t.exports=n;var u={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},c=s.prototype.emit;s(n.prototype),n.prototype.subEvents=function(){if(!this.subs){var t=this.io;this.subs=[a(t,"open",l(this,"onopen")),a(t,"packet",l(this,"onpacket")),a(t,"close",l(this,"onclose"))]}},n.prototype.open=n.prototype.connect=function(){return this.connected||(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting")),this},n.prototype.send=function(){var t=o(arguments);return t.unshift("message"),this.emit.apply(this,t),this},n.prototype.emit=function(t){if(u.hasOwnProperty(t))return c.apply(this,arguments),this;var e=o(arguments),r={type:i.EVENT,data:e,options:{}};return r.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof e[e.length-1]&&(_("emitting packet with ack id %d",this.ids),this.acks[this.ids]=e.pop(),r.id=this.ids++),this.connected?this.packet(r):this.sendBuffer.push(r),delete this.flags,this},n.prototype.packet=function(t){t.nsp=this.nsp,this.io.packet(t)},n.prototype.onopen=function(){_("transport is open - connecting"),"/"!==this.nsp&&(this.query?this.packet({type:i.CONNECT,query:this.query}):this.packet({type:i.CONNECT}))},n.prototype.onclose=function(t){_("close (%s)",t),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",t)},n.prototype.onpacket=function(t){if(t.nsp===this.nsp)switch(t.type){case i.CONNECT:this.onconnect();break;case i.EVENT:case i.BINARY_EVENT:this.onevent(t);break;case i.ACK:case i.BINARY_ACK:this.onack(t);break;case i.DISCONNECT:this.ondisconnect();break;case i.ERROR:this.emit("error",t.data)}},n.prototype.onevent=function(t){var e=t.data||[];_("emitting event %j",e),null!=t.id&&(_("attaching ack callback to event"),e.push(this.ack(t.id))),this.connected?c.apply(this,e):this.receiveBuffer.push(e)},n.prototype.ack=function(t){var e=this,r=!1;return function(){if(!r){r=!0;var n=o(arguments);_("sending ack %j",n),e.packet({type:i.ACK,id:t,data:n})}}},n.prototype.onack=function(t){var e=this.acks[t.id];"function"==typeof e?(_("calling ack %s with %j",t.id,t.data),e.apply(this,t.data),delete this.acks[t.id]):_("bad ack %s",t.id)},n.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},n.prototype.emitBuffered=function(){var t;for(t=0;t<this.receiveBuffer.length;t++)c.apply(this,this.receiveBuffer[t]);for(this.receiveBuffer=[],t=0;t<this.sendBuffer.length;t++)this.packet(this.sendBuffer[t]);this.sendBuffer=[]},n.prototype.ondisconnect=function(){_("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},n.prototype.destroy=function(){if(this.subs){for(var t=0;t<this.subs.length;t++)this.subs[t].destroy();this.subs=null}this.io.destroy(this)},n.prototype.close=n.prototype.disconnect=function(){return this.connected&&(_("performing disconnect (%s)",this.nsp),this.packet({type:i.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},n.prototype.compress=function(t){return this.flags=this.flags||{},this.flags.compress=t,this}},function(t,e){function r(t,e){for(var r=[],n=(e=e||0)||0;n<t.length;n++)r[n-e]=t[n];return r}t.exports=r},function(t,e){"use strict";function r(t,e,r){return t.on(e,r),{destroy:function(){t.removeListener(e,r)}}}t.exports=r},function(t,e){var r=[].slice;t.exports=function(t,e){if("string"==typeof e&&(e=t[e]),"function"!=typeof e)throw new Error("bind() requires a function");var n=r.call(arguments,2);return function(){return e.apply(t,n.concat(r.call(arguments)))}}},function(t,e){function r(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}t.exports=r,r.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=1&Math.floor(10*e)?t+r:t-r}return 0|Math.min(t,this.max)},r.prototype.reset=function(){this.attempts=0},r.prototype.setMin=function(t){this.ms=t},r.prototype.setMax=function(t){this.max=t},r.prototype.setJitter=function(t){this.jitter=t}}])}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var r=__webpack_module_cache__[t]={id:t,exports:{}};return __webpack_modules__[t].call(r.exports,r,r.exports,__webpack_require__),r.exports}__webpack_require__.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return __webpack_require__.d(e,{a:e}),e},__webpack_require__.d=(t,e)=>{for(var r in e)__webpack_require__.o(e,r)&&!__webpack_require__.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),__webpack_require__.nc=void 0;var __webpack_exports__={};(()=>{"use strict";__webpack_require__(865),__webpack_require__(256),__webpack_require__(966),__webpack_require__(40),__webpack_require__(673);var t=__webpack_require__(868),e=__webpack_require__(518);t.Q.newIconAtlas=function(t){return this.iconAtlasO[t]=new r(t)},t.Q.newIcon=function(t,e,r,i,s,o,a,l){return new n(t,e,r,i,s,o,a,l)},e.j3.newIconAtlas=function(e){return t.Q.newIconAtlas(e)},e.j3.newIcon=function(e,r,n,i,s,o,a){return t.Q.newIcon(e,r,n,o,i,s,a)},e.j3.newIconFromURL=function(e,r,n,i){return t.Q.newIcon("","","",i,r,n,e)};class r{_vy_name="";_vy_icons=[];_vy_texture=null;constructor(e){this._vy_name=e,t.Q.iconsO[e]={},t.Q.loadedAtlases.hasOwnProperty(e)||(t.Q.loadAtlas(e),t.Q.loadedAtlases.hasOwnProperty(e)||(t.Q.loadedAtlases[e]={}))}_vy_addIcon=function(e,r=-1){if(!this._vy_icons.includes(e)&&e._vy_isIcon&&e._vy_parent===e){if(e._vy_atlas=this,e._vy_atlasName=this._vy_name,-1===r?this._vy_icons.push(e):this._vy_icons.splice(r,0,e),t.Q.iconsO[this._vy_name][e._vy_iconName]||(t.Q.iconsO[this._vy_name][e._vy_iconName]={}),t.Q.iconsO[this._vy_name][e._vy_iconName][""]=e,e._vy_frames)for(const t of e._vy_frames)t._vy_atlas=this,t._vy_atlasName=this._vy_name;if(e._vy_states)for(const r of e._vy_states)if(r._vy_atlas=this,r._vy_atlasName=this._vy_name,t.Q.iconsO[this._vy_name][e._vy_iconName][r._vy_iconState]=r,r._vy_frames)for(const t of r._vy_frames)t._vy_atlas=this,t._vy_atlasName=this._vy_name}};_vy_removeIcon=function(r,n=-1){if(this._vy_icons.length){if(!n&&r)if(r._vy_isIcon)n=this._vy_icons.indexOf(r);else{if(!e.j3.Util.isString(r))return;for(let t=this._vy_icons.length;t--;){if(this._vy_icons[t]._vy_iconName===r){n=t;break}}}else n&&(r=this._vy_icons[n]);if(!(!r||n<0||n>=this._vy_icons.length)){if(r._vy_atlas=null,r._vy_atlasName="",this._vy_icons.splice(n,1),r._vy_frames)for(const t of r._vy_frames)t._vy_atlas=null,t._vy_atlasName="";if(r._vy_states)for(const e of r._vy_states)if(e._vy_atlas=null,e._vy_atlasName="",delete t.Q.iconsO[this._vy_name][r._vy_iconName][e._vy_iconState],e._vy_frames)for(const t of e._vy_frames)t._vy_atlas=null,t._vy_atlasName="";delete t.Q.iconsO[this._vy_name][r]}}};addIcon=function(...t){for(const e of t)this._vy_addIcon(e)};insertIcon=function(t,...e){if(!t._vy_isIcon||-1!==(t=this._vy_icons.indexOf(t)))for(let r=e.length;r--;)this._vy_addIcon(e[r],t)};removeIcon=function(...t){for(const e of t)this._vy_removeIcon(e)};removeIconAt=function(t=0,e){if(this._vy_icons?.length&&(void 0===e?e=t:e<=0&&(e=this._vy_icons.length-e-1),!(t>e)))for(let r=e;r>=t;r--)this._vy_removeIcon(null,r)};newIcon=function(e,r,n,i,s){const o=t.Q.newIcon(this._vy_name,r,"",s,n,i,e);return this._vy_addIcon(o),o};get name(){return this._vy_name}set name(t){}get texture(){return this._vy_texture}set texture(t){}getIconNames=function(t){const e=[];for(const r of this._vy_icons)t&&!r.match(t)||e.push(r._vy_iconName);return e}}class n{_vy_isIcon=!0;_vy_atlas=null;_vy_atlasName="";_vy_iconName="";_vy_iconState="";_vy_frameDelay=100;_vy_totalDelay=100;_vy_width=32;_vy_height=32;_vy_parent=null;_vy_texture=null;_vy_parState=null;_vy_frames=null;_vy_states=null;_vy_imageData=null;constructor(r="",n="",i="",s=100,o,a,l,_){this._vy_atlasName=r,this._vy_iconName=n,this._vy_iconState=i,this._vy_frameDelay=s,this._vy_totalDelay=s,this._vy_width=o||32,this._vy_height=a||32,this._vy_parent=this,l?(this._vy_imageData=l,_?(this._vy_texture=_,o||(this._vy_width=this._vy_texture.width),a||(this._vy_height=this._vy_texture.height)):(async()=>{this._vy_texture=await PIXI.Assets.load(l),o||(this._vy_width=this._vy_texture.width),a||(this._vy_height=this._vy_texture.height)})()):(this._vy_imageData=e.Bn.blankIcon,this._vy_texture=t.Q.blankPixiTex)}_vy_addState=function(e,r=-1){if(e._vy_isIcon&&e._vy_width===this._vy_width&&e._vy_height===this._vy_height&&!e._vy_parState&&(this._vy_states||(this._vy_states=[]),e._vy_parState=this,e._vy_atlas=this._vy_atlas,e._vy_atlasName=this._vy_atlasName,e._vy_iconName=this._vy_iconName,-1===r?this._vy_states.push(e):this._vy_states.splice(r,0,e),this._vy_atlas&&(t.Q.iconsO[this._vy_atlasName][this._vy_iconName][e._vy_iconState]=e),e._vy_frames))for(const t of e._vy_frames)t._vy_atlas=this,t._vy_atlasName=this._vy_name,t._vy_iconName=this._vy_iconName};_vy_removeState=function(r,n){if(this._vy_states?.length){if(!n&&r)if(r._vy_isIcon)n=this._vy_states.indexOf(r);else{if(!e.j3.Util.isString(r))return;for(let t=this._vy_states.length;t--;){if(this._vy_states[t]._vy_iconState===r){n=t;break}}}else n&&(r=this._vy_states[n]);if(!(!r||n<0||n>=this._vy_states.length)&&(r._vy_parState=null,r._vy_iconState="",this._vy_states.splice(n,1),this._vy_atlas&&delete t.Q.iconsO[this._vy_atlasName][this._vy_iconName][this._vy_iconState],r._vy_frames))for(const t of r._vy_frames)t._vy_iconState=""}};_vy_addFrame=function(t,e=-1){t._vy_isIcon&&t._vy_width===this._vy_width&&t._vy_height===this._vy_height&&t._vy_parent===t&&(this._vy_frames||(this._vy_frames=[this]),t._vy_parent=this,t._vy_atlas=this._vy_atlas,t._vy_atlasName=this._vy_atlasName,t._vy_iconName=this._vy_iconName,t._vy_iconState=this._vy_iconState,-1===e?this._vy_frames.push(t):this._vy_frames.splice(e,0,t),this._vy_totalDelay+=t._vy_frameDelay)};_vy_removeFrame=function(t,e){this._vy_frames?.length&&(!e&&t?e=this._vy_frames.indexOf(t):e&&(t=this._vy_frames[e]),!t||t===this||e<=0||e>=this._vy_frames.length||(t._vy_parent=t,this._vy_frames.splice(e,1),this._vy_totalDelay-=t._vy_frameDelay))};get isIcon(){return this._vy_atlas||!0}set isIcon(t){}get isState(){return this._vy_parState}set isState(t){}get isFrame(){return this._vy_parent!==this}set isFrame(t){}addState=function(...t){for(const e of t)this._vy_addState(e)};insertState=function(t,...e){if(!t._vy_isIcon||-1!==(t=this._vy_icons.indexOf(t)))for(let r=e.length;r--;)this._vy_addState(e[r],t)};newState=function(e,r,n){const i=t.Q.newIcon(this._vy_atlasName,this._vy_iconName,r,n,this._vy_width,this._vy_height,e);return this._vy_addState(i),i};removeState=function(...t){for(const e of t)this._vy_removeState(e)};removeStateAt=function(t=0,e){if(this._vy_states?.length&&(void 0===e?e=t:e<=0&&(e=this._vy_states.length-e-1),!(t>e)))for(let r=e;r>=t;r--)this._vy_removeState(null,r)};addFrame=function(...t){for(const e of t)this._vy_addFrame(e)};insertFrame=function(t,...e){if(!t._vy_isIcon||-1!==(t=this._vy_icons.indexOf(t)))for(let r=e.length;r--;)this._vy_addFrame(e[r],t)};newFrame=function(e,r){const n=t.Q.newIcon(this._vy_atlasName,this._vy_iconName,this._vy_iconState,r,this._vy_width,this._vy_height,e);return this._vy_addFrame(n),n};removeFrame=function(...t){for(const e of t)this._vy_removeFrame(e)};removeFrameAt=function(t,e){if(this._vy_frames?.length&&(t||(t=1),void 0===e?e=t:e<=0&&(e=this._vy_frames.length-e-1),!(t>e)))for(let r=e;r>=t;r--)this._vy_removeFrame(null,r)};remove=function(){this._vy_parState?this._vy_parState.removeState(this):this._vy_parent!==this?this._vy_parent.removeFrame(this):this._vy_atlas.removeIcon(this)};destroy=function(e){if(delete t.Q.iconsO[this._vy_atlasName][this._vy_iconName][this._vy_iconState],this._vy_parState)if(this._vy_parState!==this){if(!e){const t=this._vy_parState._vy_states.indexOf(this);-1!==t&&this._vy_parState._vy_states.splice(t,1)}}else for(let t=this._vy_states.length;t--;)this._vy_states[t].destroy(!0);if(this._vy_parent&&this._vy_parent!==this&&!e){const t=this._vy_parent._vy_frames.indexOf(this);-1!==t&&this._vy_parent._vy_frames.splice(t,1)}if(this._vy_frames?.length>1)for(let t=this._vy_frames.length;t>1;t--)this._vy_frames[t].destroy(!0)};get texture(){return this._vy_texture}set texture(t){this._vy_texture=t}get atlasTexture(){return this._vy_texture?.baseTexture}set atlasTexture(t){}get atlas(){return this._vy_atlas}set atlas(t){}get atlasName(){return this._vy_atlasName}set atlasName(t){}get iconName(){return this._vy_iconName}set iconName(t){}get iconState(){return this._vy_iconState}set iconState(t){}get width(){return this._vy_width}set width(t){}get height(){return this._vy_height}set height(t){}get frameDelay(){return this._vy_frameDelay}set frameDelay(t){this._vy_frameDelay=t}get parent(){return this._vy_parState||this._vy_parent}set parent(t){}get imageData(){return this._vy_imageData}set imageData(t){}getDataURL=function(){return this._vy_imageData};getRawData=function(){const t=new PIXI.Sprite(this._vy_texture);e.up.pixiAppOp.renderer.resize(this._vy_width,this._vy_height),e.up.pixiAppOp.stage.addChild(t);const r=e.up.pixiAppOp.renderer.extract.pixels(e.up.pixiAppOp.stage);return e.up.pixiAppOp.stage.removeChildren(),new ImageData(r.pixels,this._vy_width,this._vy_height)};setRawData=async function(r){t.Q.iconCanvas.width=this._vy_width,t.Q.iconCanvas.height=this._vy_height,t.Q.iconCanvasBrush.putImageData(r,0,0),this._vy_imageData=t.Q.iconCanvas.toDataURL(),this._vy_texture=this._vy_imageData?await PIXI.Assets.load(this._vy_imageData):t.Q.blankPixiTex,e.up.refreshInt=!0};setDataFromURL=async function(r){r?(this._vy_imageData=r,this._vy_texture=await PIXI.Assets.load(this._vy_imageData)):(this._vy_imageData=e.Bn.blankIcon,this._vy_texture=t.Q.blankPixiTex),this._vy_width=this._vy_texture.width,this._vy_height=this._vy_texture.height,e.up.refreshInt=!0};getStateNames=function(t){const e=[];if(this._vy_states)for(const r of this._vy_states)t&&!r.match(t)||e.push(r._vy_iconState);return e}}var i=__webpack_require__(140);e.vC.createWebSocket=function(){e.vC.serSocket=new WebSocket(e.vC.serSocketAdd),e.vC.serSocket.sendPacket=function(t){1===this.readyState&&this.send(JSON.stringify(t))},e.vC.serSocket.addEventListener("message",(function(t){const r=JSON.parse(t.data);for(let t=0,n=r.length;t<n;t++)e.vC.serPacketFunc[r[t][0]](r[t])})),e.vC.serSocket.onclose=function(){e.um&&e.um.onDisconnect&&e.um.onDisconnect(),e.um._vy_mapView._vy_clearScreen(1);for(const t in e.um._vy_interfaces){const r=e.um._vy_interfaces[t];r._vy_isShown&&e.up.removeFromInterface(r)}e.up.pauseDraw&&e.up.resumeRender(),e.up.pauseRender(0,1),e.vC.inLoadScreen&&e.vC.hideLoadScreen(1),e.um._vy_isKicked||(e.um._vy_isReboot?e.vC.errorDisplay.innerHTML="Server is rebooting. Please wait...":e.vC.errorDisplay.innerHTML="Disconnected from server. Attempting to reconnect...",e.vC.disconnected=1,e.vC.reconnectInterval=setInterval(e.vC.createWebSocket,1e4)),e.vC.fpsLabel.style.display="none"},e.vC.reconnectInterval&&clearInterval(e.vC.reconnectInterval),e.vC.serPacketFunc=[],e.vC.setPacketSingleVar=["_vy_density","clientSyncData","mouseOpacity","relayerHeight"],e.vC.setPacketSingleSet=["setInvisibility","setPlane","setVisibility","setComposite","setColor","setAnimator","setTransform","setAlpha","setAngle","setTextStyle","setLayer","setDir","setName","setAnchor","setText","overScreenDraw","setOverScreenMod","_vy_setMap","setTag","removeFilter"],e.vC.setPacketDoubleSet=["setSize","_vy_setPos","setOrigin","setIconOffsets","setScale"],e.vC.setPacketDiobFunc=["setFrame","setOverScreen","playAnimation","setTransition","addFilter"],e.vC.setPacketClientFunc=["outputText","setLocalStorage","setViewEyeOffsets","setEdgeLimit","setWebTagContent","callWebTagEvent","createTopScreen","setTopScreen","getTopScreen","addCustomFont","log","addWebStyle","setWebTagStyle","addFilter","aMes"],e.vC.setPacketClientSingleSet=["removeWebStyle","setWebTagFocus","removeWebTag","evalWebScript","setMapView","setScreenView","setScreenBackground","setWebBackground","setMaxFPS","setMacroAtlas","toggleScreenDrawing","changeServer","toggleMacroCapture","setMainOutput","toggleLoadScreen","removeCustomFont","createInterface","removeFilter","removeCustomMacro"],e.vC._getObject=function(e){const r=i.P.objects.get(e);if(!r&&e&&e.startsWith("m_")){const r=e.substring(2).split("_"),n=r.pop().split("x"),i=t.Q.maps[r.join("_")];if(i)return i._vy_tiles[parseInt(n[0])+i._vy_xMax*parseInt(n[1])]}return r},e.vC.serPacketFunc[0]=function(t){const r=e.vC._getObject(t[1]);r&&i.P.movMoveTo(r,t[2],t[3])},e.vC.serPacketFunc[1]=function(t){const r=e.vC._getObject(t[1]);r&&r[e.vC.setPacketSingleSet[t[2]]](t[3])},e.vC.serPacketFunc[2]=function(r){const n=e.vC._getObject(r[1]);n&&(r[3]&&(r[2]=t.Q.iconStates[r[2]]),n._vy_setIconState(r[2]))},e.vC.serPacketFunc[3]=function(t){if(e.vC._getObject(t[1]))return;const r=i.P.createObjectNew(t[2],null,t[1]);t[3]&&e.vC.serSocket.sendPacket([8,r._vy_id])},e.vC.serPacketFunc[4]=function(t){const r=e.vC._getObject(t[1]);r&&i.P.deleteDiob(r)},e.vC._serPacketFunc5=function(r,n,s,o){let a=e.vC._getObject(r[0]);const l=r[2]||o;if(a){if(a._vy_mapN===l){const t=a._vy_parentT._vy_object;if(t)for(let r=a._vy_isLoc?5:2,n=i.P.clientShareVars.length;r<n;r++){const n=t[i.P.clientShareVars[r]];e.j3.Util.isObject(n)||a[i.P.clientShareVars[r]]!==n&&(a[i.P.clientShareVars[r]]=n)}}a._vy_isOverlay||n||a._vy_isLoc||a._vy_gui||a._vy_isParticle?void 0!==l&&(a._vy_mapN=l,a._vy_map=t.Q.maps[l]):(a._vy_x=Math.floor(r[3])||0,a._vy_y=Math.floor(r[4])||0,a._vy_setMap(l||a._vy_mapN,a._vy_x,a._vy_y))}else{if(r[0]?.startsWith("m_")){let e=t.Q.maps[l];if(e||(t.Q.maps[l]=i.P.createMap(),e=t.Q.maps[l]),!e._vy_deleted.includes(r[0]))return t.Q.mapSerUpdated[e._vy_mapN]||(t.Q.mapSerUpdated[e._vy_mapN]=[]),t.Q.mapSerUpdated[e._vy_mapN].push([r,n,s,o]),a}a=i.P.createObject(r[1],null,r[0]),a._vy_x=Math.floor(r[3])||0,a._vy_y=Math.floor(r[4])||0,a._vy_isOverlay||n||a._vy_isLoc||a._vy_isParticle?a._vy_isLoc?a._vy_mapN=l:a._vy_isParticle&&a._vy_setMap(l):a._vy_setMap(l,a._vy_x,a._vy_y),n&&(a._vy_loc=n,a._vy_isOverlay=n),a.onNew?.(),n&&(a._vy_isOverlay=null)}void 0===r[5]&&void 0===r[6]||a.setIconOffsets(r[5]||a._vy_xIcoOff,r[6]||a._vy_yIcoOff),void 0===r[7]&&void 0===r[8]||(void 0!==r[7]&&(a._vy_atlas=r[7]),void 0!==r[8]&&(a._vy_icoName=r[8])),void 0!==r[9]&&(a._vy_icoState=r[9]),void 0!==r[11]&&(a._vy_dir=r[11]),a._vy_setAtlas(a._vy_atlas,a._vy_icoName,!0),a._vy_icoState?(t.Q.iconStates.includes(a._vy_icoState)||(a._vy_defIconState=0),a._vy_setIconState(a._vy_icoState,r[35],0,!0)):a._vy_dir&&a._vy_setDir(a._vy_dir,1),r[35]&&(a._vy_moving=r[35],a._vy_setDir(a._vy_dir,!0,i.P.dirNum[r[35]])),void 0!==r[10]&&a.setLayer(r[10]),void 0!==r[12]&&a.setInvisibility(r[12]),void 0!==r[13]&&a.setText(r[13]),void 0!==r[14]&&a.setTextStyle(r[14]),void 0===r[15]&&void 0===r[16]||(void 0!==r[15]&&(a._vy_w=r[15]),void 0!==r[16]&&(a._vy_h=r[16]),a.setSize(a._vy_w,a._vy_h)),void 0!==r[17]&&a.setAlpha(r[17]),void 0!==r[19]&&a.setAngle(r[19]),void 0!==r[20]&&a.setScale(r[20].x,r[20].y),void 0!==r[21]&&a.setTransform(r[21]),void 0!==r[26]&&a.setAnimator(r[26]),void 0!==r[18]&&a.setColor(r[18]),void 0!==r[22]&&a.setComposite(r[22]),void 0!==r[23]&&a.setPlane(r[23]),void 0!==r[24]&&(a._vy_name=r[24]),void 0!==r[25]&&a.setAnchor(r[25]),void 0===r[27]&&void 0===r[28]||(void 0!==r[27]&&(a._vy_xOr=r[27]),void 0!==r[28]&&(a._vy_yOr=r[28]),a.setOrigin(a._vy_xOr,a._vy_yOr)),void 0!==r[29]&&(a.relayerHeight=r[29]),void 0!==r[30]&&a.setTag(r[30]),void 0!==r[31]&&(a.mouseOpacity=r[31]),void 0!==r[32]&&(a.clientSyncData=r[32]),void 0!==r[33]&&(a._vy_density=r[33]),a._vy_isOverlay&&(a._vy_x||(a._vy_x=0),a._vy_y||(a._vy_y=0));const _=[];if(r[34]){const t=r[34];for(let r=0,n=t.length;r<n;r+=2){let n=e.vC.serPacketFunc[5]([t[r]],a,1,o);n&&(n=a._vy_addOverlay(n,t[r+1]),n&&(n._vy_x||(n._vy_x=0),n._vy_y||(n._vy_y=0),_.push(n)))}}if(a._vy_over)for(let t=a._vy_over.length;t--;){const e=a._vy_over[t];_.includes(e)||e._vy_localOver||i.P.deleteDiob(e)}return a.onClientSync?.(e.um),a},e.vC.serPacketFunc[5]=function(t,r,n,i){const s=n?t:t[1];let o;const a=s.length;if(a>=3e3){let t=0;const l=setInterval((function(){let _=0;for(;t<a&&(_++,o=e.vC._serPacketFunc5(s[t],r,n,i),!(_>=1500));t++);t>=a-1&&clearInterval(l)}),25)}else for(let t=0;t<a;t++)o=e.vC._serPacketFunc5(s[t],r,n,i);return o},e.vC.serPacketFunc[6]=function(t){0===t[1]?e.um.showInterface(t[2],t[3]):1===t[1]?e.um.hideInterface(t[2],t[3]):2===t[1]?e.um._vy_onFocus(e.vC._getObject(t[2])):3===t[1]&&e.um._vy_unfocus(e.vC._getObject(t[2]))},e.vC.serPacketFunc[7]=function(t){e.um[e.vC.setPacketClientFunc[t[1]]](...t[2])},e.vC.serPacketFunc[8]=function(t){e.um.onPacket(t[1],t[2])},e.vC.serPacketFunc[9]=function(t){"array"==typeof t[1]&&t[4]?e.R5.playSound(e.vC._getObject(t[1]),t[2]||void 0,t[3]||void 0):e.R5.playSound(t[1],t[2]||void 0,t[3]||void 0)},e.vC.serPacketFunc[10]=function(t){let r=e.vC._getObject(t[1]);const n=e.vC.serPacketFunc[5]([t[2]],0,1);if(!r&&t[4]&&(r=e.um),!r||!n)return;const i=r._vy_addOverlay(n,t[3]);i._vy_x||(i._vy_x=0),i._vy_y||(i._vy_y=0)},e.vC.serPacketFunc[11]=function(t){const r=e.vC._getObject(t[1]),n=e.vC._getObject(t[2]);r&&n&&r.removeOverlay(n,!0)},e.vC.serPacketFunc[12]=function(t){const r=t[1];e.um&&e.um[r]&&("onNew"===r||"onConnect"===r?e.um[r](e.vX):e.um[r]())},e.vC.serPacketFunc[13]=function(t){e.j3.Resource.setResource(t[1],t[2],t[3],t[4])},e.vC.serPacketFunc[14]=function(r){const n=r[1],s=r[5]?r[5]:[],o=r[4],a=r[3];for(let t=0,r=a.length;t<r;t++){const r=e.vC._serPacketFunc5(a[t],null,null,n);if(r._vy_chunks)for(let t=r._vy_chunks.length;t--;){const e=r._vy_chunks[t];e&&!e.u.includes(r)&&e.u.push(r)}else r._vy_hasUpdatedChunk=!0;s.push(r._vy_id)}for(let t=0,r=o.length;t<r;t++)s.push(e.vC._serPacketFunc5(o[t],null,null,n)._vy_id);const l=t.Q.maps[n];if(l){const t=l._vy_chunksI?.[r[2]];if(t){for(let e=t.u.length;e--;){const r=t.u[e];s.includes(r._vy_id)||(r._vy_chunks&&1!==r._vy_chunks.length?r._vy_removeFromChunk(t):i.P.deleteDiob(r))}for(let e=t.c.length;e--;){const r=t.c[e];s.includes(r._vy_id)||(r._vy_chunks&&1!==r._vy_chunks.length?r._vy_removeFromChunk(t):i.P.deleteDiob(r))}}}},e.vC.serPacketFunc[15]=function(t){const r=e.vC._getObject(t[1]);r&&r[e.vC.setPacketDiobFunc[t[2]]](...t[3])},e.vC.serPacketFunc[16]=function(t){const r=e.vC._getObject(t[1]);r&&r[e.vC.setPacketDoubleSet[t[2]]](t[3],t[4])},e.vC.serPacketFunc[17]=function(t){if(t[4]){const r=e.vC._getObject(t[4]);if(!r)return;e.um.setMouseCursor(r,t[2],t[3])}else e.um.setMouseCursor(t[1],t[2],t[3])},e.vC.serPacketFunc[18]=function(t){const r=e.vC._getObject(t[1]);r&&r.onPacket&&r.onPacket(e.um,t[2],t[3])},e.vC.serPacketFunc[19]=function(t){e.j3.Map.setLoc(e.j3.Map.getLoc(t[2],t[3],t[4]),e.vC.serPacketFunc[5]([t[1]],0,1))},e.vC.serPacketFunc[20]=function(e){const r=t.Q.maps[e[1]];e[5]&&r&&r._vy_tiles.length||t.Q.createMap(e[1],e[2],e[3],e[4])},e.vC.serPacketFunc[21]=function(r){const n=t.Q.maps[r[2]];r[3]&&n&&n._vy_tiles.length||e.j3.Map.cloneMap(r[1],r[2])},e.vC.serPacketFunc[22]=function(e){t.Q.clearMap(e[1])},e.vC.serPacketFunc[23]=function(t){e.um._vy_setPlayerMob(e.vC.serPacketFunc[5]([t[1]],0,1))},e.vC.serPacketFunc[24]=function(e){t.Q.maps[e[1]]?.setSizeByCoords(e[2],e[3],e[4])},e.vC.serPacketFunc[25]=function(t){const r=e.vC._getObject(t[1]);r&&(void 0!==r._vy_tMov&&i.P.removeMoveToObj(r),r._vy_setPos(t[2],t[3]))},e.vC.serPacketFunc[26]=function(t){e.um.uploadFile(t[1],t[2])},e.vC.serPacketFunc[27]=function(t){t[1]?e.um.setViewEye(e.vC.serPacketFunc[5]([t[1]],0,1)):e.um.setViewEye(null)},e.vC.serPacketFunc[28]=function(t){let r=e.um._vy_mapView._vy_planes[t[1]];r||(e.um._vy_mapView._vy_setPlane(t[1]),r=e.um._vy_mapView._vy_planes[t[1]]),r[t[2]]=t[3]},e.vC.serPacketFunc[29]=function(e){t.Q.macros[e[1]]||(t.Q.macros[e[1]]={});for(let r=0,n=e[2].length;r<n;r++){const n=e[2][r];n&&(t.Q.macros[e[1]][n[0]]||(t.Q.macros[e[1]][n[0]]={}),t.Q.macros[e[1]][n[0]].name=n[1],n[2]&&!t.Q.macros[e[1]][n[0]].up&&(t.Q.macros[e[1]][n[0]].up=1),n[3]&&!t.Q.macros[e[1]][n[0]].down&&(t.Q.macros[e[1]][n[0]].down=1))}},e.vC.serPacketFunc[30]=function(e){t.Q.macros[e[1]]&&(t.Q.macros[e[1]][e[3]]={},t.Q.macros[e[1]][e[3]].name=e[2],e[4]&&(t.Q.macros[e[1]][e[3]].up=e[4]),e[5]&&(t.Q.macros[e[1]][e[3]].down=e[5]))},e.vC.serPacketFunc[31]=function(r){t.Q.macros[r[1]]&&e.j3.Macro.removeMacro(r[2],r[1])},e.vC.serPacketFunc[32]=function(t){e.um._vy_customMacros[t[2]]={name:t[1],key:t[2],down:t[3],up:t[4]}},e.vC.serPacketFunc[33]=function(t){e.um[e.vC.setPacketClientSingleSet[t[1]]](t[2])},e.vC.serPacketFunc[34]=function(t){const r=e.vC._getObject(t[1]);r&&(r[e.vC.setPacketSingleVar[t[2]]]=t[3])},e.vC.serPacketFunc[35]=function(r){const n=e.vC._getObject(r[1]);if(n)if(r[5]){if(!n._vy_clientC&&r[2]!==e.um._vy_mapView._vy_map._vy_mapN){const e=n._vy_mapN;n._vy_mapN=r[4],n._vy_map=t.Q.maps[n._vy_mapN],n.onMapChange?.(e,!1),i.P.deleteDiob(n)}}else n._vy_setMap(r[2],r[3],r[4])},e.vC.serPacketFunc[36]=function(t){const r=e.vC._getObject(t[1]);r&&(void 0!==t[3]&&null!==t[3]||(t[3]=r.iconName),r._vy_setAtlas(t[2],t[3]),r._vy_recheckState&&r._vy_setIconState(r._vy_recheckState,r._vy_recheckStateM))},e.vC.serPacketFunc[37]=function(t){const r=e.vC._getObject(t[1]);r&&e.um._vy_interfaces[t[2]]&&(t[3]&&(r._vy_name=t[3]),e.um._vy_interfaces[t[2]]._vy_addChild(r),t[4]===r._vy_x&&t[5]===r._vy_y||r._vy_setPos(t[4]||0,t[5]||0))},e.vC.serPacketFunc[38]=function(t){const r=e.vC._getObject(t[1]);r&&e.um.removeInterfaceElement(t[2],r._vy_name)},e.vC.serPacketFunc[39]=function(t){if(t[1]&&t[1].image&&t[1].imageID){const r=e.vC._getObject(t[1].imageID);r&&(t[1].image=r)}e.um.topScreenDraw(t[2],t[1])},e.vC.serPacketFunc[40]=function(t){const r=e.vC._getObject(t[1]);r&&r.setMask(e.vC.serPacketFunc[5]([t[2]],0,1))},e.vC.serPacketFunc[41]=function(t){const r=e.vC._getObject(t[1]);if(!r)return;const n=t[2];if(Array.isArray(n)){const e=t[3];for(let t=0,i=n.length;t<i;t++)r[n[t]]=e[t]}else r[n]=t[3]},e.vC.serPacketFunc[42]=function(t){t[2]?e.um._vy_isReboot=!0:(t[1]||(t[1]="Disconnected from server."),e.j3.aMes(t[1]),e.um._vy_isKicked=!0)},e.vC.serPacketFunc[43]=function(t){e.vC.serSocket.sendPacket([12])},e.vC.serPacketFunc[44]=function(r){e.vC.disconnected&&(e.vC.errorDisplay.innerHTML="Reconnecting...",e.vC.changeServer(location.protocol+"//"+e.U3.serverAddress+(e.vX?"?"+e.vX:""))),e.um._vy_clientID=r[1],e.um._vy_address=r[2],e.um._vy_typesLoadedQueue&&(e.um._vy_typesLoadedQueue=!1,t.Q.typesLoaded())},e.vC.serPacketFunc[45]=function(t){const r=t[1];if(e.um._vy_accountName=r.name,e.um._vy_clientID=r.id,r.res)for(const t of r.res)e.j3.Resource.setResource(t.type,t.name,t.f,t.r);e.vC.isInitialized=!0,e.um._vy_initiate()},e.vC.serPacketFunc[46]=function(t){const r=e.vC.serPacketFunc[5]([t[1]],0,1),n=e.vC._getObject(t[2]);r&&n&&r.addInvisibilityViewer(n)},e.vC.serPacketFunc[47]=function(t){const r=e.vC._getObject(t[1]),n=e.vC._getObject(t[2]);r&&n&&r.removeInvisibilityViewer(n)},e.vC.serPacketFunc[48]=function(t){if(e.um._vy_clearKeyDownEvents(),1===t[1])alert(t[2]);else if(2===t[1]){const r=prompt(t[2],t[3]);e.vC.serSocket.sendPacket([9,r])}else if(3===t[1]){const r=confirm(t[2]);e.vC.serSocket.sendPacket([9,r])}},e.vC.serPacketFunc[49]=function(r){let n=t.Q.maps[r[1][0]];const s="m_"+r[1][0]+"_";if(n)for(let t=1,n=r[1].length;t<n;t++){const n=e.vC._getObject(s+r[1][t]);n&&i.P.deleteDiob(n)}else{n=t.Q.maps[r[1][0]]=i.P.createMap("Map",r[1][0]);for(let t=1,e=r[1].length;t<e;t++)n._vy_deleted.push(s+r[1][t])}},e.vC.serPacketFunc[50]=function(r){const n=r[1],i=t.Q.maps[n];r[0]=5,r.splice(1,1),i&&i._vy_isLoaded?e.vC.serPacketFunc[5](r,null,null,n):(t.Q.mapSerUpdated[n]||(t.Q.mapSerUpdated[n]=[]),t.Q.mapSerUpdated[n].push([r,null,null,n]))},e.vC.serPacketFunc[51]=function(r){const n=r[1],i=t.Q.maps[n];if(i&&i._vy_isLoaded){const t=[];for(let n=2,s=r.length;n<=s;n++){const s=r[n];if(!s||!s[0])continue;let o=i._vy_tiles[s[0]+i._vy_xMax*s[1]];if(o){if(s[2][1]!==o._vy_type&&(o=e.j3.Map.setLoc(o,s[2][1]),!o))continue;t.push(s[2])}}t.length&&e.vC.serPacketFunc[5](t,0,1,n)}else t.Q.mapSerUpdatedT[n]=[r]},e.vC.serPacketFunc[52]=function(t){const r=e.vC._getObject(t[1]);r&&(r._vy_moving=t[3],r._vy_setDir(i.P.dirNum[t[2]],!0,i.P.dirNum[t[3]]))}};__webpack_require__(347);e.up.interfaceElements=[],e.up.refreshInt=!1,e.up.intApp=null,e.up.topScreenBrush={},e.up.topScreenCanvas={},e.up.screenAnimations=[],e.up.syncAnimations={},e.up.outputQueue=[],e.up.defaultText={fontFamily:"Courier, monospace",fontSize:12,textBaseline:"alphabetic",fill:"#000",padding:0,leading:0,lineSpace:0},e.up.frames=0,e.up.pauseDraw=!1,e.up.disableImageSmoothing=!1,e.up.initiate=function(){document.onmousewheel=function(t){if(void 0===t.clientX||void 0===t.clientY||e.vC._vy_mouseDown)return;let r="mouseWheelScrollDown";(t.detail?-120*t.detail:t.wheelDelta)>0&&(r="mouseWheelScrollUp");const n=e.up.findMouseOverEvents(t),i=Math.floor((t.clientX-e.vC.xBodyPos)/e.vC.scaleWidth),s=Math.floor((t.clientY-e.vC.yBodyPos)/e.vC.scaleHeight);let o=i,a=s;n&&(n._vy_gui?(n.preventAutoScale&&(o=t.clientX-e.vC.xBodyPos,a=t.clientY-e.vC.yBodyPos),o-=n._vy_x,a=Math.abs(n._vy_y-a)):(o=e.um._vy_mouseEvent.dX-n._vy_x,a=e.um._vy_mouseEvent.dY-n._vy_y),"mouseWheelScrollDown"===r?(e.um.onMouseWheelScrollDown?.(n,i,s),n.onMouseWheelScrollDown?.(e.um,o,a),(n._vy_ser_onMouseWheelScrollDown||e.um._vy_ser_onMouseWheelScrollDown)&&e.vC.serSocket.sendPacket([2,n._vy_id,8,i,s,o,a])):(e.um.onMouseWheelScrollUp?.(n,i,s),n.onMouseWheelScrollUp?.(e.um,o,a),(n._vy_ser_onMouseWheelScrollUp||e.um._vy_ser_onMouseWheelScrollUp)&&e.vC.serSocket.sendPacket([2,n._vy_id,7,i,s,o,a]))),n||("mouseWheelScrollDown"===r?(e.um.onMouseWheelScrollDown?.(0,i,s),e.um._vy_ser_onMouseWheelScrollDown&&e.vC.serSocket.sendPacket([2,0,8,i,s])):"mouseWheelScrollUp"===r&&(e.um.onMouseWheelScrollUp?.(0,i,s),e.um._vy_ser_onMouseWheelScrollUp&&e.vC.serSocket.sendPacket([2,0,7,i,s])))},document.onmousemove=function(t){if(void 0===t.clientX||void 0===t.clientY)return;const r=e.up.findMouseOverEvents(t);if(e.um._vy_mousePos.x=Math.floor((t.clientX-e.vC.xBodyPos)/e.vC.scaleWidth),e.um._vy_mousePos.y=Math.floor((t.clientY-e.vC.yBodyPos)/e.vC.scaleHeight),e.vC._vy_mouseOver&&e.vC._vy_mouseOver!==r){e.um.onMouseExit?.(e.vC._vy_mouseOver,e.um._vy_mousePos.x,e.um._vy_mousePos.y);let r=e.um._vy_mousePos.x,n=e.um._vy_mousePos.y;e.vC._vy_mouseOver._vy_gui?(e.vC._vy_mouseOver.preventAutoScale&&(r=t.clientX-e.vC.xBodyPos,n=t.clientY-e.vC.yBodyPos),r-=e.vC._vy_mouseOver._vy_x,n=Math.abs(e.vC._vy_mouseOver._vy_y-n)):e.vC._vy_mouseOver._vy_onScr?(r=r-(e.vC._vy_mouseOver._vy_x-e.vC._vy_mouseOver._vy_onScr._vy_xScr)-e.vC._vy_mouseOver._vy_onScr._vy_x,n=n-(e.vC._vy_mouseOver._vy_y-e.vC._vy_mouseOver._vy_onScr._vy_yScr)-e.vC._vy_mouseOver._vy_onScr._vy_y):(r=0,n=0),e.vC._vy_mouseOver.onMouseExit?.(e.um,r,n),(e.vC._vy_mouseOver._vy_ser_onMouseExit||e.um._vy_ser_onMouseExit)&&e.vC.serSocket.sendPacket([2,e.vC._vy_mouseOver._vy_id,2,e.um._vy_mousePos.x,e.um._vy_mousePos.y,r,n]),e.vC._vy_mouseOver=0}if(r){let n=e.um._vy_mousePos.x,i=e.um._vy_mousePos.y;if(r._vy_gui?(r.preventAutoScale&&(n=t.clientX-e.vC.xBodyPos,i=t.clientY-e.vC.yBodyPos),n-=r._vy_x,i=Math.abs(r._vy_y-i),r._vy_isTextInput&&e.um._vy_focused!=r?t.preventDefault():r._vy_dom||t.preventDefault()):(n=e.um._vy_mouseEvent.dX-r._vy_x,i=e.um._vy_mouseEvent.dY-r._vy_y),e.vC._vy_mouseOver&&e.vC._vy_mouseOver==r)return e.um.onMouseMove?.(r,e.um._vy_mousePos.x,e.um._vy_mousePos.y),r.onMouseMove?.(e.um,n,i),void((e.vC._vy_mouseOver._vy_ser_onMouseMove||e.um._vy_ser_onMouseMove)&&e.vC.serSocket.sendPacket([2,e.vC._vy_mouseOver._vy_id,0,e.um._vy_mousePos.x,e.um._vy_mousePos.y,n,i]));r._vy_gui&&(r._vy_isTextInput&&e.um._vy_focused!=r?t.preventDefault():r._vy_dom||t.preventDefault()),e.vC._vy_mouseOver=r,e.um.onMouseEnter?.(r,e.um._vy_mousePos.x,e.um._vy_mousePos.y),r.onMouseEnter?.(e.um,n,i),(e.vC._vy_mouseOver._vy_ser_onMouseEnter||e.um._vy_ser_onMouseEnter)&&e.vC.serSocket.sendPacket([2,e.vC._vy_mouseOver._vy_id,1,e.um._vy_mousePos.x,e.um._vy_mousePos.y,n,i])}else e.um.onMouseMove?.(0,e.um._vy_mousePos.x,e.um._vy_mousePos.y),e.um._vy_ser_onMouseMove&&e.vC.serSocket.sendPacket([2,0,0,e.um._vy_mousePos.x,e.um._vy_mousePos.y])},document.onmousedown=function(t){if(void 0===t.clientX||void 0===t.clientY)return;if(e.vC._vy_mouseDown++,window.hasFocus||window.focus(),e.um._vy_inTextInput||e.um._vy_inCommandInput){const t=e.um._vy_inTextInput||e.um._vy_inCommandInput;e.vC.serSocket?.sendPacket([5,0,t._vy_id,t.getText()])}if(e.um._vy_focused&&e.um._vy_focused._vy_isTextInput){const t=e.um._vy_focused.getText();e.um._vy_focused._vy_lastText!=t&&(e.um._vy_focused._vy_lastText=t,e.vC.serSocket?.sendPacket([5,0,e.um._vy_focused._vy_id,t]))}const r=e.up.findMouseOverEvents(t),n=Math.floor((t.clientX-e.vC.xBodyPos)/e.vC.scaleWidth),i=Math.floor((t.clientY-e.vC.yBodyPos)/e.vC.scaleHeight);if(r){let s=n,o=i;r._vy_gui?(r.preventAutoScale&&(s=t.clientX-e.vC.xBodyPos,o=t.clientY-e.vC.yBodyPos),s-=r._vy_x,o=Math.abs(r._vy_y-o),r._vy_isTextInput&&e.um._vy_focused!=r?t.preventDefault():r._vy_dom||t.preventDefault()):(s=e.um._vy_mouseEvent.dX-r._vy_x,o=e.um._vy_mouseEvent.dY-r._vy_y),e.um.onMouseDown?.(r,n,i,t.button+1),r.onMouseDown?.(e.um,s,o,t.button+1),(r._vy_ser_onMouseDown||e.um._vy_ser_onMouseDown)&&e.vC.serSocket.sendPacket([2,r._vy_id,5,n,i,s,o,t.button+1]),e.um._vy_focused!==r&&e.um._vy_onFocus(r)}else e.um.onMouseDown?.(0,n,i,t.button+1),e.um._vy_ser_onMouseDown&&e.vC.serSocket.sendPacket([2,0,5,n,i,0,0,t.button+1]),e.um._vy_focused&&e.um._vy_onUnfocus(e.um._vy_focused)},document.onclick=function(t){if(void 0===t.clientX||void 0===t.clientY)return;const r=e.up.findMouseOverEvents(t),n=Math.floor((t.clientX-e.vC.xBodyPos)/e.vC.scaleWidth),i=Math.floor((t.clientY-e.vC.yBodyPos)/e.vC.scaleHeight);if(r){let s=n,o=i;r._vy_gui?(r.preventAutoScale&&(s=t.clientX-e.vC.xBodyPos,o=t.clientY-e.vC.yBodyPos),s-=r._vy_x,o=Math.abs(r._vy_y-o),r._vy_isTextInput&&e.um._vy_focused!=r?t.preventDefault():r._vy_dom||t.preventDefault()):(s=e.um._vy_mouseEvent.dX-r._vy_x,o=e.um._vy_mouseEvent.dY-r._vy_y),e.um.onMouseClick?.(r,n,i,t.button+1),r.onMouseClick?.(e.um,s,o,t.button+1),(r._vy_ser_onMouseClick||e.um._vy_ser_onMouseClick)&&e.vC.serSocket.sendPacket([2,r._vy_id,3,n,i,s,o,t.button+1])}else e.um.onMouseClick?.(0,n,i,t.button+1),e.um._vy_ser_onMouseClick&&e.vC.serSocket.sendPacket([2,0,3,n,i,0,0,t.button+1])},void 0===document.onauxclick?document.oncontextmenu=document.onclick:document.onauxclick=document.onclick,document.ondblclick=function(t){if(void 0===t.clientX||void 0===t.clientY)return;window.hasFocus||window.focus();const r=e.up.findMouseOverEvents(t),n=Math.floor((t.clientX-e.vC.xBodyPos)/e.vC.scaleWidth),i=Math.floor((t.clientY-e.vC.yBodyPos)/e.vC.scaleHeight);if(r){let s=n,o=i;r._vy_gui?(r.preventAutoScale&&(s=t.clientX-e.vC.xBodyPos,o=t.clientY-e.vC.yBodyPos),s-=r._vy_x,o=Math.abs(r._vy_y-o),r._vy_isTextInput&&e.um._vy_focused!=r?t.preventDefault():r._vy_dom||t.preventDefault()):(s=e.um._vy_mouseEvent.dX-r._vy_x,o=e.um._vy_mouseEvent.dY-r._vy_y),e.um.onMouseDblClick?.(r,n,i,t.button+1),r.onMouseDblClick?.(e.um,s,o,t.button+1),(r._vy_ser_onMouseDblClick||e.um._vy_ser_onMouseDblClick)&&e.vC.serSocket.sendPacket([2,r._vy_id,4,n,i,s,o,t.button+1])}else e.um.onMouseDblClick?.(0,n,i,t.button+1),e.um._vy_ser_onMouseDblClick&&e.vC.serSocket.sendPacket([2,0,4,n,i,0,0,t.button+1])},document.onmouseup=function(t){if(void 0===t.clientX||void 0===t.clientY||!e.vC._vy_mouseDown)return;3===t.button&&t.preventDefault();const r=e.up.findMouseOverEvents(t),n=Math.floor((t.clientX-e.vC.xBodyPos)/e.vC.scaleWidth),i=Math.floor((t.clientY-e.vC.yBodyPos)/e.vC.scaleHeight);if(r){let s=n,o=i;r._vy_gui?(r.preventAutoScale&&(s=t.clientX-e.vC.xBodyPos,o=t.clientY-e.vC.yBodyPos),s-=r._vy_x,o=Math.abs(r._vy_y-o),r._vy_isTextInput&&e.um._vy_focused!==r?t.preventDefault():r._vy_dom||t.preventDefault()):(s=e.um._vy_mouseEvent.dX-r._vy_x,o=e.um._vy_mouseEvent.dY-r._vy_y),e.um.onMouseUp?.(r,n,i,t.button+1),r.onMouseUp?.(e.um,s,o,t.button+1),(r._vy_ser_onMouseUp||e.um._vy_ser_onMouseUp)&&e.vC.serSocket.sendPacket([2,r._vy_id,6,n,i,s,o,t.button+1])}else e.um.onMouseUp?.(0,n,i,t.button+1),e.um._vy_ser_onMouseUp&&e.vC.serSocket.sendPacket([2,0,6,n,i,0,0,t.button+1]);e.vC._vy_mouseDown--,1!==t.button&&2!==t.button||2===t.detail&&document.ondblclick(t)},document.onkeydown=function(r){let n=r.key;if("Tab"!==n&&"Backspace"!==n||e.um._vy_inInput||r.preventDefault(),e.um._vy_inCommandInput&&"Escape"!==n){if("Enter"===n){const t=e.um._vy_inCommandInput;t&&(e.vC.serSocket?.sendPacket([5,1,t._vy_id,t.getText()]),t.onExecute?.(e.um),t._vy_text="",t._vy_dom.value="")}else!e.um.onKeyDown||"Shift"!==n&&"Control"!==n&&"Alt"!==n||r.repeat||e.um.onKeyDown(n,r);return}if(e.um._vy_inInput&&"Tab"!==n&&"Enter"!==n&&"Escape"!==n)return;(r.getModifierState("CapsLock")||r.getModifierState("Shift"))&&1===n.length&&n.charCodeAt(0)>=65&&n.charCodeAt(0)<=90&&(n=n.toLowerCase());let i=null;if(e.um._vy_customMacros[n]?.down?i=e.um._vy_customMacros[n]:t.Q.macros[e.um._vy_macroAtlas]?.[n]?.down&&(i=t.Q.macros[e.um._vy_macroAtlas][n]),e.um.onKeyDown?.(n,r),!r.repeat)return!e.um._vy_pauseMacros&&i?(e.um._vy_setKeyDownEvent(i,n),e.vC.serSocket?.sendPacket([0,n]),void r.preventDefault()):(e.um._vy_setKeyDownEvent(null,n),void(e.um._vy_ser_onKeyDown&&e.vC.serSocket.sendPacket([10,n])));i&&r.preventDefault()},document.onkeyup=function(r){let n=r.key;if(e.um._vy_inInput)return e.um._vy_clearKeyDownEvent(n),void(!e.um.onKeyUp||"Shift"!==n&&"Control"!==n&&"Alt"!==n||r.repeat||e.um.onKeyUp(n,r));if(e.um.onKeyUp?.(n,r),(r.getModifierState("CapsLock")||r.getModifierState("Shift"))&&1===n.length&&n.charCodeAt(0)>=65&&n.charCodeAt(0)<=90&&(n=n.toLowerCase()),e.um._vy_clearKeyDownEvent(n),e.um._vy_pauseMacros)e.um._vy_ser_onKeyUp&&e.vC.serSocket?.sendPacket([11,r.key]);else{let i=null;if(e.um._vy_customMacros[n]?.up?i=e.um._vy_customMacros[n]:t.Q.macros[e.um._vy_macroAtlas]?.[n]?.up&&(i=t.Q.macros[e.um._vy_macroAtlas][n]),i)return 1!==i.up&&(e.um._vy_commands?.[i.up]?e.um._vy_commands.apply(e.um,i.upArgs):e.um._vy_parentT._vy_com[i.up].apply(e.um,i.upArgs)),e.vC.serSocket?.sendPacket([1,r.key]),void r.preventDefault();e.um._vy_ser_onKeyUp&&e.vC.serSocket?.sendPacket([1,r.key])}},document.addEventListener("touchstart",(function(t){const r=t.changedTouches[0];if(void 0===r.clientX||void 0===r.clientY)return;if(window.hasFocus||window.focus(),e.um._vy_inTextInput||e.um._vy_inCommandInput){const t=e.um._vy_inTextInput||e.um._vy_inCommandInput;e.vC.serSocket?.sendPacket([5,0,t._vy_id,t.getText()])}if(e.um._vy_focused&&e.um._vy_focused._vy_isTextInput){const t=e.um._vy_focused.getText();e.um._vy_focused._vy_lastText!=t&&(e.um._vy_focused._vy_lastText=t,e.vC.serSocket?.sendPacket([5,0,e.um._vy_focused._vy_id,t]))}const n=e.up.findMouseOverEvents(r),i=Math.floor((r.clientX-e.vC.xBodyPos)/e.vC.scaleWidth),s=Math.floor((r.clientY-e.vC.yBodyPos)/e.vC.scaleHeight);if(n){let o=i,a=s;n._vy_gui?(n.preventAutoScale&&(o=r.clientX-e.vC.xBodyPos,a=r.clientY-e.vC.yBodyPos),o-=n._vy_x,a=Math.abs(n._vy_y-a)):(o=o-(n._vy_x-n._vy_onScr._vy_xScr)-n._vy_onScr._vy_x,a=a-(n._vy_y-n._vy_onScr._vy_yScr)-n._vy_onScr._vy_y),e.um.onTouchStart?.(n,i,s,t),n.onTouchStart?.(e.um,o,a,t),(n._vy_ser_onTouchStart||e.um._vy_ser_onTouchStart)&&e.vC.serSocket.sendPacket([2,n._vy_id,9,i,s,o,a]),e.um._vy_focused!==n&&e.um._vy_onFocus(n)}else e.um.onTouchStart?.(0,i,s,t),e.um._vy_ser_onTouchStart&&e.vC.serSocket.sendPacket([2,0,9,i,s,0,0]),e.um._vy_focused&&e.um._vy_onUnfocus(e.um._vy_focused)}));const r=function(t,r){const n=t.changedTouches[0];if(void 0===n.clientX||void 0===n.clientY)return;const i=e.up.findMouseOverEvents(n),s=Math.floor((n.clientX-e.vC.xBodyPos)/e.vC.scaleWidth),o=Math.floor((n.clientY-e.vC.yBodyPos)/e.vC.scaleHeight);if(i){let a=s,l=o;i._vy_gui?(i.preventAutoScale&&(a=n.clientX-e.vC.xBodyPos,l=n.clientY-e.vC.yBodyPos),a-=i._vy_x,l=Math.abs(i._vy_y-l)):(a=a-(i._vy_x-i._vy_onScr._vy_xScr)-i._vy_onScr._vy_x,l=l-(i._vy_y-i._vy_onScr._vy_yScr)-i._vy_onScr._vy_y),e.um.onTouchEnd?.(i,s,o,r,t),i.onTouchEnd?.(e.um,a,l,r,t),(i._vy_ser_onTouchEnd||e.um._vy_ser_onTouchEnd)&&e.vC.serSocket.sendPacket([2,i._vy_id,10,s,o,a,l,r])}else e.um.onTouchEnd?.(0,s,o,r,t),e.um._vy_ser_onTouchEnd&&e.vC.serSocket.sendPacket([2,0,10,s,o,0,0,r])};document.addEventListener("touchend",r),document.addEventListener("touchmove",(function(t){const r=t.changedTouches[0];if(void 0===r.clientX||void 0===r.clientY)return;const n=e.up.findMouseOverEvents(r),i=Math.floor((r.clientX-e.vC.xBodyPos)/e.vC.scaleWidth),s=Math.floor((r.clientY-e.vC.yBodyPos)/e.vC.scaleHeight);if(n){let o=i,a=s;n._vy_gui?(n.preventAutoScale&&(o=r.clientX-e.vC.xBodyPos,a=r.clientY-e.vC.yBodyPos),o-=n._vy_x,a=Math.abs(n._vy_y-a)):(o=o-(n._vy_x-n._vy_onScr._vy_xScr)-n._vy_onScr._vy_x,a=a-(n._vy_y-n._vy_onScr._vy_yScr)-n._vy_onScr._vy_y),e.um.onTouchMove?.(n,i,s,t),n.onTouchMove?.(e.um,o,a,t),(n._vy_ser_onTouchMove||e.um._vy_ser_onTouchMove)&&e.vC.serSocket.sendPacket([2,n._vy_id,11,i,s,o,a])}else e.um.onTouchMove?.(0,i,s,t),e.um._vy_ser_onTouchMove&&e.vC.serSocket.sendPacket([2,0,11,i,s])})),document.addEventListener("touchcancel",(function(t){r(t,!0)}))},e.up.addScreenAnimation=function(e){e._vy_onScrAnim=!0,this.screenAnimations.includes(e)||this.screenAnimations.push(e),e._vy_ico&&e._vy_animator&&e._vy_animator.sync&&(this.syncAnimations[e._vy_animator.sync]?(e._vy_anim=this.syncAnimations[e._vy_animator.sync],e._vy_setIcon(e._vy_ico&&e._vy_ico._vy_parent._vy_frames?e._vy_ico._vy_parent._vy_frames[e._vy_anim.frame]:t.Q.iconsO[e._vy_atlas][e._vy_icoName][e._vy_icoState],!0)):(this.syncAnimations[e._vy_animator.sync]=e._vy_anim,this.syncAnimations[e._vy_animator.sync].sync=e._vy_animator.sync))},e.up.cacheBitmap=function(t){t.cacheAsBitmap=!1,t.cacheAsBitmap=!0},e.up.addScreenSprite=function(t,r,n){if(t._vy_underApp?.length)for(const i of t._vy_underApp)i._vy_setScreenSprite(),i._vy_updateScreenSprite(),n=e.up.updateScreenSpriteOver(r,i,n);if(n=e.up.updateScreenSpriteOver(r,t,n),t._vy_overApp?.length)for(const i of t._vy_overApp)i._vy_setScreenSprite(),i._vy_updateScreenSprite(),n=e.up.updateScreenSpriteOver(r,i,n)},e.up.updateScreenSpriteOver=function(t,e,r){return e._vy_overScr&&!e._vy_overScrSprite&&(e._vy_overScrSprite=new PIXI.Sprite(PIXI.Texture.from(e._vy_overScr.canvas))),r>-1?(t.addChildAt(e._vy_pixS,r),r++,e._vy_pixT&&(t.addChildAt(e._vy_pixT,r),r++),e._vy_overScrSprite&&(t.addChildAt(e._vy_overScrSprite,r),r++)):(e._vy_pixS&&t.addChild(e._vy_pixS),e._vy_pixT&&t.addChild(e._vy_pixT),e._vy_overScrSprite&&t.addChild(e._vy_overScrSprite)),r},e.up.removeScreenSprite=function(t,e){if(t._vy_underApp?.length)for(const r of t._vy_underApp)e.removeChild(r._vy_pixS),r._vy_pixT&&e.removeChild(r._vy_pixT),r._vy_overScrSprite&&e.removeChild(r._vy_overScrSprite);if(e.removeChild(t._vy_pixS),t._vy_pixT&&e.removeChild(t._vy_pixT),t._vy_overScrSprite&&e.removeChild(t._vy_overScrSprite),t._vy_overApp?.length)for(const r of t._vy_overApp)e.removeChild(r._vy_pixS),r._vy_pixT&&e.removeChild(r._vy_pixT),r._vy_overScrSprite&&e.removeChild(r._vy_overScrSprite)},e.up.setDisplayOrderInt=function(t,e){if(!e&&t._vy_anim&&t._vy_anim.lastCheck){let e=performance.now()-t._vy_anim.lastCheck;t._vy_ico&&t._vy_ico._vy_parent._vy_frames&&e>t._vy_ico._vy_parent._vy_frames.length*t._vy_anim.delay&&(e-=Math.floor(e/(t._vy_ico._vy_parent._vy_frames.length*t._vy_anim.delay))*(t._vy_ico._vy_parent._vy_frames.length*t._vy_anim.delay)),t._vy_anim.lastCheck=performance.now(),t._vy_anim.timer=e}const r=t.preventAutoScale?this.intApp.stage:this.intApp.stageScale;for(let e=0,n=this.interfaceElements.length;e<n;e++){const n=this.interfaceElements[e];if(n._vy_plane>t._vy_plane||n._vy_plane===t._vy_plane&&n._vy_layer>t._vy_layer)return this.interfaceElements.splice(e,0,t),void this.addScreenSprite(t,r,n._vy_underApp?.length?r.children.indexOf(n._vy_underApp[0]._vy_pixS):r.children.indexOf(n._vy_pixS))}this.interfaceElements.push(t),this.addScreenSprite(t,r)},e.up.pauseRender=function(t,r){e.up.pauseDraw||(e.up.pixiApp&&(e.up.pixiApp.render(),e.up.pixiApp.stop()),t?requestAnimationFrame(e.up.refreshScreenBind):e.up.intApp.render(e.up.intApp.stage)),e.up.pauseDraw=t||!0},e.up.resumeRender=function(){e.up.pauseDraw=e.up.lastPauseDraw,e.up.pauseDraw||(delete e.up.lastPauseDraw,i.P.lastObjMove=performance.now(),e.up.pixiApp&&e.up.pixiApp.start())},e.up.nextFrame=performance.now(),e.up.relayerRefresh=[],e.up.refreshScreen=function(){const r=performance.now();i.P.refreshObjectMovement(r),i.P.refreshTransitions(r);for(let e=this.screenAnimations.length;e--;){const n=this.screenAnimations[e];if(n&&n._vy_anim&&!n._vy_anim.isPaused)if(n._vy_anim.sync){if(n._vy_anim.lastFrame===r)n._vy_setIcon(n._vy_ico&&n._vy_ico._vy_parent._vy_frames?n._vy_ico._vy_parent._vy_frames[n._vy_anim.frame]:t.Q.iconsO[n._vy_atlas][n._vy_icoName][n._vy_icoState],!0);else if(n._vy_anim.lastCheck!==r){const t=n._vy_anim.frame;n._vy_setFrame(r),n._vy_anim.frame!==t&&(n._vy_anim.lastFrame=r)}}else n._vy_setFrame(r)}if(this.frames++,this.nextFrame<=r&&(e.um._vy_fps=this.frames,e.um.hideFPS||(e.vC.fpsLabel.textContent=this.frames+" FPS"),this.nextFrame=r+1e3,this.frames=0),e.um.onScreenRender?.(r),!this.pauseDraw&&this.relayerRefresh.length&&!(this.frames%10)){for(let t=this.relayerRefresh.length;t--;){const r=this.relayerRefresh[t];r._vy_onScrRelayer=!1,e.um._vy_mapView._vy_clearDisplayOrder(r)}for(let t=this.relayerRefresh.length;t--;)e.um._vy_mapView._vy_setDisplayOrder(this.relayerRefresh[t],!0);this.relayerRefresh=[]}if(this.pauseDraw&&"map"!==this.pauseDraw||this.refreshInt&&(this.refreshInt=!1,this.intApp.renderer.render(this.intApp.stage)),this.outputQueue.length){for(let t=this.outputQueue.length;t--;){const e=this.outputQueue[t];e._vy_dom.scrollHeight-e._vy_dom.scrollTop-50<=e._vy_dom.clientHeight?(e._vy_dom.insertAdjacentHTML("beforeend",e._vy_outputQueue),e._vy_dom.scrollTop=e._vy_dom.scrollHeight):e._vy_dom.insertAdjacentHTML("beforeend",e._vy_outputQueue),e._vy_outputQueue=""}this.outputQueue=[]}this.pauseDraw&&requestAnimationFrame(this.refreshScreenBind)},e.up.refreshScreenBind=e.up.refreshScreen.bind(e.up),e.up.addToInterface=function(t,r){if(!t._vy_onScr){if(t._vy_onScr="interface",t._vy_atlas?t._vy_ico||t._vy_setIconCheck():t._vy_text&&t._vy_setIconSize(),t._vy_isWebBox?(t._vy_parent||e.vC.gameBody.appendChild(t._vy_dom),t._vy_scaleWebBox(),t._vy_dom.scrollTop=t._vy_dom.scrollHeight,e.up.interfaceElements.push(t)):((t.preventAutoScale||t._vy_edgeLock)&&t._vy_setEdgeLock(),t.isDiob&&(t._vy_setScreenSprite(),t._vy_updateScreenSprite(),e.up.setDisplayOrderInt(t,r))),t._vy_over)for(let n=t._vy_over.length;n--;){const i=t._vy_over[n];i._vy_appMask?(i._vy_onScr="interface",!i._vy_ico&&i._vy_atlas&&i._vy_setIconCheck(t),i._vy_setScreenSprite(),i._vy_updateScreenSprite(),i._vy_appMask.ownAnim?i._vy_anim&&(i._vy_ico&&i._vy_ico._vy_parent._vy_frames||i._vy_anim.playAnim)&&e.up.addScreenAnimation(i):t._vy_onScrAnim&&(i._vy_onScrAnim=!0)):e.up.addToInterface(i,r)}if(t._vy_conts)for(let n=0,i=t._vy_conts.length;n<i;n++){const i=t._vy_conts[n];i.isHidden||e.up.addToInterface(i,r)}e.up.refreshInt=!0,t._vy_anim&&t._vy_ico&&t._vy_ico._vy_parent._vy_frames&&e.up.addScreenAnimation(t)}},e.up.removeFromInterface=function(t){if(!t._vy_onScr)return;const r=e.up.interfaceElements.indexOf(t);if(-1!==r&&e.up.interfaceElements.splice(r,1),t._vy_onScr=null,t._vy_pixS&&e.up.removeScreenSprite(t,t.preventAutoScale?e.up.intApp.stage:e.up.intApp.stageScale),t._vy_conts)for(let r=t._vy_conts.length;r--;)e.up.removeFromInterface(t._vy_conts[r]);if(t._vy_over)for(let r=t._vy_over.length;r--;){const n=t._vy_over[r];if(n._vy_appMask){if(n._vy_onScr=null,n._vy_onScrAnim){if(n._vy_appMask.ownAnim){const t=e.up.screenAnimations.indexOf(n);-1!==t&&e.up.screenAnimations.splice(t,1)}n._vy_onScrAnim=!1}}else e.up.removeFromInterface(n)}if(t._vy_dom?t._vy_parent||e.vC.gameBody.removeChild(t._vy_dom):e.up.refreshInt=!0,t._vy_onScrAnim){t._vy_onScrAnim=!1;const r=e.up.screenAnimations.indexOf(t);-1!==r&&e.up.screenAnimations.splice(r,1)}},e.up.customScreenDraw=function(t,r,n){if(r instanceof Array){const i=n,s=function(){r.length?e.up._customScreenDraw(r.shift(),t,n):i&&i()};n=s,s()}else e.up._customScreenDraw(r,t,n)},e.up._customScreenDraw=function(t,r,n){if(t.composite?r.globalCompositeOperation=t.composite:r.globalCompositeOperation="source-over",t.alpha?r.globalAlpha=t.alpha:r.globalAlpha=1,"image"===t.type){if(!t.image)return void(n&&n());void 0===t.x&&(t.x=0),void 0===t.y&&(t.y=0);const i=function(t,e){if(e.angle){const n=(e.width?e.width:t.width)*(void 0!==e.anchor?void 0!==e.anchor.x?e.anchor.x:e.anchor:.5),i=(e.height?e.height:t.height)*(void 0!==e.anchor?void 0!==e.anchor.y?e.anchor.y:e.anchor:.5);r.save(),r.translate(e.x+n,e.y+i),r.rotate(2*Math.PI-e.angle),e.x=-n,e.y=-i}void 0!==e.clipX&&void 0!==e.clipY&&e.clipW&&e.clipH?r.drawImage(t,e.clipX,e.clipY,e.clipW,e.clipH,e.x,e.y,e.width?e.width:e.clipW,e.height?e.height:e.clipH):e.width&&e.height?r.drawImage(t,e.x,e.y,e.width,e.height):r.drawImage(t,e.x,e.y),n&&n(),e.angle&&r.restore()},s=t.image;if("object"==typeof s)if(s instanceof HTMLCanvasElement)i(s,t);else{let r=s._vy_ico;if(!r){if(!s.atlasName)return void(n&&n());if(r=e.j3.Icon._getIcon(s.atlasName,s.iconName?s.iconName:"",s.iconState?s.iconState:"",s.frame?s.frame:void 0),!r)return void(n&&n())}const o=new Image;o.onload=function(){i(this,t)},o.src=r._vy_imageData}else if("string"==typeof s){const e=new Image;e.onload=function(){i(this,t)},e.src=s}else i(s,t)}else{if(t.angle&&(r.save(),r.rotate(2*Math.PI-t.angle)),"fillRect"===t.type||"strokeRect"===t.type){if(t.x||(t.x=0),t.y||(t.y=0),void 0===t.width||void 0===t.height)return void(n&&n());"fillRect"===t.type?t.color?r.fillStyle=t.color:r.fillStyle="#000":(t.color?r.strokeStyle=t.color:r.strokeStyle="#000",r.lineWidth=t.lineWidth?t.lineWidth:1),"fillRect"===t.type?r.fillRect(t.x,t.y,t.width,t.height):"strokeRect"===t.type&&r.strokeRect(t.x,t.y,t.width,t.height),n&&n()}else if("clearRect"===t.type){if(void 0===t.x&&void 0===t.y&&void 0===t.width&&void 0===t.height)r.clearRect(0,0,e.um.screenView.width,e.um.screenView.height);else{if(void 0===t.x||void 0===t.y||void 0===t.width||void 0===t.height)return void(n&&n());r.clearRect(t.x,t.y,t.width,t.height)}n&&n()}else if("text"===t.type){if(void 0===t.x||void 0===t.y)return void(n&&n());t.color?r.fillStyle=t.color:r.fillStyle="#000",t.font?r.font=t.font:r.font="12px Courier, monospace",t.align&&(r.textAlign=t.align),r.fillText(t.text,t.x,t.y,t.maxWidth),n&&n()}else if("fillPath"===t.type||"strokePath"===t.type){if(!t.path||!t.path.length)return void(n&&n());"fillPath"===t.type?t.color?r.fillStyle=t.color:r.fillStyle="#000":(t.color?r.strokeStyle=t.color:r.strokeStyle="#000",r.lineWidth=t.lineWidth?t.lineWidth:1),r.beginPath();const e=t.path;for(let n=0,i=e.length;n<i;n+=3){const i=e[n];"move"===i?r.moveTo(e[n+1],e[n+2]):"line"===i?r.lineTo(e[n+1],e[n+2]):"arc"===i?(r.arc(e[n+1],e[n+2],e[n+3],e[n+4],e[n+5],e[n+6]),n+=4):"break"===i&&(n-=2,r.closePath(),"fillPath"===t.type?r.fill():"strokePath"===t.type&&r.stroke(),r.beginPath())}r.closePath(),"fillPath"===t.type?r.fill():"strokePath"===t.type&&r.stroke(),n&&n()}t.angle&&r.restore()}},e.up.createTopScreenCanvas=function(t,r,n){if(!t||e.up.topScreenCanvas[t])return;const i=document.createElement("canvas");i.className="top_canvas",i.width=window.innerWidth,i.height=window.innerHeight,void 0===r&&(r=999999),i.style.zIndex=9e5+10*r,e.vC.gameBody.appendChild(i);const s=i.getContext("2d");n&&(e.up._setTopScreenSet(s,n),n.autoScale&&(i.width=e.a$.gameWidth,i.height=e.a$.gameHeight)),e.up.topScreenBrush[t]=s,e.up.topScreenCanvas[t]=i},e.up._setTopScreenSet=function(t,r){t.topSet=r,"nearest"===r.scaleType?t.imageSmoothingEnabled=!1:"smooth"!==r.scaleType||e.up.disableImageSmoothing?t.imageSmoothingEnabled=!e.up.disableImageSmoothing:t.imageSmoothingEnabled=!0},e.up.findMouseOverEvents=function(t){let r=t.clientX-e.vC.xBodyPos,n=t.clientY-e.vC.yBodyPos;for(let i=this.interfaceElements.length;i--;){const s=this.interfaceElements[i];if(s._vy_isWebBox){if(t.target._vy_parent!==s)continue;if(!s._vy_isMapView)return t.target._vy_parent;{const t=s._vy_findMouseOver(r,n);if(t)return t}}if(s._vy_mouseOp>0){let t=s._vy_isOverlay?s._vy_isOverlay:s,i=s._vy_isOverlay?s._vy_x:0,o=s._vy_isOverlay?s._vy_y:0,a=s._vy_w,l=s._vy_h;if(1===s._vy_mouseOp?(a=s._vy_ico?s._vy_icoW:0,l=s._vy_ico?s._vy_icoH:0,i=t._vy_x+i+s._vy_xIcoOff,o=t._vy_y+o+s._vy_yIcoOff):(i=t._vy_x+t._vy_xOr+i,o=t._vy_y+t._vy_yOr+o),s.preventAutoScale){if(i<=r&&i+a>r&&o<=n&&o+l>n)return s}else if(i*e.vC.scaleWidth<=r&&(i+a)*e.vC.scaleWidth>r&&o*e.vC.scaleHeight<=n&&(o+l)*e.vC.scaleHeight>n)return s}}},window.AudioContext=window.AudioContext||window.webkitAudioContext,window.AudioContext&&(e.R5.player=new AudioContext),e.R5.playSound=function(r,n,s){let o=r,a=0;const l=typeof r;"string"===l?("Sound"===r?a=i.P.createObjectNew("Sound"):r.includes("/")&&"Sound"===r.substring(0,r.indexOf("/"))&&i.P.objectTypes[r]&&(a=i.P.createObjectNew(r)),a||(a=i.P.createObjectNew("Sound"),a.soundName=r),o=a.soundName):"object"===l&&(r._vy_type?a=r:(a=i.P.createObjectNew("Sound"),i.P._copyObjectVars(a,r)),o=a.soundName),a||(a=i.P.createObjectNew("Sound"));const _=t.Q.loadedSounds[o];if(!_||!t.Q.loadedSounds.hasOwnProperty(o))return t.Q.loadSound(o,[a,n,s]),a;if(!e.R5.player||!e.vC.game.sound)return a;if(_.data)return e.R5.player.decodeAudioData(_.data,(function(t){_.buffer=t;const r=_.loading;delete _.loading;for(const t of r)t();a&&!a._vy_isStopped&&e.R5.playSound(a,n,s)}),(function(t){console.log(t)})),delete _.data,a;if(_.loading)return _.loading.push(e.R5.playSound.bind(this,a,n,s)),a;if(!_.buffer)return a;const u=e.R5.player.createBufferSource();return a._vy_source=u,u.buffer=_.buffer,u.soundObj=a,e.R5.createGain(a),a.onEnded&&(u.onended=a.onEnded.bind(a)),a.onStarted&&!a._vy_isStopped&&a.onStarted(e.um,n),a.playbackRate&&(u.playbackRate.value=a.playbackRate),a._vy_isStopped=!1,a.startTime&&void 0===n&&(n=a.startTime),a.duration&&void 0===s&&(s=a.duration),u.startDur=n||0,a.loop?(u.loop=!0,u.loopStart=u.startDur,u.loopEnd=s||u.buffer.duration,u.start(0,u.loopStart)):(u.duration=s||u.buffer.duration,u.start(0,u.startDur,s)),u.startTime=u.context.currentTime,"suspended"===u.context.state&&(a.stop(),e.R5.queuedSounds||(document.addEventListener("click",e.R5.queueClickEvent),e.R5.queuedSounds=[]),e.R5.queuedSounds.push(a)),a},e.R5.queueClickEvent=function(t){for(const t of e.R5.queuedSounds)t.resume();document.removeEventListener("click",e.R5.queueClickEvent),delete e.R5.queuedSounds},e.R5.createGain=function(t){const r=e.R5.player.createGain();isFinite(t._vy_volume)?r.gain.value=e.um._vy_volume/100*(t._vy_volume/100):r.gain.value=e.um._vy_volume/100,t._vy_source.connect(r),r.connect(e.R5.player.destination),t._vy_gain=r},e.R5.createPanner=function(t){const r=e.R5.player.createPanner();r.panningModel="HRTF",r.distanceModel="linear",t._vy_source.connect(r),r.connect(e.R5.player.destination),t._vy_panner=r},e.j3.Icon={},e.j3.Icon.getIcon=function(e,r="",n="",i){const s=t.Q.iconsO[e]?.[r]?.[n];if(s)return i?s._vy_frames?.[i-1]:s},e.j3.Icon.getIconAtlas=function(e){return t.Q.iconAtlasO[e]||t.Q.newIconAtlas(e)},e.j3.Icon.newAtlas=function(e){if(e&&!t.Q.iconsO[e])return t.Q.iconsO[e]={},t.Q.loadedAtlases[e]={loading:!1},t.Q.iconAtlasO[e]=t.Q.newIconAtlas(e)},e.j3.Icon.newIcon=function(r,n,i,s,o){if(!r||!t.Q.iconsO[r])return;const a=e.j3.newIcon(r,n,"",i,s,null,o);return t.Q.iconAtlasO[r]._vy_addIcon(a),a},e.j3.Icon.newIconState=function(r,n,i,s){if(!r||!t.Q.iconsO[r]||!t.Q.iconsO[r][n])return;const o=t.Q.iconsO[r][n][""],a=e.j3.newIcon(r,n,i,o?._vy_width,o?._vy_height,null,s);return o?.addState(a),a},e.j3.Icon.newFrame=function(r,n,i,s="",o){if(!n||!t.Q.iconsO[n]||!t.Q.iconsO[n][i])return;const a=t.Q.iconsO[n][i][s];o||(o=e.Bn.blankIcon);const l=e.j3.newIcon(n,i,s,a?._vy_width,a?._vy_height,r,o);a?.addFrame(l)},e.j3.Icon.setFrameDelay=function(e,r,n,i,s){if(!e||!t.Q.iconsO[e]||!t.Q.iconsO[e][r])return;let o;if(void 0!==n){if(!t.Q.iconsO[e][r][n])return;o=t.Q.iconsO[e][r][n]}else o=t.Q.iconsO[e][r][""];i>1?o._vy_frames[i-1]._vy_frameDelay=s:o._vy_frameDelay=s},e.j3.Icon.getFrameDelay=function(e,r,n,i){if(!e||!t.Q.iconsO[e]||!t.Q.iconsO[e][r])return;let s;if(void 0!==n){if(!t.Q.iconsO[e][r][n])return;s=t.Q.iconsO[e][r][n]}else s=t.Q.iconsO[e][r][""];return i>1?s._vy_frames[i-1]._vy_frameDelay:s._vy_frameDelay},e.j3.Icon.getFrameCount=function(e,r,n){if(!e||!t.Q.iconsO[e]||!t.Q.iconsO[e][r])return;let i;if(void 0!==n){if(!t.Q.iconsO[e][r][n])return;i=t.Q.iconsO[e][r][n]}else i=t.Q.iconsO[e][r][""];return i._vy_frames?i._vy_frames.length:1},e.j3.Icon.clone=function(r){if(!r||!r.atlas)return;if(t.Q.iconsO[r.atlas]||t.Q.loadAtlas(r.atlas),!t.Q.iconsO[r.atlas])return;let n=r.atlas;r.newAtlas&&r.atlas!==r.newAtlas&&(t.Q.iconsO[r.newAtlas]||t.Q.loadAtlas(r.newAtlas),t.Q.iconsO[r.newAtlas]||(t.Q.iconsO[r.newAtlas]={},t.Q.loadedAtlases[r.newAtlas]={loading:!1}),n=r.newAtlas);const i=async function(r,n){r._vy_frameDelay=n._vy_frameDelay,r._vy_imageData=t.Q.getIconData(n),r._vy_texture=r._vy_imageData?await PIXI.Assets.load(r._vy_imageData):t.Q.blankPixiTex,e.up.refreshInt=!0};if(void 0!==r.icon){const s=r.newIcon?r.newIcon:r.icon,o=t.Q.iconsO[r.atlas][r.icon];if(!o)return;if(o=o[""],r.state||""===r.state){const o=r.newState?r.newState:r.state,a=t.Q.iconsO[r.atlas][r.icon][r.state];if(!a)return;if(r.frame){if(!a._vy_frames[r.frame-1])return;const l=t.Q.iconsO[n][o][""];e.j3.Icon.newFrame(null,n,s,o),i(l._vy_frames[l._vy_frames.length-1],a._vy_frames[r.frame-1])}else{if(t.Q.iconsO[n][s][o])return;e.j3.Icon.newIconState(n,s,o);const r=t.Q.iconsO[n][s][o];if(i(r,a),a._vy_frames){r._vy_frames=[r];for(let t=1,s=a._vy_frames.length;t<s;t++)e.j3.Icon.newFrame(null,n,o),i(r._vy_frames[t],a._vy_frames[t])}t.Q.iconsO[n][s][""].addState(r)}}else if(r.frame){if(!o._vy_frames[r.frame-1])return;const a=t.Q.iconsO[n][s][""];e.j3.Icon.newFrame(null,n,s),i(a._vy_frames[a._vy_frames.length-1],o._vy_frames[r.frame-1])}else{if(t.Q.iconsO[n][s])return;e.j3.Icon.newIcon(n,s,o._vy_width,o._vy_height);const r=t.Q.iconsO[n][s][""];if(i(r,o),o._vy_frames){r._vy_frames=[r];for(let t=1,a=o._vy_frames.length;t<a;t++)e.j3.Icon.newFrame(null,n,s),i(r._vy_frames[t],o._vy_frames[t])}if(o._vy_states?.length)for(let t=0,a=o._vy_states.length;t<a;t++)e.j3.Icon.newIconState(n,s,o._vy_states[t]._vy_iconState),i(r._vy_states[r._vy_states.length-1],o._vy_states[t])}}else{for(const s in t.Q.iconsO[r.atlas])for(const o in t.Q.iconsO[r.atlas][s]){const a=t.Q.iconsO[r.atlas][s][o];if(a._vy_parState)continue;e.j3.Icon.newIcon(n,a._vy_iconName,a._vy_width,a._vy_height);const l=t.Q.iconsO[n][a._vy_iconName][""];if(i(l,a),a._vy_frames){l._vy_frames=[l];for(let t=1,r=a._vy_frames.length;t<r;t++)e.j3.Icon.newFrame(null,n,a._vy_iconName),i(l._vy_frames[t],a._vy_frames[t])}}for(const s in t.Q.iconsO[r.atlas])for(const o in t.Q.iconsO[r.atlas][s]){const a=t.Q.iconsO[r.atlas][s][o];if(!a._vy_parState)continue;e.j3.Icon.newIconState(n,a._vy_parState._vy_iconName,a._vy_iconState);const l=t.Q.iconsO[n][a._vy_parState._vy_iconName][a._vy_iconState];if(i(l,a),a._vy_frames){l._vy_frames=[l];for(let t=1,r=a._vy_frames.length;t<r;t++)e.j3.Icon.newFrame(null,n,a._vy_parState._vy_iconName,a._vy_iconState),i(l._vy_frames[t],a._vy_frames[t])}t.Q.iconsO[n][a._vy_parState._vy_iconName][""].addState(l)}}},e.j3.Icon.applyFilter=function(r,n,i,s,o,a){if(!r||!n||"object"!=typeof r||!r.type)return;t.Q.alterIcon(n,i,s,o,(function(n){const i=new Image;i.onload=async function(){const i=document.createElement("canvas"),s=i.getContext("2d");i.width=n._vy_width,i.height=n._vy_height,s.drawImage(this,0,0);const o=s.getImageData(0,0,n._vy_width,n._vy_height);if("grayscale"===r.type)for(let t=0,e=o.data.length;t<e;t+=4){const e=.2126*o.data[t]+.7152*o.data[t+1]+.0722*o.data[t+2];o.data[t]=o.data[t+1]=o.data[t+2]=e}else if("lighten"===r.type){r.value||(r.value=1);for(let t=0,e=o.data.length;t<e;t+=4)o.data[t]+=r.value,o.data[t+1]+=r.value,o.data[t+2]+=r.value}else if("darken"===r.type){r.value||(r.value=1);for(let t=0,e=o.data.length;t<e;t+=4)o.data[t]-=r.value,o.data[t+1]-=r.value,o.data[t+2]-=r.value}else if("invert"===r.type)for(let t=0,e=o.data.length;t<e;t+=4)o.data[t]=255-o.data[t],o.data[t+1]=255-o.data[t+1],o.data[t+2]=255-o.data[t+2];s.putImageData(o,0,0),n._vy_imageData=i.toDataURL(),n._vy_texture=n._vy_imageData?await PIXI.Assets.load(n._vy_imageData):t.Q.blankPixiTex,e.up.refreshInt=!0,a?.()},i.src=n._vy_imageData}))},e.j3.Icon.alterColor=function(r,n,i,s,o,a){if(!r||!n||"object"!=typeof r)return;r.type||(r.type="normal");t.Q.alterIcon(n,i,s,o,(function(n){!async function(){const i=document.createElement("canvas"),s=i.getContext("2d");if(i.width=n._vy_width,i.height=n._vy_height,s.drawImage(n.image,0,0),"swap"===r.type){const t=s.getImageData(0,0,n._vy_width,n._vy_height);if(r.colors)for(const e in r.colors)for(let r=0,n=t.data.length;r<n;r+=4)void 0!==e.red&&e.red!==t.data[r]||void 0!==e.green&&e.green!==t.data[r+1]||void 0!==e.blue&&e.blue!==t.data[r+2]||void 0!==e.alpha&&e.alpha!==t.data[r+3]||(void 0!==e.newRed&&(t.data[r]=e.newRed),void 0!==e.newGreen&&(t.data[r+1]=e.newGreen),void 0!==e.newBlue&&(t.data[r+2]=e.newBlue),void 0!==e.newAlpha&&(t.data[r+3]=e.newAlpha));else for(let e=0,n=t.data.length;e<n;e+=4)void 0!==r.red&&r.red!==t.data[e]||void 0!==r.green&&r.green!==t.data[e+1]||void 0!==r.blue&&r.blue!==t.data[e+2]||void 0!==r.alpha&&r.alpha!==t.data[e+3]||(void 0!==r.newRed&&(t.data[e]=r.newRed),void 0!==r.newGreen&&(t.data[e+1]=r.newGreen),void 0!==r.newBlue&&(t.data[e+2]=r.newBlue),void 0!==r.newAlpha&&(t.data[e+3]=r.newAlpha));s.putImageData(t,0,0)}else if("normal"===r.type){const t=s.getImageData(0,0,n._vy_width,n._vy_height);for(let e=0,n=t.data.length;e<n;e+=4)r.red&&(t.data[e]+=r.red),r.green&&(t.data[e+1]+=r.green),r.blue&&(t.data[e+2]+=r.blue),r.alpha&&(t.data[e+3]+=r.alpha);s.putImageData(t,0,0)}else{const t=document.createElement("canvas"),e=t.getContext("2d");t.width=n._vy_width,t.height=n._vy_height,e.drawImage(n.image,0,0),e.globalCompositeOperation="source-atop",r.hex?e.fillStyle=r.hex:e.fillStyle="rgba("+(r.red?r.red:0)+","+(r.green?r.green:0)+","+(r.blue?r.blue:0)+","+(r.alpha?r.alpha:255)+")",e.fillRect(0,0,n._vy_width,n._vy_height),"multiply"===r.type&&(s.globalCompositeOperation="multiply"),s.drawImage(t,0,0)}n._vy_imageData=i.toDataURL(),n._vy_texture=n._vy_imageData?await PIXI.Assets.load(n._vy_imageData):t.Q.blankPixiTex,e.up.refreshInt=!0,a?.()}()}))},e.j3.Icon._getIcon=function(e,r,n,i){if(!e||!t.Q.iconsO[e])return;if(r||(r=""),!t.Q.iconsO[e][r])return;n||(n="");const s=t.Q.iconsO[e][r][n];return s?i&&s._vy_frames?.length>=i?s._vy_frames[i-1]:s:void 0},e.j3.Icon.getRawData=function(t,r,n,i){const s=e.j3.Icon._getIcon(t,r,n,i);return s?.getRawData()},e.j3.Icon.setRawData=async function(t,r,n,i,s,o){if(!r||!t)return;const a=e.j3.Icon._getIcon(r,n,i,s);a&&await a.setRawData(t),o?.()},e.j3.Icon.getDataURL=function(r,n,i,s){const o=e.j3.Icon._getIcon(r,n,i,s);if(o)return t.Q.getIconData(o)},e.j3.Icon.setDataURL=async function(t,r,n,i,s,o,a){const l=e.j3.Icon._getIcon(r,n,i,s);l?(await l.setDataFromURL(t),o?.()):o&&e.vC._callback(o,"Invalid icon destination.")},e.j3.Icon.draw=function(r,n,i,s,o,a){const l=e.j3.Icon._getIcon(n,i,s,o);if(!l)return void(a&&e.vC._callback(a,"Invalid icon destination."));const _=new Image;_.onload=function(){const n=document.createElement("canvas"),i=n.getContext("2d");n.width=l._vy_width,n.height=l._vy_height,i.drawImage(this,0,0);e.up.customScreenDraw(i,r,(async function(){l._vy_imageData=n.toDataURL(),l._vy_texture=l._vy_imageData?await PIXI.Assets.load(l._vy_imageData):t.Q.blankPixiTex,e.up.refreshInt=!0,a&&e.vC._callback(a)}))},_.src=l._vy_imageData||e.Bn.blankIcon},e.j3.Icon.getIconSize=function(t,r,n,i){const s=e.j3.Icon._getIcon(t,r,n,i);if(s)return{width:s._vy_width,height:s._vy_height}},e.j3.Icon.cacheImage=function(r,n,i){if(!t.Q.loadedAtlases.hasOwnProperty(r)||t.Q.loadedAtlases[r].loading){const s=function(t,r,n,i){"loaded"===t?e.j3.Icon.cacheImage(r,n,i):i&&e.vC._callback(i)};t.Q.loadAtlas(r,[s,this,[r,n,i]])}else i&&e.vC._callback(i)},e.j3.Icon.getIconNames=function(e){if(!e||!t.Q.iconsO[e])return[];const r=[],n=t.Q.iconsO[e];for(const t in n)r.push(t);return r},e.j3.Icon.getIconStateNames=function(e,r){if(!e||!t.Q.iconsO[e]||!t.Q.iconsO[e][r])return[];const n=[],i=t.Q.iconsO[e][r][""];if(!i||!i._vy_states?.length)return n;for(let t=0,e=i._vy_states.length;t<e;t++){const e=i._vy_states[t];e&&n.push(e._vy_iconState)}return n},e.j3.Icon.createSprite=function(t,r,n,i){const s=new PIXI.Sprite,o=e.j3.Icon._getIcon(t,r,n,i);return o?s.texture=o._vy_texture:(s.texture=PIXI.Texture.WHITE,s.width=32,s.height=32),s},e.j3.Icon.createGraphics=function(...t){return new PIXI.Graphics(...t)},e.j3.Map=class{static dirs=["east","northeast","north","northwest","west","southwest","south","southeast"];static _dirs=["east","northeast","northeast","north","north","northwest","northwest","west","west","southwest","southwest","south","south","southeast","southeast","east"];static _cDirs=["east","east","north","north","north","north","west","west","west","west","south","south","south","south","east","east"];static getMaps=function(){const e=[];for(const r in t.Q.maps)r&&e.push(r);return e};static getClients=function(e){const r=t.Q.maps[e];return r?r.getClients():[]};static sendDiob=function(e,r,n){const i=t.Q.maps[e];if(i)for(let t=0,e=i._vy_clients.length;t<e;t++)i._vy_clients[t]?.sendDiob(r,n)};static getAngle=function(t,e,r){if(t)return e?this._getAngle(t,e,r):t.angle};static _getAngle=function(t,r,n){return n?Math.atan2((r.yOrigin?r.yPos+r.yOrigin:r.yPos)+Math.round((r.height?r.height:e.a$.tileSize.height)/2)-((t.yOrigin?t.yPos+t.yOrigin:t.yPos)+Math.round((t.height?t.height:e.a$.tileSize.height)/2)),(t.xOrigin?t.xPos+t.xOrigin:t.xPos)+Math.round((t.width?t.width:e.a$.tileSize.width)/2)-((r.xOrigin?r.xPos+r.xOrigin:r.xPos)+Math.round((r.width?r.width:e.a$.tileSize.width)/2)))+Math.PI:Math.atan2((r.yOrigin?r.yPos+r.yOrigin:r.yPos)-(t.yOrigin?t.yPos+t.yOrigin:t.yPos),(t.xOrigin?t.xPos+t.xOrigin:t.xPos)-(r.xOrigin?r.xPos+r.xOrigin:r.xPos))+Math.PI};static getDir=function(t,e,r,n){if(!t)return;if(!e)return t.dir;let i=180*this._getAngle(t,e,r)/Math.PI;return i>=360?i=0:i<0&&(i=360+i),n?this._cDirs[Math.floor(i/22.5)]:this._dirs[Math.floor(i/22.5)]};static getDirByAngle=function(t,e){let r="east";if(t&&(r="string"==typeof t?t:t.dir),!e)return r;const n=this.dirs.indexOf(r);return void 0===n?r:(((e=45*n+180*e/Math.PI)>=360||e<=-360)&&(e%=360),e<0&&(e+=360),this._dirs[Math.floor(e/22.5)])};static setRegion=function(t,e){if(!(t&&t.xCoord&&t.yCoord&&t.mapName))return;const r=this.getLoc(t.xCoord,t.yCoord,t.mapName);if(!r)return;e||(e="Region");let n=e;if("string"==typeof e){if(n=i.P.regions[e],!n)return}else if(!e._vy_isRegion)return;r._vy_region=n};static getRegionByType=function(t){return i.P.regions[t]};static getDiobsByRegion=function(e,r,n,s){if(s){const i=t.Q.maps[s];return i?i.getDiobsByRegion(e,r,n):[]}if(!e)return[];const o="string"==typeof e?i.P.regions[e]:e;if(!o._vy_isRegion)return[];const a=[];for(const t of i.P.objects.values())t&&t.region===o&&!t._vy_isRegion&&(r&&!i.P.isType(t._vy_type,r,n)||a.push(t));return a};static getDiobsByTag=function(r,n){if(!n)return e.j3.World.getDiobsByTag(r);const i=t.Q.maps[n];return i?i.getDiobsByTag(r):[]};static getLoc=function(e,r,n){if(e){if("number"!=typeof e)return e._vy_isLoc?e:e.loc;{if(!r||!n)return;const i=t.Q.maps[n];if(i&&e<=i._vy_xMax)return i._vy_tiles[e+i._vy_xMax*r]}}};static setLoc=function(e,r){if(!(e&&r&&e.xCoord&&e.yCoord&&e.mapName))return;const n=this.getLoc(e.xCoord,e.yCoord,e.mapName),s=t.Q.maps[e.mapName];if(!n||!s)return;const o="string"==typeof r?i.P.createObject(r):r;if(o._vy_isLoc){if(o._vy_mapN=e.mapName,o._vy_map=s,o._vy_region=n._vy_region,o._vy_chunk=n._vy_chunk,o._vy_x=(e.xCoord-1)*s._vy_tileW,o._vy_y=(e.yCoord-1)*s._vy_tileH,n._vy_conts){const t=n._vy_conts.slice(0);for(let e=0,r=t.length;e<r;e++){const r=t[e];r._vy_loc&&r._vy_loc===n&&(r._vy_loc=o),n._vy_removeFromContents(r),o._vy_addToContents(r)}}if(s._vy_tiles[e.xCoord+s._vy_xMax*e.yCoord]=o,o.id=n._vy_id,o.onNew&&"string"==typeof r&&o.onNew(),n._vy_onScr){const t=n._vy_onScr;t._vy_removeFromScreen(n),t._vy_addToScreen(o)}return n._vy_isLoc=!1,n._vy_id="",n.onDel?.(),i.P.deleteDiob(n),o}};static getLocByDir=function(t,e){if(!e)return;let r=0;e.includes("east")?r=1:e.includes("west")&&(r=-1);let n=0;return e.includes("south")?n=1:e.includes("north")&&(n=-1),this.getLoc(t.xCoord+r,t.yCoord+n,t.mapName)||i.P.voidTile};static getLocByPos=function(e,r,n){const i=t.Q.maps[n];if(i)return this.getLoc(Math.floor(e/i._vy_tileW)+1,Math.floor(r/i._vy_tileH)+1,n)};static getDist=function(t,r,n){if(!t||!r||void 0===t.xPos||void 0===t.yPos||void 0===r.xPos||void 0===r.yPos)return;let i=(t.width?t.width:e.a$.tileSize.width)/2,s=(t.height?t.height:e.a$.tileSize.height)/2,o=(r.width?r.width:e.a$.tileSize.width)/2,a=(r.height?r.height:e.a$.tileSize.height)/2;if(n){const e=this._getDistArr[this.dirs.indexOf(this.getDir(t,r,!0))],n=this._getDistArr[this.dirs.indexOf(this.getDir(r,t,!0))];i=2*i*e[0],s=2*s*e[1],o=2*o*n[0],a=2*a*n[1]}const l=t.xOrigin?t.xPos+t.xOrigin:t.xPos,_=t.yOrigin?t.yPos+t.yOrigin:t.yPos,u=r.xOrigin?r.xPos+r.xOrigin:r.xPos,c=r.yOrigin?r.yPos+r.yOrigin:r.yPos;return Math.sqrt(Math.pow(u+o-(l+i),2)+Math.pow(c+a-(_+s),2))};static _getDistArr=[[1,.5],[1,0],[.5,0],[0,0],[0,.5],[0,1],[.5,1],[1,1]];static getTileDist=function(t,e){if(t&&e&&t.xCoord&&t.yCoord&&e.xCoord&&e.yCoord)return Math.max(Math.abs(e.xCoord-t.xCoord),Math.abs(e.yCoord-t.yCoord))};static getRange=function(t,e,r,n){return t?(t._vy_type||(t=this.getLoc(t.x,t.y,t.map)),this._range(t,e,r,n)):[]};static getRangeByType=function(t,e,r,n,i,s){return t?(t._vy_type||(t=this.getLoc(t.x,t.y,t.map)),this._range(t,n,i,s,e,r)):[]};static getRangeView=function(t,e,r,n){return t?(t._vy_type||(t=this.getLoc(t.x,t.y,t.map)),this._range(t,e,r,n,null,null,1)):[]};static getRangeViewByType=function(t,e,r,n,i,s){return t?(t._vy_type||(t=this.getLoc(t.x,t.y,t.map)),this._range(t,n,i,s,e,r,1)):[]};static getRangeViewers=function(t,e,r,n){return t?(t._vy_type||(t=this.getLoc(t.x,t.y,t.map)),this._range(t,e,r,n,null,null,2)):[]};static getRangeViewersByType=function(t,e,r,n,i,s){return t?(t._vy_type||(t=this.getLoc(t.x,t.y,t.map)),this._range(t,n,i,s,e,r,2)):[]};static _range=function(e,r,n,s,o,a,l){const _=t.Q.maps[e._vy_mapN];if("object"!=typeof e||!_)return[];if(void 0===e._vy_x||void 0===e._vy_y)return[];r||(r=0),r<0&&(r=0),void 0===n?n=r:n<0&&(n=0);const u=[],c=Math.floor(r/_._vy_tileW)+1,h=Math.floor(n/_._vy_tileH)+1,d=Math.floor(e._vy_x/_._vy_tileW)+1,p=Math.floor(e._vy_y/_._vy_tileH)+1;for(let t=0-c,y=c+e._vy_xTiles-1;t<=y;t++)for(let c=0-h,y=h+e._vy_yTiles-1;c<=y;c++){const h=_._vy_tiles[d+t+_._vy_xMax*(p+c)];if(h&&h._vy_conts)for(let t=h._vy_conts.length;t--;){const _=h._vy_conts[t];if(_&&_._vy_type&&((_!==e||!s)&&!(_._vy_x+_._vy_xOr+_._vy_w<=e._vy_x+e._vy_xOr-r||_._vy_x+_._vy_xOr>=e._vy_x+e._vy_xOr+e._vy_w+r||_._vy_y+_._vy_yOr+_._vy_h<=e._vy_y+e._vy_yOr-n||_._vy_y+_._vy_yOr>=e._vy_y+e._vy_yOr+e._vy_h+n)&&(!o||i.P.isType(_._vy_type,o,a)))){if(1===l&&_._vy_invisibility>e._vy_visibility&&-1===_._vy_viewers?.indexOf(e))continue;if(2===l&&e._vy_invisibility>_._vy_visibility&&-1===e._vy_viewers?.indexOf(_))continue;-1===u.indexOf(_)&&u.push(_)}}}return u};static getTileRange=function(t,e,r,n){return t?(t._vy_type||(t=this.getLoc(t.x,t.y,t.map)),this._tileRange(t,e,r,n)):[]};static getTileRangeByType=function(t,e,r,n,i,s){return t?(t._vy_type||(t=this.getLoc(t.x,t.y,t.map)),this._tileRange(t,n,i,s,e,r)):[]};static getTileRangeView=function(t,e,r,n){return t?(t._vy_type||(t=this.getLoc(t.x,t.y,t.map)),this._tileRange(t,e,r,n,null,null,1)):[]};static getTileRangeViewByType=function(t,e,r,n,i,s){return t?(t._vy_type||(t=this.getLoc(t.x,t.y,t.map)),this._tileRange(t,n,i,s,e,r,1)):[]};static getTileRangeViewers=function(t,e,r,n){return t?(t._vy_type||(t=this.getLoc(t.x,t.y,t.map)),this._tileRange(t,e,r,n,null,null,2)):[]};static getTileRangeViewersByType=function(t,e,r,n,i,s){return t?(t._vy_type||(t=this.getLoc(t.x,t.y,t.map)),this._tileRange(t,n,i,s,e,r,2)):[]};static _tileRange=function(e,r,n,s,o,a,l){const _=t.Q.maps[e._vy_mapN];if("object"!=typeof e||!_)return[];if(void 0===e._vy_x||void 0===e._vy_y)return[];r||(r=0),void 0===n&&(n=r),r<0&&(r=0),n<0&&(n=0);const u=[],c=Math.floor(e._vy_x/_._vy_tileW)+1,h=Math.floor(e._vy_y/_._vy_tileH)+1;for(let t=0-r,d=r+e._vy_xTiles-1;t<=d;t++)for(let r=0-n,d=n+e._vy_yTiles-1;r<=d;r++){const n=_._vy_tiles[c+t+_._vy_xMax*(h+r)];if(n&&n._vy_conts)for(let t=n._vy_conts.length;t--;){const r=n._vy_conts[t];if(r&&r._vy_type&&((r!==e||!s)&&(!o||i.P.isType(r._vy_type,o,a)))){if(1===l&&r._vy_invisibility>e._vy_visibility&&-1===r._vy_viewers?.indexOf(e))continue;if(2===l&&e._vy_invisibility>r._vy_visibility&&-1===e._vy_viewers?.indexOf(r))continue;-1===u.indexOf(r)&&u.push(r)}}}return u};static getDiobs=function(e,r,n,i){if(!e)return[];t.Q.maps[e]||t.Q.loadMap(e);const s=t.Q.maps[e];return s?s.getDiobs(r,n,i):[]};static getDiobsByPos=function(e,r,n,s,o,a,l,_){const u=[];s||(s=r),o||(o=n);const c=t.Q.maps[e];if(!c)return u;const h=Math.floor(r/c._vy_tileW)+1,d=Math.floor(n/c._vy_tileH)+1,p=this.getTiles(e,h,d,Math.floor(s/c._vy_tileW)+1-h,Math.floor(o/c._vy_tileH)+1-d);for(let t=0,e=p.length;t<e;t++){const e=p[t];if(_&&(a&&!i.P.isType(e._vy_type,a,l)||u.push(e),a&&!i.P.isType(e.region._vy_type,a,l)||!u.includes(e._vy_region)||u.includes(e._vy_region)||u.push(e._vy_region)),e._vy_conts)for(let t=0,_=e._vy_conts.length;t<_;t++){const _=e._vy_conts[t];_._vy_x+_._vy_xOr+_._vy_w<r||_._vy_x+_._vy_xOr>s||_._vy_y+_._vy_yOr+_._vy_h<n||_._vy_y+_._vy_yOr>o||(a&&!i.P.isType(_._vy_type,a,l)||u.includes(_)||u.push(_))}}return u};static getScreenDiobs=function(t,r,n){return e.j3.Client._vy_mapView?e.j3.Client._vy_mapView.getDiobs(t,r,n):[]};static getTiles=function(e,r,n,i,s){if(!e)return[];const o=t.Q.maps[e];return o||t.Q.loadMap(e),o?o.getTiles(r,n,i,s):[]};static getTilesByRange=function(e,r,n,s,o,a){const l=t.Q.maps[e.mapName];if("object"!=typeof e||!l)return[];r||(r=0),r<0&&(r=0),void 0===n?n=r:n<0&&(n=0);const _=[];let u,c,h=Math.floor(r/l._vy_tileW)+1,d=Math.floor(n/l._vy_tileH)+1,p=h,y=d,v=e.xPos,f=e.yPos;e._vy_type?(v+=e._vy_xOr,f+=e._vy_yOr,u=e._vy_w,c=e._vy_h,p+=e._vy_xTiles-1,y+=e._vy_yTiles-1):(u=e.width||l._vy_tileW,c=e.height||l._vy_tileH,p+=Math.floor(u/l._vy_tileW),y+=Math.floor(c/l._vy_tileH));const m=Math.floor(v/l._vy_tileW)+1,g=Math.floor(f/l._vy_tileH)+1;for(let t=-h;t<=p;t++)for(let h=-d;h<=y;h++){const d=l._vy_tiles[m+t+l._vy_xMax*(g+h)];!d||a&&d===e||d._vy_x+l._vy_tileW<=v-r||d._vy_x>=v+u+r||d._vy_y+l._vy_tileH<=f-n||d._vy_y>=f+c+n||(s&&!i.P.isType(d._vy_type,s,o)||-1===_.indexOf(d)&&_.push(d))}return _};static setMapSize=function(e,r,n,i){t.Q.maps[e]?.setSizeByCoords(r,n,i)};static getMapSize=function(e){return e?(t.Q.maps[e]||t.Q.loadMap(e),t.Q.maps[e]?{x:t.Q.maps[e]._vy_xMax,y:t.Q.maps[e]._vy_yMax,xPos:t.Q.maps[e]._vy_width,yPos:t.Q.maps[e]._vy_height}:{x:0,y:0,xPos:0,yPos:0}):{x:0,y:0,xPos:0,yPos:0}};static createMap=function(e,r,n,i){t.Q.createMap(e,r,n,i)};static createMapFromText=function(e,r,n){t.Q.newMap(e,r,null,n)};static cloneMap=function(e,r,n){t.Q.maps[e]||t.Q.loadMap(e),t.Q.loadingResources["map_"+e]&&t.Q.loadingResources["map_"+e].loading?(t.Q.loadingResources["map_"+e].clones||(t.Q.loadingResources["map_"+e].clones=[]),t.Q.loadingResources["map_"+e].clones.push([this.cloneMap,this,[e,r,n]])):t.Q.maps[e].cloneMap(r,n)};static deleteMap=function(r){e.j3.World.onMapDel?.(r),t.Q.clearMap(r)}},e.j3.Map.pixelDist=e.j3.Map.getDist,e.j3.Map.tileDist=e.j3.Map.getTileDist,e.j3.Map.pixelRange=e.j3.Map.getRange,e.j3.Map.pixelRangeByType=e.j3.Map.getRangeByType,e.j3.Map.pixelRangeView=e.j3.Map.getRangeView,e.j3.Map.pixelRangeViewByType=e.j3.Map.getRangeViewByType,e.j3.Map.pixelRangeViewers=e.j3.Map.getRangeViewers,e.j3.Map.pixelRangeViewersByType=e.j3.Map.getRangeViewersByType,e.j3.Map.tileRange=e.j3.Map.getTileRange,e.j3.Map.tileRangeByType=e.j3.Map.getTileRangeByType,e.j3.Map.tileRangeView=e.j3.Map.getTileRangeView,e.j3.Map.tileRangeViewByType=e.j3.Map.getTileRangeViewByType,e.j3.Map.tileRangeViewers=e.j3.Map.getTileRangeViewers,e.j3.Map.tileRangeViewersByType=e.j3.Map.getTileRangeViewersByType,e.j3.Type={},e.j3.Type.setStaticVariable=function(t,e,r){i.P.objectTypes[t]?.setStaticVar(e,r)},e.j3.Type.getStaticVariable=function(t,e){return i.P.objectTypes[t]?.getStaticVar(e)},e.j3.Type.addInheritance=function(t,e){i.P.objectTypes[t]?.addInherit(e)},e.j3.Type.removeInheritance=function(t,e){i.P.objectTypes[t]?.removeInherit(e)},e.j3.Type.getInheritances=function(t){return i.P.objectTypes[t]?.inherits},e.j3.Type.setFunction=function(t,e,r,n){i.P.objectTypes[t]?.setFunc(e,r,n)},e.j3.Type.getFunction=function(t,e,r){return i.P.objectTypes[t]?.getFunc(e,r)},e.j3.Type.setVariables=function(t,e){i.P.objectTypes[t]?.setVars(e)},e.j3.Type.getVariable=function(t,e,r){return i.P.objectTypes[t]?.getVar(e,r)},e.j3.Type.getVariables=function(t,e){return i.P.objectTypes[t]?.getVars(e)},e.j3.Type.newType=function(t,e,r){let n=i.P.objectTypes[t];if(n){if(r)for(const t of r)n.addInherit(t);if(e)for(const t in e)n.setVar(t,e[t]);return n}return i.P.createObjectType(t,e,r)},e.j3.Type.setType=e.j3.Type.newType,e.j3.Type.getType=function(t){return i.P.objectTypes[t]},e.j3.Type.getTypes=function(t,e,r){const n=[];for(const s in i.P.objectTypes)if(t){if(i.P.isType(s,t,1)){if(e&&s===t)continue;if(r&&(s.match(/\//g)||[]).length>(t.match(/\//g)||[]).length+1)continue;n.push(s)}}else n.push(s);return n},e.j3.Type.isType=function(t,e){return!(!t||!i.P.objectTypes[t])&&!(e&&!i.P.isType(t,e,1))},e.j3.Type.callFunction=function(t,e,r,n){if(!i.P.objectTypes[t])return;const s=i.P.objectTypes[t]._vy_vars[e];return s?s.apply(r,n):void 0};var s,o=__webpack_require__(979),a=__webpack_require__.n(o);e.j3.Util={},e.j3.Util.handleCallback=function(t){return e.vC._callback(t)},e.j3.Util.copyObject=function(t,e,r){return i.P._copyObjectVars(t,e,r)},e.j3.Util.getSaveObject=function(t,e){return i.P._copyObjectVars(e||{},t,1,1,1)},e.j3.Util.getObjectKeys=Object.keys,e.j3.Util.getObjectValues=Object.values,e.j3.Util.getVariableType=function(t){return typeof t},e.j3.Util.isObject=function(t){return"object"==typeof t&&null!==t},e.j3.Util.isNumber=function(t){return"number"==typeof t&&!isNaN(t)},e.j3.Util.isString=function(t){return"string"==typeof t},e.j3.Util.isArray=function(t){return!(!t||t.constructor!==Array)},e.j3.Util.isFunction=function(t){return!!(t&&t.constructor&&t.call&&t.apply)},e.j3.Util.toNumber=Number,e.j3.Util.toString=JSON.stringify,e.j3.Util.parseInt=parseInt,e.j3.Util.parseFloat=parseFloat,e.j3.Util.getCharFromCode=String.fromCharCode,e.j3.Util.pick=function(t,e){const r=Array.isArray(t)&&!e?t:arguments;return r[Math.floor(Math.random()*r.length)]},e.j3.Util.regExp=function(t,e){return e?new RegExp(t,e):new RegExp(t)},e.j3.Util.encodeWebTags=function(t){return t.replace(/\</g,"&lt;").replace(/\>/g,"&gt;").replace(/\//g,"&#47;")},e.j3.Util.stringToObject=function(t){return JSON.parse(t)},e.j3.Util.arrayBufferToBase64=function(t){let e="";const r=new Uint8Array(t);for(let t=0,n=r.byteLength;t<n;t++)e+=String.fromCharCode(r[t]);return btoa(e)},e.j3.Util.encodeURI=function(t){return encodeURI(t)},e.j3.Util.decodeURI=function(t){return decodeURI(t)},e.j3.Util.encodeURIComponent=function(t){return encodeURIComponent(t)},e.j3.Util.decodeURIComponent=function(t){return decodeURIComponent(t)},e.j3.Util.toDegrees=function(t){return 180*t/Math.PI},e.j3.Util.toRadians=function(t){return t*Math.PI/180},e.j3.Util.gzUnzip=function(t){return a().inflate(xmlReq.response,{to:"string"})},e.j3.Util.getWebStyle=function(t){return e.vC.getWebStyle(t)},e.j3.Util.getDirNum=function(t){return i.P.dirNum.indexOf(t)},e.j3.Event=((s=class{}).addTicker=function(t,e){var r;t&&(null===(r=t.startTicker)||void 0===r||r.call(t,e))},s.removeTicker=function(t){var e;t&&(null===(e=t.stopTicker)||void 0===e||e.call(t))},s.interruptSpawn=function(t){clearTimeout(t)},s.interruptThread=function(t){clearInterval(t)},s),e.j3.Event.interpolatePos=i.P.movMoveTo,e.j3.Event.getTickers=i.P.getTickers.bind(i.P),e.j3.Event.toggleTicker=i.P.toggleTicker.bind(i.P),e.j3.Date=new Date,e.j3.Date.newDate=function(){return arguments[0]?new Date(arguments[0]):new Date},e.j3.Date.now=Date.now,e.j3.Date.now||(e.j3.Date.now=function(){return(new Date).getTime()});var l,_,u=function(t,e,r,n){return new(r||(r=Promise))((function(i,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}l((n=n.apply(t,e||[])).next())}))};e.j3.Resource=((l=class{}).loadResource=function(e,r,n){t.Q.loadingResources[e.substr(0,3)+"_"+r]={type:e,name:r},t.Q.loadResource(e.substr(0,3),r,n)},l.loadResourceData=function(e,r,n,i){const s=e.substr(0,3)+"_"+r;t.Q.resources[s]||(t.Q.resources[s]={p:s,v:0}),t.Q.resources[s].f="local","icon"===e&&(t.Q.loadedAtlases[r]={loading:[]},t.Q.iconsO[r]||(t.Q.iconsO[r]={}),t.Q._loadAtlas(r,n,i))},l.getFileText=function(e){if(t.Q.fileText[e])return t.Q.fileText[e].text},l.setResource=function(e,r,n,i){const s=e.substr(0,3)+"_"+r;t.Q.resources[s]={p:s,v:0,f:n},i&&(t.Q.resources[s].r=!0)},l.getResourcePath=function(r,n,i){const s=r.substr(0,3)+"_"+n;if(!t.Q.resources[s])return;const o=t.Q.resources[s];return i?(o.r?o.f:e.U3.serverPath+"/resources/"+o.f)+"?v="+o.v:(o.r?o.f:e.U3.resourceServer+"/resources/"+o.f)+"?v="+o.v},l.getResources=function(e){const r=[];for(const n in t.Q.resources){if(n.includes("/"))continue;const t=n.split("_");e&&!e.startsWith(t.shift())||r.push(t.join("_"))}return r},l.checkIconFileFormat=function(t,e){return u(this,void 0,void 0,(function*(){if(!t)return!1;let e=t;e instanceof File&&(yield new Promise(((t,r)=>{const n=new FileReader;n.onload=()=>{e=n.result,t()},n.readAsText(e,"latin1")}))),e instanceof ArrayBuffer&&(e=e.toString());try{e=a().inflate(t,{to:"string"})}catch(t){}try{if(e=JSON.parse(e),!e.v||!e.i)return!1}catch(t){return!1}return!0}))},l.newSound=function(e,r,n){const i={loading:[]};if(i.data=r,"url"===n){const t=window.atob(r.substring(r.indexOf(",")+1)),e=t.length,n=new Uint8Array(e);for(let r=0;r<e;r++)n[r]=t.charCodeAt(r);i.data=n.buffer}t.Q.resources["sou_"+e]=i,t.Q.loadedSounds[e]=i},l),e.j3.File={},e.j3.File.makeDir=function(t,r){r&&e.vC._callback(r)},e.j3.File.getDir=function(t,r){r&&e.vC._callback(r)},e.j3.File.getStats=function(t,r){r&&e.vC._callback(r)},e.j3.File.remove=function(t,r){r&&e.vC._callback(r)},e.j3.File.appendText=function(t,r,n){n&&e.vC._callback(n,"Unable to append text.")},e.j3.File.writeText=function(t,r,n){n&&e.vC._callback(n,"Unable to write text.")},e.j3.File.readText=function(t,r){r&&e.vC._callback(r,[0,"Unable to read text."])},e.j3.File.writeSave=function(t,r,n){n&&e.vC._callback(n,"Unable to write save.")},e.j3.File.readSave=function(t,r){r&&e.vC._callback(r,[0,"Unable to read save."])},e.j3.File.exists=function(t,r){r&&e.vC._callback(r,0)},e.j3.File.readDir=function(t,r){r&&e.vC._callback(r,[0,"Unable to read directory."])},e.j3.File.stat=function(t,r){r&&e.vC._callback(r,[0,"Unable to stat file."])},e.j3.File.writeResource=async function(t,e){console.error(`Failed to write resource ${t}: File.writeResource currently only supported on the server`)},e.j3.Macro=((_=class{}).newMacroAtlas=function(e){t.Q.macros.hasOwnProperty(e)||(t.Q.macros[e]={})},_.newMacro=function(e,r,n,i,s){if(!r||!n||!t.Q.macros.hasOwnProperty(r))return;t.Q.createMacro(r,e,n);const o=t.Q.macros[r][n];if(s){const e=s.match(/^(.*)\((.*)\)$/);e&&(o.up=e[1],e[2]&&(o.upArgs=t.Q.parseMacroFileKeyArgs(e[2])))}if(i){const e=i.match(/^(.*)\((.*)\)$/);e&&(o.down=e[1],e[2]&&(o.downArgs=t.Q.parseMacroFileKeyArgs(e[2])))}},_.removeMacro=function(e,r){if(t.Q.macros.hasOwnProperty(r))for(const n in t.Q.macros[r]){const i=t.Q.macros[r][n];i&&i.name===e&&(t.Q.macros[r][n]=void 0)}},_.getMacroAtlasNames=function(e){const r=[];for(const n in t.Q.macros){const t=n.includes("/");(e&&t||!e&&!t)&&r.push(n)}return r},_.getMacroNames=function(e){if(!t.Q.macros.hasOwnProperty(e))return[];const r=[];for(const n in t.Q.macros[e]){const i=t.Q.macros[e][n];i&&r.push(i.name)}return r},_),e.j3.Math=Math,e.j3.Math.getMatrix=function(){const t=[];for(let e=0,r=arguments[0];e<r;e++){t[e]=[];for(let r=0,n=arguments[1];r<n;r++)t[e][r]=parseFloat(arguments[e+r+2])||0}return t},e.j3.Math.rand=function(t,e){return void 0===e?void 0===t?Math.random():Math.floor(Math.random()*(t+1)):(t||(t=0),Math.floor(Math.random()*(e-t+1)+t))},e.j3.Math.prob=function(t){return Math.random()<=t/100},e.j3.Math.clamp=function(t,e,r){return Math.max(e,Math.min(t,r))},e.j3.Math.lerp=function(t,e,r){return t*(1-r)+e*r},e.j3.Math.normalize=function(t,e,r){return(t-e)/(r-e)},e.j3.Math.remap=function(t,e,r,n,i){return n+(t-e)*(i-n)/(r-e)},console.log("%c Vylocity Engine v0.5.7 ","background: #4a5876; color: #dabf70; font-weight: bold; padding: 6px 2px 7px 2px;","https://www.vylocity.com/"),PIXI.HelloSystem.hello=!1,PIXI.AbstractRenderer.defaultOptions.resolution=window.devicePixelRatio,PIXI.AbstractRenderer.defaultOptions.failIfMajorPerformanceCaveat=!0,e.j3.Math=Math,e.j3.getIcon=e.j3.Icon.getIcon,e.j3.getIconAtlas=e.j3.Icon.getIconAtlas,e.j3.setType=e.j3.Type.setType,e.j3.getType=e.j3.Type.getType,e.j3.new=function(t,...e){return i.P.createObjectNew(t,null,...e)},i.P.preinitiate(),e.j3.Client=i.P.createClient("Client"),e.j3.World=i.P._createObject("World"),e.j3.getMap=e.j3.World.getMap,e.j3.getResource=e.j3.World.getResource,e.j3.load=async function(){"complete"!==document.readyState&&await new Promise((t=>{window.addEventListener("load",(()=>{t()}))})),e.vC.gameBody=document.createElement("div"),e.vC.gameBody.id="game_body",e.vC.gameBody.innerHTML='\n\t\t<div id="web_background"></div>\n\t\t<canvas id="interface_canvas"></canvas>\n\t\t<div id="error_message"></div>\n\t\t<div id="fps_label"></div>\n\t\t<div id="load_screen">\n\t\t\t<div id="load_screen_login_box_1">\n\t\t\t\t<div id="load_screen_login_mes_1">This game requires being logged in to play. You can <a onclick="_vy_t_windowPar.gameHeaderShowLogin()">click here</a> to bring up the login window, or select a service below to log in with.</div>\n\t\t\t\t<div class="load_screen_login_buttons_box">\n\t\t\t\t\t<a onclick="_vy_t_windowPar.gameHeaderShowLogin()" class="load_screen_vy_login_button"></a>\n\t\t\t\t\t<a onclick="_vy_t_windowPar.gameHeaderShowLogin(1)" class="load_screen_twit_login_button"></a>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div id="load_screen_login_box_2">\n\t\t\t\t<div id="load_screen_login_mes_2">This server requires authentication before connecting.</div>\n\t\t\t</div>\n\t\t\t<div id="load_screen_loader_back"></div>\n\t\t\t<div id="load_screen_loader"></div>\n\t\t\t<div id="load_screen_loader_text">0%</div>\n\t\t\t<div id="load_screen_logo"></div>\n\t\t</div>\n\t\t<div class="box" id="games_list"></div>\n\t\t<div id="logo_box"></div>\n\t',document.body.appendChild(e.vC.gameBody),e.vC.intCanvasControl=document.getElementById("interface_canvas"),e.vC.errorDisplay=document.getElementById("error_message"),e.vC.errorDisplay.style.width=window.innerWidth+"px",e.vC.fpsLabel=document.getElementById("fps_label"),e.vC.loadScreen=document.getElementById("load_screen"),e.vC.initiate(),window.focus(),i.P.initiate(),await e.vC.setGameSettings(),t.Q.initiate()}})()})();