three-nebula 10.0.2 → 11.0.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 (170) hide show
  1. package/.claude/rules/no-coauthor.md +4 -0
  2. package/CHANGELOG.md +23 -0
  3. package/build/cjs/behaviour/Alpha.js +2 -2
  4. package/build/cjs/behaviour/Attraction.js +2 -2
  5. package/build/cjs/behaviour/Behaviour.js +1 -1
  6. package/build/cjs/behaviour/Collision.js +2 -2
  7. package/build/cjs/behaviour/Color.js +2 -2
  8. package/build/cjs/behaviour/CrossZone.js +8 -4
  9. package/build/cjs/behaviour/Force.js +2 -2
  10. package/build/cjs/behaviour/Gravity.js +2 -2
  11. package/build/cjs/behaviour/RandomDrift.js +2 -2
  12. package/build/cjs/behaviour/Repulsion.js +2 -2
  13. package/build/cjs/behaviour/Rotate.js +5 -5
  14. package/build/cjs/behaviour/Scale.js +2 -2
  15. package/build/cjs/behaviour/Spring.js +2 -2
  16. package/build/cjs/constants/index.js +1 -1
  17. package/build/cjs/core/Particle.js +1 -1
  18. package/build/cjs/core/Pool.js +1 -1
  19. package/build/cjs/core/System.js +8 -4
  20. package/build/cjs/core/constants.js +2 -2
  21. package/build/cjs/core/fromJSON.js +6 -2
  22. package/build/cjs/core/fromJSONAsync.js +8 -4
  23. package/build/cjs/core/three/Euler.js +1 -1
  24. package/build/cjs/core/three/Math.js +1 -1
  25. package/build/cjs/core/three/Matrix4.js +1 -1
  26. package/build/cjs/core/three/Quaternion.js +1 -1
  27. package/build/cjs/core/three/Vector3.js +1 -1
  28. package/build/cjs/debug/Debug.js +1 -1
  29. package/build/cjs/debug/log.js +1 -1
  30. package/build/cjs/ease/index.js +1 -1
  31. package/build/cjs/emitter/Emitter.js +17 -6
  32. package/build/cjs/emitter/FollowEmitter.js +2 -2
  33. package/build/cjs/events/EventDispatcher.js +3 -3
  34. package/build/cjs/initializer/Body.js +2 -2
  35. package/build/cjs/initializer/BodySprite.js +3 -3
  36. package/build/cjs/initializer/Initializer.js +1 -1
  37. package/build/cjs/initializer/InitializerUtil.js +1 -1
  38. package/build/cjs/initializer/Life.js +2 -2
  39. package/build/cjs/initializer/Mass.js +2 -2
  40. package/build/cjs/initializer/Position.js +8 -4
  41. package/build/cjs/initializer/Radius.js +2 -2
  42. package/build/cjs/initializer/Rate.js +2 -2
  43. package/build/cjs/initializer/Rotation.js +95 -0
  44. package/build/cjs/initializer/Texture.js +3 -3
  45. package/build/cjs/initializer/Velocity/PolarVelocity.js +2 -2
  46. package/build/cjs/initializer/Velocity/RadialVelocity.js +2 -2
  47. package/build/cjs/initializer/Velocity/VectorVelocity.js +2 -2
  48. package/build/cjs/initializer/Velocity/Velocity.js +2 -2
  49. package/build/cjs/initializer/constants.js +1 -1
  50. package/build/cjs/initializer/index.js +9 -1
  51. package/build/cjs/initializer/types.js +4 -2
  52. package/build/cjs/math/ArraySpan.js +2 -2
  53. package/build/cjs/math/Box.js +1 -1
  54. package/build/cjs/math/ColorSpan.js +2 -2
  55. package/build/cjs/math/MathUtils.js +1 -1
  56. package/build/cjs/math/Polar3D.js +1 -1
  57. package/build/cjs/math/Span.js +1 -1
  58. package/build/cjs/math/Vector3D.js +1 -1
  59. package/build/cjs/math/constants.js +1 -1
  60. package/build/cjs/math/index.js +5 -1
  61. package/build/cjs/math/integration.js +1 -1
  62. package/build/cjs/renderer/BaseRenderer.js +1 -1
  63. package/build/cjs/renderer/CustomRenderer.js +1 -1
  64. package/build/cjs/renderer/GPURenderer/Desktop/index.js +25 -4
  65. package/build/cjs/renderer/GPURenderer/Desktop/shaders/fragmentShader.js +2 -2
  66. package/build/cjs/renderer/GPURenderer/Desktop/shaders/vertexShader.js +2 -2
  67. package/build/cjs/renderer/GPURenderer/Mobile/index.js +25 -4
  68. package/build/cjs/renderer/GPURenderer/Mobile/shaders/fragmentShader.js +2 -2
  69. package/build/cjs/renderer/GPURenderer/Mobile/shaders/vertexShader.js +2 -2
  70. package/build/cjs/renderer/GPURenderer/common/ParticleBuffer/constants.js +9 -4
  71. package/build/cjs/renderer/GPURenderer/common/ParticleBuffer/index.js +1 -1
  72. package/build/cjs/renderer/GPURenderer/common/TextureAtlas/index.js +1 -1
  73. package/build/cjs/renderer/GPURenderer/common/stores/Target.js +3 -1
  74. package/build/cjs/renderer/GPURenderer/common/stores/UniqueList.js +1 -1
  75. package/build/cjs/renderer/GPURenderer/index.js +2 -2
  76. package/build/cjs/renderer/MeshRenderer.js +9 -9
  77. package/build/cjs/renderer/SpriteRenderer.js +7 -2
  78. package/build/cjs/utils/index.js +1 -1
  79. package/build/cjs/utils/uid.js +3 -5
  80. package/build/cjs/zone/BoxZone.js +2 -2
  81. package/build/cjs/zone/LineZone.js +2 -2
  82. package/build/cjs/zone/MeshZone.js +2 -2
  83. package/build/cjs/zone/PointZone.js +6 -4
  84. package/build/cjs/zone/ScreenZone.js +2 -2
  85. package/build/cjs/zone/SphereZone.js +6 -4
  86. package/build/cjs/zone/Zone.js +1 -1
  87. package/build/esm/behaviour/Alpha.js +1 -1
  88. package/build/esm/behaviour/Attraction.js +1 -1
  89. package/build/esm/behaviour/Behaviour.js +1 -1
  90. package/build/esm/behaviour/Collision.js +1 -1
  91. package/build/esm/behaviour/Color.js +1 -1
  92. package/build/esm/behaviour/CrossZone.js +1 -1
  93. package/build/esm/behaviour/Force.js +1 -1
  94. package/build/esm/behaviour/Gravity.js +1 -1
  95. package/build/esm/behaviour/RandomDrift.js +1 -1
  96. package/build/esm/behaviour/Repulsion.js +1 -1
  97. package/build/esm/behaviour/Rotate.js +4 -4
  98. package/build/esm/behaviour/Scale.js +1 -1
  99. package/build/esm/behaviour/Spring.js +1 -1
  100. package/build/esm/constants/index.js +1 -1
  101. package/build/esm/core/Particle.js +1 -1
  102. package/build/esm/core/Pool.js +1 -1
  103. package/build/esm/core/System.js +2 -2
  104. package/build/esm/core/constants.js +3 -3
  105. package/build/esm/core/fromJSON.js +1 -1
  106. package/build/esm/core/fromJSONAsync.js +2 -2
  107. package/build/esm/core/three/Euler.js +1 -1
  108. package/build/esm/core/three/Math.js +1 -1
  109. package/build/esm/core/three/Matrix4.js +1 -1
  110. package/build/esm/core/three/Quaternion.js +1 -1
  111. package/build/esm/core/three/Vector3.js +1 -1
  112. package/build/esm/debug/Debug.js +1 -1
  113. package/build/esm/debug/log.js +1 -1
  114. package/build/esm/ease/index.js +1 -1
  115. package/build/esm/emitter/Emitter.js +11 -4
  116. package/build/esm/emitter/FollowEmitter.js +1 -1
  117. package/build/esm/events/EventDispatcher.js +3 -3
  118. package/build/esm/initializer/Body.js +1 -1
  119. package/build/esm/initializer/BodySprite.js +2 -2
  120. package/build/esm/initializer/Initializer.js +1 -1
  121. package/build/esm/initializer/InitializerUtil.js +1 -1
  122. package/build/esm/initializer/Life.js +1 -1
  123. package/build/esm/initializer/Mass.js +1 -1
  124. package/build/esm/initializer/Position.js +3 -2
  125. package/build/esm/initializer/Radius.js +1 -1
  126. package/build/esm/initializer/Rate.js +1 -1
  127. package/build/esm/initializer/Rotation.js +54 -0
  128. package/build/esm/initializer/Texture.js +2 -2
  129. package/build/esm/initializer/Velocity/PolarVelocity.js +1 -1
  130. package/build/esm/initializer/Velocity/RadialVelocity.js +1 -1
  131. package/build/esm/initializer/Velocity/VectorVelocity.js +1 -1
  132. package/build/esm/initializer/Velocity/Velocity.js +1 -1
  133. package/build/esm/initializer/constants.js +1 -1
  134. package/build/esm/initializer/index.js +2 -1
  135. package/build/esm/initializer/types.js +2 -1
  136. package/build/esm/math/ArraySpan.js +1 -1
  137. package/build/esm/math/Box.js +1 -1
  138. package/build/esm/math/ColorSpan.js +1 -1
  139. package/build/esm/math/MathUtils.js +1 -1
  140. package/build/esm/math/Polar3D.js +1 -1
  141. package/build/esm/math/Span.js +1 -1
  142. package/build/esm/math/constants.js +1 -1
  143. package/build/esm/math/integration.js +1 -1
  144. package/build/esm/renderer/BaseRenderer.js +1 -1
  145. package/build/esm/renderer/GPURenderer/Desktop/index.js +29 -3
  146. package/build/esm/renderer/GPURenderer/Desktop/shaders/fragmentShader.js +8 -1
  147. package/build/esm/renderer/GPURenderer/Desktop/shaders/vertexShader.js +4 -1
  148. package/build/esm/renderer/GPURenderer/Mobile/index.js +29 -3
  149. package/build/esm/renderer/GPURenderer/Mobile/shaders/fragmentShader.js +8 -1
  150. package/build/esm/renderer/GPURenderer/Mobile/shaders/vertexShader.js +4 -1
  151. package/build/esm/renderer/GPURenderer/common/ParticleBuffer/constants.js +6 -3
  152. package/build/esm/renderer/GPURenderer/common/ParticleBuffer/index.js +1 -1
  153. package/build/esm/renderer/GPURenderer/common/TextureAtlas/index.js +1 -1
  154. package/build/esm/renderer/GPURenderer/common/stores/Target.js +3 -1
  155. package/build/esm/renderer/GPURenderer/common/stores/UniqueList.js +1 -1
  156. package/build/esm/renderer/GPURenderer/index.js +1 -1
  157. package/build/esm/renderer/MeshRenderer.js +7 -8
  158. package/build/esm/renderer/SpriteRenderer.js +5 -1
  159. package/build/esm/utils/index.js +1 -1
  160. package/build/esm/utils/uid.js +2 -2
  161. package/build/esm/zone/BoxZone.js +1 -1
  162. package/build/esm/zone/LineZone.js +1 -1
  163. package/build/esm/zone/MeshZone.js +1 -1
  164. package/build/esm/zone/PointZone.js +5 -3
  165. package/build/esm/zone/ScreenZone.js +1 -1
  166. package/build/esm/zone/SphereZone.js +5 -3
  167. package/build/esm/zone/Zone.js +1 -1
  168. package/build/three-nebula.js +1 -1
  169. package/build/three-nebula.js.map +1 -1
  170. package/package.json +31 -31
@@ -1,2 +1,2 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Nebula=e():t.Nebula=e()}(this,(function(){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var s=e[r]={i:r,l:!1,exports:{}};return t[r].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(r,s,function(e){return t[e]}.bind(null,s));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=46)}([function(t,e,i){"use strict";(function(t){i.d(e,"d",(function(){return r})),i.d(e,"e",(function(){return s})),i.d(e,"a",(function(){return n})),i.d(e,"c",(function(){return o})),i.d(e,"b",(function(){return a})),i.d(e,"f",(function(){return h}));const r=3.142,s=500,n=r/180,o=100,a="euler",h=()=>!!t&&(t.env,!1)}).call(this,i(15))},function(t,e){t.exports=function(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}},function(t,e,i){var r=i(3),s=i(4);t.exports=function(t){return"number"==typeof t||s(t)&&"[object Number]"==r(t)}},function(t,e,i){var r=i(7),s=i(29),n=i(30),o=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":o&&o in Object(t)?s(t):n(t)}},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e,i){var r=i(6),s=i(19),n=i(10);t.exports=function(t){return(n(t)?r:s)(t)}},function(t,e,i){var r=i(18);t.exports=function(t){var e=t.length;return e?t[r(0,e-1)]:void 0}},function(t,e,i){var r=i(8).Symbol;t.exports=r},function(t,e,i){var r=i(9),s="object"==typeof self&&self&&self.Object===Object&&self,n=r||s||Function("return this")();t.exports=n},function(t,e,i){(function(e){var i="object"==typeof e&&e&&e.Object===Object&&e;t.exports=i}).call(this,i(28))},function(t,e){var i=Array.isArray;t.exports=i},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},function(t,e,i){var r,s,n=i(16),o=i(17),a=0,h=0;t.exports=function(t,e,i){var u=e&&i||0,c=e||[],l=(t=t||{}).node||r,d=void 0!==t.clockseq?t.clockseq:s;if(null==l||null==d){var p=n();null==l&&(l=r=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==d&&(d=s=16383&(p[6]<<8|p[7]))}var f=void 0!==t.msecs?t.msecs:(new Date).getTime(),y=void 0!==t.nsecs?t.nsecs:h+1,m=f-a+(y-h)/1e4;if(m<0&&void 0===t.clockseq&&(d=d+1&16383),(m<0||f>a)&&void 0===t.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=f,h=y,s=d;var g=(1e4*(268435455&(f+=122192928e5))+y)%4294967296;c[u++]=g>>>24&255,c[u++]=g>>>16&255,c[u++]=g>>>8&255,c[u++]=255&g;var x=f/4294967296*1e4&268435455;c[u++]=x>>>8&255,c[u++]=255&x,c[u++]=x>>>24&15|16,c[u++]=x>>>16&255,c[u++]=d>>>8|128,c[u++]=255&d;for(var v=0;v<6;++v)c[u+v]=l[v];return e||o(c)}},function(t,e,i){var r=i(45);t.exports=function(t,e){if(null==t)return{};var i,s,n=r(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(s=0;s<o.length;s++)i=o[s],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(n[i]=t[i])}return n}},function(t,e){var i,r,s=t.exports={};function n(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(i===setTimeout)return setTimeout(t,0);if((i===n||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:n}catch(t){i=n}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(t){r=o}}();var h,u=[],c=!1,l=-1;function d(){c&&h&&(c=!1,h.length?u=h.concat(u):l=-1,u.length&&p())}function p(){if(!c){var t=a(d);c=!0;for(var e=u.length;e;){for(h=u,u=[];++l<e;)h&&h[l].run();l=-1,e=u.length}h=null,c=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function f(t,e){this.fun=t,this.array=e}function y(){}s.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)e[i-1]=arguments[i];u.push(new f(t,e)),1!==u.length||c||a(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=y,s.addListener=y,s.once=y,s.off=y,s.removeListener=y,s.removeAllListeners=y,s.emit=y,s.prependListener=y,s.prependOnceListener=y,s.listeners=function(t){return[]},s.binding=function(t){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(t){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},function(t,e){var i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(i){var r=new Uint8Array(16);t.exports=function(){return i(r),r}}else{var s=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),s[e]=t>>>((3&e)<<3)&255;return s}}},function(t,e){for(var i=[],r=0;r<256;++r)i[r]=(r+256).toString(16).substr(1);t.exports=function(t,e){var r=e||0,s=i;return[s[t[r++]],s[t[r++]],s[t[r++]],s[t[r++]],"-",s[t[r++]],s[t[r++]],"-",s[t[r++]],s[t[r++]],"-",s[t[r++]],s[t[r++]],"-",s[t[r++]],s[t[r++]],s[t[r++]],s[t[r++]],s[t[r++]],s[t[r++]]].join("")}},function(t,e){var i=Math.floor,r=Math.random;t.exports=function(t,e){return t+i(r()*(e-t+1))}},function(t,e,i){var r=i(6),s=i(20);t.exports=function(t){return r(s(t))}},function(t,e,i){var r=i(21),s=i(23);t.exports=function(t){return null==t?[]:r(t,s(t))}},function(t,e,i){var r=i(22);t.exports=function(t,e){return r(e,(function(e){return t[e]}))}},function(t,e){t.exports=function(t,e){for(var i=-1,r=null==t?0:t.length,s=Array(r);++i<r;)s[i]=e(t[i],i,t);return s}},function(t,e,i){var r=i(24),s=i(38),n=i(42);t.exports=function(t){return n(t)?r(t):s(t)}},function(t,e,i){var r=i(25),s=i(26),n=i(10),o=i(31),a=i(33),h=i(34),u=Object.prototype.hasOwnProperty;t.exports=function(t,e){var i=n(t),c=!i&&s(t),l=!i&&!c&&o(t),d=!i&&!c&&!l&&h(t),p=i||c||l||d,f=p?r(t.length,String):[],y=f.length;for(var m in t)!e&&!u.call(t,m)||p&&("length"==m||l&&("offset"==m||"parent"==m)||d&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||a(m,y))||f.push(m);return f}},function(t,e){t.exports=function(t,e){for(var i=-1,r=Array(t);++i<t;)r[i]=e(i);return r}},function(t,e,i){var r=i(27),s=i(4),n=Object.prototype,o=n.hasOwnProperty,a=n.propertyIsEnumerable,h=r(function(){return arguments}())?r:function(t){return s(t)&&o.call(t,"callee")&&!a.call(t,"callee")};t.exports=h},function(t,e,i){var r=i(3),s=i(4);t.exports=function(t){return s(t)&&"[object Arguments]"==r(t)}},function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){var r=i(7),s=Object.prototype,n=s.hasOwnProperty,o=s.toString,a=r?r.toStringTag:void 0;t.exports=function(t){var e=n.call(t,a),i=t[a];try{t[a]=void 0;var r=!0}catch(t){}var s=o.call(t);return r&&(e?t[a]=i:delete t[a]),s}},function(t,e){var i=Object.prototype.toString;t.exports=function(t){return i.call(t)}},function(t,e,i){(function(t){var r=i(8),s=i(32),n=e&&!e.nodeType&&e,o=n&&"object"==typeof t&&t&&!t.nodeType&&t,a=o&&o.exports===n?r.Buffer:void 0,h=(a?a.isBuffer:void 0)||s;t.exports=h}).call(this,i(11)(t))},function(t,e){t.exports=function(){return!1}},function(t,e){var i=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&i.test(t))&&t>-1&&t%1==0&&t<e}},function(t,e,i){var r=i(35),s=i(36),n=i(37),o=n&&n.isTypedArray,a=o?s(o):r;t.exports=a},function(t,e,i){var r=i(3),s=i(12),n=i(4),o={};o["[object Float32Array]"]=o["[object Float64Array]"]=o["[object Int8Array]"]=o["[object Int16Array]"]=o["[object Int32Array]"]=o["[object Uint8Array]"]=o["[object Uint8ClampedArray]"]=o["[object Uint16Array]"]=o["[object Uint32Array]"]=!0,o["[object Arguments]"]=o["[object Array]"]=o["[object ArrayBuffer]"]=o["[object Boolean]"]=o["[object DataView]"]=o["[object Date]"]=o["[object Error]"]=o["[object Function]"]=o["[object Map]"]=o["[object Number]"]=o["[object Object]"]=o["[object RegExp]"]=o["[object Set]"]=o["[object String]"]=o["[object WeakMap]"]=!1,t.exports=function(t){return n(t)&&s(t.length)&&!!o[r(t)]}},function(t,e){t.exports=function(t){return function(e){return t(e)}}},function(t,e,i){(function(t){var r=i(9),s=e&&!e.nodeType&&e,n=s&&"object"==typeof t&&t&&!t.nodeType&&t,o=n&&n.exports===s&&r.process,a=function(){try{var t=n&&n.require&&n.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=a}).call(this,i(11)(t))},function(t,e,i){var r=i(39),s=i(40),n=Object.prototype.hasOwnProperty;t.exports=function(t){if(!r(t))return s(t);var e=[];for(var i in Object(t))n.call(t,i)&&"constructor"!=i&&e.push(i);return e}},function(t,e){var i=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||i)}},function(t,e,i){var r=i(41)(Object.keys,Object);t.exports=r},function(t,e){t.exports=function(t,e){return function(i){return t(e(i))}}},function(t,e,i){var r=i(43),s=i(12);t.exports=function(t){return null!=t&&s(t.length)&&!r(t)}},function(t,e,i){var r=i(3),s=i(44);t.exports=function(t){if(!s(t))return!1;var e=r(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e){t.exports=function(t,e){if(null==t)return{};var i,r,s={},n=Object.keys(t);for(r=0;r<n.length;r++)i=n[r],e.indexOf(i)>=0||(s[i]=t[i]);return s}},function(t,e,i){"use strict";i.r(e),i.d(e,"Alpha",(function(){return ze})),i.d(e,"Attraction",(function(){return Me})),i.d(e,"Collision",(function(){return Pe})),i.d(e,"Color",(function(){return Ee})),i.d(e,"CrossZone",(function(){return Oe})),i.d(e,"Force",(function(){return Te})),i.d(e,"Gravity",(function(){return Se})),i.d(e,"RandomDrift",(function(){return Ae})),i.d(e,"Repulsion",(function(){return Ce})),i.d(e,"Rotate",(function(){return je})),i.d(e,"Scale",(function(){return Re})),i.d(e,"Spring",(function(){return Ie})),i.d(e,"Behaviour",(function(){return we})),i.d(e,"Debug",(function(){return Ge})),i.d(e,"log",(function(){return Ye})),i.d(e,"ease",(function(){return h})),i.d(e,"easeLinear",(function(){return u})),i.d(e,"easeInQuad",(function(){return c})),i.d(e,"easeOutQuad",(function(){return l})),i.d(e,"easeInOutQuad",(function(){return d})),i.d(e,"easeInCubic",(function(){return p})),i.d(e,"easeOutCubic",(function(){return f})),i.d(e,"easeInOutCubic",(function(){return y})),i.d(e,"easeInQuart",(function(){return m})),i.d(e,"easeOutQuart",(function(){return g})),i.d(e,"easeInOutQuart",(function(){return x})),i.d(e,"easeInSine",(function(){return v})),i.d(e,"easeOutSine",(function(){return b})),i.d(e,"easeInOutSine",(function(){return _})),i.d(e,"easeInExpo",(function(){return w})),i.d(e,"easeOutExpo",(function(){return z})),i.d(e,"easeInOutExpo",(function(){return M})),i.d(e,"easeInCirc",(function(){return P})),i.d(e,"easeOutCirc",(function(){return E})),i.d(e,"easeInOutCirc",(function(){return O})),i.d(e,"easeInBack",(function(){return T})),i.d(e,"easeOutBack",(function(){return S})),i.d(e,"easeInOutBack",(function(){return A})),i.d(e,"setEasingByName",(function(){return C})),i.d(e,"getEasingByName",(function(){return j})),i.d(e,"FollowEmitter",(function(){return Xe})),i.d(e,"Emitter",(function(){return be})),i.d(e,"Body",(function(){return Ct})),i.d(e,"BodySprite",(function(){return Ft})),i.d(e,"InitializerUtil",(function(){return Lt})),i.d(e,"Life",(function(){return Ut})),i.d(e,"Mass",(function(){return Nt})),i.d(e,"Position",(function(){return ae})),i.d(e,"Radius",(function(){return he})),i.d(e,"Rate",(function(){return ue})),i.d(e,"Texture",(function(){return de})),i.d(e,"VectorVelocity",(function(){return me})),i.d(e,"PolarVelocity",(function(){return fe})),i.d(e,"RadialVelocity",(function(){return ye})),i.d(e,"ArraySpan",(function(){return ft})),i.d(e,"createArraySpan",(function(){return yt})),i.d(e,"ColorSpan",(function(){return mt})),i.d(e,"createColorSpan",(function(){return gt})),i.d(e,"Box",(function(){return xt})),i.d(e,"integrate",(function(){return Mt})),i.d(e,"MathUtils",(function(){return ut})),i.d(e,"Polar3D",(function(){return Et})),i.d(e,"Span",(function(){return ct})),i.d(e,"createSpan",(function(){return lt})),i.d(e,"Vector3D",(function(){return Pt})),i.d(e,"INTEGRATION_TYPE_EULER",(function(){return vt})),i.d(e,"INTEGRATION_TYPE_RK2",(function(){return bt})),i.d(e,"INTEGRATION_TYPE_RK4",(function(){return _t})),i.d(e,"INTEGRATION_TYPE_VERLET",(function(){return wt})),i.d(e,"CustomRenderer",(function(){return Qe})),i.d(e,"MeshRenderer",(function(){return He})),i.d(e,"SpriteRenderer",(function(){return We})),i.d(e,"GPURenderer",(function(){return vi})),i.d(e,"ColorUtil",(function(){return Q})),i.d(e,"PUID",(function(){return H})),i.d(e,"THREEUtil",(function(){return it})),i.d(e,"Util",(function(){return rt})),i.d(e,"uid",(function(){return nt})),i.d(e,"withDefaults",(function(){return ht})),i.d(e,"BoxZone",(function(){return ee})),i.d(e,"LineZone",(function(){return ie})),i.d(e,"MeshZone",(function(){return re})),i.d(e,"PointZone",(function(){return se})),i.d(e,"ScreenZone",(function(){return ne})),i.d(e,"SphereZone",(function(){return oe})),i.d(e,"System",(function(){return Ue})),i.d(e,"Particle",(function(){return Ot})),i.d(e,"Pool",(function(){return Tt}));var r={};i.r(r),i.d(r,"BoxZone",(function(){return ee})),i.d(r,"LineZone",(function(){return ie})),i.d(r,"MeshZone",(function(){return re})),i.d(r,"PointZone",(function(){return se})),i.d(r,"ScreenZone",(function(){return ne})),i.d(r,"SphereZone",(function(){return oe}));var s={};i.r(s),i.d(s,"Body",(function(){return Ct})),i.d(s,"BodySprite",(function(){return Ft})),i.d(s,"InitializerUtil",(function(){return Lt})),i.d(s,"Life",(function(){return Ut})),i.d(s,"Mass",(function(){return Nt})),i.d(s,"Position",(function(){return ae})),i.d(s,"Radius",(function(){return he})),i.d(s,"Rate",(function(){return ue})),i.d(s,"Texture",(function(){return de})),i.d(s,"VectorVelocity",(function(){return me})),i.d(s,"PolarVelocity",(function(){return fe})),i.d(s,"RadialVelocity",(function(){return ye}));var n={};i.r(n),i.d(n,"Alpha",(function(){return ze})),i.d(n,"Attraction",(function(){return Me})),i.d(n,"Collision",(function(){return Pe})),i.d(n,"Color",(function(){return Ee})),i.d(n,"CrossZone",(function(){return Oe})),i.d(n,"Force",(function(){return Te})),i.d(n,"Gravity",(function(){return Se})),i.d(n,"RandomDrift",(function(){return Ae})),i.d(n,"Repulsion",(function(){return Ce})),i.d(n,"Rotate",(function(){return je})),i.d(n,"Scale",(function(){return Re})),i.d(n,"Spring",(function(){return Ie})),i.d(n,"Behaviour",(function(){return we}));const o=["BodySprite","Texture"];var a=i(0);const h={easeLinear:function(t){return t},easeInQuad:function(t){return Math.pow(t,2)},easeOutQuad:function(t){return-(Math.pow(t-1,2)-1)},easeInOutQuad:function(t){return(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2)},easeInCubic:function(t){return Math.pow(t,3)},easeOutCubic:function(t){return Math.pow(t-1,3)+1},easeInOutCubic:function(t){return(t/=.5)<1?.5*Math.pow(t,3):.5*(Math.pow(t-2,3)+2)},easeInQuart:function(t){return Math.pow(t,4)},easeOutQuart:function(t){return-(Math.pow(t-1,4)-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*Math.pow(t,4):-.5*((t-=2)*Math.pow(t,3)-2)},easeInSine:function(t){return 1-Math.cos(t*(a.d/2))},easeOutSine:function(t){return Math.sin(t*(a.d/2))},easeInOutSine:function(t){return-.5*(Math.cos(a.d*t)-1)},easeInExpo:function(t){return 0===t?0:Math.pow(2,10*(t-1))},easeOutExpo:function(t){return 1===t?1:1-Math.pow(2,-10*t)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*--t))},easeInCirc:function(t){return-(Math.sqrt(1-t*t)-1)},easeOutCirc:function(t){return Math.sqrt(1-Math.pow(t-1,2))},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInBack:function(t){var e=1.70158;return t*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack:function(t){var e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)}},{easeLinear:u,easeInQuad:c,easeOutQuad:l,easeInOutQuad:d,easeInCubic:p,easeOutCubic:f,easeInOutCubic:y,easeInQuart:m,easeOutQuart:g,easeInOutQuart:x,easeInSine:v,easeOutSine:b,easeInOutSine:_,easeInExpo:w,easeOutExpo:z,easeInOutExpo:M,easeInCirc:P,easeOutCirc:E,easeInOutCirc:O,easeInBack:T,easeOutBack:S,easeInOutBack:A}=h,C=t=>h[t]?h[t]:h.easeLinear,j=t=>h[t]?h[t]:h.easeLinear,R=u,I=["Position","Life","Radius","Mass","Body","BodySprite","Texture","PolarVelocity","RadialVelocity","VectorVelocity"],D=["Alpha","Attraction","Color","CrossZone","Force","Gravity","RandomDrift","Repulsion","Rotate","Scale","Spring"],B=["BoxZone","LineZone","MeshZone","PointZone","SphereZone"];var V,k,F,Z,L,U,N,q,G,Y,X=i(1),J=i.n(X),Q={getRGB:function(t){var e={};if("number"==typeof t)r=Math.floor(t),e.r=(t>>16&255)/255,e.g=(t>>8&255)/255,e.b=(255&t)/255;else if("string"==typeof t){var i;if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(t))e.r=Math.min(255,parseInt(i[1],10))/255,e.g=Math.min(255,parseInt(i[2],10))/255,e.b=Math.min(255,parseInt(i[3],10))/255;else if(i=/^\#([A-Fa-f0-9]+)$/.exec(t)){var r=i[1];e.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,e.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,e.b=parseInt(r.charAt(4)+r.charAt(5),16)/255}}else e.r=t.r,e.g=t.g,e.b=t.b;return e}},H={_id:0,_uids:new Map,getNewId:function(){return"PUID_"+ ++this._id},id:function(t){if(this._uids.has(t))return this._uids.get(t);const e=this.getNewId();return this._uids.set(t,e),e}},W={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){for(var t=[],e=0;e<256;e++)t[e]=(e<16?"0":"")+e.toString(16);return function(){var e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,r=4294967295*Math.random()|0,s=4294967295*Math.random()|0;return(t[255&e]+t[e>>8&255]+t[e>>16&255]+t[e>>24&255]+"-"+t[255&i]+t[i>>8&255]+"-"+t[i>>16&15|64]+t[i>>24&255]+"-"+t[63&r|128]+t[r>>8&255]+"-"+t[r>>16&255]+t[r>>24&255]+t[255&s]+t[s>>8&255]+t[s>>16&255]+t[s>>24&255]).toUpperCase()}}(),clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,r,s){return r+(t-e)*(s-r)/(i-e)},lerp:function(t,e,i){return(1-i)*t+i*e},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*W.DEG2RAD},radToDeg:function(t){return t*W.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}};function $(t,e,i,r){this._x=t||0,this._y=e||0,this._z=i||0,this._w=void 0!==r?r:1}function K(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0}function tt(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function et(t,e,i,r){this._x=t||0,this._y=e||0,this._z=i||0,this._order=r||et.DefaultOrder}Object.assign($,{slerp:function(t,e,i,r){return i.copy(t).slerp(e,r)},slerpFlat:function(t,e,i,r,s,n,o){var a=i[r+0],h=i[r+1],u=i[r+2],c=i[r+3],l=s[n+0],d=s[n+1],p=s[n+2],f=s[n+3];if(c!==f||a!==l||h!==d||u!==p){var y=1-o,m=a*l+h*d+u*p+c*f,g=m>=0?1:-1,x=1-m*m;if(x>Number.EPSILON){var v=Math.sqrt(x),b=Math.atan2(v,m*g);y=Math.sin(y*b)/v,o=Math.sin(o*b)/v}var _=o*g;if(a=a*y+l*_,h=h*y+d*_,u=u*y+p*_,c=c*y+f*_,y===1-o){var w=1/Math.sqrt(a*a+h*h+u*u+c*c);a*=w,h*=w,u*=w,c*=w}}t[e]=a,t[e+1]=h,t[e+2]=u,t[e+3]=c}}),Object.defineProperties($.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}}),Object.assign($.prototype,{isQuaternion:!0,set:function(t,e,i,r){return this._x=t,this._y=e,this._z=i,this._w=r,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=t._x,r=t._y,s=t._z,n=t.order,o=Math.cos,a=Math.sin,h=o(i/2),u=o(r/2),c=o(s/2),l=a(i/2),d=a(r/2),p=a(s/2);return"XYZ"===n?(this._x=l*u*c+h*d*p,this._y=h*d*c-l*u*p,this._z=h*u*p+l*d*c,this._w=h*u*c-l*d*p):"YXZ"===n?(this._x=l*u*c+h*d*p,this._y=h*d*c-l*u*p,this._z=h*u*p-l*d*c,this._w=h*u*c+l*d*p):"ZXY"===n?(this._x=l*u*c-h*d*p,this._y=h*d*c+l*u*p,this._z=h*u*p+l*d*c,this._w=h*u*c-l*d*p):"ZYX"===n?(this._x=l*u*c-h*d*p,this._y=h*d*c+l*u*p,this._z=h*u*p-l*d*c,this._w=h*u*c+l*d*p):"YZX"===n?(this._x=l*u*c+h*d*p,this._y=h*d*c+l*u*p,this._z=h*u*p-l*d*c,this._w=h*u*c-l*d*p):"XZY"===n&&(this._x=l*u*c-h*d*p,this._y=h*d*c-l*u*p,this._z=h*u*p+l*d*c,this._w=h*u*c+l*d*p),!1!==e&&this._onChangeCallback(),this},setFromAxisAngle:function(t,e){var i=e/2,r=Math.sin(i);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(i),this._onChangeCallback(),this},setFromRotationMatrix:function(t){var e,i=t.elements,r=i[0],s=i[4],n=i[8],o=i[1],a=i[5],h=i[9],u=i[2],c=i[6],l=i[10],d=r+a+l;return d>0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(c-h)*e,this._y=(n-u)*e,this._z=(o-s)*e):r>a&&r>l?(e=2*Math.sqrt(1+r-a-l),this._w=(c-h)/e,this._x=.25*e,this._y=(s+o)/e,this._z=(n+u)/e):a>l?(e=2*Math.sqrt(1+a-r-l),this._w=(n-u)/e,this._x=(s+o)/e,this._y=.25*e,this._z=(h+c)/e):(e=2*Math.sqrt(1+l-r-a),this._w=(o-s)/e,this._x=(n+u)/e,this._y=(h+c)/e,this._z=.25*e),this._onChangeCallback(),this},setFromUnitVectors:function(t,e){var i=t.dot(e)+1;return i<1e-6?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()},angleTo:function(t){return 2*Math.acos(Math.abs(W.clamp(this.dot(t),-1,1)))},rotateTowards:function(t,e){var i=this.angleTo(t);if(0===i)return this;var r=Math.min(1,e/i);return this.slerp(t,r),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var i=t._x,r=t._y,s=t._z,n=t._w,o=e._x,a=e._y,h=e._z,u=e._w;return this._x=i*u+n*o+r*h-s*a,this._y=r*u+n*a+s*o-i*h,this._z=s*u+n*h+i*a-r*o,this._w=n*u-i*o-r*a-s*h,this._onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,r=this._y,s=this._z,n=this._w,o=n*t._w+i*t._x+r*t._y+s*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=n,this._x=i,this._y=r,this._z=s,this;var a=1-o*o;if(a<=Number.EPSILON){var h=1-e;return this._w=h*n+e*this._w,this._x=h*i+e*this._x,this._y=h*r+e*this._y,this._z=h*s+e*this._z,this.normalize(),this._onChangeCallback(),this}var u=Math.sqrt(a),c=Math.atan2(u,o),l=Math.sin((1-e)*c)/u,d=Math.sin(e*c)/u;return this._w=n*l+this._w*d,this._x=i*l+this._x*d,this._y=r*l+this._y*d,this._z=s*l+this._z*d,this._onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},_onChange:function(t){return this._onChangeCallback=t,this},_onChangeCallback:function(){}}),Object.assign(K.prototype,{isVector3:!0,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:(k=new $,function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(k.setFromEuler(t))}),applyAxisAngle:function(){var t=new $;return function(e,i){return this.applyQuaternion(t.setFromAxisAngle(e,i))}}(),applyMatrix3:function(t){var e=this.x,i=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6]*r,this.y=s[1]*e+s[4]*i+s[7]*r,this.z=s[2]*e+s[5]*i+s[8]*r,this},applyMatrix4:function(t){var e=this.x,i=this.y,r=this.z,s=t.elements,n=1/(s[3]*e+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*e+s[4]*i+s[8]*r+s[12])*n,this.y=(s[1]*e+s[5]*i+s[9]*r+s[13])*n,this.z=(s[2]*e+s[6]*i+s[10]*r+s[14])*n,this},applyQuaternion:function(t){var e=this.x,i=this.y,r=this.z,s=t.x,n=t.y,o=t.z,a=t.w,h=a*e+n*r-o*i,u=a*i+o*e-s*r,c=a*r+s*i-n*e,l=-s*e-n*i-o*r;return this.x=h*a+l*-s+u*-o-c*-n,this.y=u*a+l*-n+c*-s-h*-o,this.z=c*a+l*-o+h*-n-u*-s,this},project:function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},unproject:function(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)},transformDirection:function(t){var e=this.x,i=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*r,this.y=s[1]*e+s[5]*i+s[9]*r,this.z=s[2]*e+s[6]*i+s[10]*r,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},cross:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)},crossVectors:function(t,e){var i=t.x,r=t.y,s=t.z,n=e.x,o=e.y,a=e.z;return this.x=r*a-s*o,this.y=s*n-i*a,this.z=i*o-r*n,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:(V=new K,function(t){return V.copy(this).projectOnVector(t),this.sub(V)}),reflect:function(){var t=new K;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(W.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},setFromSphericalCoords:function(t,e,i){var r=Math.sin(e)*t;return this.x=r*Math.sin(i),this.y=Math.cos(e)*t,this.z=r*Math.cos(i),this},setFromCylindrical:function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},setFromCylindricalCoords:function(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=r,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(tt.prototype,{isMatrix4:!0,set:function(t,e,i,r,s,n,o,a,h,u,c,l,d,p,f,y){var m=this.elements;return m[0]=t,m[4]=e,m[8]=i,m[12]=r,m[1]=s,m[5]=n,m[9]=o,m[13]=a,m[2]=h,m[6]=u,m[10]=c,m[14]=l,m[3]=d,m[7]=p,m[11]=f,m[15]=y,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new tt).fromArray(this.elements)},copy:function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this},copyPosition:function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},extractBasis:function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},extractRotation:function(){var t=new K;return function(e){var i=this.elements,r=e.elements,s=1/t.setFromMatrixColumn(e,0).length(),n=1/t.setFromMatrixColumn(e,1).length(),o=1/t.setFromMatrixColumn(e,2).length();return i[0]=r[0]*s,i[1]=r[1]*s,i[2]=r[2]*s,i[3]=0,i[4]=r[4]*n,i[5]=r[5]*n,i[6]=r[6]*n,i[7]=0,i[8]=r[8]*o,i[9]=r[9]*o,i[10]=r[10]*o,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,this}}(),makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,i=t.x,r=t.y,s=t.z,n=Math.cos(i),o=Math.sin(i),a=Math.cos(r),h=Math.sin(r),u=Math.cos(s),c=Math.sin(s);if("XYZ"===t.order){var l=n*u,d=n*c,p=o*u,f=o*c;e[0]=a*u,e[4]=-a*c,e[8]=h,e[1]=d+p*h,e[5]=l-f*h,e[9]=-o*a,e[2]=f-l*h,e[6]=p+d*h,e[10]=n*a}else if("YXZ"===t.order){var y=a*u,m=a*c,g=h*u,x=h*c;e[0]=y+x*o,e[4]=g*o-m,e[8]=n*h,e[1]=n*c,e[5]=n*u,e[9]=-o,e[2]=m*o-g,e[6]=x+y*o,e[10]=n*a}else if("ZXY"===t.order){y=a*u,m=a*c,g=h*u,x=h*c;e[0]=y-x*o,e[4]=-n*c,e[8]=g+m*o,e[1]=m+g*o,e[5]=n*u,e[9]=x-y*o,e[2]=-n*h,e[6]=o,e[10]=n*a}else if("ZYX"===t.order){l=n*u,d=n*c,p=o*u,f=o*c;e[0]=a*u,e[4]=p*h-d,e[8]=l*h+f,e[1]=a*c,e[5]=f*h+l,e[9]=d*h-p,e[2]=-h,e[6]=o*a,e[10]=n*a}else if("YZX"===t.order){var v=n*a,b=n*h,_=o*a,w=o*h;e[0]=a*u,e[4]=w-v*c,e[8]=_*c+b,e[1]=c,e[5]=n*u,e[9]=-o*u,e[2]=-h*u,e[6]=b*c+_,e[10]=v-w*c}else if("XZY"===t.order){v=n*a,b=n*h,_=o*a,w=o*h;e[0]=a*u,e[4]=-c,e[8]=h*u,e[1]=v*c+w,e[5]=n*u,e[9]=b*c-_,e[2]=_*c-b,e[6]=o*u,e[10]=w*c+v}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:(q=new K(0,0,0),G=new K(1,1,1),function(t){return this.compose(q,t,G)}),lookAt:(L=new K,U=new K,N=new K,function(t,e,i){var r=this.elements;return N.subVectors(t,e),0===N.lengthSq()&&(N.z=1),N.normalize(),L.crossVectors(i,N),0===L.lengthSq()&&(1===Math.abs(i.z)?N.x+=1e-4:N.z+=1e-4,N.normalize(),L.crossVectors(i,N)),L.normalize(),U.crossVectors(N,L),r[0]=L.x,r[4]=U.x,r[8]=N.x,r[1]=L.y,r[5]=U.y,r[9]=N.y,r[2]=L.z,r[6]=U.z,r[10]=N.z,this}),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,r=e.elements,s=this.elements,n=i[0],o=i[4],a=i[8],h=i[12],u=i[1],c=i[5],l=i[9],d=i[13],p=i[2],f=i[6],y=i[10],m=i[14],g=i[3],x=i[7],v=i[11],b=i[15],_=r[0],w=r[4],z=r[8],M=r[12],P=r[1],E=r[5],O=r[9],T=r[13],S=r[2],A=r[6],C=r[10],j=r[14],R=r[3],I=r[7],D=r[11],B=r[15];return s[0]=n*_+o*P+a*S+h*R,s[4]=n*w+o*E+a*A+h*I,s[8]=n*z+o*O+a*C+h*D,s[12]=n*M+o*T+a*j+h*B,s[1]=u*_+c*P+l*S+d*R,s[5]=u*w+c*E+l*A+d*I,s[9]=u*z+c*O+l*C+d*D,s[13]=u*M+c*T+l*j+d*B,s[2]=p*_+f*P+y*S+m*R,s[6]=p*w+f*E+y*A+m*I,s[10]=p*z+f*O+y*C+m*D,s[14]=p*M+f*T+y*j+m*B,s[3]=g*_+x*P+v*S+b*R,s[7]=g*w+x*E+v*A+b*I,s[11]=g*z+x*O+v*C+b*D,s[15]=g*M+x*T+v*j+b*B,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new K;return function(e){for(var i=0,r=e.count;i<r;i++)t.x=e.getX(i),t.y=e.getY(i),t.z=e.getZ(i),t.applyMatrix4(this),e.setXYZ(i,t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],i=t[4],r=t[8],s=t[12],n=t[1],o=t[5],a=t[9],h=t[13],u=t[2],c=t[6],l=t[10],d=t[14];return t[3]*(+s*a*c-r*h*c-s*o*l+i*h*l+r*o*d-i*a*d)+t[7]*(+e*a*d-e*h*l+s*n*l-r*n*d+r*h*u-s*a*u)+t[11]*(+e*h*c-e*o*d-s*n*c+i*n*d+s*o*u-i*h*u)+t[15]*(-r*o*u-e*a*c+e*o*l+r*n*c-i*n*l+i*a*u)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(t,e,i){var r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=i),this},getInverse:function(t,e){var i=this.elements,r=t.elements,s=r[0],n=r[1],o=r[2],a=r[3],h=r[4],u=r[5],c=r[6],l=r[7],d=r[8],p=r[9],f=r[10],y=r[11],m=r[12],g=r[13],x=r[14],v=r[15],b=p*x*l-g*f*l+g*c*y-u*x*y-p*c*v+u*f*v,_=m*f*l-d*x*l-m*c*y+h*x*y+d*c*v-h*f*v,w=d*g*l-m*p*l+m*u*y-h*g*y-d*u*v+h*p*v,z=m*p*c-d*g*c-m*u*f+h*g*f+d*u*x-h*p*x,M=s*b+n*_+o*w+a*z;if(0===M){var P="THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0";if(!0===e)throw new Error(P);return console.warn(P),this.identity()}var E=1/M;return i[0]=b*E,i[1]=(g*f*a-p*x*a-g*o*y+n*x*y+p*o*v-n*f*v)*E,i[2]=(u*x*a-g*c*a+g*o*l-n*x*l-u*o*v+n*c*v)*E,i[3]=(p*c*a-u*f*a-p*o*l+n*f*l+u*o*y-n*c*y)*E,i[4]=_*E,i[5]=(d*x*a-m*f*a+m*o*y-s*x*y-d*o*v+s*f*v)*E,i[6]=(m*c*a-h*x*a-m*o*l+s*x*l+h*o*v-s*c*v)*E,i[7]=(h*f*a-d*c*a+d*o*l-s*f*l-h*o*y+s*c*y)*E,i[8]=w*E,i[9]=(m*p*a-d*g*a-m*n*y+s*g*y+d*n*v-s*p*v)*E,i[10]=(h*g*a-m*u*a+m*n*l-s*g*l-h*n*v+s*u*v)*E,i[11]=(d*u*a-h*p*a-d*n*l+s*p*l+h*n*y-s*u*y)*E,i[12]=z*E,i[13]=(d*g*o-m*p*o+m*n*f-s*g*f-d*n*x+s*p*x)*E,i[14]=(m*u*o-h*g*o-m*n*c+s*g*c+h*n*x-s*u*x)*E,i[15]=(h*p*o-d*u*o+d*n*c-s*p*c-h*n*f+s*u*f)*E,this},scale:function(t){var e=this.elements,i=t.x,r=t.y,s=t.z;return e[0]*=i,e[4]*=r,e[8]*=s,e[1]*=i,e[5]*=r,e[9]*=s,e[2]*=i,e[6]*=r,e[10]*=s,e[3]*=i,e[7]*=r,e[11]*=s,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,r))},makeTranslation:function(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var i=Math.cos(e),r=Math.sin(e),s=1-i,n=t.x,o=t.y,a=t.z,h=s*n,u=s*o;return this.set(h*n+i,h*o-r*a,h*a+r*o,0,h*o+r*a,u*o+i,u*a-r*n,0,h*a-r*o,u*a+r*n,s*a*a+i,0,0,0,0,1),this},makeScale:function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this},makeShear:function(t,e,i){return this.set(1,e,i,0,t,1,i,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,i){var r=this.elements,s=e._x,n=e._y,o=e._z,a=e._w,h=s+s,u=n+n,c=o+o,l=s*h,d=s*u,p=s*c,f=n*u,y=n*c,m=o*c,g=a*h,x=a*u,v=a*c,b=i.x,_=i.y,w=i.z;return r[0]=(1-(f+m))*b,r[1]=(d+v)*b,r[2]=(p-x)*b,r[3]=0,r[4]=(d-v)*_,r[5]=(1-(l+m))*_,r[6]=(y+g)*_,r[7]=0,r[8]=(p+x)*w,r[9]=(y-g)*w,r[10]=(1-(l+f))*w,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this},decompose:(F=new K,Z=new tt,function(t,e,i){var r=this.elements,s=F.set(r[0],r[1],r[2]).length(),n=F.set(r[4],r[5],r[6]).length(),o=F.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),t.x=r[12],t.y=r[13],t.z=r[14],Z.copy(this);var a=1/s,h=1/n,u=1/o;return Z.elements[0]*=a,Z.elements[1]*=a,Z.elements[2]*=a,Z.elements[4]*=h,Z.elements[5]*=h,Z.elements[6]*=h,Z.elements[8]*=u,Z.elements[9]*=u,Z.elements[10]*=u,e.setFromRotationMatrix(Z),i.x=s,i.y=n,i.z=o,this}),makePerspective:function(t,e,i,r,s,n){void 0===n&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,a=2*s/(e-t),h=2*s/(i-r),u=(e+t)/(e-t),c=(i+r)/(i-r),l=-(n+s)/(n-s),d=-2*n*s/(n-s);return o[0]=a,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=h,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=l,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(t,e,i,r,s,n){var o=this.elements,a=1/(e-t),h=1/(i-r),u=1/(n-s),c=(e+t)*a,l=(i+r)*h,d=(n+s)*u;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*h,o[9]=0,o[13]=-l,o[2]=0,o[6]=0,o[10]=-2*u,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(e[r]!==i[r])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}),et.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],et.DefaultOrder="XYZ",Object.defineProperties(et.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this._onChangeCallback()}}}),Object.assign(et.prototype,{isEuler:!0,set:function(t,e,i,r){return this._x=t,this._y=e,this._z=i,this._order=r||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this},setFromRotationMatrix:function(t,e,i){var r=W.clamp,s=t.elements,n=s[0],o=s[4],a=s[8],h=s[1],u=s[5],c=s[9],l=s[2],d=s[6],p=s[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(r(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(-c,p),this._z=Math.atan2(-o,n)):(this._x=Math.atan2(d,u),this._z=0)):"YXZ"===e?(this._x=Math.asin(-r(c,-1,1)),Math.abs(c)<.99999?(this._y=Math.atan2(a,p),this._z=Math.atan2(h,u)):(this._y=Math.atan2(-l,n),this._z=0)):"ZXY"===e?(this._x=Math.asin(r(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-l,p),this._z=Math.atan2(-o,u)):(this._y=0,this._z=Math.atan2(h,n))):"ZYX"===e?(this._y=Math.asin(-r(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(d,p),this._z=Math.atan2(h,n)):(this._x=0,this._z=Math.atan2(-o,u))):"YZX"===e?(this._z=Math.asin(r(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(-c,u),this._y=Math.atan2(-l,n)):(this._x=0,this._y=Math.atan2(a,p))):"XZY"===e?(this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(d,u),this._y=Math.atan2(a,n)):(this._x=Math.atan2(-c,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==i&&this._onChangeCallback(),this},setFromQuaternion:function(){var t=new tt;return function(e,i,r){return t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,i,r)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:(Y=new $,function(t){return Y.setFromEuler(this),this.setFromQuaternion(Y,t)}),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new K(this._x,this._y,this._z)},_onChange:function(t){return this._onChangeCallback=t,this},_onChangeCallback:function(){}});var it={toScreenPos:function(){var t=new K;return function(e,i,r){return t.copy(e),t.project(i),t.x=Math.round((t.x+1)*r.width/2),t.y=Math.round((1-t.y)*r.height/2),t.z=0,t}}(),toSpacePos:function(){var t,e=new K,i=new K;return function(r,s,n){return e.set(r.x/n.width*2-1,-r.y/n.height*2+1,.5),e.unproject(s),i.copy(e.sub(s.position).normalize()),t=-s.position.z/i.z,e.copy(s.position),e.add(i.multiplyScalar(t)),e}}()},rt={initValue:function(t,e){return null!=t&&null!=t?t:e},isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},destroyArray:function(t){t.length=0},destroyObject:function(t){for(var e in t)delete t[e]},isUndefined:function(){for(var t in arguments){var e=arguments[t];if(void 0!==e)return!1}return!0},setVectorByObj:function(t,e){void 0!==e.x&&(t.position.x=e.x),void 0!==e.y&&(t.position.y=e.y),void 0!==e.z&&(t.position.z=e.z),void 0!==e.vx&&(t.velocity.x=e.vx),void 0!==e.vy&&(t.velocity.y=e.vy),void 0!==e.vz&&(t.velocity.z=e.vz),void 0!==e.ax&&(t.acceleration.x=e.ax),void 0!==e.ay&&(t.acceleration.y=e.ay),void 0!==e.az&&(t.acceleration.z=e.az),void 0!==e.p&&t.position.copy(e.p),void 0!==e.v&&t.velocity.copy(e.v),void 0!==e.a&&t.acceleration.copy(e.a),void 0!==e.position&&t.position.copy(e.position),void 0!==e.velocity&&t.velocity.copy(e.velocity),void 0!==e.accelerate&&t.acceleration.copy(e.accelerate)},setPrototypeByObj:function(t,e,i){for(var r in e)t.hasOwnProperty(r)&&(i?i.indexOf(r)<0&&(t[r]=this._getValue(e[r])):t[r]=this._getValue(e[r]));return t},_getValue:function(t){return"Span"===t.constructor.type?t.getValue():t}},st=i(13),nt=i.n(st).a;function ot(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function at(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?ot(Object(i),!0).forEach((function(e){J()(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ot(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}const ht=(t,e)=>at(at({},t),e);var ut={randomAToB:function(t,e,i){return i?(Math.random()*(e-t)>>0)+t:t+Math.random()*(e-t)},randomFloating:function(t,e,i){return this.randomAToB(t-e,t+e,i)},randomZone:function(t){},degreeTransform:function(t){return t*a.d/180},toColor16:function(t){return"#"+t.toString(16)},randomColor:function(){return"#"+("00000"+(16777216*Math.random()<<0).toString(16)).slice(-6)},lerp:function(t,e,i){return e+(t-e)*i},getNormal:function(t,e){return 0==t.x&&0==t.y?0==t.z?e.set(1,0,1):e.set(1,1,-t.y/t.z):0==t.x?e.set(1,0,1):e.set(-t.y/t.x,1,1),e.normalize()},axisRotate:function(t,e,i,r){var s=Math.cos(r),n=Math.sin(r),o=i.dot(e)*(1-s);t.copy(i),t.cross(e).scalar(n),t.addValue(e.x*s,e.y*s,e.z*s),t.addValue(i.x*o,i.y*o,i.z*o)}};class ct{constructor(t,e,i){this._isArray=!1,this.type="Span",rt.isArray(t)?(this._isArray=!0,this.a=t):(this.a=rt.initValue(t,1),this.b=rt.initValue(e,this.a),this._center=rt.initValue(i,!1))}getValue(t){return this._isArray?this.a[this.a.length*Math.random()>>0]:this._center?ut.randomFloating(this.a,this.b,t):ut.randomAToB(this.a,this.b,t)}}const lt=(t,e,i)=>t instanceof ct?t:void 0===e?new ct(t):void 0===i?new ct(t,e):new ct(t,e,i);var dt=i(5),pt=i.n(dt);class ft extends ct{constructor(t){super(),this.type="ArraySpan",this.items=Array.isArray(t)?t:[t]}getValue(){return pt()(this.items)}}const yt=t=>t?t instanceof ft?t:new ft(t):null;class mt extends ct{constructor(t){super(),this.type="ColorSpan",this.shouldRandomize="random"===t,this.colors=Array.isArray(t)?t:[t]}getValue(){return this.shouldRandomize?ut.randomColor():pt()(this.colors)}}const gt=t=>(t||(console.warn(`Invalid colors argument ${t} passed to createColorSpan. Defaulting to 'random'.`),t="random"),t instanceof mt?t:new mt(t));class xt{constructor(t,e,i,r,s,n){this.type="Box",this.x=t,this.y=e,this.z=i,this.width=r,this.height=s,this.depth=n,this.bottom=this.y+this.height,this.right=this.x+this.width,this.right=this.x+this.width}contains(t,e,i){return t<=this.right&&t>=this.x&&e<=this.bottom&&e>=this.y&&i<=this.depth&&i>=this.z}}const vt="EULER",bt="RUNGE_KUTTA_2",_t="RUNGE_KUTTA_4",wt="VERLET",zt=(t,e,i)=>{t.sleep||(t.old.position.copy(t.position),t.old.velocity.copy(t.velocity),t.acceleration.scalar(1/t.mass),t.velocity.add(t.acceleration.scalar(e)),t.position.add(t.old.velocity.scalar(e)),i&&t.velocity.scalar(Math.pow(i,e/.0167)),t.acceleration.clear())},Mt=(t,e,i,r=vt)=>{switch(r){case vt:zt(t,e,i);break;default:zt(t,e,i)}};class Pt extends K{clear(){return this.x=0,this.y=0,this.z=0,this}scalar(t){return this.x*=t,this.y*=t,this.z*=t,this}addValue(t,e,i){return this.x+=t,this.y+=e,this.z+=i,this}toString(){return"x:"+this.x+"y:"+this.y+"z:"+this.z}eulerFromDir(t){return(new et).setFromVector3(t)}}class Et{constructor(t,e,i){this.type="Polar3D",this.radius=t||1,this.phi=i||0,this.theta=e||0}set(t,e,i){return this.radius=t||1,this.phi=i||0,this.theta=e||0,this}setRadius(t){return this.radius=t,this}setPhi(t){return this.phi=t,this}setTheta(t){return this.theta=t,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}toVector3D(){return new Pt(this.getX(),this.getY(),this.getZ())}getX(){return this.radius*Math.sin(this.theta)*Math.cos(this.phi)}getY(){return-this.radius*Math.sin(this.theta)*Math.sin(this.phi)}getZ(){return this.radius*Math.cos(this.theta)}normalize(){return this.radius=1,this}equals(t){return t.radius===this.radius&&t.phi===this.phi&&t.theta===this.theta}clear(){return this.radius=0,this.phi=0,this.theta=0,this}clone(){return new Et(this.radius,this.phi,this.theta)}}class Ot{constructor(t){this.id="particle-"+nt(),this.type="Particle",this.life=1/0,this.age=0,this.energy=1,this.dead=!1,this.sleep=!1,this.body=null,this.parent=null,this.mass=1,this.radius=10,this.alpha=1,this.scale=1,this.useColor=!1,this.useAlpha=!1,this.easing=R,this.position=new Pt,this.velocity=new Pt,this.acceleration=new Pt,this.old={},this.old.position=this.position.clone(),this.old.velocity=this.velocity.clone(),this.old.acceleration=this.acceleration.clone(),this.behaviours=[],this.transform={},this.color={r:0,g:0,b:0},this.rotation=new Pt,this.distanceToCamera=0,rt.setPrototypeByObj(this,t)}getDirection(){return Math.atan2(this.velocity.x,-this.velocity.y)*(180/a.d)}reset(){return this.life=1/0,this.age=0,this.energy=1,this.dead=!1,this.sleep=!1,this.body=null,this.parent=null,this.mass=1,this.radius=10,this.alpha=1,this.scale=1,this.useColor=!1,this.useAlpha=!1,this.easing=R,this.position.set(0,0,0),this.velocity.set(0,0,0),this.acceleration.set(0,0,0),this.old.position.set(0,0,0),this.old.velocity.set(0,0,0),this.old.acceleration.set(0,0,0),this.color.r=0,this.color.g=0,this.color.b=0,this.rotation.clear(),rt.destroyObject(this.transform),this.removeAllBehaviours(),this}update(t,e){if(!this.sleep){this.age+=t;let i=this.behaviours.length;for(;i--;){this.behaviours[i].applyBehaviour(this,t,e)}}if(this.age>=this.life)this.destroy();else{const t=this.easing(this.age/this.life);this.energy=Math.max(1-t,0)}}addBehaviour(t){this.behaviours.push(t),t.initialize(this)}addBehaviours(t){let e=t.length;for(;e--;)this.addBehaviour(t[e])}removeBehaviour(t){const e=this.behaviours.indexOf(t);e>-1&&this.behaviours.splice(e,1)}removeAllBehaviours(){rt.destroyArray(this.behaviours)}destroy(){this.removeAllBehaviours(),this.energy=0,this.dead=!0,this.parent=null}}class Tt{constructor(){this.type="Pool",this.cID=0,this.list={}}create(t,...e){if(!this.canCreateNewObject(t))throw new Error("The pool is unable to create or clone the object supplied");return this.cID++,this.canInstantiateObject(t)?new t(...e):this.canCloneObject(t)?t.clone():void 0}canInstantiateObject(t){return"function"==typeof t}canCloneObject(t){return t.clone&&"function"==typeof t.clone}canCreateNewObject(t){return!(!this.canInstantiateObject(t)&&!this.canCloneObject(t))}getCount(){var t=0;for(var e in this.list)t+=this.list[e].length;return t++}get(t,...e){var i,r=t.__puid||H.id(t);return(i=this.list[r]&&this.list[r].length>0?this.list[r].pop():this.create(t,...e)).__puid=t.__puid||r,i}expire(t){return this._getList(t.__puid).push(t)}destroy(){for(var t in this.list)this.list[t].length=0,delete this.list[t]}_getList(t){return t=t||"default",this.list[t]||(this.list[t]=[]),this.list[t]}}var St=class{constructor(){this.listeners=null}set listeners(t){this._listeners=t}get listeners(){return this._listeners}addEventListener(t,e){return this.listeners?this.removeEventListener(t,e):this.listeners={},this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e),e}removeEventListener(t,e){if(this.listeners&&this.listeners[t])for(var i=this.listeners[t],r=0,s=i.length;r<s;r++)if(i[r]==e){1==s?delete this.listeners[t]:i.splice(r,1);break}}removeAllEventListeners(t){t?this.listeners&&delete this.listeners[t]:this.listeners=null}dispatchEvent(t,e){var i=!1,r=this.listeners;if(t&&r){var s=r[t];if(!s)return i;for(var n,o=(s=s.slice()).length;o--;)n=s[o],i=i||n(e)}return!!i}hasEventListener(t){var e=this.listeners;return!(!e||!e[t])}};class At{constructor(t="Initializer",e=!0){this.type=t,this.isEnabled=e}init(t,e){this.isEnabled&&(e?(this.initialize(e),e.hasBeenInitialized=!0):(this.initialize(t),t.hasBeenInitialized=!0))}reset(){}initialize(t){}static requiresWebGlApi(){return!1}static fromJSON(t){}}class Ct extends At{constructor(t,e,i,r=!0){super("Body",r),this.body=yt(t),this.w=e,this.h=i||e}initialize(t){var e=this.body.getValue();this.w?t.body={width:this.w,height:this.h,body:e}:t.body=e}static fromJSON(t){const{body:e,width:i,height:r,isEnabled:s=!0}=t;return new Ct(e,i,r,s)}}function jt(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function Rt(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?jt(Object(i),!0).forEach((function(e){J()(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):jt(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}const It={AdditiveBlending:2,CustomBlending:5,MultiplyBlending:4,NoBlending:0,NormalBlending:1,SubtractiveBlending:3},Dt={color:16711680,blending:2,fog:!0},Bt=Rt(Rt({},Dt),{},{blending:"AdditiveBlending"});function Vt(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function kt(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Vt(Object(i),!0).forEach((function(e){J()(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Vt(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}class Ft extends At{constructor(t,e,i=Dt,r=!0){super("BodySprite",r);const{Sprite:s,SpriteMaterial:n,TextureLoader:o}=t;this.materialProperties=ht(Dt,i),(new o).load(e,t=>{this.texture=t,this.material=new n(kt(kt({},{map:t}),this.materialProperties)),this.sprite=new s(this.material)},void 0,t=>{throw new Error(t)})}initialize(t){t.body=this.sprite}static fromJSON(t,e){const{texture:i,materialProperties:r=Bt,isEnabled:s=!0}=t;return new Ft(e,i,ht(Bt,(t=>{const{blending:e}=t;return kt(kt({},t),{},{blending:e?It[e]:It[Bt.blending]})})(r)),s)}}const Zt=new et;var Lt={particleEuler:null,initialize:function(t,e,i){let r=i.length;for(;r--;)i[r].init(t,e);t.bindEmitter&&this.bindEmitter(t,e)},bindEmitter:function(t,e){const{rotation:{x:i,y:r,z:s}}=t;e.position.add(t.position),e.velocity.add(t.velocity),e.acceleration.add(t.acceleration),e.velocity.applyEuler(Zt.set(i,r,s))}};class Ut extends At{constructor(t,e,i,r=!0){super("Life",r),this.lifePan=lt(t,e,i)}initialize(t){this.lifePan.a==1/0||"infi"==this.lifePan.a?t.life=1/0:t.life=this.lifePan.getValue()}static fromJSON(t){const{min:e,max:i,center:r=!1,isEnabled:s=!0}=t;return new Ut(e,i,r,s)}}class Nt extends At{constructor(t,e,i=!1,r=!0){super("Mass",r),this.massPan=lt(t,e,i)}initialize(t){t.mass=this.massPan.getValue()}static fromJSON(t){const{min:e,max:i,center:r=!1,isEnabled:s=!0}=t;return new Nt(e,i,r,s)}}var qt,Gt,Yt,Xt,Jt,Qt,Ht,Wt,$t=i(14),Kt=i.n($t);class te{constructor(t="Zone"){this.type=t,this.vector=new Pt(0,0,0),this.random=0,this.crossType="dead",this.log=!0,this.supportsCrossing=!0}getPosition(){return null}crossing(t){if(!this.supportsCrossing)return console.warn(this.constructor.name+" does not support the crossing method");switch(this.crossType){case"bound":this._bound(t);break;case"cross":this._cross(t);break;case"dead":this._dead(t)}}isBoxZone(){return!1}isLineZone(){return!1}isMeshZone(){return!1}isPointZone(){return!1}isScreenZone(){return!1}isSphereZone(){return!1}_dead(t){}_bound(t){}_cross(t){}}class ee extends te{constructor(t,e,i,r,s,n){var o,a,h,u,c;super("BoxZone"),rt.isUndefined(e,i,r,s,n)?(o=a=h=0,u=c=r=t||100):rt.isUndefined(r,s,n)?(o=a=h=0,u=t,c=e,r=i):(o=t,a=e,h=i,u=r,c=s,r=n),this.x=o,this.y=a,this.z=h,this.width=u,this.height=c,this.depth=r,this.friction=.85,this.max=6}isBoxZone(){return!0}getPosition(){return this.vector.x=this.x+ut.randomAToB(-.5,.5)*this.width,this.vector.y=this.y+ut.randomAToB(-.5,.5)*this.height,this.vector.z=this.z+ut.randomAToB(-.5,.5)*this.depth,this.vector}_dead(t){(t.position.x+t.radius<this.x-this.width/2||t.position.x-t.radius>this.x+this.width/2)&&(t.dead=!0),(t.position.y+t.radius<this.y-this.height/2||t.position.y-t.radius>this.y+this.height/2)&&(t.dead=!0),(t.position.z+t.radius<this.z-this.depth/2||t.position.z-t.radius>this.z+this.depth/2)&&(t.dead=!0)}_bound(t){t.position.x-t.radius<this.x-this.width/2?(t.position.x=this.x-this.width/2+t.radius,t.velocity.x*=-this.friction,this._static(t,"x")):t.position.x+t.radius>this.x+this.width/2&&(t.position.x=this.x+this.width/2-t.radius,t.velocity.x*=-this.friction,this._static(t,"x")),t.position.y-t.radius<this.y-this.height/2?(t.position.y=this.y-this.height/2+t.radius,t.velocity.y*=-this.friction,this._static(t,"y")):t.position.y+t.radius>this.y+this.height/2&&(t.position.y=this.y+this.height/2-t.radius,t.velocity.y*=-this.friction,this._static(t,"y")),t.position.z-t.radius<this.z-this.depth/2?(t.position.z=this.z-this.depth/2+t.radius,t.velocity.z*=-this.friction,this._static(t,"z")):t.position.z+t.radius>this.z+this.depth/2&&(t.position.z=this.z+this.depth/2-t.radius,t.velocity.z*=-this.friction,this._static(t,"z"))}_static(t,e){t.velocity[e]*t.acceleration[e]>0||Math.abs(t.velocity[e])<.0167*Math.abs(t.acceleration[e])*this.max&&(t.velocity[e]=0,t.acceleration[e]=0)}_cross(t){t.position.x+t.radius<this.x-this.width/2&&t.velocity.x<=0?t.position.x=this.x+this.width/2+t.radius:t.position.x-t.radius>this.x+this.width/2&&t.velocity.x>=0&&(t.position.x=this.x-this.width/2-t.radius),t.position.y+t.radius<this.y-this.height/2&&t.velocity.y<=0?t.position.y=this.y+this.height/2+t.radius:t.position.y-t.radius>this.y+this.height/2&&t.velocity.y>=0&&(t.position.y=this.y-this.height/2-t.radius),t.position.z+t.radius<this.z-this.depth/2&&t.velocity.z<=0?t.position.z=this.z+this.depth/2+t.radius:t.position.z-t.radius>this.z+this.depth/2&&t.velocity.z>=0&&(t.position.z=this.z-this.depth/2-t.radius)}}class ie extends te{constructor(t,e,i,r,s,n){super("LineZone"),t instanceof Pt?(this.x1=t.x,this.y1=t.y,this.z1=t.z,this.x2=r.x,this.y2=r.y,this.z2=r.z):(this.x1=t,this.y1=e,this.z1=i,this.x2=r,this.y2=s,this.z2=n),this.supportsCrossing=!1}isLineZone(){return!0}getPosition(){return this.random=Math.random(),this.vector.x=this.x1+this.random*(this.x2-this.x1),this.vector.y=this.y1+this.random*(this.y2-this.y1),this.vector.z=this.z1+this.random*(this.z2-this.z1),this.vector}}class re extends te{constructor(t,e=1,i){if(super("MeshZone"),this.geometry=null,this.scale=e,this.supportsCrossing=!1,t.type&&"Geometry"===t.type&&(this.geometry=t),t.geometry&&(this.geometry=t.geometry),!this.geometry)throw new Error("MeshZone unable to set geometry from the supplied bounds");this.geometry.isBufferGeometry&&(this.geometry=(new i).fromBufferGeometry(this.geometry))}isMeshZone(){return!0}getPosition(){const t=this.geometry.vertices,e=t[t.length*Math.random()>>0];return this.vector.x=e.x*this.scale,this.vector.y=e.y*this.scale,this.vector.z=e.z*this.scale,this.vector}}class se extends te{constructor(t,e,i){var r;super("PointZone"),rt.isUndefined(t,e,i)?r=0:(r=t,e),this.x=r,this.y=r,this.z=r,this.supportsCrossing=!1}isPointZone(){return!0}getPosition(){return this.vector.x=this.x,this.vector.y=this.y,this.vector.z=this.z,this.vector}}class ne extends te{constructor(t,e,i,r){super("ScreenZone"),this.camera=t,this.renderer=e,this.dis=i||20,r=r||"1234";for(var s=1;s<5;s++)this["d"+s]=r.indexOf(s+"")>=0}isScreenZone(){return!0}_dead(t){var e=it.toScreenPos(t.position,this.camera,this.renderer.domElement),i=this.renderer.domElement;(e.y+t.radius<-this.dis&&this.d1||e.y-t.radius>i.height+this.dis&&this.d3)&&(t.dead=!0),(e.x+t.radius<-this.dis&&this.d4||e.x-t.radius>i.width+this.dis&&this.d2)&&(t.dead=!0)}_bound(t){var e=it.toScreenPos(t.position,this.camera,this.renderer.domElement),i=this.renderer.domElement;(e.y+t.radius<-this.dis||e.y-t.radius>i.height+this.dis)&&(t.velocity.y*=-1),(e.x+t.radius<-this.dis||e.x-t.radius>i.width+this.dis)&&(t.velocity.y*=-1)}}ne.prototype.getPosition=(Gt=new Pt,function(){return qt=this.renderer.domElement,Gt.x=Math.random()*qt.width,Gt.y=Math.random()*qt.height,this.vector.copy(it.toSpacePos(Gt,this.camera,qt)),this.vector}),ne.prototype._cross=function(){var t=new Pt;return function(e){var i=it.toScreenPos(e.position,this.camera,this.renderer.domElement),r=this.renderer.domElement;i.y+e.radius<-this.dis?(t.x=i.x,t.y=r.height+this.dis+e.radius,e.position.y=it.toSpacePos(t,this.camera,r).y):i.y-e.radius>r.height+this.dis&&(t.x=i.x,t.y=-this.dis-e.radius,e.position.y=it.toSpacePos(t,this.camera,r).y),i.x+e.radius<-this.dis?(t.y=i.y,t.x=r.width+this.dis+e.radius,e.position.x=it.toSpacePos(t,this.camera,r).x):i.x-e.radius>r.width+this.dis&&(t.y=i.y,t.x=-this.dis-e.radius,e.position.x=it.toSpacePos(t,this.camera,r).x)}}();class oe extends te{constructor(t,e,i,r){let s,n,o,a;super("SphereZone"),rt.isUndefined(e,i,r)?(s=n=o=0,a=t||100):(s=t,n=e,o=i,a=r),this.x=s,this.y=s,this.z=s,this.radius=a,this.the=this.phi=0}isSphereZone(){return!0}_dead(t){t.position.distanceTo(this)-t.radius>this.radius&&(t.dead=!0)}_cross(){console.warn(this.constructor.name+" does not support the _cross method")}}oe.prototype.getPosition=function(){return this.random=Math.random(),Jt=this.random*this.radius,Yt=a.d*Math.random(),Xt=2*a.d*Math.random(),this.vector.x=this.x+Jt*Math.sin(Yt)*Math.cos(Xt),this.vector.y=this.y+Jt*Math.sin(Xt)*Math.sin(Yt),this.vector.z=this.z+Jt*Math.cos(Yt),this.vector},oe.prototype._bound=(Ht=new Pt,Wt=new Pt,function(t){t.position.distanceTo(this)+t.radius>=this.radius&&(Ht.copy(t.position).sub(this).normalize(),Wt.copy(t.velocity),Qt=2*Wt.dot(Ht),t.velocity.sub(Ht.scalar(Qt)))});class ae extends At{constructor(){super("Position"),this.reset.apply(this,arguments)}reset(){this.zones?this.zones.length=0:this.zones=[],this.zones=this.zones.concat(Array.prototype.slice.call(arguments))}addZone(){this.zones=this.zones.concat(Array.prototype.slice.call(arguments))}static fromJSON(t){const{zoneType:e}=t,i=Kt()(t,["zoneType"]);if(!B.includes(e))throw new Error(`The zone type ${e} is invalid or not yet supported`);return new ae(new r[e](...Object.values(i)))}}ae.prototype.initialize=function(){let t;return function(e){t=this.zones[Math.random()*this.zones.length>>0],t.getPosition(),e.position.x=t.vector.x,e.position.y=t.vector.y,e.position.z=t.vector.z}}();class he extends At{constructor(t,e,i=!1,r=!0){super("Radius",r),this.radius=lt(t,e,i)}reset(t,e,i=!1){this.radius=lt(t,e,i)}initialize(t){t.radius=this.radius.getValue(),t.transform.oldRadius=t.radius}static fromJSON(t){const{width:e,height:i,center:r=!1,isEnabled:s=!0}=t;return new he(e,i,r,s)}}class ue extends At{constructor(t=1,e=1){super("Rate"),this.numPan=lt(t),this.timePan=lt(e),this.startTime=0,this.nextTime=0,this.init()}init(){this.startTime=0,this.nextTime=this.timePan.getValue()}getValue(t){return this.startTime+=t,this.startTime>=this.nextTime?(this.init(),1==this.numPan.b?this.numPan.getValue("Float")>.5?1:0:this.numPan.getValue("Int")):0}static fromJSON(t){const{particlesMin:e,particlesMax:i,perSecondMin:r,perSecondMax:s}=t;return new ue(new ct(e,i),new ct(r,s))}}function ce(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function le(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?ce(Object(i),!0).forEach((function(e){J()(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ce(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}class de extends At{constructor(t,e,i=Dt,r=!0){super("Texture",r);const{Sprite:s,SpriteMaterial:n}=t;this.materialProperties=ht(Dt,i),this.texture=e,this.material=new n(le(le({},{map:e}),this.materialProperties)),this.sprite=new s(this.material)}initialize(t){t.body=this.sprite}static fromJSON(t,e){const{loadedTexture:i,materialProperties:r=Bt,isEnabled:s=!0}=t;return new de(e,i,ht(Bt,(t=>{const{blending:e}=t;return le(le({},t),{},{blending:e?It[e]:It[Bt.blending]})})(r)),s)}}class pe extends At{constructor(t,e=!0){super(t,e),this.dirVec=new Pt(0,0,0)}normalize(t){return t*a.c}}pe.prototype.initialize=function(){var t,e=new Pt(0,0,1),i=new Pt(0,0,0);return function(r){return t=this.tha*Math.random(),this._useV&&this.dirVec.copy(this.dir).scalar(this.radiusPan.getValue()),ut.getNormal(this.dirVec,e),i.copy(this.dirVec).applyAxisAngle(e,t),i.applyAxisAngle(this.dirVec.normalize(),Math.random()*a.d*2),r.velocity.copy(i),this}}();class fe extends pe{constructor(t,e,i=!0){super("PolarVelocity",i),this.tha=e*a.a,this.dirVec=t.toVector3D(),this._useV=!1}static fromJSON(t){const{polarRadius:e,polarTheta:i,polarPhi:r,velocityTheta:s,isEnabled:n=!0}=t;return new fe(new Et(e,i,r),s,n)}}class ye extends pe{constructor(t,e,i,r=!0){super("RadialVelocity",r),this.radiusPan=lt(t),this.dir=e.clone().normalize(),this.tha=i*a.a,this._useV=!0}static fromJSON(t){const{radius:e,x:i,y:r,z:s,theta:n,isEnabled:o=!0}=t;return new ye(e,new Pt(i,r,s),n,o)}}class me extends pe{constructor(t,e,i=!0){super("VectorVelocity",i),this.radiusPan=lt(1),this.dir=t.clone(),this.tha=e*a.a,this._useV=!0}static fromJSON(t){const{x:e,y:i,z:r,theta:s,isEnabled:n=!0}=t;return new me(new Pt(e,i,r),s,n)}}const ge=new ue(1,.1);var xe=i(2),ve=i.n(xe);class be extends Ot{constructor(t){super(t),this.type="Emitter",this.particles=[],this.initializers=[],this.behaviours=[],this.emitterBehaviours=[],this.currentEmitTime=0,this.totalEmitTimes=-1,this.damping=.006,this.bindEmitter=!0,this.bindEmitterEvent=!1,this.rate=ge,this.isEmitting=!1,this.id="emitter-"+nt(),this.cID=0,this.name="Emitter",this.index=void 0,this.eventDispatcher=new St}dispatch(t,e=this){this.eventDispatcher.dispatchEvent(t,e)}setRate(t){return this.rate=t,this}setPosition(t={}){const{position:e}=this,{x:i=e.x,y:r=e.y,z:s=e.z}=t;return this.position.set(i,r,s),this}setRotation(t={}){const{rotation:e}=this,{x:i=e.x,y:r=e.y,z:s=e.z}=t;return this.rotation.set(i,r,s),this}emit(t=1/0,e=1/0){return this.currentEmitTime=0,this.totalEmitTimes=ve()(t)?t:1/0,this.life=1===t?t:ve()(e)?e:1/0,this.rate.init(),this.isEmitting=!0,this}experimental_emit(){const{isEmitting:t,totalEmitTimes:e,life:i}=this;return t||(this.currentEmitTime=0,e||this.setTotalEmitTimes(1/0),i||this.setLife(1/0),this.rate.init(),this.isEmitting=!0),this}setTotalEmitTimes(t=1/0){return this.totalEmitTimes=ve()(t)?t:1/0,this}setLife(t=1/0){return 1===this.totalEmitTimes?this.life=this.totalEmitTimes:this.life=ve()(t)?t:1/0,this}stopEmit(){this.totalEmitTimes=-1,this.currentEmitTime=0,this.isEmitting=!1}removeAllParticles(){let t=this.particles.length;for(;t--;)this.particles[t].dead=!0}addInitializer(t){return this.initializers.push(t),this}addInitializers(t){let e=t.length;for(;e--;)this.addInitializer(t[e]);return this}setInitializers(t){return this.initializers=t,this}removeInitializer(t){const e=this.initializers.indexOf(t);return e>-1&&this.initializers.splice(e,1),this}removeAllInitializers(){return rt.destroyArray(this.initializers),this}addBehaviour(t){return this.behaviours.push(t),this}addBehaviours(t){let e=t.length;for(;e--;)this.addBehaviour(t[e]);return this}setBehaviours(t){return this.behaviours=t,this}removeBehaviour(t){const e=this.behaviours.indexOf(t);return e>-1&&this.behaviours.splice(e,1),this}removeAllBehaviours(){return rt.destroyArray(this.behaviours),this}addEmitterBehaviour(t){return this.emitterBehaviours.push(t),t.initialize(this),this}addEmitterBehaviours(t){let e=t.length;for(;e--;)this.addEmitterBehaviour(t[e]);return this}setEmitterBehaviours(t){const e=t.length;this.emitterBehaviours=t;for(let t=0;t<e;t++)this.emitterBehaviours[t].initialize(this);return this}removeEmitterBehaviour(t){const e=this.emitterBehaviours.indexOf(t);return e>-1&&this.emitterBehaviours.splice(e,1),this}removeAllEmitterBehaviours(){return rt.destroyArray(this.emitterBehaviours),this}addOnEmitterDeadEventListener(t){return this.eventDispatcher.addEventListener(this.id+"_EMITTER_DEAD",()=>t()),this}createParticle(){const t=this.parent.pool.get(Ot),e=this.particles.length;return this.setupParticle(t,e),this.parent&&this.parent.dispatch("PARTICLE_CREATED",t),this.bindEmitterEvent&&this.dispatch("PARTICLE_CREATED",t),t}setupParticle(t,e){const{initializers:i,behaviours:r}=this;Lt.initialize(this,t,i),t.addBehaviours(r),t.parent=this,t.index=e,this.particles.push(t)}update(t){if(!this.isEmitting)return;this.age+=t,(this.dead||this.age>=this.life)&&this.destroy(),this.generate(t),this.integrate(t);let e=this.particles.length;for(;e--;){const t=this.particles[e];t.dead&&(this.parent&&this.parent.dispatch("PARTICLE_DEAD",t),this.bindEmitterEvent&&this.dispatch("PARTICLE_DEAD",t),this.parent.pool.expire(t.reset()),this.particles.splice(e,1))}this.updateEmitterBehaviours(t)}updateEmitterBehaviours(t){if(this.sleep)return;const e=this.emitterBehaviours.length;for(let i=0;i<e;i++)this.emitterBehaviours[i].applyBehaviour(this,t,i)}integrate(t){const e=this.parent?this.parent.integrationType:vt,i=1-this.damping;Mt(this,t,i,e);let r=this.particles.length;for(;r--;){const s=this.particles[r];s.update(t,r),Mt(s,t,i,e),this.parent&&this.parent.dispatch("PARTICLE_UPDATE",s),this.bindEmitterEvent&&this.dispatch("PARTICLE_UPDATE",s)}}generate(t){if(1!==this.totalEmitTimes){if(this.currentEmitTime+=t,this.currentEmitTime<this.totalEmitTimes){let e=this.rate.getValue(t);for(e>0&&(this.cID=e);e--;)this.createParticle()}}else{let t=this.rate.getValue(99999);for(t>0&&(this.cID=t);t--;)this.createParticle();this.totalEmitTimes=0}}destroy(){this.dead=!0,this.energy=0,this.totalEmitTimes=-1,0==this.particles.length&&(this.isEmitting=!1,this.removeAllInitializers(),this.removeAllBehaviours(),this.dispatch(this.id+"_EMITTER_DEAD"),this.parent&&this.parent.removeEmitter(this))}}const _e=u;class we{constructor(t=1/0,e=_e,i="Behaviour",r=!0){this.type=i,this.isEnabled=r,this.id="behaviour-"+nt(),this.life=t,this.easing=e,this.age=0,this.energy=1,this.dead=!1}reset(t=1/0,e=_e){this.life=t,this.easing=e||_e}set life(t){this._life=ve()(t)?t:1/0}get life(){return this._life}normalizeForce(t){return t.scalar(a.c)}normalizeValue(t){return t*a.c}initialize(t){}applyBehaviour(t,e,i){this.isEnabled&&this.mutate(t,e,i)}mutate(t,e,i){}energize(t,e){if(this.dead)return;if(this.age+=e,this.age>=this.life)return this.energy=0,void(this.dead=!0);const i=this.easing(t.age/t.life);this.energy=Math.max(1-i,0)}destroy(){}fromJSON(t){}}class ze extends we{constructor(t=1,e=null,i,r,s=!0){super(i,r,"Alpha",s),this.alphaA=t,this.alphaB=e,this.reset(t,e)}get same(){return this._same}set same(t){this._same=t}reset(t=1,e=null,i,r){this.same=null==e,this.alphaA=lt(t),this.alphaB=lt(e),i&&super.reset(i,r)}initialize(t){t.useAlpha=!0,t.transform.alphaA=this.alphaA.getValue(),t.transform.alphaB=this.same?t.transform.alphaA:this.alphaB.getValue()}mutate(t,e,i){this.energize(t,e,i),t.alpha=ut.lerp(t.transform.alphaA,t.transform.alphaB,this.energy),t.alpha<.002&&(t.alpha=0)}static fromJSON(t){const{alphaA:e,alphaB:i,life:r,easing:s,isEnabled:n=!0}=t;return new ze(e,i,r,j(s),n)}}class Me extends we{constructor(t=new Pt,e=100,i=1e3,r=1/0,s=_e,n=!0){super(r,s,"Attraction",n),this.targetPosition=t,this.radius=i,this.force=this.normalizeValue(e),this.radiusSq=this.radius*this.radius,this.attractionForce=new Pt,this.lengthSq=0}reset(t=new Pt,e=100,i=1e3,r,s){this.targetPosition=t,this.radius=i,this.force=this.normalizeValue(e),this.radiusSq=this.radius*this.radius,this.attractionForce=new Pt,this.lengthSq=0,r&&super.reset(r,s)}mutate(t,e,i){this.energize(t,e,i),this.attractionForce.copy(this.targetPosition),this.attractionForce.sub(t.position),this.lengthSq=this.attractionForce.lengthSq(),this.lengthSq>4e-6&&this.lengthSq<this.radiusSq&&(this.attractionForce.normalize(),this.attractionForce.scalar(1-this.lengthSq/this.radiusSq),this.attractionForce.scalar(this.force),t.acceleration.add(this.attractionForce))}static fromJSON(t){const{x:e,y:i,z:r,force:s,radius:n,life:o,easing:a,isEnabled:h=!0}=t;return new Me(new Pt(e,i,r),s,n,o,j(a),h)}}class Pe extends we{constructor(t,e,i,r,s,n=!0){super(r,s,"Collision",n),this.reset(t,e,i)}reset(t,e,i,r,s){this.emitter=t,this.useMass=e,this.onCollide=i,this.particles=[],this.delta=new Pt,r&&super.reset(r,s)}mutate(t,e,i){const r=this.emitter?this.emitter.particles.slice(i):this.particles.slice(i);let s,n,o,a,h,u,c=r.length;for(;c--;)s=r[c],s!=t&&(this.delta.copy(s.position).sub(t.position),n=this.delta.lengthSq(),a=t.radius+s.radius,n<=a*a&&(o=a-Math.sqrt(n),o+=.5,h=this._getAverageMass(t,s),u=this._getAverageMass(s,t),t.position.add(this.delta.clone().normalize().scalar(o*-h)),s.position.add(this.delta.normalize().scalar(o*u)),this.onCollide&&this.onCollide(t,s)))}_getAverageMass(t,e){return this.useMass?e.mass/(t.mass+e.mass):.5}fromJSON(t){}}class Ee extends we{constructor(t,e,i,r,s=!0){super(i,r,"Color",s),this.reset(t,e)}get same(){return this._same}set same(t){this._same=t}reset(t,e,i,r){this.same=null==e,this.colorA=gt(t),this.colorB=gt(e),i&&super.reset(i,r)}initialize(t){t.transform.colorA=Q.getRGB(this.colorA.getValue()),t.useColor=!0,t.transform.colorB=this.same?t.transform.colorA:Q.getRGB(this.colorB.getValue())}mutate(t,e,i){this.energize(t,e,i),this._same?(t.color.r=t.transform.colorA.r,t.color.g=t.transform.colorA.g,t.color.b=t.transform.colorA.b):(t.color.r=ut.lerp(t.transform.colorA.r,t.transform.colorB.r,this.energy),t.color.g=ut.lerp(t.transform.colorA.g,t.transform.colorB.g,this.energy),t.color.b=ut.lerp(t.transform.colorA.b,t.transform.colorB.b,this.energy))}static fromJSON(t){const{colorA:e,colorB:i,life:r,easing:s,isEnabled:n=!0}=t;return new Ee(e,i,r,j(s),n)}}class Oe extends we{constructor(t,e,i,r,s){super(i,r,"CrossZone",s),this.reset(t,e)}reset(t,e="dead",i,r){this.zone=t,this.zone.crossType=e,i&&super.reset(i,r)}mutate(t,e,i){this.energize(t,e,i),this.zone.crossing.call(this.zone,t)}static fromJSON(t){const{zoneType:e,zoneParams:i,crossType:s,life:n,easing:o,isEnabled:a=!0}=t,h=new r[e](...Object.values(i));return new Oe(h,s,n,j(o),a)}}class Te extends we{constructor(t,e,i,r,s,n=!0){super(r,s,"Force",n),this.reset(t,e,i)}reset(t,e,i){this.force=this.normalizeForce(new Pt(t,e,i)),this.force.id=Math.random()}mutate(t,e,i){this.energize(t,e,i),t.acceleration.add(this.force)}static fromJSON(t){const{fx:e,fy:i,fz:r,life:s,easing:n,isEnabled:o=!0}=t;return new Te(e,i,r,s,j(n),o)}}class Se extends Te{constructor(t,e,i,r=!0){super(0,-t,0,e,i,r),this.type="Gravity"}static fromJSON(t){const{gravity:e,life:i,easing:r,isEnabled:s=!0}=t;return new Se(e,i,j(r),s)}}class Ae extends we{constructor(t,e,i,r=.03,s,n,o=!0){super(s,n,"RandomDrift",o),this.reset(t,e,i,r),this.time=0}reset(t,e,i,r=.03,s,n){this.randomForce=this.normalizeForce(new Pt(t,e,i)),this.delayPan=lt(r),this.time=0,s&&super.reset(s,n)}mutate(t,e,i){if(this.energize(t,e,i),this.time+=e,this.time>=this.delayPan.getValue()){const e=ut.randomAToB(-this.randomForce.x,this.randomForce.x),i=ut.randomAToB(-this.randomForce.y,this.randomForce.y),r=ut.randomAToB(-this.randomForce.z,this.randomForce.z);t.acceleration.addValue(e,i,r),this.time=0}}static fromJSON(t){const{x:e,y:i,z:r,delay:s,life:n,easing:o,isEnabled:a=!0}=t;return new Ae(e,i,r,s,n,j(o),a)}}class Ce extends Me{constructor(t,e,i,r,s,n=!0){super(t,e,i,r,s,n),this.force*=-1,this.type="Repulsion"}reset(t,e,i,r,s){super.reset(t,e,i,r,s),this.force*=-1}static fromJSON(t){const{x:e,y:i,z:r,force:s,radius:n,life:o,easing:a,isEnabled:h=!0}=t;return new Ce(new Pt(e,i,r),s,n,o,j(a),h)}}class je extends we{constructor(t,e,i,r,s,n=!0){super(r,s,"Rotate",n),this.reset(t,e,i)}get rotationType(){return this._rotationType}set rotationType(t){this._rotationType=t}reset(t,e,i,r,s){this.x=t||0,this.y=e||0,this.z=i||0,void 0===t||"same"==t?this.rotationType="same":null==e?this.rotationType="set":void 0===i?this.rotationType="to":(this.rotationType="add",this.x=lt(this.x*a.a),this.y=lt(this.y*a.a),this.z=lt(this.z*a.a)),r&&super.reset(r,s)}initialize(t){switch(this.rotationType){case"same":break;case"set":this._setRotation(t.rotation,this.x);break;case"to":t.transform.fR=t.transform.fR||new Pt,t.transform.tR=t.transform.tR||new Pt,this._setRotation(t.transform.fR,this.x),this._setRotation(t.transform.tR,this.y);break;case"add":t.transform.addR=new Pt(this.x.getValue(),this.y.getValue(),this.z.getValue())}}_setRotation(t,e){if(t=t||new Pt,"random"==e){var i=ut.randomAToB(-a.d,a.d),r=ut.randomAToB(-a.d,a.d),s=ut.randomAToB(-a.d,a.d);t.set(i,r,s)}else e instanceof Pt&&t.copy(e)}mutate(t,e,i){switch(this.energize(t,e,i),this.rotationType){case"same":t.rotation||(t.rotation=new Pt),t.rotation.eulerFromDir(t.velocity);break;case"set":break;case"to":t.rotation.x=ut.lerp(t.transform.fR.x,t.transform.tR.x,this.energy),t.rotation.y=ut.lerp(t.transform.fR.y,t.transform.tR.y,this.energy),t.rotation.z=ut.lerp(t.transform.fR.z,t.transform.tR.z,this.energy);break;case"add":t.rotation.add(t.transform.addR)}}static fromJSON(t){const{x:e,y:i,z:r,life:s,easing:n,isEnabled:o=!0}=t;return new je(e,i,r,s,j(n),o)}}class Re extends we{constructor(t,e,i,r,s=!0){super(i,r,"Scale",s),this.reset(t,e)}get same(){return this._same}set same(t){this._same=t}reset(t,e,i,r){this.same=null==e,this.scaleA=lt(t||1),this.scaleB=lt(e),i&&super.reset(i,r)}initialize(t){t.transform.scaleA=this.scaleA.getValue(),t.transform.oldRadius=t.radius,t.transform.scaleB=this.same?t.transform.scaleA:this.scaleB.getValue()}mutate(t,e,i){this.energize(t,e,i),t.scale=ut.lerp(t.transform.scaleA,t.transform.scaleB,this.energy),t.scale<5e-4&&(t.scale=0),t.radius=t.transform.oldRadius*t.scale}static fromJSON(t){const{scaleA:e,scaleB:i,life:r,easing:s,isEnabled:n=!0}=t;return new Re(e,i,r,j(s),n)}}class Ie extends we{constructor(t,e,i,r,s,n,o,a=!0){super(n,o,"Spring",a),this.reset(t,e,i,r,s)}reset(t,e,i,r,s){this.pos?this.pos.set(t,e,i):this.pos=new Pt(t,e,i),this.spring=r||.1,this.friction=s||.98}mutate(t,e,i){this.energize(t,e,i),t.velocity.x+=(this.pos.x-t.position.x)*this.spring,t.velocity.y+=(this.pos.y-t.position.y)*this.spring,t.velocity.z+=(this.pos.z-t.position.z)*this.spring}static fromJSON(t){const{x:e,y:i,z:r,spring:s,friction:n,life:o,easing:a,isEnabled:h=!0}=t;return new Ie(e,i,r,s,n,o,j(a),h)}}const De=t=>{const e=[];return t.forEach(t=>{const{type:i,properties:r}=t;if(!D.includes(i))throw new Error(`The behaviour type ${i} is invalid or not yet supported`);e.push(n[i].fromJSON(r))}),e};var Be=(t,e,i,r)=>{const{preParticles:n=a.e,integrationType:h=a.b,emitters:u=[]}=t,c=new i(e,n,h);return u.forEach(t=>{const i=new r,{rate:n,rotation:a,initializers:h,behaviours:u,emitterBehaviours:l=[],position:d,totalEmitTimes:p=1/0,life:f=1/0}=t;i.setRate((t=>ue.fromJSON(t))(n)).setRotation(a).setInitializers(((t,e)=>{const i=[];return t.forEach(t=>{const{type:r,properties:n}=t;if(!I.includes(r))throw new Error(`The initializer type ${r} is invalid or not yet supported`);o.includes(r)?i.push(s[r].fromJSON(n,e)):i.push(s[r].fromJSON(n))}),i})(h,e)).setBehaviours(De(u)).setEmitterBehaviours(De(l)).setPosition(d).emit(p,f),c.addEmitter(i)}),c};function Ve(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function ke(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Ve(Object(i),!0).forEach((function(e){J()(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Ve(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}const Fe={shouldAutoEmit:!0},Ze=t=>new Promise((e,i)=>{if(!t.length)return e([]);const r=t.length,s=[];t.forEach(t=>{const{type:o,properties:a}=t;return D.includes(o)?(s.push(n[o].fromJSON(a)),s.length===r?e(s):void 0):i(`The behaviour type ${o} is invalid or not yet supported`)})}),Le=(t,e,i,r)=>new Promise((n,a)=>{if(!t.length)return n([]);const h=[],u=t.length;if(!u)return n(h);t.forEach(t=>{const c=new e,{rate:l,rotation:d,initializers:p,behaviours:f,emitterBehaviours:y=[],position:m,totalEmitTimes:g=1/0,life:x=1/0}=t;var v;c.setRate((v=l,ue.fromJSON(v))).setRotation(d).setPosition(m),((t,e)=>new Promise((i,r)=>{if(!t.length)return i([]);const n=t.length,a=[],h=t.filter(({properties:t})=>!t.texture),u=t.filter(({properties:t})=>t.texture);h.forEach(t=>{const{type:h,properties:u}=t;return I.includes(h)?(o.includes(h)?a.push(s[h].fromJSON(u,e)):a.push(s[h].fromJSON(u)),a.length===n?i(a):void 0):r(`The initializer type ${h} is invalid or not yet supported`)}),u.forEach(t=>{const{type:s,properties:o,properties:{texture:h}}=t,u=new e.TextureLoader;if(!I.includes(s))return r(`The initializer type ${s} is invalid or not yet supported`);u.load(h,t=>{if(a.push(de.fromJSON(ke(ke({},o),{},{loadedTexture:t}),e)),a.length===n)return i(a)},void 0,r)})}))(p,i).then(t=>(c.setInitializers(t),Ze(f))).then(t=>(c.setBehaviours(t),Ze(y))).then(t=>(c.setEmitterBehaviours(t),Promise.resolve(c))).then(t=>{if(h.push(r?t.emit(g,x):t.setTotalEmitTimes(g).setLife(x)),h.length===u)return n(h)}).catch(a)})});class Ue{constructor(t=a.e,e=vt){this.type="System",this.canUpdate=!0,this.preParticles=t,this.integrationType=e,this.emitters=[],this.renderers=[],this.pool=new Tt,this.eventDispatcher=new St}static fromJSON(t,e){return Be(t,e,Ue,be)}static fromJSONAsync(t,e,i){return((t,e,i,r,s={})=>new Promise((n,o)=>{const{preParticles:h=a.e,integrationType:u=a.b,emitters:c=[]}=t,l=new i(h,u),{shouldAutoEmit:d}=ke(ke({},Fe),s);Le(c,r,e,d).then(t=>{const e=t.length;if(!e)return n(l);t.forEach(t=>{l.addEmitter(t),l.emitters.length===e&&n(l)})}).catch(o)}))(t,e,Ue,be,i)}dispatch(t,e=this){this.eventDispatcher.dispatchEvent(t,e)}addRenderer(t){return this.renderers.push(t),t.init(this),this}removeRenderer(t){return this.renderers.splice(this.renderers.indexOf(t),1),t.remove(this),this}addEmitter(t){const e=this.emitters.length;return t.parent=this,t.index=e,this.emitters.push(t),this.dispatch("EMITTER_ADDED",t),this}removeEmitter(t){return t.parent!==this||(t.parent=null,t.index=void 0,this.emitters.splice(this.emitters.indexOf(t),1),this.dispatch("EMITTER_REMOVED",t)),this}emit({onStart:t,onUpdate:e,onEnd:i}){t&&t(),e&&this.eventDispatcher.addEventListener("SYSTEM_UPDATE",e);const r=this.emitters.map(t=>{const{life:e}=t;return e===1/0?(i&&i(),t.experimental_emit(),Promise.resolve()):new Promise(e=>{t.addOnEmitterDeadEventListener(()=>{i&&i(),e()}),t.experimental_emit()})});try{return Promise.all(r)}catch(t){console.warn(t)}}update(t=.0167){const e=t||.0167;if(this.canUpdate){if(e>0){let t=this.emitters.length;for(;t--;){const i=this.emitters[t];i.update(e),i.isEmitting&&this.dispatch("SYSTEM_UPDATE")}}this.dispatch("SYSTEM_UPDATE_AFTER")}return Promise.resolve()}getCount(){const t=this.emitters.length;let e,i=0;for(e=0;e<t;e++)i+=this.emitters[e].particles.length;return i}destroy(){const t=this.emitters.length;this.canUpdate=!1;for(let e=0;e<t;e++)this.emitters[e]&&this.emitters[e].destroy(),delete this.emitters[e];for(let e=0;e<t;e++)this.renderers[e]&&this.renderers[e].destroy&&(this.renderers[e].destroy(),delete this.renderers[e]);this.emitters.length=0,this.pool.destroy(),this.canUpdate=!0}}const Ne=15,qe=0;var Ge={addEventListener:function(t,e){return t.eventDispatcher.addEventListener("SYSTEM_UPDATE",e),this},drawZone:function(t,e,i,r={}){const{width:s=Ne,height:n=Ne,depth:o=Ne,radius:a=Ne,x:h=qe,y:u=qe,z:c=qe}=r;let l;r.isPointZone()&&(l=new t.SphereGeometry(15)),r.isLineZone(),r.isBoxZone()&&(l=new t.BoxGeometry(s,n,o)),r.isSphereZone()&&(l=new t.SphereGeometry(a,Ne,Ne)),r.isMeshZone()&&(l=r.geometry.geometry?r.geometry.geometry.clone():r.geometry.clone()),l||(l=new t.BoxGeometry(s,n,o));const d=new t.MeshBasicMaterial({color:"#2194ce",wireframe:!0}),p=new t.Mesh(l.clone(),d);i.add(p),this.addEventListener(e,(function(){p.position.set(h,u,c)}))},drawEmitter:function(t,e,i,r,s){const n=new t.OctahedronGeometry(Ne),o=new t.MeshBasicMaterial({color:s||"#aaa",wireframe:!0}),a=new t.Mesh(n.clone(),o);i.add(a),this.addEventListener(e,(function(){a.position.copy(r.position),a.rotation.set(r.rotation.x,r.rotation.y,r.rotation.z)}))},renderInfo:function(){function t(t,e){var i="material"==t?"_materialPool":"_targetPool";return e.renderers[0][i].cID}return function(e,i){this.addInfo(i);var r="";switch(this._infoType){case 2:r+="emitter:"+e.emitters.length+"<br>",r+="em speed:"+e.emitters[0].cID+"<br>",r+="pos:"+function(t){var e=t.emitters[0];return Math.round(e.p.x)+","+Math.round(e.p.y)+","+Math.round(e.p.z)}(e);break;case 3:r+=e.renderers[0].name+"<br>",r+="target:"+t("target")+"<br>",r+="material:"+t("material");break;default:r+="particles:"+e.getCount()+"<br>",r+="pool:"+e.pool.getCount()+"<br>",r+="total:"+(e.getCount()+e.pool.getCount())}this._infoCon.innerHTML=r}}(),addInfo:function(t){var e=this;if(!this._infoCon){var i,r;switch(this._infoCon=document.createElement("div"),this._infoCon.style.cssText=["position:fixed;bottom:0px;left:0;cursor:pointer;","opacity:0.9;z-index:10000;padding:10px;font-size:12px;","width:120px;height:50px;background-color:#002;color:#0ff;"].join(""),this._infoType=1,this._infoCon.addEventListener("click",(function(){e._infoType++,e._infoType>3&&(e._infoType=1)}),!1),t){case 2:i="#201",r="#f08";break;case 3:i="#020",r="#0f0";break;default:i="#002",r="#0ff"}this._infoCon.style["background-color"]=i,this._infoCon.style.color=r}this._infoCon.parentNode||document.body.appendChild(this._infoCon)}},Ye=function(){let t=0;if(window.console&&window.console.trace){var e=Array.prototype.slice.call(arguments),i=arguments[0]+"";if(0==i.indexOf("+")){var r=parseInt(arguments[0]);t<r&&(e.shift(),console.trace.apply(console,e),t++)}else e.unshift("+15"),this.apply(console,e)}};class Xe extends be{constructor(t,e,i){super(i),this.type="FollowEmitter",this.mouseTarget=rt.initValue(t,window),this.ease=rt.initValue(e,.7),this._allowEmitting=!1,this.initEventHandler()}initEventHandler(){var t=this;this.mousemoveHandler=function(e){t.mousemove.call(t,e)},this.mousedownHandler=function(e){t.mousedown.call(t,e)},this.mouseupHandler=function(e){t.mouseup.call(t,e)},this.mouseTarget.addEventListener("mousemove",this.mousemoveHandler,!1)}emit(){this._allowEmitting=!0}stopEmit(){this._allowEmitting=!1}setCameraAndCanvas(t,e){this.camera=t,this.canvas=e}mousemove(t){t.layerX||0==t.layerX?(this.position.x+=(t.layerX-this.position.x)*this.ease,this.position.y+=(t.layerY-this.position.y)*this.ease):(t.offsetX||0==t.offsetX)&&(this.position.x+=(t.offsetX-this.position.x)*this.ease,this.position.y+=(t.offsetY-this.position.y)*this.ease),this.position.copy(it.toSpacePos(this.position,this.camera,this.canvas)),this._allowEmitting&&super.emit("once")}destroy(){super.destroy(),this.mouseTarget.removeEventListener("mousemove",this.mousemoveHandler,!1)}}class Je{constructor(t="BaseRenderer"){this.type=t}init(t){var e=this;this.system=t,this.system.eventDispatcher.addEventListener("SYSTEM_UPDATE",(function(t){e.onSystemUpdate.call(e,t)})),this.system.eventDispatcher.addEventListener("PARTICLE_CREATED",(function(t){e.onParticleCreated.call(e,t)})),this.system.eventDispatcher.addEventListener("PARTICLE_UPDATE",(function(t){e.onParticleUpdate.call(e,t)})),this.system.eventDispatcher.addEventListener("PARTICLE_DEAD",(function(t){e.onParticleDead.call(e,t)})),this.logRendererType()}remove(){this.system=null}onParticleCreated(t){}onParticleUpdate(t){}onParticleDead(t){}onSystemUpdate(t){}logRendererType(){a.f&&console.log(""+this.type)}}class Qe extends Je{constructor(){super("CustomRenderer"),this.targetPool=new Tt,this.materialPool=new Tt}onSystemUpdate(){}onParticleCreated(t){}onParticleUpdate(t){}onParticleDead(t){}}class He extends Je{constructor(t,e){super("MeshRenderer"),this.container=t,this._targetPool=new Tt,this._materialPool=new Tt,this._body=new e.Mesh(new e.BoxGeometry(50,50,50),new e.MeshLambertMaterial({color:"#ff0000"}))}isThreeSprite(t){return t.target.isSprite}onSystemUpdate(){}onParticleCreated(t){t.target||(t.body||(t.body=this._body),t.target=this._targetPool.get(t.body),(t.useAlpha||t.useColor)&&(t.target.material.__puid=H.id(t.body.material),t.target.material=this._materialPool.get(t.target.material))),t.target&&(t.target.position.copy(t.position),this.container.add(t.target))}onParticleUpdate(t){const{target:e,useAlpha:i,useColor:r,rotation:s}=t;e&&(e.position.copy(t.position),this.isThreeSprite(t)||e.rotation.set(s.x,s.y,s.z),this.scale(t),i&&(e.material.opacity=t.alpha,e.material.transparent=!0),r&&e.material.color.copy(t.color))}scale(t){t.target.scale.set(t.scale,t.scale,t.scale)}onParticleDead(t){t.target&&((t.useAlpha||t.useColor)&&this._materialPool.expire(t.target.material),this._targetPool.expire(t.target),this.container.remove(t.target),t.target=null)}}class We extends He{constructor(t,e){super(t,e),this.type="SpriteRenderer",this._body=new e.Sprite(new e.SpriteMaterial({color:16777215}))}scale(t){t.target.scale.set(t.scale*t.radius,t.scale*t.radius,1)}}const $e=["x","y","z"].length,Ke=["r","g","b","a"].length,ti=[4*$e,4,4*Ke].reduce((t,e)=>t+e),ei=1,ii=1,ri=2,si={position:$e,size:ei,color:Ke,alpha:ii,texID:ri},ni=([$e,ei,Ke,ii,ri].reduce((t,e)=>t+e),{blending:"AdditiveBlending",baseColor:16777215,depthTest:!0,depthWrite:!1,transparent:!0,maxParticles:1e4,shouldDebugTextureAtlas:!1,shouldForceDesktopRenderer:!1,shouldForceMobileRenderer:!1});class oi{constructor(t){this.position=new t.Vector3,this.size=0,this.color=new t.Color,this.alpha=0,this.texture=null,this.index=0}reset(){this.position.set(0,0,0),this.size=0,this.color.setRGB(0,0,0),this.alpha=0,this.texture=null}}class ai{constructor(t=1/0){this.max=t,this.count=0,this._items={}}add(t){void 0===this._items[t]&&(this._items[t]=this.count++)}find(t){return this._items[t]}destroy(){this._items={},this.count=0}}let hi;class ui{constructor(t=1e4,e){hi=e,this.maxParticles=t,this.createInterleavedBuffer().createBufferGeometry()}createInterleavedBuffer(){const t=new ArrayBuffer(this.maxParticles*ti);return this.interleavedBuffer=new hi.InterleavedBuffer(new Float32Array(t),ti),this}createBufferGeometry(){this.geometry=new hi.BufferGeometry;const{interleavedBuffer:t,geometry:e}=this;return Object.keys(si).reduce((i,r)=>{const s=si[r];return e.setAttribute(r,new hi.InterleavedBufferAttribute(t,s,i)),i+s},0),this}get buffer(){return this.interleavedBuffer}get stride(){return ti}}class ci{constructor(t,e){const{three:i,type:r}=t,s=new Float32Array(1024),n=this.ctx=document.createElement("canvas").getContext("2d"),{canvas:o}=n;this.shouldDebug=e,this.rendererType=r,this.indexData=s,this.canvas=o,this.entries=[],"DesktopGPURenderer"===r&&(this.atlasIndex=new i.DataTexture(s,256,1,i.RGBAFormat,i.FloatType)),o.width=o.height=256,e&&this.debug(o,n),this.atlasTexture=new i.CanvasTexture(o),this.atlasTexture.flipY=!1,t.material.uniforms.uTexture.value=this.atlasTexture,"DesktopGPURenderer"===r&&(t.material.uniforms.atlasIndex.value=this.atlasIndex),t.material.uniformsNeedUpdate=!0}log(...t){a.f&&console.log(...t)}debug(){const{canvas:t,ctx:e}=this,i=t.width;e.fillStyle="purple",e.fillRect(0,0,i,i),e.fillStyle="green",e.fillRect(0,i,i,i),e.fillStyle="blue",e.fillRect(i,0,i,i),e.fillStyle="orange",e.fillRect(i,i,i,i),e.fillStyle="yellow",e.font=t.width+"px Verdana",e.fillText("top row",100,500),e.fillStyle="pink",e.fillText("bottom row",100,1500),t.style.position="absolute",t.style.width=t.style.height="300px",t.style.left=t.style.top="0px",t.style.zIndex=100,document.body.appendChild(t)}addTexture(t){this.log("Adding texture to atlas:",t.uuid),t.textureIndex=this.entries.length,this.entries.push({texture:t}),this.needsUpdate=!0}update(){if(!this.needsUpdate)return;const{entries:t,canvas:e,indexData:i,ctx:r,atlasIndex:s,atlasTexture:n,rendererType:o}=this;for(let e=0;e<t.length;e++)if(!t[e].texture.image)return;this.needsUpdate=!1;for(let e=0;e<t.length;e++){const i=t[e],{texture:r}=i,{width:s,height:n}=r.image;i.w=s,i.h=n}const a=function(t){let e=0,i=0;for(const r of t)e+=r.w*r.h,i=Math.max(i,r.w);t.sort((t,e)=>e.h-t.h);const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let s=0,n=0;for(const e of t)for(let t=r.length-1;t>=0;t--){const i=r[t];if(!(e.w>i.w||e.h>i.h)){if(e.x=i.x,e.y=i.y,n=Math.max(n,e.y+e.h),s=Math.max(s,e.x+e.w),e.w===i.w&&e.h===i.h){const e=r.pop();t<r.length&&(r[t]=e)}else e.h===i.h?(i.x+=e.w,i.w-=e.w):e.w===i.w?(i.y+=e.h,i.h-=e.h):(r.push({x:i.x+e.w,y:i.y,w:i.w-e.w,h:e.h}),i.y+=e.h,i.h-=e.h);break}}return{w:s,h:n,fill:e/(s*n)||0}}(t);this.log("Rebuilt atlas:",a),e.width==a.w&&e.height==a.h||(e.width=a.w,e.height=a.h);for(let s=0;s<t.length;s++){const t=this.entries[s],n=4*t.texture.textureIndex;"DesktopGPURenderer"===o&&(i[n+0]=t.x/e.width,i[n+1]=t.y/e.height,i[n+2]=(t.x+t.w)/e.width,i[n+3]=(t.y+t.h)/e.height),"MobileGPURenderer"===o&&(i[n+0]=t.x/(e.width+1),i[n+1]=t.y/(e.height+1),i[n+2]=(t.x+t.w)/(e.width+1),i[n+3]=(t.y+t.h)/(e.height+1)),r.drawImage(t.texture.image,t.x,t.y,t.w,t.h)}"DesktopGPURenderer"===o&&(s.needsUpdate=!0),n.needsUpdate=!0}destroy(){const{atlasIndex:t,atlasTexture:e,canvas:i}=this;e.dispose(),t&&t.dispose(),this.shouldDebug&&i.remove(),this.entries=[]}}function li(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function di(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?li(Object(i),!0).forEach((function(e){J()(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):li(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}let pi;class fi extends Je{constructor(t,e,i=ni){super("DesktopGPURenderer"),pi=this.three=e;const r=di(di({},ni),i),{camera:s,maxParticles:n,baseColor:o,blending:a,depthTest:h,depthWrite:u,transparent:c,shouldDebugTextureAtlas:l}=r,d=new ui(n,pi),p=new pi.ShaderMaterial({uniforms:{baseColor:{value:new pi.Color(o)},uTexture:{value:null},atlasIndex:{value:null}},vertexShader:"\n uniform sampler2D uTexture;\n //atlasIndex is a 256x1 float texture of tile rectangles as r=minx g=miny b=maxx a=maxy\n uniform sampler2D atlasIndex;\n\n attribute float size;\n attribute vec3 color;\n attribute float alpha;\n attribute float texID;\n\n varying vec3 targetColor;\n varying float targetAlpha;\n varying vec4 tileRect;\n varying float tileID;\n\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n targetColor = color;\n targetAlpha = alpha;\n\n tileID = texID;\n //get the tile rectangle from the atlasIndex texture..\n tileRect = texture2D(atlasIndex, vec2((tileID + 0.5) / 256.0, 0.5));\n\n gl_PointSize = ((size * 600.0) / -mvPosition.z);\n gl_Position = projectionMatrix * mvPosition;\n }\n",fragmentShader:"\n uniform vec3 baseColor;\n uniform sampler2D uTexture;\n uniform sampler2D atlasIndex;\n\n varying vec3 targetColor;\n varying float targetAlpha;\n varying vec4 tileRect;\n varying float tileID;\n\n void main() {\n gl_FragColor = vec4(baseColor * targetColor, targetAlpha);\n\n vec2 uv = gl_PointCoord;\n uv = mix(tileRect.xy, tileRect.zw, gl_PointCoord);\n\n gl_FragColor = gl_FragColor * texture2D(uTexture, uv);\n\n }\n",blending:pi[a],depthTest:h,depthWrite:u,transparent:c});this.container=t,this.camera=s,this.targetPool=new Tt,this.uniqueList=new ai(n),this.particleBuffer=d,this.buffer=d.buffer,this.stride=d.stride,this.geometry=d.geometry,this.material=p,this.points=new pi.Points(this.geometry,this.material),this.points.frustumCulled=!1,this.shouldDebugTextureAtlas=l,this.container.add(this.points)}onSystemUpdate(t){super.onSystemUpdate(t),this.buffer.needsUpdate=!0,this.textureAtlas&&this.textureAtlas.update()}onParticleCreated(t){t.target||(t.target=this.targetPool.get(oi,pi),this.uniqueList.add(t.id)),this.updateTarget(t).mapParticleTargetPropsToPoint(t)}onParticleUpdate(t){t.target&&this.updateTarget(t).mapParticleTargetPropsToPoint(t)}onParticleDead(t){t.target&&(t.target.reset(),this.mapParticleTargetPropsToPoint(t),t.target=null)}updateTarget(t){const{position:e,scale:i,radius:r,color:s,alpha:n,body:o,id:a}=t,{r:h,g:u,b:c}=s;if(t.target.position.copy(e),t.target.size=i*r,t.target.color.setRGB(h,u,c),t.target.alpha=n,t.target.index=this.uniqueList.find(a),o&&o instanceof pi.Sprite){const{map:e}=o.material;t.target.texture=e,t.target.textureIndex=this.getTextureID(e,this.shouldDebugTextureAtlas)}return this}mapParticleTargetPropsToPoint(t){return this.updatePointPosition(t).updatePointSize(t).updatePointColor(t).updatePointAlpha(t).updatePointTextureIndex(t),this}updatePointPosition(t){const{geometry:e,stride:i,buffer:r}=this,{target:s}=t,{offset:n}=e.attributes.position;return r.array[s.index*i+n+0]=s.position.x,r.array[s.index*i+n+1]=s.position.y,r.array[s.index*i+n+2]=s.position.z,this}updatePointSize(t){const{geometry:e,stride:i,buffer:r}=this,{target:s}=t,{offset:n}=e.attributes.size;return r.array[s.index*i+n+0]=s.size,this}updatePointColor(t){const{geometry:e,stride:i,buffer:r}=this,{target:s}=t,{offset:n}=e.attributes.color;return r.array[s.index*i+n+0]=s.color.r,r.array[s.index*i+n+1]=s.color.g,r.array[s.index*i+n+2]=s.color.b,this}updatePointAlpha(t){const{geometry:e,stride:i,buffer:r}=this,{target:s}=t,{offset:n}=e.attributes.alpha;return r.array[s.index*i+n+0]=s.alpha,this}updatePointTextureIndex(t){const{geometry:e,stride:i,buffer:r}=this,{target:s}=t,{offset:n}=e.attributes.texID;return r.array[s.index*i+n+0]=s.textureIndex,this}getTextureID(t,e){return void 0===t.textureIndex&&(this.textureAtlas||(this.textureAtlas=new ci(this,e)),this.textureAtlas.addTexture(t)),t.textureIndex}destroy(){const{container:t,points:e,textureAtlas:i,uniqueList:r}=this;t.remove(e),r.destroy(),i&&i.destroy()}}function yi(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,r)}return i}function mi(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?yi(Object(i),!0).forEach((function(e){J()(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):yi(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}let gi;class xi extends Je{constructor(t,e,i=ni){super("MobileGPURenderer"),gi=this.three=e;const r=mi(mi({},ni),i),{camera:s,maxParticles:n,baseColor:o,blending:a,depthTest:h,depthWrite:u,transparent:c,shouldDebugTextureAtlas:l}=r,d=new ui(n,gi),p=new gi.ShaderMaterial({uniforms:{baseColor:{value:new gi.Color(o)},uTexture:{value:null},FFatlasIndex:{value:null},atlasDim:{value:new gi.Vector2}},vertexShader:"\n uniform sampler2D uTexture;\n uniform vec2 atlasDim;\n\n attribute float size;\n attribute vec3 color;\n attribute float alpha;\n attribute vec2 texID;\n\n varying vec3 targetColor;\n varying float targetAlpha;\n varying vec4 tileRect;\n\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n targetColor = color;\n targetAlpha = alpha;\n\n vec2 tmin = floor(texID) / atlasDim;\n vec2 tmax = fract(texID);\n tileRect = vec4(tmin,tmax);\n\n gl_PointSize = ((size * 600.0) / -mvPosition.z);\n gl_Position = projectionMatrix * mvPosition;\n }\n",fragmentShader:"\n uniform vec3 baseColor;\n uniform sampler2D uTexture;\n\n varying vec3 targetColor;\n varying float targetAlpha;\n varying vec4 tileRect;\n\n void main() {\n gl_FragColor = vec4(baseColor * targetColor, targetAlpha);\n\n vec2 uv = gl_PointCoord;\n uv = mix(tileRect.xy, tileRect.zw, gl_PointCoord);\n\n gl_FragColor = gl_FragColor * texture2D(uTexture, uv);\n }\n",blending:gi[a],depthTest:h,depthWrite:u,transparent:c});this.camera=s,this.targetPool=new Tt,this.uniqueList=new ai(n),this.particleBuffer=d,this.buffer=d.buffer,this.stride=d.stride,this.geometry=d.geometry,this.material=p,this.points=new gi.Points(this.geometry,this.material),this.points.frustumCulled=!1,this.shouldDebugTextureAtlas=l,t.add(this.points)}onSystemUpdate(t){super.onSystemUpdate(t),this.buffer.needsUpdate=!0;const{textureAtlas:e}=this;e&&(e.update(),this.material.uniforms.atlasDim.value.set(e.atlasTexture.image.width,e.atlasTexture.image.height))}onParticleCreated(t){t.target||(t.target=this.targetPool.get(oi,gi),this.uniqueList.add(t.id)),this.updateTarget(t).mapParticleTargetPropsToPoint(t)}onParticleUpdate(t){t.target&&this.updateTarget(t).mapParticleTargetPropsToPoint(t)}onParticleDead(t){t.target&&(t.target.reset(),this.mapParticleTargetPropsToPoint(t),t.target=null)}updateTarget(t){const{position:e,scale:i,radius:r,color:s,alpha:n,body:o,id:a}=t,{r:h,g:u,b:c}=s;if(t.target.position.copy(e),t.target.size=i*r,t.target.color.setRGB(h,u,c),t.target.alpha=n,t.target.index=this.uniqueList.find(a),o&&o instanceof gi.Sprite){const{map:e}=o.material;t.target.texture=e,t.target.textureIndex=this.getTextureID(e,this.shouldDebugTextureAtlas)}return this}mapParticleTargetPropsToPoint(t){return this.updatePointPosition(t).updatePointSize(t).updatePointColor(t).updatePointAlpha(t).updatePointTextureIndex(t),this}updatePointPosition(t){const{geometry:e,stride:i,buffer:r}=this,{target:s}=t,{offset:n}=e.attributes.position;return r.array[s.index*i+n+0]=s.position.x,r.array[s.index*i+n+1]=s.position.y,r.array[s.index*i+n+2]=s.position.z,this}updatePointSize(t){const{geometry:e,stride:i,buffer:r}=this,{target:s}=t,{offset:n}=e.attributes.size;return r.array[s.index*i+n+0]=s.size,this}updatePointColor(t){const{geometry:e,stride:i,buffer:r}=this,{target:s}=t,{offset:n}=e.attributes.color;return r.array[s.index*i+n+0]=s.color.r,r.array[s.index*i+n+1]=s.color.g,r.array[s.index*i+n+2]=s.color.b,this}updatePointAlpha(t){const{geometry:e,stride:i,buffer:r}=this,{target:s}=t,{offset:n}=e.attributes.alpha;return r.array[s.index*i+n+0]=s.alpha,this}updatePointTextureIndex(t){const{geometry:e,stride:i,buffer:r}=this,{target:s}=t,{offset:n}=e.attributes.texID,o=s.index*i+n+0;{let t=4*s.textureIndex;const e=this.textureAtlas,i=e.indexData,n=i[t++],a=i[t++],h=i[t++],u=i[t++];r.array[o]=(n*e.atlasTexture.image.width|0)+h,r.array[o+1]=(a*e.atlasTexture.image.height|0)+u}return this}getTextureID(t,e){return void 0===t.textureIndex&&(this.textureAtlas||(this.textureAtlas=new ci(this,e)),this.textureAtlas.addTexture(t)),t.textureIndex}destroy(){const{container:t,points:e,textureAtlas:i,uniqueList:r}=this;t.remove(e),r.destroy(),i&&i.destroy()}}class vi extends Je{constructor(t,e,i=ni){super("GPURenderer");const{shouldForceDesktopRenderer:r,shouldForceMobileRenderer:s}=i,n=[t,e,i];return r?new fi(...n):s?new xi(...n):this.isFloatingPointTextureSupported()?new fi(...n):new xi(...n)}isFloatingPointTextureSupported(){const t=document.createElement("canvas");if(window.WebGL2RenderingContext&&t.getContext("webgl2"))return!0;const e=!!t.getContext("webgl").getExtension("OES_texture_float");return t.remove(),e}}e.default=Ue}])}));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Nebula=e():t.Nebula=e()}(this,function(){return(()=>{var t={705:(t,e,i)=>{var s=i(639).Symbol;t.exports=s},636:(t,e,i)=>{var s=i(545),r=i(694),n=i(469),o=i(144),a=i(776),h=i(719),c=Object.prototype.hasOwnProperty;t.exports=function(t,e){var i=n(t),u=!i&&r(t),l=!i&&!u&&o(t),d=!i&&!u&&!l&&h(t),p=i||u||l||d,y=p?s(t.length,String):[],f=y.length;for(var m in t)!e&&!c.call(t,m)||p&&("length"==m||l&&("offset"==m||"parent"==m)||d&&("buffer"==m||"byteLength"==m||"byteOffset"==m)||a(m,f))||y.push(m);return y}},932:t=>{t.exports=function(t,e){for(var i=-1,s=null==t?0:t.length,r=Array(s);++i<s;)r[i]=e(t[i],i,t);return r}},311:(t,e,i)=>{var s=i(877);t.exports=function(t){var e=t.length;return e?t[s(0,e-1)]:void 0}},239:(t,e,i)=>{var s=i(705),r=i(607),n=i(333),o=s?s.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":o&&o in Object(t)?r(t):n(t)}},454:(t,e,i)=>{var s=i(239),r=i(5);t.exports=function(t){return r(t)&&"[object Arguments]"==s(t)}},749:(t,e,i)=>{var s=i(239),r=i(780),n=i(5),o={};o["[object Float32Array]"]=o["[object Float64Array]"]=o["[object Int8Array]"]=o["[object Int16Array]"]=o["[object Int32Array]"]=o["[object Uint8Array]"]=o["[object Uint8ClampedArray]"]=o["[object Uint16Array]"]=o["[object Uint32Array]"]=!0,o["[object Arguments]"]=o["[object Array]"]=o["[object ArrayBuffer]"]=o["[object Boolean]"]=o["[object DataView]"]=o["[object Date]"]=o["[object Error]"]=o["[object Function]"]=o["[object Map]"]=o["[object Number]"]=o["[object Object]"]=o["[object RegExp]"]=o["[object Set]"]=o["[object String]"]=o["[object WeakMap]"]=!1,t.exports=function(t){return n(t)&&r(t.length)&&!!o[s(t)]}},280:(t,e,i)=>{var s=i(726),r=i(916),n=Object.prototype.hasOwnProperty;t.exports=function(t){if(!s(t))return r(t);var e=[];for(var i in Object(t))n.call(t,i)&&"constructor"!=i&&e.push(i);return e}},877:t=>{var e=Math.floor,i=Math.random;t.exports=function(t,s){return t+e(i()*(s-t+1))}},992:(t,e,i)=>{var s=i(311),r=i(628);t.exports=function(t){return s(r(t))}},545:t=>{t.exports=function(t,e){for(var i=-1,s=Array(t);++i<t;)s[i]=e(i);return s}},518:t=>{t.exports=function(t){return function(e){return t(e)}}},415:(t,e,i)=>{var s=i(932);t.exports=function(t,e){return s(e,function(e){return t[e]})}},957:(t,e,i)=>{var s="object"==typeof i.g&&i.g&&i.g.Object===Object&&i.g;t.exports=s},607:(t,e,i)=>{var s=i(705),r=Object.prototype,n=r.hasOwnProperty,o=r.toString,a=s?s.toStringTag:void 0;t.exports=function(t){var e=n.call(t,a),i=t[a];try{t[a]=void 0;var s=!0}catch(t){}var r=o.call(t);return s&&(e?t[a]=i:delete t[a]),r}},776:t=>{var e=/^(?:0|[1-9]\d*)$/;t.exports=function(t,i){var s=typeof t;return!!(i=null==i?9007199254740991:i)&&("number"==s||"symbol"!=s&&e.test(t))&&t>-1&&t%1==0&&t<i}},726:t=>{var e=Object.prototype;t.exports=function(t){var i=t&&t.constructor;return t===("function"==typeof i&&i.prototype||e)}},916:(t,e,i)=>{var s=i(569)(Object.keys,Object);t.exports=s},167:(t,e,i)=>{t=i.nmd(t);var s=i(957),r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r&&s.process,a=function(){try{return n&&n.require&&n.require("util").types||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=a},333:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},569:t=>{t.exports=function(t,e){return function(i){return t(e(i))}}},639:(t,e,i)=>{var s=i(957),r="object"==typeof self&&self&&self.Object===Object&&self,n=s||r||Function("return this")();t.exports=n},694:(t,e,i)=>{var s=i(454),r=i(5),n=Object.prototype,o=n.hasOwnProperty,a=n.propertyIsEnumerable,h=s(function(){return arguments}())?s:function(t){return r(t)&&o.call(t,"callee")&&!a.call(t,"callee")};t.exports=h},469:t=>{var e=Array.isArray;t.exports=e},612:(t,e,i)=>{var s=i(560),r=i(780);t.exports=function(t){return null!=t&&r(t.length)&&!s(t)}},144:(t,e,i)=>{t=i.nmd(t);var s=i(639),r=i(62),n=e&&!e.nodeType&&e,o=n&&t&&!t.nodeType&&t,a=o&&o.exports===n?s.Buffer:void 0,h=(a?a.isBuffer:void 0)||r;t.exports=h},560:(t,e,i)=>{var s=i(239),r=i(218);t.exports=function(t){if(!r(t))return!1;var e=s(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},780:t=>{t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},763:(t,e,i)=>{var s=i(239),r=i(5);t.exports=function(t){return"number"==typeof t||r(t)&&"[object Number]"==s(t)}},218:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},5:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},719:(t,e,i)=>{var s=i(749),r=i(518),n=i(167),o=n&&n.isTypedArray,a=o?r(o):s;t.exports=a},674:(t,e,i)=>{var s=i(636),r=i(280),n=i(612);t.exports=function(t){return n(t)?s(t):r(t)}},534:(t,e,i)=>{var s=i(311),r=i(992),n=i(469);t.exports=function(t){return(n(t)?s:r)(t)}},62:t=>{t.exports=function(){return!1}},628:(t,e,i)=>{var s=i(415),r=i(674);t.exports=function(t){return null==t?[]:s(t,r(t))}}},e={};function i(s){var r=e[s];if(void 0!==r)return r.exports;var n=e[s]={id:s,loaded:!1,exports:{}};return t[s](n,n.exports,i),n.loaded=!0,n.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var s={};return(()=>{"use strict";i.r(s),i.d(s,{Alpha:()=>mi,ArraySpan:()=>ie,Attraction:()=>gi,Behaviour:()=>fi,Body:()=>ze,BodySprite:()=>Ae,Box:()=>oe,BoxZone:()=>Ve,Collision:()=>xi,Color:()=>vi,ColorSpan:()=>re,ColorUtil:()=>wt,CrossZone:()=>bi,CustomRenderer:()=>Zi,Debug:()=>Di,Emitter:()=>di,FollowEmitter:()=>Fi,Force:()=>_i,GPURenderer:()=>ds,Gravity:()=>wi,INTEGRATION_TYPE_EULER:()=>ae,INTEGRATION_TYPE_RK2:()=>he,INTEGRATION_TYPE_RK4:()=>ce,INTEGRATION_TYPE_VERLET:()=>ue,InitializerUtil:()=>Re,Life:()=>Ie,LineZone:()=>Fe,Mass:()=>Be,MathUtils:()=>Ht,MeshRenderer:()=>Ui,MeshZone:()=>ke,PUID:()=>zt,Particle:()=>ye,PointZone:()=>Ze,Polar3D:()=>pe,PolarVelocity:()=>oi,Pool:()=>fe,Position:()=>We,RadialVelocity:()=>ai,Radius:()=>ti,RandomDrift:()=>zi,Rate:()=>ei,Repulsion:()=>Mi,Rotate:()=>Pi,Rotation:()=>Ke,Scale:()=>Oi,ScreenZone:()=>Ue,Span:()=>Wt,SphereZone:()=>$e,Spring:()=>Ei,SpriteRenderer:()=>Ni,System:()=>Ri,THREEUtil:()=>kt,Texture:()=>ri,Util:()=>Zt,Vector3D:()=>de,VectorVelocity:()=>hi,createArraySpan:()=>se,createColorSpan:()=>ne,createSpan:()=>Kt,default:()=>ps,ease:()=>Z,easeInBack:()=>ot,easeInCirc:()=>st,easeInCubic:()=>Y,easeInExpo:()=>tt,easeInOutBack:()=>ht,easeInOutCirc:()=>nt,easeInOutCubic:()=>X,easeInOutExpo:()=>it,easeInOutQuad:()=>q,easeInOutQuart:()=>$,easeInOutSine:()=>K,easeInQuad:()=>N,easeInQuart:()=>J,easeInSine:()=>H,easeLinear:()=>U,easeOutBack:()=>at,easeOutCirc:()=>rt,easeOutCubic:()=>G,easeOutExpo:()=>et,easeOutQuad:()=>L,easeOutQuart:()=>Q,easeOutSine:()=>W,getEasingByName:()=>ut,integrate:()=>le,log:()=>Vi,setEasingByName:()=>ct,uid:()=>Xt,withDefaults:()=>$t});var t={};i.r(t),i.d(t,{BoxZone:()=>Ve,LineZone:()=>Fe,MeshZone:()=>ke,PointZone:()=>Ze,ScreenZone:()=>Ue,SphereZone:()=>$e});var e={};i.r(e),i.d(e,{Body:()=>ze,BodySprite:()=>Ae,InitializerUtil:()=>Re,Life:()=>Ie,Mass:()=>Be,PolarVelocity:()=>oi,Position:()=>We,RadialVelocity:()=>ai,Radius:()=>ti,Rate:()=>ei,Rotation:()=>Ke,Texture:()=>ri,VectorVelocity:()=>hi});var r={};i.r(r),i.d(r,{Alpha:()=>mi,Attraction:()=>gi,Behaviour:()=>fi,Collision:()=>xi,Color:()=>vi,CrossZone:()=>bi,Force:()=>_i,Gravity:()=>wi,RandomDrift:()=>zi,Repulsion:()=>Mi,Rotate:()=>Pi,Scale:()=>Oi,Spring:()=>Ei});const n="Alpha",o="Attraction",a="Color",h="CrossZone",c="Force",u="Gravity",l="RandomDrift",d="Repulsion",p="Rotate",y="Scale",f="Spring",m="Body",g="BodySprite",x="Texture",v="Life",b="Mass",_="Position",w="Rotation",z="Radius",M="VectorVelocity",P="PolarVelocity",O="RadialVelocity",E=[g,x],T="BoxZone",S="LineZone",C="MeshZone",A="PointZone",j="SphereZone",R="MobileGPURenderer",I="DesktopGPURenderer",B=3.142,D=500,V=B/180,F="euler",k=()=>!!process&&(process.env,!1),Z={easeLinear:function(t){return t},easeInQuad:function(t){return Math.pow(t,2)},easeOutQuad:function(t){return-(Math.pow(t-1,2)-1)},easeInOutQuad:function(t){return(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2)},easeInCubic:function(t){return Math.pow(t,3)},easeOutCubic:function(t){return Math.pow(t-1,3)+1},easeInOutCubic:function(t){return(t/=.5)<1?.5*Math.pow(t,3):.5*(Math.pow(t-2,3)+2)},easeInQuart:function(t){return Math.pow(t,4)},easeOutQuart:function(t){return-(Math.pow(t-1,4)-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*Math.pow(t,4):-.5*((t-=2)*Math.pow(t,3)-2)},easeInSine:function(t){return 1-Math.cos(t*(B/2))},easeOutSine:function(t){return Math.sin(t*(B/2))},easeInOutSine:function(t){return-.5*(Math.cos(B*t)-1)},easeInExpo:function(t){return 0===t?0:Math.pow(2,10*(t-1))},easeOutExpo:function(t){return 1===t?1:1-Math.pow(2,-10*t)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*--t))},easeInCirc:function(t){return-(Math.sqrt(1-t*t)-1)},easeOutCirc:function(t){return Math.sqrt(1-Math.pow(t-1,2))},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInBack:function(t){var e=1.70158;return t*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack:function(t){var e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)}},{easeLinear:U,easeInQuad:N,easeOutQuad:L,easeInOutQuad:q,easeInCubic:Y,easeOutCubic:G,easeInOutCubic:X,easeInQuart:J,easeOutQuart:Q,easeInOutQuart:$,easeInSine:H,easeOutSine:W,easeInOutSine:K,easeInExpo:tt,easeOutExpo:et,easeInOutExpo:it,easeInCirc:st,easeOutCirc:rt,easeInOutCirc:nt,easeInBack:ot,easeOutBack:at,easeInOutBack:ht}=Z,ct=t=>Z[t]?Z[t]:Z.easeLinear,ut=t=>Z[t]?Z[t]:Z.easeLinear,lt=1/0,dt=!1,pt=!1,yt=!1,ft=!1,mt=U,gt=.0167,xt=[_,w,v,z,b,m,g,x,P,O,M],vt=[n,o,a,h,c,u,l,d,p,y,f],bt=[T,S,C,A,j];function _t(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}const wt={getRGB:function(t){var e={};if("number"==typeof t)s=Math.floor(t),e.r=(t>>16&255)/255,e.g=(t>>8&255)/255,e.b=(255&t)/255;else if("string"==typeof t){var i;if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(t))e.r=Math.min(255,parseInt(i[1],10))/255,e.g=Math.min(255,parseInt(i[2],10))/255,e.b=Math.min(255,parseInt(i[3],10))/255;else if(i=/^\#([A-Fa-f0-9]+)$/.exec(t)){var s=i[1];e.r=parseInt(s.charAt(0)+s.charAt(1),16)/255,e.g=parseInt(s.charAt(2)+s.charAt(3),16)/255,e.b=parseInt(s.charAt(4)+s.charAt(5),16)/255}}else e.r=t.r,e.g=t.g,e.b=t.b;return e}},zt={_id:0,_uids:new Map,getNewId:function(){return"PUID_"+ ++this._id},id:function(t){if(this._uids.has(t))return this._uids.get(t);const e=this.getNewId();return this._uids.set(t,e),e}};var Mt,Pt,Ot,Et,Tt,St,Ct,At,jt,Rt,It={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){for(var t=[],e=0;e<256;e++)t[e]=(e<16?"0":"")+e.toString(16);return function(){var e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,s=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(t[255&e]+t[e>>8&255]+t[e>>16&255]+t[e>>24&255]+"-"+t[255&i]+t[i>>8&255]+"-"+t[i>>16&15|64]+t[i>>24&255]+"-"+t[63&s|128]+t[s>>8&255]+"-"+t[s>>16&255]+t[s>>24&255]+t[255&r]+t[r>>8&255]+t[r>>16&255]+t[r>>24&255]).toUpperCase()}}(),clamp:function(t,e,i){return Math.max(e,Math.min(i,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,i,s,r){return s+(t-e)*(r-s)/(i-e)},lerp:function(t,e,i){return(1-i)*t+i*e},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*It.DEG2RAD},radToDeg:function(t){return t*It.RAD2DEG},isPowerOfTwo:function(t){return!(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}};function Bt(t,e,i,s){this._x=t||0,this._y=e||0,this._z=i||0,this._w=void 0!==s?s:1}function Dt(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0}function Vt(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function Ft(t,e,i,s){this._x=t||0,this._y=e||0,this._z=i||0,this._order=s||Ft.DefaultOrder}Object.assign(Bt,{slerp:function(t,e,i,s){return i.copy(t).slerp(e,s)},slerpFlat:function(t,e,i,s,r,n,o){var a=i[s+0],h=i[s+1],c=i[s+2],u=i[s+3],l=r[n+0],d=r[n+1],p=r[n+2],y=r[n+3];if(u!==y||a!==l||h!==d||c!==p){var f=1-o,m=a*l+h*d+c*p+u*y,g=m>=0?1:-1,x=1-m*m;if(x>Number.EPSILON){var v=Math.sqrt(x),b=Math.atan2(v,m*g);f=Math.sin(f*b)/v,o=Math.sin(o*b)/v}var _=o*g;if(a=a*f+l*_,h=h*f+d*_,c=c*f+p*_,u=u*f+y*_,f===1-o){var w=1/Math.sqrt(a*a+h*h+c*c+u*u);a*=w,h*=w,c*=w,u*=w}}t[e]=a,t[e+1]=h,t[e+2]=c,t[e+3]=u}}),Object.defineProperties(Bt.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}}),Object.assign(Bt.prototype,{isQuaternion:!0,set:function(t,e,i,s){return this._x=t,this._y=e,this._z=i,this._w=s,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=t._x,s=t._y,r=t._z,n=t.order,o=Math.cos,a=Math.sin,h=o(i/2),c=o(s/2),u=o(r/2),l=a(i/2),d=a(s/2),p=a(r/2);return"XYZ"===n?(this._x=l*c*u+h*d*p,this._y=h*d*u-l*c*p,this._z=h*c*p+l*d*u,this._w=h*c*u-l*d*p):"YXZ"===n?(this._x=l*c*u+h*d*p,this._y=h*d*u-l*c*p,this._z=h*c*p-l*d*u,this._w=h*c*u+l*d*p):"ZXY"===n?(this._x=l*c*u-h*d*p,this._y=h*d*u+l*c*p,this._z=h*c*p+l*d*u,this._w=h*c*u-l*d*p):"ZYX"===n?(this._x=l*c*u-h*d*p,this._y=h*d*u+l*c*p,this._z=h*c*p-l*d*u,this._w=h*c*u+l*d*p):"YZX"===n?(this._x=l*c*u+h*d*p,this._y=h*d*u+l*c*p,this._z=h*c*p-l*d*u,this._w=h*c*u-l*d*p):"XZY"===n&&(this._x=l*c*u-h*d*p,this._y=h*d*u-l*c*p,this._z=h*c*p+l*d*u,this._w=h*c*u+l*d*p),!1!==e&&this._onChangeCallback(),this},setFromAxisAngle:function(t,e){var i=e/2,s=Math.sin(i);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(i),this._onChangeCallback(),this},setFromRotationMatrix:function(t){var e,i=t.elements,s=i[0],r=i[4],n=i[8],o=i[1],a=i[5],h=i[9],c=i[2],u=i[6],l=i[10],d=s+a+l;return d>0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(u-h)*e,this._y=(n-c)*e,this._z=(o-r)*e):s>a&&s>l?(e=2*Math.sqrt(1+s-a-l),this._w=(u-h)/e,this._x=.25*e,this._y=(r+o)/e,this._z=(n+c)/e):a>l?(e=2*Math.sqrt(1+a-s-l),this._w=(n-c)/e,this._x=(r+o)/e,this._y=.25*e,this._z=(h+u)/e):(e=2*Math.sqrt(1+l-s-a),this._w=(o-r)/e,this._x=(n+c)/e,this._y=(h+u)/e,this._z=.25*e),this._onChangeCallback(),this},setFromUnitVectors:function(t,e){var i=t.dot(e)+1;return i<1e-6?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()},angleTo:function(t){return 2*Math.acos(Math.abs(It.clamp(this.dot(t),-1,1)))},rotateTowards:function(t,e){var i=this.angleTo(t);if(0===i)return this;var s=Math.min(1,e/i);return this.slerp(t,s),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var i=t._x,s=t._y,r=t._z,n=t._w,o=e._x,a=e._y,h=e._z,c=e._w;return this._x=i*c+n*o+s*h-r*a,this._y=s*c+n*a+r*o-i*h,this._z=r*c+n*h+i*a-s*o,this._w=n*c-i*o-s*a-r*h,this._onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this._x,s=this._y,r=this._z,n=this._w,o=n*t._w+i*t._x+s*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=n,this._x=i,this._y=s,this._z=r,this;var a=1-o*o;if(a<=Number.EPSILON){var h=1-e;return this._w=h*n+e*this._w,this._x=h*i+e*this._x,this._y=h*s+e*this._y,this._z=h*r+e*this._z,this.normalize(),this._onChangeCallback(),this}var c=Math.sqrt(a),u=Math.atan2(c,o),l=Math.sin((1-e)*u)/c,d=Math.sin(e*u)/c;return this._w=n*l+this._w*d,this._x=i*l+this._x*d,this._y=s*l+this._y*d,this._z=r*l+this._z*d,this._onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},_onChange:function(t){return this._onChangeCallback=t,this},_onChangeCallback:function(){}}),Object.assign(Dt.prototype,{isVector3:!0,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:(Mt=new Bt,function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Mt.setFromEuler(t))}),applyAxisAngle:function(){var t=new Bt;return function(e,i){return this.applyQuaternion(t.setFromAxisAngle(e,i))}}(),applyMatrix3:function(t){var e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*s,this.y=r[1]*e+r[4]*i+r[7]*s,this.z=r[2]*e+r[5]*i+r[8]*s,this},applyMatrix4:function(t){var e=this.x,i=this.y,s=this.z,r=t.elements,n=1/(r[3]*e+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*s+r[12])*n,this.y=(r[1]*e+r[5]*i+r[9]*s+r[13])*n,this.z=(r[2]*e+r[6]*i+r[10]*s+r[14])*n,this},applyQuaternion:function(t){var e=this.x,i=this.y,s=this.z,r=t.x,n=t.y,o=t.z,a=t.w,h=a*e+n*s-o*i,c=a*i+o*e-r*s,u=a*s+r*i-n*e,l=-r*e-n*i-o*s;return this.x=h*a+l*-r+c*-o-u*-n,this.y=c*a+l*-n+u*-r-h*-o,this.z=u*a+l*-o+h*-n-c*-r,this},project:function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},unproject:function(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)},transformDirection:function(t){var e=this.x,i=this.y,s=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*s,this.y=r[1]*e+r[5]*i+r[9]*s,this.z=r[2]*e+r[6]*i+r[10]*s,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},clampLength:function(t,e){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,i){return this.subVectors(e,t).multiplyScalar(i).add(t)},cross:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)},crossVectors:function(t,e){var i=t.x,s=t.y,r=t.z,n=e.x,o=e.y,a=e.z;return this.x=s*a-r*o,this.y=r*n-i*a,this.z=i*o-s*n,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:(Rt=new Dt,function(t){return Rt.copy(this).projectOnVector(t),this.sub(Rt)}),reflect:function(){var t=new Dt;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(It.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return e*e+i*i+s*s},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},setFromSphericalCoords:function(t,e,i){var s=Math.sin(e)*t;return this.x=s*Math.sin(i),this.y=Math.cos(e)*t,this.z=s*Math.cos(i),this},setFromCylindrical:function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},setFromCylindricalCoords:function(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=s,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(Vt.prototype,{isMatrix4:!0,set:function(t,e,i,s,r,n,o,a,h,c,u,l,d,p,y,f){var m=this.elements;return m[0]=t,m[4]=e,m[8]=i,m[12]=s,m[1]=r,m[5]=n,m[9]=o,m[13]=a,m[2]=h,m[6]=c,m[10]=u,m[14]=l,m[3]=d,m[7]=p,m[11]=y,m[15]=f,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new Vt).fromArray(this.elements)},copy:function(t){var e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this},copyPosition:function(t){var e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this},extractBasis:function(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this},extractRotation:function(){var t=new Dt;return function(e){var i=this.elements,s=e.elements,r=1/t.setFromMatrixColumn(e,0).length(),n=1/t.setFromMatrixColumn(e,1).length(),o=1/t.setFromMatrixColumn(e,2).length();return i[0]=s[0]*r,i[1]=s[1]*r,i[2]=s[2]*r,i[3]=0,i[4]=s[4]*n,i[5]=s[5]*n,i[6]=s[6]*n,i[7]=0,i[8]=s[8]*o,i[9]=s[9]*o,i[10]=s[10]*o,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,this}}(),makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,i=t.x,s=t.y,r=t.z,n=Math.cos(i),o=Math.sin(i),a=Math.cos(s),h=Math.sin(s),c=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){var l=n*c,d=n*u,p=o*c,y=o*u;e[0]=a*c,e[4]=-a*u,e[8]=h,e[1]=d+p*h,e[5]=l-y*h,e[9]=-o*a,e[2]=y-l*h,e[6]=p+d*h,e[10]=n*a}else if("YXZ"===t.order){var f=a*c,m=a*u,g=h*c,x=h*u;e[0]=f+x*o,e[4]=g*o-m,e[8]=n*h,e[1]=n*u,e[5]=n*c,e[9]=-o,e[2]=m*o-g,e[6]=x+f*o,e[10]=n*a}else if("ZXY"===t.order)f=a*c,m=a*u,g=h*c,x=h*u,e[0]=f-x*o,e[4]=-n*u,e[8]=g+m*o,e[1]=m+g*o,e[5]=n*c,e[9]=x-f*o,e[2]=-n*h,e[6]=o,e[10]=n*a;else if("ZYX"===t.order)l=n*c,d=n*u,p=o*c,y=o*u,e[0]=a*c,e[4]=p*h-d,e[8]=l*h+y,e[1]=a*u,e[5]=y*h+l,e[9]=d*h-p,e[2]=-h,e[6]=o*a,e[10]=n*a;else if("YZX"===t.order){var v=n*a,b=n*h,_=o*a,w=o*h;e[0]=a*c,e[4]=w-v*u,e[8]=_*u+b,e[1]=u,e[5]=n*c,e[9]=-o*c,e[2]=-h*c,e[6]=b*u+_,e[10]=v-w*u}else"XZY"===t.order&&(v=n*a,b=n*h,_=o*a,w=o*h,e[0]=a*c,e[4]=-u,e[8]=h*c,e[1]=v*u+w,e[5]=n*c,e[9]=b*u-_,e[2]=_*u-b,e[6]=o*c,e[10]=w*u+v);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:(Ct=new Dt(0,0,0),At=new Dt(1,1,1),function(t){return this.compose(Ct,t,At)}),lookAt:(Et=new Dt,Tt=new Dt,St=new Dt,function(t,e,i){var s=this.elements;return St.subVectors(t,e),0===St.lengthSq()&&(St.z=1),St.normalize(),Et.crossVectors(i,St),0===Et.lengthSq()&&(1===Math.abs(i.z)?St.x+=1e-4:St.z+=1e-4,St.normalize(),Et.crossVectors(i,St)),Et.normalize(),Tt.crossVectors(St,Et),s[0]=Et.x,s[4]=Tt.x,s[8]=St.x,s[1]=Et.y,s[5]=Tt.y,s[9]=St.y,s[2]=Et.z,s[6]=Tt.z,s[10]=St.z,this}),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var i=t.elements,s=e.elements,r=this.elements,n=i[0],o=i[4],a=i[8],h=i[12],c=i[1],u=i[5],l=i[9],d=i[13],p=i[2],y=i[6],f=i[10],m=i[14],g=i[3],x=i[7],v=i[11],b=i[15],_=s[0],w=s[4],z=s[8],M=s[12],P=s[1],O=s[5],E=s[9],T=s[13],S=s[2],C=s[6],A=s[10],j=s[14],R=s[3],I=s[7],B=s[11],D=s[15];return r[0]=n*_+o*P+a*S+h*R,r[4]=n*w+o*O+a*C+h*I,r[8]=n*z+o*E+a*A+h*B,r[12]=n*M+o*T+a*j+h*D,r[1]=c*_+u*P+l*S+d*R,r[5]=c*w+u*O+l*C+d*I,r[9]=c*z+u*E+l*A+d*B,r[13]=c*M+u*T+l*j+d*D,r[2]=p*_+y*P+f*S+m*R,r[6]=p*w+y*O+f*C+m*I,r[10]=p*z+y*E+f*A+m*B,r[14]=p*M+y*T+f*j+m*D,r[3]=g*_+x*P+v*S+b*R,r[7]=g*w+x*O+v*C+b*I,r[11]=g*z+x*E+v*A+b*B,r[15]=g*M+x*T+v*j+b*D,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new Dt;return function(e){for(var i=0,s=e.count;i<s;i++)t.x=e.getX(i),t.y=e.getY(i),t.z=e.getZ(i),t.applyMatrix4(this),e.setXYZ(i,t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],i=t[4],s=t[8],r=t[12],n=t[1],o=t[5],a=t[9],h=t[13],c=t[2],u=t[6],l=t[10],d=t[14];return t[3]*(+r*a*u-s*h*u-r*o*l+i*h*l+s*o*d-i*a*d)+t[7]*(+e*a*d-e*h*l+r*n*l-s*n*d+s*h*c-r*a*c)+t[11]*(+e*h*u-e*o*d-r*n*u+i*n*d+r*o*c-i*h*c)+t[15]*(-s*o*c-e*a*u+e*o*l+s*n*u-i*n*l+i*a*c)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(t,e,i){var s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=i),this},getInverse:function(t,e){var i=this.elements,s=t.elements,r=s[0],n=s[1],o=s[2],a=s[3],h=s[4],c=s[5],u=s[6],l=s[7],d=s[8],p=s[9],y=s[10],f=s[11],m=s[12],g=s[13],x=s[14],v=s[15],b=p*x*l-g*y*l+g*u*f-c*x*f-p*u*v+c*y*v,_=m*y*l-d*x*l-m*u*f+h*x*f+d*u*v-h*y*v,w=d*g*l-m*p*l+m*c*f-h*g*f-d*c*v+h*p*v,z=m*p*u-d*g*u-m*c*y+h*g*y+d*c*x-h*p*x,M=r*b+n*_+o*w+a*z;if(0===M){var P="THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0";if(!0===e)throw new Error(P);return console.warn(P),this.identity()}var O=1/M;return i[0]=b*O,i[1]=(g*y*a-p*x*a-g*o*f+n*x*f+p*o*v-n*y*v)*O,i[2]=(c*x*a-g*u*a+g*o*l-n*x*l-c*o*v+n*u*v)*O,i[3]=(p*u*a-c*y*a-p*o*l+n*y*l+c*o*f-n*u*f)*O,i[4]=_*O,i[5]=(d*x*a-m*y*a+m*o*f-r*x*f-d*o*v+r*y*v)*O,i[6]=(m*u*a-h*x*a-m*o*l+r*x*l+h*o*v-r*u*v)*O,i[7]=(h*y*a-d*u*a+d*o*l-r*y*l-h*o*f+r*u*f)*O,i[8]=w*O,i[9]=(m*p*a-d*g*a-m*n*f+r*g*f+d*n*v-r*p*v)*O,i[10]=(h*g*a-m*c*a+m*n*l-r*g*l-h*n*v+r*c*v)*O,i[11]=(d*c*a-h*p*a-d*n*l+r*p*l+h*n*f-r*c*f)*O,i[12]=z*O,i[13]=(d*g*o-m*p*o+m*n*y-r*g*y-d*n*x+r*p*x)*O,i[14]=(m*c*o-h*g*o-m*n*u+r*g*u+h*n*x-r*c*x)*O,i[15]=(h*p*o-d*c*o+d*n*u-r*p*u-h*n*y+r*c*y)*O,this},scale:function(t){var e=this.elements,i=t.x,s=t.y,r=t.z;return e[0]*=i,e[4]*=s,e[8]*=r,e[1]*=i,e[5]*=s,e[9]*=r,e[2]*=i,e[6]*=s,e[10]*=r,e[3]*=i,e[7]*=s,e[11]*=r,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,s))},makeTranslation:function(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var i=Math.cos(e),s=Math.sin(e),r=1-i,n=t.x,o=t.y,a=t.z,h=r*n,c=r*o;return this.set(h*n+i,h*o-s*a,h*a+s*o,0,h*o+s*a,c*o+i,c*a-s*n,0,h*a-s*o,c*a+s*n,r*a*a+i,0,0,0,0,1),this},makeScale:function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this},makeShear:function(t,e,i){return this.set(1,e,i,0,t,1,i,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,i){var s=this.elements,r=e._x,n=e._y,o=e._z,a=e._w,h=r+r,c=n+n,u=o+o,l=r*h,d=r*c,p=r*u,y=n*c,f=n*u,m=o*u,g=a*h,x=a*c,v=a*u,b=i.x,_=i.y,w=i.z;return s[0]=(1-(y+m))*b,s[1]=(d+v)*b,s[2]=(p-x)*b,s[3]=0,s[4]=(d-v)*_,s[5]=(1-(l+m))*_,s[6]=(f+g)*_,s[7]=0,s[8]=(p+x)*w,s[9]=(f-g)*w,s[10]=(1-(l+y))*w,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this},decompose:(Pt=new Dt,Ot=new Vt,function(t,e,i){var s=this.elements,r=Pt.set(s[0],s[1],s[2]).length(),n=Pt.set(s[4],s[5],s[6]).length(),o=Pt.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),t.x=s[12],t.y=s[13],t.z=s[14],Ot.copy(this);var a=1/r,h=1/n,c=1/o;return Ot.elements[0]*=a,Ot.elements[1]*=a,Ot.elements[2]*=a,Ot.elements[4]*=h,Ot.elements[5]*=h,Ot.elements[6]*=h,Ot.elements[8]*=c,Ot.elements[9]*=c,Ot.elements[10]*=c,e.setFromRotationMatrix(Ot),i.x=r,i.y=n,i.z=o,this}),makePerspective:function(t,e,i,s,r,n){void 0===n&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,a=2*r/(e-t),h=2*r/(i-s),c=(e+t)/(e-t),u=(i+s)/(i-s),l=-(n+r)/(n-r),d=-2*n*r/(n-r);return o[0]=a,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=h,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=l,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(t,e,i,s,r,n){var o=this.elements,a=1/(e-t),h=1/(i-s),c=1/(n-r),u=(e+t)*a,l=(i+s)*h,d=(n+r)*c;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*h,o[9]=0,o[13]=-l,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(t){for(var e=this.elements,i=t.elements,s=0;s<16;s++)if(e[s]!==i[s])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[i+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}),Ft.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],Ft.DefaultOrder="XYZ",Object.defineProperties(Ft.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this._onChangeCallback()}}}),Object.assign(Ft.prototype,{isEuler:!0,set:function(t,e,i,s){return this._x=t,this._y=e,this._z=i,this._order=s||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this},setFromRotationMatrix:function(t,e,i){var s=It.clamp,r=t.elements,n=r[0],o=r[4],a=r[8],h=r[1],c=r[5],u=r[9],l=r[2],d=r[6],p=r[10];return"XYZ"===(e=e||this._order)?(this._y=Math.asin(s(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,n)):(this._x=Math.atan2(d,c),this._z=0)):"YXZ"===e?(this._x=Math.asin(-s(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(a,p),this._z=Math.atan2(h,c)):(this._y=Math.atan2(-l,n),this._z=0)):"ZXY"===e?(this._x=Math.asin(s(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-l,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(h,n))):"ZYX"===e?(this._y=Math.asin(-s(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(d,p),this._z=Math.atan2(h,n)):(this._x=0,this._z=Math.atan2(-o,c))):"YZX"===e?(this._z=Math.asin(s(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-l,n)):(this._x=0,this._y=Math.atan2(a,p))):"XZY"===e?(this._z=Math.asin(-s(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,n)):(this._x=Math.atan2(-u,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==i&&this._onChangeCallback(),this},setFromQuaternion:function(){var t=new Vt;return function(e,i,s){return t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,i,s)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:(jt=new Bt,function(t){return jt.setFromEuler(this),this.setFromQuaternion(jt,t)}),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new Dt(this._x,this._y,this._z)},_onChange:function(t){return this._onChangeCallback=t,this},_onChangeCallback:function(){}});const kt={toScreenPos:function(){var t=new Dt;return function(e,i,s){return t.copy(e),t.project(i),t.x=Math.round((t.x+1)*s.width/2),t.y=Math.round((1-t.y)*s.height/2),t.z=0,t}}(),toSpacePos:function(){var t,e=new Dt,i=new Dt;return function(s,r,n){return e.set(s.x/n.width*2-1,-s.y/n.height*2+1,.5),e.unproject(r),i.copy(e.sub(r.position).normalize()),t=-r.position.z/i.z,e.copy(r.position),e.add(i.multiplyScalar(t)),e}}()},Zt={initValue:function(t,e){return null!=t&&null!=t?t:e},isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},destroyArray:function(t){t.length=0},destroyObject:function(t){for(var e in t)delete t[e]},isUndefined:function(){for(var t in arguments)if(void 0!==arguments[t])return!1;return!0},setVectorByObj:function(t,e){void 0!==e.x&&(t.position.x=e.x),void 0!==e.y&&(t.position.y=e.y),void 0!==e.z&&(t.position.z=e.z),void 0!==e.vx&&(t.velocity.x=e.vx),void 0!==e.vy&&(t.velocity.y=e.vy),void 0!==e.vz&&(t.velocity.z=e.vz),void 0!==e.ax&&(t.acceleration.x=e.ax),void 0!==e.ay&&(t.acceleration.y=e.ay),void 0!==e.az&&(t.acceleration.z=e.az),void 0!==e.p&&t.position.copy(e.p),void 0!==e.v&&t.velocity.copy(e.v),void 0!==e.a&&t.acceleration.copy(e.a),void 0!==e.position&&t.position.copy(e.position),void 0!==e.velocity&&t.velocity.copy(e.velocity),void 0!==e.accelerate&&t.acceleration.copy(e.accelerate)},setPrototypeByObj:function(t,e,i){for(var s in e)t.hasOwnProperty(s)&&(i?i.indexOf(s)<0&&(t[s]=this._getValue(e[s])):t[s]=this._getValue(e[s]));return t},_getValue:function(t){return"Span"===t.constructor.type?t.getValue():t}};let Ut;const Nt=new Uint8Array(16);function Lt(){if(!Ut){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ut=crypto.getRandomValues.bind(crypto)}return Ut(Nt)}const qt=[];for(let t=0;t<256;++t)qt.push((t+256).toString(16).slice(1));const Yt={};function Gt(t,e,i,s,r,n,o=0){if(t.length<16)throw new Error("Random bytes length must be >= 16");if(n){if(o<0||o+16>n.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`)}else n=new Uint8Array(16),o=0;e??=Date.now(),i??=0,s??=16383&(t[8]<<8|t[9]),r??=t.slice(10,16);const a=(1e4*(268435455&(e+=122192928e5))+i)%4294967296;n[o++]=a>>>24&255,n[o++]=a>>>16&255,n[o++]=a>>>8&255,n[o++]=255&a;const h=e/4294967296*1e4&268435455;n[o++]=h>>>8&255,n[o++]=255&h,n[o++]=h>>>24&15|16,n[o++]=h>>>16&255,n[o++]=s>>>8|128,n[o++]=255&s;for(let t=0;t<6;++t)n[o++]=r[t];return n}const Xt=function(t,e,i){let s;const r=t?._v6??!1;if(t){const e=Object.keys(t);1===e.length&&"_v6"===e[0]&&(t=void 0)}if(t)s=Gt(t.random??t.rng?.()??Lt(),t.msecs,t.nsecs,t.clockseq,t.node,e,i);else{const t=Date.now(),n=Lt();!function(t,e,i){t.msecs??=-1/0,t.nsecs??=0,e===t.msecs?(t.nsecs++,t.nsecs>=1e4&&(t.node=void 0,t.nsecs=0)):e>t.msecs?t.nsecs=0:e<t.msecs&&(t.node=void 0),t.node||(t.node=i.slice(10,16),t.node[0]|=1,t.clockseq=16383&(i[8]<<8|i[9])),t.msecs=e}(Yt,t,n),s=Gt(n,Yt.msecs,Yt.nsecs,r?void 0:Yt.clockseq,r?void 0:Yt.node,e,i)}return e??function(t,e=0){return(qt[t[e+0]]+qt[t[e+1]]+qt[t[e+2]]+qt[t[e+3]]+"-"+qt[t[e+4]]+qt[t[e+5]]+"-"+qt[t[e+6]]+qt[t[e+7]]+"-"+qt[t[e+8]]+qt[t[e+9]]+"-"+qt[t[e+10]]+qt[t[e+11]]+qt[t[e+12]]+qt[t[e+13]]+qt[t[e+14]]+qt[t[e+15]]).toLowerCase()}(s)};function Jt(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,s)}return i}function Qt(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Jt(Object(i),!0).forEach(function(e){_t(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Jt(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}const $t=(t,e)=>Qt(Qt({},t),e),Ht={randomAToB:function(t,e,i){return i?(Math.random()*(e-t)|0)+t:t+Math.random()*(e-t)},randomFloating:function(t,e,i){return this.randomAToB(t-e,t+e,i)},randomZone:function(t){},degreeTransform:function(t){return t*B/180},toColor16:function(t){return"#"+t.toString(16)},randomColor:function(){return"#"+("00000"+(16777216*Math.random()|0).toString(16)).slice(-6)},lerp:function(t,e,i){return e+(t-e)*i},getNormal:function(t,e){return 0==t.x&&0==t.y?0==t.z?e.set(1,0,1):e.set(1,1,-t.y/t.z):0==t.x?e.set(1,0,1):e.set(-t.y/t.x,1,1),e.normalize()},axisRotate:function(t,e,i,s){var r=Math.cos(s),n=Math.sin(s),o=i.dot(e)*(1-r);t.copy(i),t.cross(e).scalar(n),t.addValue(e.x*r,e.y*r,e.z*r),t.addValue(i.x*o,i.y*o,i.z*o)}};class Wt{constructor(t,e,i){this._isArray=!1,this.type="Span",Zt.isArray(t)?(this._isArray=!0,this.a=t):(this.a=Zt.initValue(t,1),this.b=Zt.initValue(e,this.a),this._center=Zt.initValue(i,!1))}getValue(t){return this._isArray?this.a[this.a.length*Math.random()|0]:this._center?Ht.randomFloating(this.a,this.b,t):Ht.randomAToB(this.a,this.b,t)}}const Kt=(t,e,i)=>t instanceof Wt?t:void 0===e?new Wt(t):void 0===i?new Wt(t,e):new Wt(t,e,i);var te=i(534),ee=i.n(te);class ie extends Wt{constructor(t){super(),this.type="ArraySpan",this.items=Array.isArray(t)?t:[t]}getValue(){return ee()(this.items)}}const se=t=>t?t instanceof ie?t:new ie(t):null;class re extends Wt{constructor(t){super(),this.type="ColorSpan",this.shouldRandomize="random"===t,this.colors=Array.isArray(t)?t:[t]}getValue(){return this.shouldRandomize?Ht.randomColor():ee()(this.colors)}}const ne=t=>(t||(console.warn(`Invalid colors argument ${t} passed to createColorSpan. Defaulting to 'random'.`),t="random"),t instanceof re?t:new re(t));class oe{constructor(t,e,i,s,r,n){this.type="Box",this.x=t,this.y=e,this.z=i,this.width=s,this.height=r,this.depth=n,this.bottom=this.y+this.height,this.right=this.x+this.width,this.right=this.x+this.width}contains(t,e,i){return t<=this.right&&t>=this.x&&e<=this.bottom&&e>=this.y&&i<=this.depth&&i>=this.z}}const ae="EULER",he="RUNGE_KUTTA_2",ce="RUNGE_KUTTA_4",ue="VERLET",le=(t,e,i,s=ae)=>{((t,e,i)=>{t.sleep||(t.old.position.copy(t.position),t.old.velocity.copy(t.velocity),t.acceleration.scalar(1/t.mass),t.velocity.add(t.acceleration.scalar(e)),t.position.add(t.old.velocity.scalar(e)),i&&t.velocity.scalar(Math.pow(i,e/gt)),t.acceleration.clear())})(t,e,i)};class de extends Dt{clear(){return this.x=0,this.y=0,this.z=0,this}scalar(t){return this.x*=t,this.y*=t,this.z*=t,this}addValue(t,e,i){return this.x+=t,this.y+=e,this.z+=i,this}toString(){return"x:"+this.x+"y:"+this.y+"z:"+this.z}eulerFromDir(t){return(new Ft).setFromVector3(t)}}class pe{constructor(t,e,i){this.type="Polar3D",this.radius=t||1,this.phi=i||0,this.theta=e||0}set(t,e,i){return this.radius=t||1,this.phi=i||0,this.theta=e||0,this}setRadius(t){return this.radius=t,this}setPhi(t){return this.phi=t,this}setTheta(t){return this.theta=t,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}toVector3D(){return new de(this.getX(),this.getY(),this.getZ())}getX(){return this.radius*Math.sin(this.theta)*Math.cos(this.phi)}getY(){return-this.radius*Math.sin(this.theta)*Math.sin(this.phi)}getZ(){return this.radius*Math.cos(this.theta)}normalize(){return this.radius=1,this}equals(t){return t.radius===this.radius&&t.phi===this.phi&&t.theta===this.theta}clear(){return this.radius=0,this.phi=0,this.theta=0,this}clone(){return new pe(this.radius,this.phi,this.theta)}}class ye{constructor(t){this.id=`particle-${Xt()}`,this.type="Particle",this.life=lt,this.age=0,this.energy=1,this.dead=dt,this.sleep=pt,this.body=null,this.parent=null,this.mass=1,this.radius=10,this.alpha=1,this.scale=1,this.useColor=yt,this.useAlpha=ft,this.easing=mt,this.position=new de,this.velocity=new de,this.acceleration=new de,this.old={},this.old.position=this.position.clone(),this.old.velocity=this.velocity.clone(),this.old.acceleration=this.acceleration.clone(),this.behaviours=[],this.transform={},this.color={r:0,g:0,b:0},this.rotation=new de,this.distanceToCamera=0,Zt.setPrototypeByObj(this,t)}getDirection(){return Math.atan2(this.velocity.x,-this.velocity.y)*(180/B)}reset(){return this.life=lt,this.age=0,this.energy=1,this.dead=dt,this.sleep=pt,this.body=null,this.parent=null,this.mass=1,this.radius=10,this.alpha=1,this.scale=1,this.useColor=yt,this.useAlpha=ft,this.easing=mt,this.position.set(0,0,0),this.velocity.set(0,0,0),this.acceleration.set(0,0,0),this.old.position.set(0,0,0),this.old.velocity.set(0,0,0),this.old.acceleration.set(0,0,0),this.color.r=0,this.color.g=0,this.color.b=0,this.rotation.clear(),Zt.destroyObject(this.transform),this.removeAllBehaviours(),this}update(t,e){if(!this.sleep){this.age+=t;let i=this.behaviours.length;for(;i--;)this.behaviours[i].applyBehaviour(this,t,e)}if(this.age>=this.life)this.destroy();else{const t=this.easing(this.age/this.life);this.energy=Math.max(1-t,0)}}addBehaviour(t){this.behaviours.push(t),t.initialize(this)}addBehaviours(t){let e=t.length;for(;e--;)this.addBehaviour(t[e])}removeBehaviour(t){const e=this.behaviours.indexOf(t);e>-1&&this.behaviours.splice(e,1)}removeAllBehaviours(){Zt.destroyArray(this.behaviours)}destroy(){this.removeAllBehaviours(),this.energy=0,this.dead=!0,this.parent=null}}class fe{constructor(){this.type="Pool",this.cID=0,this.list={}}create(t,...e){if(!this.canCreateNewObject(t))throw new Error("The pool is unable to create or clone the object supplied");return this.cID++,this.canInstantiateObject(t)?new t(...e):this.canCloneObject(t)?t.clone():void 0}canInstantiateObject(t){return"function"==typeof t}canCloneObject(t){return t.clone&&"function"==typeof t.clone}canCreateNewObject(t){return!(!this.canInstantiateObject(t)&&!this.canCloneObject(t))}getCount(){var t=0;for(var e in this.list)t+=this.list[e].length;return t++}get(t,...e){var i,s=t.__puid||zt.id(t);return(i=this.list[s]&&this.list[s].length>0?this.list[s].pop():this.create(t,...e)).__puid=t.__puid||s,i}expire(t){return this._getList(t.__puid).push(t)}destroy(){for(var t in this.list)this.list[t].length=0,delete this.list[t]}_getList(t){return t=t||"default",this.list[t]||(this.list[t]=[]),this.list[t]}}const me=class{constructor(){this.listeners=null}set listeners(t){this._listeners=t}get listeners(){return this._listeners}addEventListener(t,e){return this.listeners?this.removeEventListener(t,e):this.listeners={},this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(e),e}removeEventListener(t,e){if(this.listeners&&this.listeners[t])for(var i=this.listeners[t],s=0,r=i.length;s<r;s++)if(i[s]==e){1==r?delete this.listeners[t]:i.splice(s,1);break}}removeAllEventListeners(t){t?this.listeners&&delete this.listeners[t]:this.listeners=null}dispatchEvent(t,e){var i=!1,s=this.listeners;if(t&&s){var r=s[t];if(!r)return i;for(var n,o=(r=r.slice()).length;o--;)n=r[o],i=i||n(e)}return!!i}hasEventListener(t){var e=this.listeners;return!(!e||!e[t])}},ge="SYSTEM_UPDATE",xe="PARTICLE_CREATED",ve="PARTICLE_UPDATE",be="PARTICLE_DEAD",_e="EMITTER_DEAD";class we{constructor(t="Initializer",e=!0){this.type=t,this.isEnabled=e}init(t,e){this.isEnabled&&(e?(this.initialize(e),e.hasBeenInitialized=!0):(this.initialize(t),t.hasBeenInitialized=!0))}reset(){}initialize(t){}static requiresWebGlApi(){return!1}static fromJSON(t){}}class ze extends we{constructor(t,e,i,s=!0){super(m,s),this.body=se(t),this.w=e,this.h=i||e}initialize(t){var e=this.body.getValue();this.w?t.body={width:this.w,height:this.h,body:e}:t.body=e}static fromJSON(t){const{body:e,width:i,height:s,isEnabled:r=!0}=t;return new ze(e,i,s,r)}}function Me(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,s)}return i}function Pe(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Me(Object(i),!0).forEach(function(e){_t(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Me(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}const Oe={AdditiveBlending:2,CustomBlending:5,MultiplyBlending:4,NoBlending:0,NormalBlending:1,SubtractiveBlending:3},Ee={color:16711680,blending:2,fog:!0},Te=Pe(Pe({},Ee),{},{blending:"AdditiveBlending"});function Se(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,s)}return i}function Ce(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Se(Object(i),!0).forEach(function(e){_t(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Se(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}class Ae extends we{constructor(t,e,i=Ee,s=!0){super(g,s);const{Sprite:r,SpriteMaterial:n,TextureLoader:o}=t;this.materialProperties=$t(Ee,i),(new o).load(e,t=>{this.texture=t,this.material=new n(Ce(Ce({},{map:t}),this.materialProperties)),this.sprite=new r(this.material)},void 0,t=>{throw new Error(t)})}initialize(t){t.body=this.sprite}static fromJSON(t,e){const{texture:i,materialProperties:s=Te,isEnabled:r=!0}=t;return new Ae(e,i,$t(Te,(t=>{const{blending:e}=t;return Ce(Ce({},t),{},{blending:e?Oe[e]:Oe[Te.blending]})})(s)),r)}}const je=new Ft,Re={particleEuler:null,initialize:function(t,e,i){let s=i.length;for(;s--;)i[s].init(t,e);t.bindEmitter&&this.bindEmitter(t,e)},bindEmitter:function(t,e){const{rotation:{x:i,y:s,z:r}}=t;e.position.add(t.position),e.velocity.add(t.velocity),e.acceleration.add(t.acceleration),e.velocity.applyEuler(je.set(i,s,r))}};class Ie extends we{constructor(t,e,i,s=!0){super(v,s),this.lifePan=Kt(t,e,i)}initialize(t){this.lifePan.a==1/0||"infi"==this.lifePan.a?t.life=1/0:t.life=this.lifePan.getValue()}static fromJSON(t){const{min:e,max:i,center:s=!1,isEnabled:r=!0}=t;return new Ie(e,i,s,r)}}class Be extends we{constructor(t,e,i=!1,s=!0){super(b,s),this.massPan=Kt(t,e,i)}initialize(t){t.mass=this.massPan.getValue()}static fromJSON(t){const{min:e,max:i,center:s=!1,isEnabled:r=!0}=t;return new Be(e,i,s,r)}}class De{constructor(t="Zone"){this.type=t,this.vector=new de(0,0,0),this.random=0,this.crossType="dead",this.log=!0,this.supportsCrossing=!0}getPosition(){return null}crossing(t){if(!this.supportsCrossing)return console.warn(`${this.constructor.name} does not support the crossing method`);switch(this.crossType){case"bound":this._bound(t);break;case"cross":this._cross(t);break;case"dead":this._dead(t)}}isBoxZone(){return!1}isLineZone(){return!1}isMeshZone(){return!1}isPointZone(){return!1}isScreenZone(){return!1}isSphereZone(){return!1}_dead(t){}_bound(t){}_cross(t){}}class Ve extends De{constructor(t,e,i,s,r,n){var o,a,h,c,u;super(T),Zt.isUndefined(e,i,s,r,n)?(o=a=h=0,c=u=s=t||100):Zt.isUndefined(s,r,n)?(o=a=h=0,c=t,u=e,s=i):(o=t,a=e,h=i,c=s,u=r,s=n),this.x=o,this.y=a,this.z=h,this.width=c,this.height=u,this.depth=s,this.friction=.85,this.max=6}isBoxZone(){return!0}getPosition(){return this.vector.x=this.x+Ht.randomAToB(-.5,.5)*this.width,this.vector.y=this.y+Ht.randomAToB(-.5,.5)*this.height,this.vector.z=this.z+Ht.randomAToB(-.5,.5)*this.depth,this.vector}_dead(t){(t.position.x+t.radius<this.x-this.width/2||t.position.x-t.radius>this.x+this.width/2)&&(t.dead=!0),(t.position.y+t.radius<this.y-this.height/2||t.position.y-t.radius>this.y+this.height/2)&&(t.dead=!0),(t.position.z+t.radius<this.z-this.depth/2||t.position.z-t.radius>this.z+this.depth/2)&&(t.dead=!0)}_bound(t){t.position.x-t.radius<this.x-this.width/2?(t.position.x=this.x-this.width/2+t.radius,t.velocity.x*=-this.friction,this._static(t,"x")):t.position.x+t.radius>this.x+this.width/2&&(t.position.x=this.x+this.width/2-t.radius,t.velocity.x*=-this.friction,this._static(t,"x")),t.position.y-t.radius<this.y-this.height/2?(t.position.y=this.y-this.height/2+t.radius,t.velocity.y*=-this.friction,this._static(t,"y")):t.position.y+t.radius>this.y+this.height/2&&(t.position.y=this.y+this.height/2-t.radius,t.velocity.y*=-this.friction,this._static(t,"y")),t.position.z-t.radius<this.z-this.depth/2?(t.position.z=this.z-this.depth/2+t.radius,t.velocity.z*=-this.friction,this._static(t,"z")):t.position.z+t.radius>this.z+this.depth/2&&(t.position.z=this.z+this.depth/2-t.radius,t.velocity.z*=-this.friction,this._static(t,"z"))}_static(t,e){t.velocity[e]*t.acceleration[e]>0||Math.abs(t.velocity[e])<.0167*Math.abs(t.acceleration[e])*this.max&&(t.velocity[e]=0,t.acceleration[e]=0)}_cross(t){t.position.x+t.radius<this.x-this.width/2&&t.velocity.x<=0?t.position.x=this.x+this.width/2+t.radius:t.position.x-t.radius>this.x+this.width/2&&t.velocity.x>=0&&(t.position.x=this.x-this.width/2-t.radius),t.position.y+t.radius<this.y-this.height/2&&t.velocity.y<=0?t.position.y=this.y+this.height/2+t.radius:t.position.y-t.radius>this.y+this.height/2&&t.velocity.y>=0&&(t.position.y=this.y-this.height/2-t.radius),t.position.z+t.radius<this.z-this.depth/2&&t.velocity.z<=0?t.position.z=this.z+this.depth/2+t.radius:t.position.z-t.radius>this.z+this.depth/2&&t.velocity.z>=0&&(t.position.z=this.z-this.depth/2-t.radius)}}class Fe extends De{constructor(t,e,i,s,r,n){super(S),t instanceof de?(this.x1=t.x,this.y1=t.y,this.z1=t.z,this.x2=s.x,this.y2=s.y,this.z2=s.z):(this.x1=t,this.y1=e,this.z1=i,this.x2=s,this.y2=r,this.z2=n),this.supportsCrossing=!1}isLineZone(){return!0}getPosition(){return this.random=Math.random(),this.vector.x=this.x1+this.random*(this.x2-this.x1),this.vector.y=this.y1+this.random*(this.y2-this.y1),this.vector.z=this.z1+this.random*(this.z2-this.z1),this.vector}}class ke extends De{constructor(t,e=1,i){if(super(C),this.geometry=null,this.scale=e,this.supportsCrossing=!1,t.type&&"Geometry"===t.type&&(this.geometry=t),t.geometry&&(this.geometry=t.geometry),!this.geometry)throw new Error("MeshZone unable to set geometry from the supplied bounds");this.geometry.isBufferGeometry&&(this.geometry=(new i).fromBufferGeometry(this.geometry))}isMeshZone(){return!0}getPosition(){const t=this.geometry.vertices,e=t[t.length*Math.random()|0];return this.vector.x=e.x*this.scale,this.vector.y=e.y*this.scale,this.vector.z=e.z*this.scale,this.vector}}class Ze extends De{constructor(t,e,i){var s;super(A),s=Zt.isUndefined(t,e,i)?0:t,this.x=s,this.y=s,this.z=s,this.supportsCrossing=!1}isPointZone(){return!0}getPosition(){return this.vector.x=this.x,this.vector.y=this.y,this.vector.z=this.z,this.vector}}class Ue extends De{constructor(t,e,i,s){super("ScreenZone"),this.camera=t,this.renderer=e,this.dis=i||20,s=s||"1234";for(var r=1;r<5;r++)this["d"+r]=s.indexOf(r+"")>=0}isScreenZone(){return!0}_dead(t){var e=kt.toScreenPos(t.position,this.camera,this.renderer.domElement),i=this.renderer.domElement;(e.y+t.radius<-this.dis&&this.d1||e.y-t.radius>i.height+this.dis&&this.d3)&&(t.dead=!0),(e.x+t.radius<-this.dis&&this.d4||e.x-t.radius>i.width+this.dis&&this.d2)&&(t.dead=!0)}_bound(t){var e=kt.toScreenPos(t.position,this.camera,this.renderer.domElement),i=this.renderer.domElement;(e.y+t.radius<-this.dis||e.y-t.radius>i.height+this.dis)&&(t.velocity.y*=-1),(e.x+t.radius<-this.dis||e.x-t.radius>i.width+this.dis)&&(t.velocity.y*=-1)}}var Ne,Le,qe,Ye,Ge,Xe,Je,Qe;Ue.prototype.getPosition=(Le=new de,function(){return Ne=this.renderer.domElement,Le.x=Math.random()*Ne.width,Le.y=Math.random()*Ne.height,this.vector.copy(kt.toSpacePos(Le,this.camera,Ne)),this.vector}),Ue.prototype._cross=function(){var t=new de;return function(e){var i=kt.toScreenPos(e.position,this.camera,this.renderer.domElement),s=this.renderer.domElement;i.y+e.radius<-this.dis?(t.x=i.x,t.y=s.height+this.dis+e.radius,e.position.y=kt.toSpacePos(t,this.camera,s).y):i.y-e.radius>s.height+this.dis&&(t.x=i.x,t.y=-this.dis-e.radius,e.position.y=kt.toSpacePos(t,this.camera,s).y),i.x+e.radius<-this.dis?(t.y=i.y,t.x=s.width+this.dis+e.radius,e.position.x=kt.toSpacePos(t,this.camera,s).x):i.x-e.radius>s.width+this.dis&&(t.y=i.y,t.x=-this.dis-e.radius,e.position.x=kt.toSpacePos(t,this.camera,s).x)}}();class $e extends De{constructor(t,e,i,s){let r,n,o,a;super(j),Zt.isUndefined(e,i,s)?(r=n=o=0,a=t||100):(r=t,n=e,o=i,a=s),this.x=r,this.y=r,this.z=r,this.radius=a,this.the=this.phi=0}isSphereZone(){return!0}_dead(t){t.position.distanceTo(this)-t.radius>this.radius&&(t.dead=!0)}_cross(){console.warn(`${this.constructor.name} does not support the _cross method`)}}$e.prototype.getPosition=function(){return this.random=Math.random(),Ge=this.random*this.radius,qe=B*Math.random(),Ye=2*B*Math.random(),this.vector.x=this.x+Ge*Math.sin(qe)*Math.cos(Ye),this.vector.y=this.y+Ge*Math.sin(Ye)*Math.sin(qe),this.vector.z=this.z+Ge*Math.cos(qe),this.vector},$e.prototype._bound=(Je=new de,Qe=new de,function(t){t.position.distanceTo(this)+t.radius>=this.radius&&(Je.copy(t.position).sub(this).normalize(),Qe.copy(t.velocity),Xe=2*Qe.dot(Je),t.velocity.sub(Je.scalar(Xe)))});const He=["zoneType"];class We extends we{constructor(){super(_),this.reset.apply(this,arguments)}reset(){this.zones?this.zones.length=0:this.zones=[],this.zones=this.zones.concat(Array.prototype.slice.call(arguments))}addZone(){this.zones=this.zones.concat(Array.prototype.slice.call(arguments))}static fromJSON(e){const{zoneType:i}=e,s=function(t,e){if(null==t)return{};var i,s,r=function(t,e){if(null==t)return{};var i,s,r={},n=Object.keys(t);for(s=0;s<n.length;s++)i=n[s],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(s=0;s<n.length;s++)i=n[s],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}(e,He);if(!bt.includes(i))throw new Error(`The zone type ${i} is invalid or not yet supported`);return new We(new t[i](...Object.values(s)))}}We.prototype.initialize=function(){let t;return function(e){t=this.zones[Math.random()*this.zones.length|0],t.getPosition(),e.position.x=t.vector.x,e.position.y=t.vector.y,e.position.z=t.vector.z}}();class Ke extends we{constructor(t,e,i,s=!0,r=!0){super(w,r),this.rotation=new Dt(t,e,i),this.useEmitterRotation=s}initialize(t){this.useEmitterRotation?t.rotation.copy(t.parent.rotation).add(this.rotation):t.rotation.copy(this.rotation)}static fromJSON(t){const{x:e,y:i,z:s,useEmitterRotation:r=!0,isEnabled:n=!0}=t;return new Ke(e,i,s,r,n)}}class ti extends we{constructor(t,e,i=!1,s=!0){super(z,s),this.radius=Kt(t,e,i)}reset(t,e,i=!1){this.radius=Kt(t,e,i)}initialize(t){t.radius=this.radius.getValue(),t.transform.oldRadius=t.radius}static fromJSON(t){const{width:e,height:i,center:s=!1,isEnabled:r=!0}=t;return new ti(e,i,s,r)}}class ei extends we{constructor(t=1,e=1){super("Rate"),this.numPan=Kt(t),this.timePan=Kt(e),this.startTime=0,this.nextTime=0,this.init()}init(){this.startTime=0,this.nextTime=this.timePan.getValue()}getValue(t){return this.startTime+=t,this.startTime>=this.nextTime?(this.init(),1==this.numPan.b?this.numPan.getValue("Float")>.5?1:0:this.numPan.getValue("Int")):0}static fromJSON(t){const{particlesMin:e,particlesMax:i,perSecondMin:s,perSecondMax:r}=t;return new ei(new Wt(e,i),new Wt(s,r))}}function ii(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,s)}return i}function si(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?ii(Object(i),!0).forEach(function(e){_t(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ii(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}class ri extends we{constructor(t,e,i=Ee,s=!0){super(x,s);const{Sprite:r,SpriteMaterial:n}=t;this.materialProperties=$t(Ee,i),this.texture=e,this.material=new n(si(si({},{map:e}),this.materialProperties)),this.sprite=new r(this.material)}initialize(t){t.body=this.sprite}static fromJSON(t,e){const{loadedTexture:i,materialProperties:s=Te,isEnabled:r=!0}=t;return new ri(e,i,$t(Te,(t=>{const{blending:e}=t;return si(si({},t),{},{blending:e?Oe[e]:Oe[Te.blending]})})(s)),r)}}class ni extends we{constructor(t,e=!0){super(t,e),this.dirVec=new de(0,0,0)}normalize(t){return 100*t}}ni.prototype.initialize=function(){var t,e=new de(0,0,1),i=new de(0,0,0);return function(s){return t=this.tha*Math.random(),this._useV&&this.dirVec.copy(this.dir).scalar(this.radiusPan.getValue()),Ht.getNormal(this.dirVec,e),i.copy(this.dirVec).applyAxisAngle(e,t),i.applyAxisAngle(this.dirVec.normalize(),Math.random()*B*2),s.velocity.copy(i),this}}();class oi extends ni{constructor(t,e,i=!0){super(P,i),this.tha=e*V,this.dirVec=t.toVector3D(),this._useV=!1}static fromJSON(t){const{polarRadius:e,polarTheta:i,polarPhi:s,velocityTheta:r,isEnabled:n=!0}=t;return new oi(new pe(e,i,s),r,n)}}class ai extends ni{constructor(t,e,i,s=!0){super(O,s),this.radiusPan=Kt(t),this.dir=e.clone().normalize(),this.tha=i*V,this._useV=!0}static fromJSON(t){const{radius:e,x:i,y:s,z:r,theta:n,isEnabled:o=!0}=t;return new ai(e,new de(i,s,r),n,o)}}class hi extends ni{constructor(t,e,i=!0){super(M,i),this.radiusPan=Kt(1),this.dir=t.clone(),this.tha=e*V,this._useV=!0}static fromJSON(t){const{x:e,y:i,z:s,theta:r,isEnabled:n=!0}=t;return new hi(new de(e,i,s),r,n)}}const ci=new ei(1,.1);var ui=i(763),li=i.n(ui);class di extends ye{constructor(t){super(t),this.type="Emitter",this.particles=[],this.initializers=[],this.behaviours=[],this.emitterBehaviours=[],this.currentEmitTime=0,this.totalEmitTimes=-1,this.damping=.006,this.bindEmitter=!0,this.bindEmitterEvent=!1,this.rate=ci,this.isEmitting=!1,this.id=`emitter-${Xt()}`,this.cID=0,this.name="Emitter",this.index=void 0,this.eventDispatcher=new me}dispatch(t,e=this){this.eventDispatcher.dispatchEvent(t,e)}setRate(t){return this.rate=t,this}setPosition(t={}){const{position:e}=this,{x:i=e.x,y:s=e.y,z:r=e.z}=t;return this.position.set(i,s,r),this}setRotation(t={}){const{rotation:e}=this,{x:i=e.x,y:s=e.y,z:r=e.z}=t;return this.rotation.set(i,s,r),this}emit(t=1/0,e=1/0){return this.currentEmitTime=0,this.totalEmitTimes=li()(t)?t:1/0,this.life=1===t?t:li()(e)?e:1/0,this.rate.init(),this.isEmitting=!0,this}experimental_emit(){const{isEmitting:t,totalEmitTimes:e,life:i}=this;return t||(this.currentEmitTime=0,e||this.setTotalEmitTimes(1/0),i||this.setLife(1/0),this.rate.init(),this.isEmitting=!0),this}setTotalEmitTimes(t=1/0){return this.totalEmitTimes=li()(t)?t:1/0,this}setLife(t=1/0){return 1===this.totalEmitTimes?this.life=this.totalEmitTimes:this.life=li()(t)?t:1/0,this}stopEmit(){this.totalEmitTimes=-1,this.currentEmitTime=0,this.isEmitting=!1}removeAllParticles(){let t=this.particles.length;for(;t--;)this.particles[t].dead=!0}addInitializer(t){return this.initializers.push(t),this}addInitializers(t){let e=t.length;for(;e--;)this.addInitializer(t[e]);return this}setInitializers(t){return this.initializers=t,this}removeInitializer(t){const e=this.initializers.indexOf(t);return e>-1&&this.initializers.splice(e,1),this}removeAllInitializers(){return Zt.destroyArray(this.initializers),this}addBehaviour(t){return this.behaviours.push(t),this}addBehaviours(t){let e=t.length;for(;e--;)this.addBehaviour(t[e]);return this}setBehaviours(t){return this.behaviours=t,this}removeBehaviour(t){const e=this.behaviours.indexOf(t);return e>-1&&this.behaviours.splice(e,1),this}removeAllBehaviours(){return Zt.destroyArray(this.behaviours),this}addEmitterBehaviour(t){return this.emitterBehaviours.push(t),t.initialize(this),this}addEmitterBehaviours(t){let e=t.length;for(;e--;)this.addEmitterBehaviour(t[e]);return this}setEmitterBehaviours(t){const e=t.length;this.emitterBehaviours=t;for(let t=0;t<e;t++)this.emitterBehaviours[t].initialize(this);return this}removeEmitterBehaviour(t){const e=this.emitterBehaviours.indexOf(t);return e>-1&&this.emitterBehaviours.splice(e,1),this}removeAllEmitterBehaviours(){return Zt.destroyArray(this.emitterBehaviours),this}addOnEmitterDeadEventListener(t){return this.eventDispatcher.addEventListener(`${this.id}_${_e}`,()=>t()),this}createParticle(){const t=this.parent.pool.get(ye),e=this.particles.length;return this.setupParticle(t,e),this.parent&&this.parent.dispatch(xe,t),this.bindEmitterEvent&&this.dispatch(xe,t),t}setupParticle(t,e){const{initializers:i,behaviours:s}=this;Re.initialize(this,t,i),t.addBehaviours(s),t.parent=this,t.index=e,this.particles.push(t)}update(t){if(!this.isEmitting&&0===this.particles.length)return;this.age+=t,(this.dead||this.age>=this.life)&&this.destroy(),this.isEmitting&&this.generate(t),this.integrate(t);let e=this.particles.length;for(;e--;){const t=this.particles[e];t.dead&&(this.parent&&this.parent.dispatch(be,t),this.bindEmitterEvent&&this.dispatch(be,t),this.parent.pool.expire(t.reset()),this.particles.splice(e,1),0===this.particles.length&&this.parent&&this.parent.dispatch(ge))}this.updateEmitterBehaviours(t)}updateEmitterBehaviours(t){if(this.sleep)return;const e=this.emitterBehaviours.length;for(let i=0;i<e;i++)this.emitterBehaviours[i].applyBehaviour(this,t,i)}integrate(t){const e=this.parent?this.parent.integrationType:ae,i=1-this.damping;le(this,t,i,e);let s=this.particles.length;for(;s--;){const r=this.particles[s];r.update(t,s),le(r,t,i,e),this.parent&&this.parent.dispatch(ve,r),this.bindEmitterEvent&&this.dispatch(ve,r)}}generate(t){if(1===this.totalEmitTimes){let t=this.rate.getValue(99999);for(t>0&&(this.cID=t);t--;)this.createParticle();return void(this.totalEmitTimes=0)}if(this.currentEmitTime+=t,this.currentEmitTime<this.totalEmitTimes){let e=this.rate.getValue(t);for(e>0&&(this.cID=e);e--;)this.createParticle()}}destroy(){this.dead=!0,this.energy=0,this.totalEmitTimes=-1,0==this.particles.length&&(this.isEmitting=!1,this.removeAllInitializers(),this.removeAllBehaviours(),this.dispatch(`${this.id}_${_e}`),this.parent&&this.parent.removeEmitter(this))}}const pi=1/0,yi=U;class fi{constructor(t=1/0,e=yi,i="Behaviour",s=!0){this.type=i,this.isEnabled=s,this.id=`behaviour-${Xt()}`,this.life=t,this.easing=e,this.age=0,this.energy=1,this.dead=!1}reset(t=1/0,e=yi){this.life=t,this.easing=e||yi}set life(t){this._life=li()(t)?t:pi}get life(){return this._life}normalizeForce(t){return t.scalar(100)}normalizeValue(t){return 100*t}initialize(t){}applyBehaviour(t,e,i){this.isEnabled&&this.mutate(t,e,i)}mutate(t,e,i){}energize(t,e){if(this.dead)return;if(this.age+=e,this.age>=this.life)return this.energy=0,void(this.dead=!0);const i=this.easing(t.age/t.life);this.energy=Math.max(1-i,0)}destroy(){}fromJSON(t){}}class mi extends fi{constructor(t=1,e=null,i,s,r=!0){super(i,s,n,r),this.alphaA=t,this.alphaB=e,this.reset(t,e)}get same(){return this._same}set same(t){this._same=t}reset(t=1,e=null,i,s){this.same=null==e,this.alphaA=Kt(t),this.alphaB=Kt(e),i&&super.reset(i,s)}initialize(t){t.useAlpha=!0,t.transform.alphaA=this.alphaA.getValue(),t.transform.alphaB=this.same?t.transform.alphaA:this.alphaB.getValue()}mutate(t,e,i){this.energize(t,e,i),t.alpha=Ht.lerp(t.transform.alphaA,t.transform.alphaB,this.energy),t.alpha<.002&&(t.alpha=0)}static fromJSON(t){const{alphaA:e,alphaB:i,life:s,easing:r,isEnabled:n=!0}=t;return new mi(e,i,s,ut(r),n)}}class gi extends fi{constructor(t=new de,e=100,i=1e3,s=1/0,r=yi,n=!0){super(s,r,o,n),this.targetPosition=t,this.radius=i,this.force=this.normalizeValue(e),this.radiusSq=this.radius*this.radius,this.attractionForce=new de,this.lengthSq=0}reset(t=new de,e=100,i=1e3,s,r){this.targetPosition=t,this.radius=i,this.force=this.normalizeValue(e),this.radiusSq=this.radius*this.radius,this.attractionForce=new de,this.lengthSq=0,s&&super.reset(s,r)}mutate(t,e,i){this.energize(t,e,i),this.attractionForce.copy(this.targetPosition),this.attractionForce.sub(t.position),this.lengthSq=this.attractionForce.lengthSq(),this.lengthSq>4e-6&&this.lengthSq<this.radiusSq&&(this.attractionForce.normalize(),this.attractionForce.scalar(1-this.lengthSq/this.radiusSq),this.attractionForce.scalar(this.force),t.acceleration.add(this.attractionForce))}static fromJSON(t){const{x:e,y:i,z:s,force:r,radius:n,life:o,easing:a,isEnabled:h=!0}=t;return new gi(new de(e,i,s),r,n,o,ut(a),h)}}class xi extends fi{constructor(t,e,i,s,r,n=!0){super(s,r,"Collision",n),this.reset(t,e,i)}reset(t,e,i,s,r){this.emitter=t,this.useMass=e,this.onCollide=i,this.particles=[],this.delta=new de,s&&super.reset(s,r)}mutate(t,e,i){const s=this.emitter?this.emitter.particles.slice(i):this.particles.slice(i);let r,n,o,a,h,c,u=s.length;for(;u--;)r=s[u],r!=t&&(this.delta.copy(r.position).sub(t.position),n=this.delta.lengthSq(),a=t.radius+r.radius,n<=a*a&&(o=a-Math.sqrt(n),o+=.5,h=this._getAverageMass(t,r),c=this._getAverageMass(r,t),t.position.add(this.delta.clone().normalize().scalar(o*-h)),r.position.add(this.delta.normalize().scalar(o*c)),this.onCollide&&this.onCollide(t,r)))}_getAverageMass(t,e){return this.useMass?e.mass/(t.mass+e.mass):.5}fromJSON(t){}}class vi extends fi{constructor(t,e,i,s,r=!0){super(i,s,a,r),this.reset(t,e)}get same(){return this._same}set same(t){this._same=t}reset(t,e,i,s){this.same=null==e,this.colorA=ne(t),this.colorB=ne(e),i&&super.reset(i,s)}initialize(t){t.transform.colorA=wt.getRGB(this.colorA.getValue()),t.useColor=!0,t.transform.colorB=this.same?t.transform.colorA:wt.getRGB(this.colorB.getValue())}mutate(t,e,i){this.energize(t,e,i),this._same?(t.color.r=t.transform.colorA.r,t.color.g=t.transform.colorA.g,t.color.b=t.transform.colorA.b):(t.color.r=Ht.lerp(t.transform.colorA.r,t.transform.colorB.r,this.energy),t.color.g=Ht.lerp(t.transform.colorA.g,t.transform.colorB.g,this.energy),t.color.b=Ht.lerp(t.transform.colorA.b,t.transform.colorB.b,this.energy))}static fromJSON(t){const{colorA:e,colorB:i,life:s,easing:r,isEnabled:n=!0}=t;return new vi(e,i,s,ut(r),n)}}class bi extends fi{constructor(t,e,i,s,r){super(i,s,h,r),this.reset(t,e)}reset(t,e="dead",i,s){this.zone=t,this.zone.crossType=e,i&&super.reset(i,s)}mutate(t,e,i){this.energize(t,e,i),this.zone.crossing.call(this.zone,t)}static fromJSON(e){const{zoneType:i,zoneParams:s,crossType:r,life:n,easing:o,isEnabled:a=!0}=e,h=new t[i](...Object.values(s));return new bi(h,r,n,ut(o),a)}}class _i extends fi{constructor(t,e,i,s,r,n=!0){super(s,r,c,n),this.reset(t,e,i)}reset(t,e,i){this.force=this.normalizeForce(new de(t,e,i)),this.force.id=Math.random()}mutate(t,e,i){this.energize(t,e,i),t.acceleration.add(this.force)}static fromJSON(t){const{fx:e,fy:i,fz:s,life:r,easing:n,isEnabled:o=!0}=t;return new _i(e,i,s,r,ut(n),o)}}class wi extends _i{constructor(t,e,i,s=!0){super(0,-t,0,e,i,s),this.type=u}static fromJSON(t){const{gravity:e,life:i,easing:s,isEnabled:r=!0}=t;return new wi(e,i,ut(s),r)}}class zi extends fi{constructor(t,e,i,s=.03,r,n,o=!0){super(r,n,l,o),this.reset(t,e,i,s),this.time=0}reset(t,e,i,s=.03,r,n){this.randomForce=this.normalizeForce(new de(t,e,i)),this.delayPan=Kt(s),this.time=0,r&&super.reset(r,n)}mutate(t,e,i){if(this.energize(t,e,i),this.time+=e,this.time>=this.delayPan.getValue()){const e=Ht.randomAToB(-this.randomForce.x,this.randomForce.x),i=Ht.randomAToB(-this.randomForce.y,this.randomForce.y),s=Ht.randomAToB(-this.randomForce.z,this.randomForce.z);t.acceleration.addValue(e,i,s),this.time=0}}static fromJSON(t){const{x:e,y:i,z:s,delay:r,life:n,easing:o,isEnabled:a=!0}=t;return new zi(e,i,s,r,n,ut(o),a)}}class Mi extends gi{constructor(t,e,i,s,r,n=!0){super(t,e,i,s,r,n),this.force*=-1,this.type=d}reset(t,e,i,s,r){super.reset(t,e,i,s,r),this.force*=-1}static fromJSON(t){const{x:e,y:i,z:s,force:r,radius:n,life:o,easing:a,isEnabled:h=!0}=t;return new Mi(new de(e,i,s),r,n,o,ut(a),h)}}class Pi extends fi{constructor(t,e,i,s,r,n=!0){super(s,r,p,n),this.reset(t,e,i)}get rotationType(){return this._rotationType}set rotationType(t){this._rotationType=t}reset(t,e,i,s,r){this.x=t||0,this.y=e||0,this.z=i||0,void 0===t||"same"==t?this.rotationType="same":null==e?this.rotationType="set":void 0===i?this.rotationType="to":(this.rotationType="add",this.x=Kt(this.x*V),this.y=Kt(this.y*V),this.z=Kt(this.z*V)),s&&super.reset(s,r)}initialize(t){switch(this.rotationType){case"same":break;case"set":this._setRotation(t.rotation,this.x);break;case"to":t.transform.fR=t.transform.fR||new de,t.transform.tR=t.transform.tR||new de,this._setRotation(t.transform.fR,this.x),this._setRotation(t.transform.tR,this.y);break;case"add":t.transform.addR=new de(this.x.getValue(),this.y.getValue(),this.z.getValue())}}_setRotation(t,e){if(t=t||new de,"random"==e){var i=Ht.randomAToB(-B,B),s=Ht.randomAToB(-B,B),r=Ht.randomAToB(-B,B);t.set(i,s,r)}else e instanceof de&&t.copy(e)}mutate(t,e,i){switch(this.energize(t,e,i),this.rotationType){case"same":t.rotation||(t.rotation=new de),t.rotation.copy(t.velocity);break;case"set":break;case"to":t.rotation.x=Ht.lerp(t.transform.fR.x,t.transform.tR.x,this.energy),t.rotation.y=Ht.lerp(t.transform.fR.y,t.transform.tR.y,this.energy),t.rotation.z=Ht.lerp(t.transform.fR.z,t.transform.tR.z,this.energy);break;case"add":t.rotation.add(t.transform.addR)}}static fromJSON(t){const{x:e,y:i,z:s,life:r,easing:n,isEnabled:o=!0}=t;return new Pi(e,i,s,r,ut(n),o)}}class Oi extends fi{constructor(t,e,i,s,r=!0){super(i,s,y,r),this.reset(t,e)}get same(){return this._same}set same(t){this._same=t}reset(t,e,i,s){this.same=null==e,this.scaleA=Kt(t||1),this.scaleB=Kt(e),i&&super.reset(i,s)}initialize(t){t.transform.scaleA=this.scaleA.getValue(),t.transform.oldRadius=t.radius,t.transform.scaleB=this.same?t.transform.scaleA:this.scaleB.getValue()}mutate(t,e,i){this.energize(t,e,i),t.scale=Ht.lerp(t.transform.scaleA,t.transform.scaleB,this.energy),t.scale<5e-4&&(t.scale=0),t.radius=t.transform.oldRadius*t.scale}static fromJSON(t){const{scaleA:e,scaleB:i,life:s,easing:r,isEnabled:n=!0}=t;return new Oi(e,i,s,ut(r),n)}}class Ei extends fi{constructor(t,e,i,s,r,n,o,a=!0){super(n,o,f,a),this.reset(t,e,i,s,r)}reset(t,e,i,s,r){this.pos?this.pos.set(t,e,i):this.pos=new de(t,e,i),this.spring=s||.1,this.friction=r||.98}mutate(t,e,i){this.energize(t,e,i),t.velocity.x+=(this.pos.x-t.position.x)*this.spring,t.velocity.y+=(this.pos.y-t.position.y)*this.spring,t.velocity.z+=(this.pos.z-t.position.z)*this.spring}static fromJSON(t){const{x:e,y:i,z:s,spring:r,friction:n,life:o,easing:a,isEnabled:h=!0}=t;return new Ei(e,i,s,r,n,o,ut(a),h)}}const Ti=t=>{const e=[];return t.forEach(t=>{const{type:i,properties:s}=t;if(!vt.includes(i))throw new Error(`The behaviour type ${i} is invalid or not yet supported`);e.push(r[i].fromJSON(s))}),e};function Si(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,s)}return i}function Ci(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Si(Object(i),!0).forEach(function(e){_t(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Si(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}const Ai={shouldAutoEmit:!0},ji=t=>new Promise((e,i)=>{if(!t.length)return e([]);const s=t.length,n=[];t.forEach(t=>{const{type:o,properties:a}=t;return vt.includes(o)?(n.push(r[o].fromJSON(a)),n.length===s?e(n):void 0):i(`The behaviour type ${o} is invalid or not yet supported`)})});class Ri{constructor(t=D,e=ae){this.type="System",this.canUpdate=!0,this.preParticles=t,this.integrationType=e,this.emitters=[],this.renderers=[],this.pool=new fe,this.eventDispatcher=new me}static fromJSON(t,i){return((t,i,s,r)=>{const{preParticles:n=D,integrationType:o=F,emitters:a=[]}=t,h=new s(i,n,o);return a.forEach(t=>{const s=new r,{rate:n,rotation:o,initializers:a,behaviours:c,emitterBehaviours:u=[],position:l,totalEmitTimes:d=1/0,life:p=1/0}=t;s.setRate((t=>ei.fromJSON(t))(n)).setRotation(o).setInitializers(((t,i)=>{const s=[];return t.forEach(t=>{const{type:r,properties:n}=t;if(!xt.includes(r))throw new Error(`The initializer type ${r} is invalid or not yet supported`);E.includes(r)?s.push(e[r].fromJSON(n,i)):s.push(e[r].fromJSON(n))}),s})(a,i)).setBehaviours(Ti(c)).setEmitterBehaviours(Ti(u)).setPosition(l).emit(d,p),h.addEmitter(s)}),h})(t,i,Ri,di)}static fromJSONAsync(t,i,s){return((t,i,s,r,n={})=>new Promise((o,a)=>{const{preParticles:h=D,integrationType:c=F,emitters:u=[]}=t,l=new s(h,c),{shouldAutoEmit:d}=Ci(Ci({},Ai),n);((t,i,s,r)=>new Promise((n,o)=>{if(!t.length)return n([]);const a=[],h=t.length;if(!h)return n(a);t.forEach(t=>{const c=new i,{rate:u,rotation:l,initializers:d,behaviours:p,emitterBehaviours:y=[],position:f,totalEmitTimes:m=1/0,life:g=1/0}=t;var x;c.setRate((x=u,ei.fromJSON(x))).setRotation(l).setPosition(f),((t,i)=>new Promise((s,r)=>{if(!t.length)return s([]);const n=t.length,o=[],a=t.filter(({properties:t})=>!t.texture),h=t.filter(({properties:t})=>t.texture);a.forEach(t=>{const{type:a,properties:h}=t;return xt.includes(a)?(E.includes(a)?o.push(e[a].fromJSON(h,i)):o.push(e[a].fromJSON(h)),o.length===n?s(o):void 0):r(`The initializer type ${a} is invalid or not yet supported`)}),h.forEach(t=>{const{type:e,properties:a,properties:{texture:h}}=t,c=new i.TextureLoader;if(!xt.includes(e))return r(`The initializer type ${e} is invalid or not yet supported`);c.load(h,t=>{if(o.push(ri.fromJSON(Ci(Ci({},a),{},{loadedTexture:t}),i)),o.length===n)return s(o)},void 0,r)})}))(d,s).then(t=>(c.setInitializers(t),ji(p))).then(t=>(c.setBehaviours(t),ji(y))).then(t=>(c.setEmitterBehaviours(t),Promise.resolve(c))).then(t=>{if(a.push(r?t.emit(m,g):t.setTotalEmitTimes(m).setLife(g)),a.length===h)return n(a)}).catch(o)})}))(u,r,i,d).then(t=>{const e=t.length;if(!e)return o(l);t.forEach(t=>{l.addEmitter(t),l.emitters.length===e&&o(l)})}).catch(a)}))(t,i,Ri,di,s)}dispatch(t,e=this){this.eventDispatcher.dispatchEvent(t,e)}addRenderer(t){return this.renderers.push(t),t.init(this),this}removeRenderer(t){return this.renderers.splice(this.renderers.indexOf(t),1),t.remove(this),this}addEmitter(t){const e=this.emitters.length;return t.parent=this,t.index=e,this.emitters.push(t),this.dispatch("EMITTER_ADDED",t),this}removeEmitter(t){return t.parent!==this||(t.parent=null,t.index=void 0,this.emitters.splice(this.emitters.indexOf(t),1),this.dispatch("EMITTER_REMOVED",t)),this}emit({onStart:t,onUpdate:e,onEnd:i}){t&&t(),e&&this.eventDispatcher.addEventListener(ge,e);const s=this.emitters.map(t=>{const{life:e}=t;return e===1/0?(i&&i(),t.experimental_emit(),Promise.resolve()):new Promise(e=>{t.addOnEmitterDeadEventListener(()=>{i&&i(),e()}),t.experimental_emit()})});try{return Promise.all(s)}catch(t){console.warn(t)}}update(t=.0167){const e=t||gt;if(this.canUpdate){if(e>0){let t=this.emitters.length;for(;t--;){const i=this.emitters[t];i.update(e),i.particles.length&&this.dispatch(ge)}}this.dispatch("SYSTEM_UPDATE_AFTER")}return Promise.resolve()}getCount(){const t=this.emitters.length;let e,i=0;for(e=0;e<t;e++)i+=this.emitters[e].particles.length;return i}destroy(){const t=this.emitters.length;this.canUpdate=!1;for(let e=0;e<t;e++)this.emitters[e]&&this.emitters[e].destroy(),delete this.emitters[e];for(let e=0;e<t;e++)this.renderers[e]&&this.renderers[e].destroy&&(this.renderers[e].destroy(),delete this.renderers[e]);this.emitters.length=0,this.pool.destroy(),this.canUpdate=!0}}const Ii=15,Bi=0,Di={addEventListener:function(t,e){return t.eventDispatcher.addEventListener("SYSTEM_UPDATE",e),this},drawZone:function(t,e,i,s={}){const{width:r=Ii,height:n=Ii,depth:o=Ii,radius:a=Ii,x:h=Bi,y:c=Bi,z:u=Bi}=s;let l;s.isPointZone()&&(l=new t.SphereGeometry(15)),s.isLineZone(),s.isBoxZone()&&(l=new t.BoxGeometry(r,n,o)),s.isSphereZone()&&(l=new t.SphereGeometry(a,Ii,Ii)),s.isMeshZone()&&(l=s.geometry.geometry?s.geometry.geometry.clone():s.geometry.clone()),l||(l=new t.BoxGeometry(r,n,o));const d=new t.MeshBasicMaterial({color:"#2194ce",wireframe:!0}),p=new t.Mesh(l.clone(),d);i.add(p),this.addEventListener(e,function(){p.position.set(h,c,u)})},drawEmitter:function(t,e,i,s,r){const n=new t.OctahedronGeometry(Ii),o=new t.MeshBasicMaterial({color:r||"#aaa",wireframe:!0}),a=new t.Mesh(n.clone(),o);i.add(a),this.addEventListener(e,function(){a.position.copy(s.position),a.rotation.set(s.rotation.x,s.rotation.y,s.rotation.z)})},renderInfo:function(){function t(t,e){var i="material"==t?"_materialPool":"_targetPool";return e.renderers[0][i].cID}return function(e,i){this.addInfo(i);var s="";switch(this._infoType){case 2:s+="emitter:"+e.emitters.length+"<br>",s+="em speed:"+e.emitters[0].cID+"<br>",s+="pos:"+function(t){var e=t.emitters[0];return Math.round(e.p.x)+","+Math.round(e.p.y)+","+Math.round(e.p.z)}(e);break;case 3:s+=e.renderers[0].name+"<br>",s+="target:"+t("target")+"<br>",s+="material:"+t("material");break;default:s+="particles:"+e.getCount()+"<br>",s+="pool:"+e.pool.getCount()+"<br>",s+="total:"+(e.getCount()+e.pool.getCount())}this._infoCon.innerHTML=s}}(),addInfo:function(t){var e=this;if(!this._infoCon){var i,s;switch(this._infoCon=document.createElement("div"),this._infoCon.style.cssText=["position:fixed;bottom:0px;left:0;cursor:pointer;","opacity:0.9;z-index:10000;padding:10px;font-size:12px;","width:120px;height:50px;background-color:#002;color:#0ff;"].join(""),this._infoType=1,this._infoCon.addEventListener("click",function(){e._infoType++,e._infoType>3&&(e._infoType=1)},!1),t){case 2:i="#201",s="#f08";break;case 3:i="#020",s="#0f0";break;default:i="#002",s="#0ff"}this._infoCon.style["background-color"]=i,this._infoCon.style.color=s}this._infoCon.parentNode||document.body.appendChild(this._infoCon)}};function Vi(){let t=0;if(window.console&&window.console.trace){var e=Array.prototype.slice.call(arguments);0==(arguments[0]+"").indexOf("+")?t<parseInt(arguments[0])&&(e.shift(),console.trace.apply(console,e),t++):(e.unshift("+15"),this.apply(console,e))}}class Fi extends di{constructor(t,e,i){super(i),this.type="FollowEmitter",this.mouseTarget=Zt.initValue(t,window),this.ease=Zt.initValue(e,.7),this._allowEmitting=!1,this.initEventHandler()}initEventHandler(){var t=this;this.mousemoveHandler=function(e){t.mousemove.call(t,e)},this.mousedownHandler=function(e){t.mousedown.call(t,e)},this.mouseupHandler=function(e){t.mouseup.call(t,e)},this.mouseTarget.addEventListener("mousemove",this.mousemoveHandler,!1)}emit(){this._allowEmitting=!0}stopEmit(){this._allowEmitting=!1}setCameraAndCanvas(t,e){this.camera=t,this.canvas=e}mousemove(t){t.layerX||0==t.layerX?(this.position.x+=(t.layerX-this.position.x)*this.ease,this.position.y+=(t.layerY-this.position.y)*this.ease):(t.offsetX||0==t.offsetX)&&(this.position.x+=(t.offsetX-this.position.x)*this.ease,this.position.y+=(t.offsetY-this.position.y)*this.ease),this.position.copy(kt.toSpacePos(this.position,this.camera,this.canvas)),this._allowEmitting&&super.emit("once")}destroy(){super.destroy(),this.mouseTarget.removeEventListener("mousemove",this.mousemoveHandler,!1)}}class ki{constructor(t="BaseRenderer"){this.type=t}init(t){var e=this;this.system=t,this.system.eventDispatcher.addEventListener(ge,function(t){e.onSystemUpdate.call(e,t)}),this.system.eventDispatcher.addEventListener(xe,function(t){e.onParticleCreated.call(e,t)}),this.system.eventDispatcher.addEventListener(ve,function(t){e.onParticleUpdate.call(e,t)}),this.system.eventDispatcher.addEventListener(be,function(t){e.onParticleDead.call(e,t)}),this.logRendererType()}remove(){this.system=null}onParticleCreated(t){}onParticleUpdate(t){}onParticleDead(t){}onSystemUpdate(t){}logRendererType(){k&&console.log(`${this.type}`)}}class Zi extends ki{constructor(){super("CustomRenderer"),this.targetPool=new fe,this.materialPool=new fe}onSystemUpdate(){}onParticleCreated(t){}onParticleUpdate(t){}onParticleDead(t){}}class Ui extends ki{constructor(t,e){super("MeshRenderer"),this.container=t,this._targetPool=new fe,this._materialPool=new fe,this._body=new e.Mesh(new e.BoxGeometry(50,50,50),new e.MeshLambertMaterial({color:"#ff0000"}))}isThreeSprite(t){return t.target.isSprite}onSystemUpdate(){}onParticleCreated(t){t.target||(t.body||(t.body=this._body),t.target=this._targetPool.get(t.body),(t.useAlpha||t.useColor)&&(t.target.material.__puid=zt.id(t.body.material),t.target.material=this._materialPool.get(t.target.material))),t.target&&(t.target.position.copy(t.position),this.container.add(t.target))}onParticleUpdate(t){const{target:e,useAlpha:i,useColor:s}=t;e&&(e.position.copy(t.position),this.rotate(t),this.scale(t),i&&(e.material.opacity=t.alpha,e.material.transparent=!0),s&&e.material.color.copy(t.color))}rotate(t){t.target.rotation.set(t.rotation.x,t.rotation.y,t.rotation.z)}scale(t){t.target.scale.set(t.scale,t.scale,t.scale)}onParticleDead(t){t.target&&((t.useAlpha||t.useColor)&&this._materialPool.expire(t.target.material),this._targetPool.expire(t.target),this.container.remove(t.target),t.target=null)}}class Ni extends Ui{constructor(t,e){super(t,e),this.type="SpriteRenderer",this._body=new e.Sprite(new e.SpriteMaterial({color:16777215}))}rotate(t){t.target.material.rotation=t.rotation.z}scale(t){t.target.scale.set(t.scale*t.radius,t.scale*t.radius,1)}}const Li=[12,4,4,16].reduce((t,e)=>t+e),qi=3,Yi=1,Gi=1,Xi=4,Ji=1,Qi=2,$i={position:qi,rotation:Yi,size:Gi,color:Xi,alpha:Ji,texID:Qi},Hi=([qi,Yi,Gi,Xi,Ji,Qi].reduce((t,e)=>t+e),{blending:"AdditiveBlending",baseColor:16777215,depthTest:!0,depthWrite:!1,transparent:!0,maxParticles:1e4,shouldDebugTextureAtlas:!1,shouldForceDesktopRenderer:!1,shouldForceMobileRenderer:!1});class Wi{constructor(t){this.position=new t.Vector3,this.rotation=new t.Vector3,this.size=0,this.color=new t.Color,this.alpha=0,this.texture=null,this.index=0}reset(){this.position.set(0,0,0),this.rotation.set(0,0,0),this.size=0,this.color.setRGB(0,0,0),this.alpha=0,this.texture=null}}class Ki{constructor(t=1/0){this.max=t,this.count=0,this._items={}}add(t){void 0===this._items[t]&&(this._items[t]=this.count++)}find(t){return this._items[t]}destroy(){this._items={},this.count=0}}let ts;class es{constructor(t=1e4,e){ts=e,this.maxParticles=t,this.createInterleavedBuffer().createBufferGeometry()}createInterleavedBuffer(){const t=new ArrayBuffer(this.maxParticles*Li);return this.interleavedBuffer=new ts.InterleavedBuffer(new Float32Array(t),Li),this}createBufferGeometry(){this.geometry=new ts.BufferGeometry;const{interleavedBuffer:t,geometry:e}=this;return Object.keys($i).reduce((i,s)=>{const r=$i[s];return e.setAttribute(s,new ts.InterleavedBufferAttribute(t,r,i)),i+r},0),this}get buffer(){return this.interleavedBuffer}get stride(){return Li}}class is{constructor(t,e){const{three:i,type:s}=t,r=new Float32Array(1024),n=this.ctx=document.createElement("canvas").getContext("2d"),{canvas:o}=n;this.shouldDebug=e,this.rendererType=s,this.indexData=r,this.canvas=o,this.entries=[],s===I&&(this.atlasIndex=new i.DataTexture(r,256,1,i.RGBAFormat,i.FloatType)),o.width=o.height=256,e&&this.debug(o,n),this.atlasTexture=new i.CanvasTexture(o),this.atlasTexture.flipY=!1,t.material.uniforms.uTexture.value=this.atlasTexture,s===I&&(t.material.uniforms.atlasIndex.value=this.atlasIndex),t.material.uniformsNeedUpdate=!0}log(...t){k&&console.log(...t)}debug(){const{canvas:t,ctx:e}=this,i=t.width;e.fillStyle="purple",e.fillRect(0,0,i,i),e.fillStyle="green",e.fillRect(0,i,i,i),e.fillStyle="blue",e.fillRect(i,0,i,i),e.fillStyle="orange",e.fillRect(i,i,i,i),e.fillStyle="yellow",e.font=t.width+"px Verdana",e.fillText("top row",100,500),e.fillStyle="pink",e.fillText("bottom row",100,1500),t.style.position="absolute",t.style.width=t.style.height="300px",t.style.left=t.style.top="0px",t.style.zIndex=100,document.body.appendChild(t)}addTexture(t){this.log("Adding texture to atlas:",t.uuid),t.textureIndex=this.entries.length,this.entries.push({texture:t}),this.needsUpdate=!0}update(){if(!this.needsUpdate)return;const{entries:t,canvas:e,indexData:i,ctx:s,atlasIndex:r,atlasTexture:n,rendererType:o}=this;for(let e=0;e<t.length;e++)if(!t[e].texture.image)return;this.needsUpdate=!1;for(let e=0;e<t.length;e++){const i=t[e],{texture:s}=i,{width:r,height:n}=s.image;i.w=r,i.h=n}const a=function(t){let e=0,i=0;for(const s of t)e+=s.w*s.h,i=Math.max(i,s.w);t.sort((t,e)=>e.h-t.h);const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let r=0,n=0;for(const e of t)for(let t=s.length-1;t>=0;t--){const i=s[t];if(!(e.w>i.w||e.h>i.h)){if(e.x=i.x,e.y=i.y,n=Math.max(n,e.y+e.h),r=Math.max(r,e.x+e.w),e.w===i.w&&e.h===i.h){const e=s.pop();t<s.length&&(s[t]=e)}else e.h===i.h?(i.x+=e.w,i.w-=e.w):e.w===i.w?(i.y+=e.h,i.h-=e.h):(s.push({x:i.x+e.w,y:i.y,w:i.w-e.w,h:e.h}),i.y+=e.h,i.h-=e.h);break}}return{w:r,h:n,fill:e/(r*n)||0}}(t);this.log("Rebuilt atlas:",a),e.width==a.w&&e.height==a.h||(e.width=a.w,e.height=a.h);for(let r=0;r<t.length;r++){const t=this.entries[r],n=4*t.texture.textureIndex;o===I&&(i[n+0]=t.x/e.width,i[n+1]=t.y/e.height,i[n+2]=(t.x+t.w)/e.width,i[n+3]=(t.y+t.h)/e.height),o===R&&(i[n+0]=t.x/(e.width+1),i[n+1]=t.y/(e.height+1),i[n+2]=(t.x+t.w)/(e.width+1),i[n+3]=(t.y+t.h)/(e.height+1)),s.drawImage(t.texture.image,t.x,t.y,t.w,t.h)}o===I&&(r.needsUpdate=!0),n.needsUpdate=!0}destroy(){const{atlasIndex:t,atlasTexture:e,canvas:i}=this;e.dispose(),t&&t.dispose(),this.shouldDebug&&i.remove(),this.entries=[]}}const ss="600.0";function rs(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,s)}return i}function ns(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?rs(Object(i),!0).forEach(function(e){_t(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):rs(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}let os,as;class hs extends ki{constructor(t,e,i=Hi){super(I),os=this.three=e;const s=ns(ns({},Hi),i),{camera:r,maxParticles:n,baseColor:o,blending:a,depthTest:h,depthWrite:c,transparent:u,shouldDebugTextureAtlas:l}=s,d=new es(n,os),p=new os.ShaderMaterial({uniforms:{baseColor:{value:new os.Color(o)},uTexture:{value:null},atlasIndex:{value:null}},vertexShader:`\n uniform sampler2D uTexture;\n //atlasIndex is a 256x1 float texture of tile rectangles as r=minx g=miny b=maxx a=maxy\n uniform sampler2D atlasIndex;\n\n attribute float size;\n attribute vec3 color;\n attribute float alpha;\n attribute float texID;\n attribute float rotation;\n\n varying float vRotation;\n varying vec3 targetColor;\n varying float targetAlpha;\n varying vec4 tileRect;\n varying float tileID;\n\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n targetColor = color;\n targetAlpha = alpha;\n vRotation = rotation;\n\n tileID = texID;\n //get the tile rectangle from the atlasIndex texture..\n tileRect = texture2D(atlasIndex, vec2((tileID + 0.5) / 256.0, 0.5));\n\n gl_PointSize = ((size * ${ss}) / -mvPosition.z);\n gl_Position = projectionMatrix * mvPosition;\n }\n`,fragmentShader:"\n uniform vec3 baseColor;\n uniform sampler2D uTexture;\n uniform sampler2D atlasIndex;\n\n varying float vRotation;\n varying vec3 targetColor;\n varying float targetAlpha;\n varying vec4 tileRect;\n varying float tileID;\n\n void main() {\n gl_FragColor = vec4(baseColor * targetColor, targetAlpha);\n\n vec2 uv = gl_PointCoord;\n uv = mix(tileRect.xy, tileRect.zw, gl_PointCoord);\n\n float mid = 0.5;\n uv = vec2(\n cos(vRotation) * (uv.x - mid) - sin(vRotation) * (uv.y - mid) + mid,\n cos(vRotation) * (uv.y - mid) + sin(vRotation) * (uv.x - mid) + mid\n );\n\n gl_FragColor = gl_FragColor * texture2D(uTexture, uv);\n\n }\n",blending:os[a],depthTest:h,depthWrite:c,transparent:u});this.container=t,this.camera=r,this.targetPool=new fe,this.uniqueList=new Ki(n),this.particleBuffer=d,this.buffer=d.buffer,this.stride=d.stride,this.geometry=d.geometry,this.material=p,this.points=new os.Points(this.geometry,this.material),this.points.frustumCulled=!1,this.shouldDebugTextureAtlas=l,this.container.add(this.points)}onSystemUpdate(t){super.onSystemUpdate(t),this.buffer.needsUpdate=!0,this.textureAtlas&&this.textureAtlas.update()}onParticleCreated(t){t.target||(t.target=this.targetPool.get(Wi,os),this.uniqueList.add(t.id)),this.updateTarget(t).mapParticleTargetPropsToPoint(t)}onParticleUpdate(t){t.target&&this.updateTarget(t).mapParticleTargetPropsToPoint(t)}onParticleDead(t){t.target&&(t.target.reset(),this.mapParticleTargetPropsToPoint(t),t.target=null)}updateTarget(t){const{position:e,rotation:i,scale:s,radius:r,color:n,alpha:o,body:a,id:h}=t,{r:c,g:u,b:l}=n;if(t.target.position.copy(e),t.target.rotation.copy(i),t.target.size=s*r,t.target.color.setRGB(c,u,l),t.target.alpha=o,t.target.index=this.uniqueList.find(h),a&&a instanceof os.Sprite){const{map:e}=a.material;t.target.texture=e,t.target.textureIndex=this.getTextureID(e,this.shouldDebugTextureAtlas)}return this}mapParticleTargetPropsToPoint(t){return this.updatePointPosition(t).updatePointSize(t).updatePointRotation(t).updatePointColor(t).updatePointAlpha(t).updatePointTextureIndex(t),this}updatePointPosition(t){const{geometry:e,stride:i,buffer:s}=this,{target:r}=t,{offset:n}=e.attributes.position;return s.array[r.index*i+n+0]=r.position.x,s.array[r.index*i+n+1]=r.position.y,s.array[r.index*i+n+2]=r.position.z,this}updatePointSize(t){const{geometry:e,stride:i,buffer:s}=this,{target:r}=t,{offset:n}=e.attributes.size;return s.array[r.index*i+n+0]=r.size,this}updatePointRotation(t){const{geometry:e,stride:i,buffer:s}=this,{target:r}=t,{offset:n}=e.attributes.rotation;return s.array[r.index*i+n+0]=r.rotation.z,this}updatePointColor(t){const{geometry:e,stride:i,buffer:s}=this,{target:r}=t,{offset:n}=e.attributes.color;return s.array[r.index*i+n+0]=r.color.r,s.array[r.index*i+n+1]=r.color.g,s.array[r.index*i+n+2]=r.color.b,this}updatePointAlpha(t){const{geometry:e,stride:i,buffer:s}=this,{target:r}=t,{offset:n}=e.attributes.alpha;return s.array[r.index*i+n+0]=r.alpha,this}updatePointTextureIndex(t){const{geometry:e,stride:i,buffer:s}=this,{target:r}=t,{offset:n}=e.attributes.texID;return s.array[r.index*i+n+0]=r.textureIndex,this}getTextureID(t,e){return void 0===t.textureIndex&&(this.textureAtlas||(this.textureAtlas=new is(this,e)),this.textureAtlas.addTexture(t)),t.textureIndex}destroy(){const{container:t,points:e,textureAtlas:i,uniqueList:s}=this;t.remove(e),s.destroy(),i&&i.destroy()}}function cs(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,s)}return i}function us(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?cs(Object(i),!0).forEach(function(e){_t(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):cs(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}class ls extends ki{constructor(t,e,i=Hi){super(R),as=this.three=e;const s=us(us({},Hi),i),{camera:r,maxParticles:n,baseColor:o,blending:a,depthTest:h,depthWrite:c,transparent:u,shouldDebugTextureAtlas:l}=s,d=new es(n,as),p=new as.ShaderMaterial({uniforms:{baseColor:{value:new as.Color(o)},uTexture:{value:null},FFatlasIndex:{value:null},atlasDim:{value:new as.Vector2}},vertexShader:`\n uniform sampler2D uTexture;\n uniform vec2 atlasDim;\n\n attribute float size;\n attribute vec3 color;\n attribute float alpha;\n attribute vec2 texID;\n attribute float rotation;\n\n varying float vRotation;\n varying vec3 targetColor;\n varying float targetAlpha;\n varying vec4 tileRect;\n\n void main() {\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n targetColor = color;\n targetAlpha = alpha;\n vRotation = rotation;\n\n vec2 tmin = floor(texID) / atlasDim;\n vec2 tmax = fract(texID);\n tileRect = vec4(tmin,tmax);\n\n gl_PointSize = ((size * ${ss}) / -mvPosition.z);\n gl_Position = projectionMatrix * mvPosition;\n }\n`,fragmentShader:"\n uniform vec3 baseColor;\n uniform sampler2D uTexture;\n\n varying float vRotation;\n varying vec3 targetColor;\n varying float targetAlpha;\n varying vec4 tileRect;\n\n void main() {\n gl_FragColor = vec4(baseColor * targetColor, targetAlpha);\n\n vec2 uv = gl_PointCoord;\n uv = mix(tileRect.xy, tileRect.zw, gl_PointCoord);\n\n float mid = 0.5;\n uv = vec2(\n cos(vRotation) * (uv.x - mid) - sin(vRotation) * (uv.y - mid) + mid,\n cos(vRotation) * (uv.y - mid) + sin(vRotation) * (uv.x - mid) + mid\n );\n \n gl_FragColor = gl_FragColor * texture2D(uTexture, uv);\n }\n",blending:as[a],depthTest:h,depthWrite:c,transparent:u});this.camera=r,this.targetPool=new fe,this.uniqueList=new Ki(n),this.particleBuffer=d,this.buffer=d.buffer,this.stride=d.stride,this.geometry=d.geometry,this.material=p,this.points=new as.Points(this.geometry,this.material),this.points.frustumCulled=!1,this.shouldDebugTextureAtlas=l,t.add(this.points)}onSystemUpdate(t){super.onSystemUpdate(t),this.buffer.needsUpdate=!0;const{textureAtlas:e}=this;e&&(e.update(),this.material.uniforms.atlasDim.value.set(e.atlasTexture.image.width,e.atlasTexture.image.height))}onParticleCreated(t){t.target||(t.target=this.targetPool.get(Wi,as),this.uniqueList.add(t.id)),this.updateTarget(t).mapParticleTargetPropsToPoint(t)}onParticleUpdate(t){t.target&&this.updateTarget(t).mapParticleTargetPropsToPoint(t)}onParticleDead(t){t.target&&(t.target.reset(),this.mapParticleTargetPropsToPoint(t),t.target=null)}updateTarget(t){const{position:e,rotation:i,scale:s,radius:r,color:n,alpha:o,body:a,id:h}=t,{r:c,g:u,b:l}=n;if(t.target.position.copy(e),t.target.rotation.copy(i),t.target.size=s*r,t.target.color.setRGB(c,u,l),t.target.alpha=o,t.target.index=this.uniqueList.find(h),a&&a instanceof as.Sprite){const{map:e}=a.material;t.target.texture=e,t.target.textureIndex=this.getTextureID(e,this.shouldDebugTextureAtlas)}return this}mapParticleTargetPropsToPoint(t){return this.updatePointPosition(t).updatePointSize(t).updatePointRotation(t).updatePointColor(t).updatePointAlpha(t).updatePointTextureIndex(t),this}updatePointPosition(t){const{geometry:e,stride:i,buffer:s}=this,{target:r}=t,{offset:n}=e.attributes.position;return s.array[r.index*i+n+0]=r.position.x,s.array[r.index*i+n+1]=r.position.y,s.array[r.index*i+n+2]=r.position.z,this}updatePointSize(t){const{geometry:e,stride:i,buffer:s}=this,{target:r}=t,{offset:n}=e.attributes.size;return s.array[r.index*i+n+0]=r.size,this}updatePointRotation(t){const{geometry:e,stride:i,buffer:s}=this,{target:r}=t,{offset:n}=e.attributes.rotation;return s.array[r.index*i+n+0]=r.rotation.z,this}updatePointColor(t){const{geometry:e,stride:i,buffer:s}=this,{target:r}=t,{offset:n}=e.attributes.color;return s.array[r.index*i+n+0]=r.color.r,s.array[r.index*i+n+1]=r.color.g,s.array[r.index*i+n+2]=r.color.b,this}updatePointAlpha(t){const{geometry:e,stride:i,buffer:s}=this,{target:r}=t,{offset:n}=e.attributes.alpha;return s.array[r.index*i+n+0]=r.alpha,this}updatePointTextureIndex(t){const{geometry:e,stride:i,buffer:s}=this,{target:r}=t,{offset:n}=e.attributes.texID,o=r.index*i+n+0;{let t=4*r.textureIndex;const e=this.textureAtlas,i=e.indexData,n=i[t++],a=i[t++],h=i[t++],c=i[t++];s.array[o]=(n*e.atlasTexture.image.width|0)+h,s.array[o+1]=(a*e.atlasTexture.image.height|0)+c}return this}getTextureID(t,e){return void 0===t.textureIndex&&(this.textureAtlas||(this.textureAtlas=new is(this,e)),this.textureAtlas.addTexture(t)),t.textureIndex}destroy(){const{container:t,points:e,textureAtlas:i,uniqueList:s}=this;t.remove(e),s.destroy(),i&&i.destroy()}}class ds extends ki{constructor(t,e,i=Hi){super("GPURenderer");const{shouldForceDesktopRenderer:s,shouldForceMobileRenderer:r}=i,n=[t,e,i];return s?new hs(...n):r?new ls(...n):this.isFloatingPointTextureSupported()?new hs(...n):new ls(...n)}isFloatingPointTextureSupported(){const t=document.createElement("canvas");if(window.WebGL2RenderingContext&&t.getContext("webgl2"))return!0;const e=!!t.getContext("webgl").getExtension("OES_texture_float");return t.remove(),e}}const ps=Ri})(),s})()});
2
2
  //# sourceMappingURL=three-nebula.js.map