aframe-babia-components 1.2.0 → 1.2.3

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 (127) hide show
  1. package/components/filters/babia-selector.js +256 -79
  2. package/components/filters/babia-treebuilder.js +4 -5
  3. package/components/geometries/babia-cyl.js +180 -0
  4. package/components/others/assets/tooltip.png +0 -0
  5. package/components/others/babia-camera.js +195 -0
  6. package/components/others/babia-controls.js +62 -37
  7. package/components/others/babia-navigator.js +55 -49
  8. package/components/others/babia-range-selector.js +208 -0
  9. package/components/others/babia-slider.js +36 -8
  10. package/components/others/babia-ui.js +246 -73
  11. package/components/others/common.js +60 -73
  12. package/components/queriers/babia-querycsv.js +96 -0
  13. package/components/queriers/babia-queryes.js +203 -132
  14. package/components/visualizers/babia-bars.js +4 -35
  15. package/components/visualizers/babia-barsmap.js +2 -30
  16. package/components/visualizers/babia-boats.js +291 -279
  17. package/components/visualizers/babia-bubbles.js +9 -26
  18. package/components/visualizers/babia-city.js +19 -9
  19. package/components/visualizers/babia-cyls.js +197 -201
  20. package/components/visualizers/babia-cylsmap.js +171 -241
  21. package/components/visualizers/babia-doughnut.js +2 -28
  22. package/components/visualizers/babia-network.js +191 -124
  23. package/components/visualizers/babia-pie.js +2 -30
  24. package/dist/aframe-babia-components.js +6785 -5626
  25. package/dist/aframe-babia-components.min.js +7 -1
  26. package/dist/aframe-babia-components.min.js.map +1 -0
  27. package/docs/APIs/CHARTS.md +11 -4
  28. package/docs/APIs/DATAMANAGEMENT.md +7 -0
  29. package/docs/APIs/OTHERS.md +27 -0
  30. package/docs/APIs/QUERIERS.md +16 -0
  31. package/docs/RELEASE_NOTES.md +44 -23
  32. package/docs/Tutorials/multiuser.md +47 -2
  33. package/docs/Tutorials/temporal_evol_with_boats.md +4 -4
  34. package/examples/assets/door/New Bitmap Image.jpg +0 -0
  35. package/examples/assets/door/door.mtl +26 -0
  36. package/examples/assets/door/door.obj +6927 -0
  37. package/examples/assets/popups/0.png +0 -0
  38. package/examples/assets/popups/1.png +0 -0
  39. package/examples/assets/popups/10.png +0 -0
  40. package/examples/assets/popups/2.png +0 -0
  41. package/examples/assets/popups/3.png +0 -0
  42. package/examples/assets/popups/4.png +0 -0
  43. package/examples/assets/popups/5.png +0 -0
  44. package/examples/assets/popups/6.png +0 -0
  45. package/examples/assets/popups/7.png +0 -0
  46. package/examples/assets/popups/8.png +0 -0
  47. package/examples/assets/popups/9.png +0 -0
  48. package/examples/assets/popups/close.jpg +0 -0
  49. package/examples/assets/popups/info.jpg +0 -0
  50. package/examples/assets/textures/brownwall.png +0 -0
  51. package/examples/assets/textures/concrete.png +0 -0
  52. package/examples/assets/textures/white-wall-texture.jpg +0 -0
  53. package/examples/boats/boats_new_element/data1.json +18 -18
  54. package/examples/boats/boats_new_element/data2.json +19 -19
  55. package/examples/boats/boats_new_element/index.html +1 -1
  56. package/examples/charts/cyls/index.html +13 -4
  57. package/examples/charts/cyls/primitive.html +76 -0
  58. package/examples/charts/cylsmap/index.html +14 -5
  59. package/examples/charts_querier/bars_querier/data.csv +10 -0
  60. package/examples/charts_querier/bars_querier/index_csv.html +80 -0
  61. package/examples/dashboard/chaoss-dashboards.html +259 -0
  62. package/examples/dashboard/chaoss-issues.html +248 -0
  63. package/examples/dashboard/chaoss-pr.html +248 -0
  64. package/examples/dashboard/index.html +247 -0
  65. package/examples/dashboard/issues_queries/80-percent-open-time.json +123 -0
  66. package/examples/dashboard/issues_queries/issues-by-organization.json +107 -0
  67. package/examples/dashboard/issues_queries/issues.json +117 -0
  68. package/examples/dashboard/issues_queries/median-open-time.json +123 -0
  69. package/examples/dashboard/issues_queries/organizations.json +130 -0
  70. package/examples/dashboard/issues_queries/projects.json +130 -0
  71. package/examples/dashboard/issues_queries/repositories.json +130 -0
  72. package/examples/dashboard/issues_queries/status.json +107 -0
  73. package/examples/dashboard/issues_queries/submitter.json +125 -0
  74. package/examples/dashboard/issues_queries/submitters.json +113 -0
  75. package/examples/dashboard/pullrequests_queries/80-percent-open-time.json +123 -0
  76. package/examples/dashboard/pullrequests_queries/median-open-time.json +123 -0
  77. package/examples/dashboard/pullrequests_queries/organizations.json +130 -0
  78. package/examples/dashboard/pullrequests_queries/projects.json +130 -0
  79. package/examples/dashboard/pullrequests_queries/pull-requests-by-organization.json +107 -0
  80. package/examples/dashboard/pullrequests_queries/pull-requests.json +117 -0
  81. package/examples/dashboard/pullrequests_queries/repositories.json +130 -0
  82. package/examples/dashboard/pullrequests_queries/status.json +107 -0
  83. package/examples/dashboard/pullrequests_queries/submitter.json +125 -0
  84. package/examples/dashboard/pullrequests_queries/submitters.json +113 -0
  85. package/examples/dashboard/range.html +88 -0
  86. package/examples/dashboard/template.html +136 -0
  87. package/examples/demos/1.0.11/index_multiuser_ui.html +1 -1
  88. package/examples/multi_bars/data.json +14 -0
  89. package/examples/multi_bars/data2.json +15 -0
  90. package/examples/multi_bars/data3.json +23 -0
  91. package/examples/multi_bars/easyrtc.js +11984 -0
  92. package/examples/multi_bars/index.html +97 -0
  93. package/examples/multi_bars/index1.html +111 -0
  94. package/examples/multi_bars/index2.html +102 -0
  95. package/examples/multi_bars/index3.html +104 -0
  96. package/examples/multi_boats/data3.json +174 -0
  97. package/examples/multi_boats/data4.json +192 -0
  98. package/examples/multi_boats/easyrtc.js +11984 -0
  99. package/examples/multi_boats/index_multi_boats.html +223 -0
  100. package/examples/multi_boats/jetuml.html +256 -0
  101. package/examples/multi_boats/jetuml_code_data.json +1 -0
  102. package/examples/multi_boats/jetuml_evolution_experiment.html +419 -0
  103. package/examples/multi_boats/only_queryjson.html +132 -0
  104. package/examples/multi_boats/only_queryjson2.html +167 -0
  105. package/examples/multi_boats/only_queryjson3.html +165 -0
  106. package/examples/multi_boats/queryjson_treebuilder.html +132 -0
  107. package/examples/multi_boats/with_selector.html +255 -0
  108. package/examples/multiuser/choose_avatar/index.html +18 -8
  109. package/examples/selector_boats/jetuml.html +74 -0
  110. package/examples/selector_boats/jetuml_evol_data.json +1 -0
  111. package/examples/selector_boats/jetuml_from_3_2_to_1_0.json +62382 -0
  112. package/examples/selector_boats/jetumltest.html +80 -0
  113. package/examples/ui/link/index.html +12 -11
  114. package/examples/ui/network/data.json +123 -0
  115. package/examples/ui/network/links.json +13 -0
  116. package/examples/ui/network/network.html +75 -0
  117. package/examples/ui/network/network_nodes_links.html +82 -0
  118. package/examples/ui/network/nodes.json +12 -0
  119. package/index.html +73 -2
  120. package/index.js +12 -1
  121. package/package.json +6 -3
  122. package/tests/screenshots/other_snapshots.js/chaoss-issues.png +0 -0
  123. package/tests/screenshots/other_snapshots.js/chaoss-pr.png +0 -0
  124. package/tests/screenshots/other_snapshots.js/template.png +0 -0
  125. package/tests/ui.js +7 -0
  126. package/webpack.common.js +10 -1
  127. package/webpack.devnossl.js +16 -0
@@ -1,2 +1,8 @@
1
- !function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=11)}([function(t,e){let n=(t,e)=>{t.emit("babiaVisualizerUpdated",e)};t.exports.dataReadyToSend=(t,e)=>{e.interestedElements.forEach(e=>{n(e,t)})},t.exports.dispatchEventOnElement=n,t.exports.findDataComponent=(t,e,n)=>{let i="babiaQuerierDataReady";if(t.from){let r=document.getElementById(t.from);if(r.components["babia-filter"])n.dataComponent=r.components["babia-filter"],i="babiaFilterDataReady";else if(r.components["babia-queryjson"])n.dataComponent=r.components["babia-queryjson"];else if(r.components["babia-queryes"])n.dataComponent=r.components["babia-queryes"];else if(r.components["babia-querygithub"])n.dataComponent=r.components["babia-querygithub"];else{if(!r.components["babia-selector"])return void console.error("Problem registering to the querier",e);n.dataComponent=r.components["babia-selector"],i="babiaSelectorDataReady"}}else if(e.components["babia-filter"])n.dataComponent=e.components["babia-filter"],i="babiaFilterDataReady";else if(e.components["babia-queryjson"])n.dataComponent=e.components["babia-queryjson"];else if(e.components["babia-queryes"])n.dataComponent=e.components["babia-queryes"];else if(e.components["babia-querygithub"])n.dataComponent=e.components["babia-querygithub"];else if(e.components["babia-selector"])n.dataComponent=e.components["babia-selector"],i="babiaSelectorDataReady";else if(document.querySelectorAll("[babia-filter]").length>0)n.dataComponent=document.querySelectorAll("[babia-filter]")[0].components["babia-filter"],i="babiaFilterDataReady";else if(document.querySelectorAll("[babia-queryjson]").length>0)n.dataComponent=document.querySelectorAll("[babia-queryjson]")[0].components["babia-queryjson"];else if(document.querySelectorAll("[babia-queryjson]").length>0)n.dataComponent=document.querySelectorAll("[babia-queryes]")[0].components["babia-queryes"];else if(document.querySelectorAll("[babia-querygithub]").length>0)n.dataComponent=document.querySelectorAll("[babia-querygithub]")[0].components["babia-querygithub"];else{if(!(document.querySelectorAll("[babia-selector]").length>0))return void console.error("Error, querier not found",e,e.components,e.components["babia-selector"]);n.dataComponent=document.querySelectorAll("[babia-selector]")[0].components["babia-selector"],i="babiaSelectorDataReady"}return i},t.exports.findProdComponent=(t,e,n)=>{let i;if(t.from){let n=document.getElementById(t.from);if(n.components["babia-filter"])i=n.components["babia-filter"];else if(n.components["babia-queryjson"])i=n.components["babia-queryjson"];else if(n.components["babia-queryes"])i=n.components["babia-queryes"];else if(n.components["babia-querygithub"])i=n.components["babia-querygithub"];else if(n.components["babia-selector"])i=n.components["babia-selector"];else{if(!n.components["babia-treebuilder"])return void console.error("Problem registering to the querier",e);i=n.components["babia-treebuilder"]}}else{if(t.nodesFrom){let n=document.getElementById(t.nodesFrom);if(n.components["babia-filter"])prodComponentNodes=n.components["babia-filter"];else if(n.components["babia-queryjson"])prodComponentNodes=n.components["babia-queryjson"];else if(n.components["babia-queryes"])prodComponentNodes=n.components["babia-queryes"];else{if(!n.components["babia-querygithub"])return void console.error("Problem registering to the querier",e);prodComponentNodes=n.components["babia-querygithub"]}let i=document.getElementById(t.linksFrom);if(i.components["babia-filter"])prodComponentLinks=i.components["babia-filter"];else if(i.components["babia-queryjson"])prodComponentLinks=i.components["babia-queryjson"];else if(i.components["babia-queryes"])prodComponentLinks=i.components["babia-queryes"];else{if(!i.components["babia-querygithub"])return void console.error("Problem registering to the querier",e);prodComponentLinks=i.components["babia-querygithub"]}return{nodes:prodComponentNodes,links:prodComponentLinks}}if(e.components["babia-filter"]&&"babia-filter"!=n)i=e.components["babia-filter"];else if(e.components["babia-queryjson"]&&"babia-queryjson"!=n)i=e.components["babia-queryjson"];else if(e.components["babia-queryes"]&&"babia-queryes"!=n)i=e.components["babia-queryes"];else if(e.components["babia-querygithub"]&&"babia-querygithub"!=n)i=e.components["babia-querygithub"];else if(e.components["babia-selector"]&&"babia-selector"!=n)i=e.components["babia-selector"];else if(e.components["babia-treebuilder"])i=e.components["babia-treebuilder"];else if(document.querySelectorAll("[babia-filter]").length>0)i=document.querySelectorAll("[babia-filter]")[0].components["babia-filter"];else if(document.querySelectorAll("[babia-queryjson]").length>0)i=document.querySelectorAll("[babia-queryjson]")[0].components["babia-queryjson"];else if(document.querySelectorAll("[babia-queryjson]").length>0)i=document.querySelectorAll("[babia-queryes]")[0].components["babia-queryes"];else if(document.querySelectorAll("[babia-querygithub]").length>0)i=document.querySelectorAll("[babia-querygithub]")[0].components["babia-querygithub"];else if(document.querySelectorAll("[babia-selector]").length>0)i=document.querySelectorAll("[babia-selector]")[0].components["babia-selector"];else{if(!(document.querySelectorAll("[babia-treebuilder]").length>0))return void console.error("Error, querier not found",e,e.components,e.components["babia-selector"]);i=document.querySelectorAll("[babia-treebuilder]")[0].components["babia-treebuilder"]}}return i},t.exports.findNavComponent=(t,e)=>{let n;if(t.controller){let i=document.getElementById(t.controller);if(!i.components["babia-navigator"])return void console.error("Problem registering to the navigator",e);n=i.components["babia-navigator"]}else if(e.components["babia-navigator"])n=e.components["babia-navigator"];else{if(!(document.querySelectorAll("[babia-navigator]").length>0))return void console.error("Error, navigator not found",e,e.components,e.components["babia-navigator"]);n=document.querySelectorAll("[babia-navigator]")[0].components["babia-navigator"]}return n},t.exports.findTargetComponent=(t,e)=>{let n;if(t.target){{let e=document.getElementById(t.target);if(null==e)return void console.error("Target not exist.");if(e.components["babia-bars"])n=e.components["babia-bars"];else if(e.components["babia-barsmap"])n=e.components["babia-barsmap"];else if(e.components["babia-cyls"])n=e.components["babia-cyls"];else if(e.components["babia-cylsmap"])n=e.components["babia-cylsmap"];else if(e.components["babia-pie"])n=e.components["babia-pie"];else if(e.components["babia-doughnut"])n=e.components["babia-doughnut"];else if(e.components["babia-bubbles"])n=e.components["babia-bubbles"];else if(e.components["babia-city"])n=e.components["babia-city"];else{if(!e.components["babia-boats"])return void console.error("Visualizer not found.");n=e.components["babia-boats"]}}return n}console.error("Error: Target not inserted. ")},t.exports.colors={palettes:{blues:["#142850","#27496d","#00909e","#dae1e7"],foxy:["#f79071","#fa744f","#16817a","#024249"],flat:["#120136","#035aa6","#40bad5","#fcbf1e"],sunset:["#202040","#543864","#ff6363","#ffbd69"],bussiness:["#de7119","#dee3e2","#116979","#18b0b0"],icecream:["#f76a8c","#f8dc88","#f8fab8","#ccf0e1"],ubuntu:["#511845","#900c3f","#c70039","#ff5733"],pearl:["#efa8e4","#f8e1f4","#fff0f5","#97e5ef"],commerce:["#222831","#30475e","#f2a365","#ececec"]},get:function(t,e){let n=this.palettes[e].length;return this.palettes[e][t%n]}},t.exports.updateTitle=(t,e)=>{let n=document.createElement("a-entity");return n.classList.add("babiaxrTitle"),n.setAttribute("text-geometry",{value:t.title}),t.titleFont&&n.setAttribute("text-geometry",{font:t.titleFont}),t.titleColor&&n.setAttribute("material",{color:t.titleColor}),n.setAttribute("position",t.titlePosition),n.setAttribute("rotation",e),n},t.exports.parseJson=t=>{let e;return e="string"==typeof t||t instanceof String?JSON.parse(t):t,e}},function(t,e,n){"use strict";n.r(e);e.default=function(t){return t instanceof Function?t:"string"==typeof t?function(e){return e[t]}:function(e){return t}}},function(t,e,n){class i{constructor(t,e){this.currentId=0,this.notifiers={},this.data,this.function1=t,this.function2=e}set(t){console.log("produced",t),this.data=t;for(const t of Object.values(this.notifiers))t(this.data)}register(t,e){void 0!==this.data&&(console.log("Data was ready"),t(this.data));let n=this.currentId;return this.notifiers[n]=t,this.currentId++,e&&this.function1&&this.function1(e),n}unregister(t,e){delete this.notifiers[t],e&&this.function2&&this.function2(e)}}t.exports.NotiBuffer=i},function(t,e,n){const i=n(7);t.exports=function(t){return function(e,n){let r=n&&n.indent||0,a=n&&void 0!==n.join?n.join:"\n",s=Array(r+1).join(" "),o=[];for(let n=0;n<t;++n){let t=i(n),r=0===n?"":s;o.push(r+e.replace(/{var}/g,t))}return o.join(a)}}},function(t,e){t.exports=function(t){!function(t){if(!t)throw new Error("Eventify cannot use falsy object as events subject");for(var e=["on","fire","off"],n=0;n<e.length;++n)if(t.hasOwnProperty(e[n]))throw new Error("Subject cannot be eventified, since it already has property '"+e[n]+"'")}(t);var e=function(t){var e=Object.create(null);return{on:function(n,i,r){if("function"!=typeof i)throw new Error("callback is expected to be a function");var a=e[n];return a||(a=e[n]=[]),a.push({callback:i,ctx:r}),t},off:function(n,i){if(void 0===n)return e=Object.create(null),t;if(e[n])if("function"!=typeof i)delete e[n];else for(var r=e[n],a=0;a<r.length;++a)r[a].callback===i&&r.splice(a,1);return t},fire:function(n){var i,r=e[n];if(!r)return t;arguments.length>1&&(i=Array.prototype.splice.call(arguments,1));for(var a=0;a<r.length;++a){var s=r[a];s.callback.apply(s.ctx,i)}return t}}}(t);return t.on=e.on,t.off=e.off,t.fire=e.fire,t}},function(t,e,n){var i;!function(r){var a=/^\s+/,s=/\s+$/,o=0,l=r.round,h=r.min,c=r.max,u=r.random;function d(t,e){if(e=e||{},(t=t||"")instanceof d)return t;if(!(this instanceof d))return new d(t,e);var n=function(t){var e={r:0,g:0,b:0},n=1,i=null,o=null,l=null,u=!1,d=!1;"string"==typeof t&&(t=function(t){t=t.replace(a,"").replace(s,"").toLowerCase();var e,n=!1;if(R[t])t=R[t],n=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};if(e=G.rgb.exec(t))return{r:e[1],g:e[2],b:e[3]};if(e=G.rgba.exec(t))return{r:e[1],g:e[2],b:e[3],a:e[4]};if(e=G.hsl.exec(t))return{h:e[1],s:e[2],l:e[3]};if(e=G.hsla.exec(t))return{h:e[1],s:e[2],l:e[3],a:e[4]};if(e=G.hsv.exec(t))return{h:e[1],s:e[2],v:e[3]};if(e=G.hsva.exec(t))return{h:e[1],s:e[2],v:e[3],a:e[4]};if(e=G.hex8.exec(t))return{r:N(e[1]),g:N(e[2]),b:N(e[3]),a:F(e[4]),format:n?"name":"hex8"};if(e=G.hex6.exec(t))return{r:N(e[1]),g:N(e[2]),b:N(e[3]),format:n?"name":"hex"};if(e=G.hex4.exec(t))return{r:N(e[1]+""+e[1]),g:N(e[2]+""+e[2]),b:N(e[3]+""+e[3]),a:F(e[4]+""+e[4]),format:n?"name":"hex8"};if(e=G.hex3.exec(t))return{r:N(e[1]+""+e[1]),g:N(e[2]+""+e[2]),b:N(e[3]+""+e[3]),format:n?"name":"hex"};return!1}(t));"object"==typeof t&&(W(t.r)&&W(t.g)&&W(t.b)?(p=t.r,f=t.g,m=t.b,e={r:255*I(p,255),g:255*I(f,255),b:255*I(m,255)},u=!0,d="%"===String(t.r).substr(-1)?"prgb":"rgb"):W(t.h)&&W(t.s)&&W(t.v)?(i=k(t.s),o=k(t.v),e=function(t,e,n){t=6*I(t,360),e=I(e,100),n=I(n,100);var i=r.floor(t),a=t-i,s=n*(1-e),o=n*(1-a*e),l=n*(1-(1-a)*e),h=i%6;return{r:255*[n,o,s,s,l,n][h],g:255*[l,n,n,o,s,s][h],b:255*[s,s,l,n,n,o][h]}}(t.h,i,o),u=!0,d="hsv"):W(t.h)&&W(t.s)&&W(t.l)&&(i=k(t.s),l=k(t.l),e=function(t,e,n){var i,r,a;function s(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}if(t=I(t,360),e=I(e,100),n=I(n,100),0===e)i=r=a=n;else{var o=n<.5?n*(1+e):n+e-n*e,l=2*n-o;i=s(l,o,t+1/3),r=s(l,o,t),a=s(l,o,t-1/3)}return{r:255*i,g:255*r,b:255*a}}(t.h,i,l),u=!0,d="hsl"),t.hasOwnProperty("a")&&(n=t.a));var p,f,m;return n=D(n),{ok:u,format:t.format||d,r:h(255,c(e.r,0)),g:h(255,c(e.g,0)),b:h(255,c(e.b,0)),a:n}}(t);this._originalInput=t,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=l(100*this._a)/100,this._format=e.format||n.format,this._gradientType=e.gradientType,this._r<1&&(this._r=l(this._r)),this._g<1&&(this._g=l(this._g)),this._b<1&&(this._b=l(this._b)),this._ok=n.ok,this._tc_id=o++}function p(t,e,n){t=I(t,255),e=I(e,255),n=I(n,255);var i,r,a=c(t,e,n),s=h(t,e,n),o=(a+s)/2;if(a==s)i=r=0;else{var l=a-s;switch(r=o>.5?l/(2-a-s):l/(a+s),a){case t:i=(e-n)/l+(e<n?6:0);break;case e:i=(n-t)/l+2;break;case n:i=(t-e)/l+4}i/=6}return{h:i,s:r,l:o}}function f(t,e,n){t=I(t,255),e=I(e,255),n=I(n,255);var i,r,a=c(t,e,n),s=h(t,e,n),o=a,l=a-s;if(r=0===a?0:l/a,a==s)i=0;else{switch(a){case t:i=(e-n)/l+(e<n?6:0);break;case e:i=(n-t)/l+2;break;case n:i=(t-e)/l+4}i/=6}return{h:i,s:r,v:o}}function m(t,e,n,i){var r=[B(l(t).toString(16)),B(l(e).toString(16)),B(l(n).toString(16))];return i&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function g(t,e,n,i){return[B(O(i)),B(l(t).toString(16)),B(l(e).toString(16)),B(l(n).toString(16))].join("")}function v(t,e){e=0===e?0:e||10;var n=d(t).toHsl();return n.s-=e/100,n.s=z(n.s),d(n)}function y(t,e){e=0===e?0:e||10;var n=d(t).toHsl();return n.s+=e/100,n.s=z(n.s),d(n)}function b(t){return d(t).desaturate(100)}function x(t,e){e=0===e?0:e||10;var n=d(t).toHsl();return n.l+=e/100,n.l=z(n.l),d(n)}function _(t,e){e=0===e?0:e||10;var n=d(t).toRgb();return n.r=c(0,h(255,n.r-l(-e/100*255))),n.g=c(0,h(255,n.g-l(-e/100*255))),n.b=c(0,h(255,n.b-l(-e/100*255))),d(n)}function w(t,e){e=0===e?0:e||10;var n=d(t).toHsl();return n.l-=e/100,n.l=z(n.l),d(n)}function M(t,e){var n=d(t).toHsl(),i=(n.h+e)%360;return n.h=i<0?360+i:i,d(n)}function E(t){var e=d(t).toHsl();return e.h=(e.h+180)%360,d(e)}function S(t){var e=d(t).toHsl(),n=e.h;return[d(t),d({h:(n+120)%360,s:e.s,l:e.l}),d({h:(n+240)%360,s:e.s,l:e.l})]}function A(t){var e=d(t).toHsl(),n=e.h;return[d(t),d({h:(n+90)%360,s:e.s,l:e.l}),d({h:(n+180)%360,s:e.s,l:e.l}),d({h:(n+270)%360,s:e.s,l:e.l})]}function T(t){var e=d(t).toHsl(),n=e.h;return[d(t),d({h:(n+72)%360,s:e.s,l:e.l}),d({h:(n+216)%360,s:e.s,l:e.l})]}function C(t,e,n){e=e||6,n=n||30;var i=d(t).toHsl(),r=360/n,a=[d(t)];for(i.h=(i.h-(r*e>>1)+720)%360;--e;)i.h=(i.h+r)%360,a.push(d(i));return a}function L(t,e){e=e||6;for(var n=d(t).toHsv(),i=n.h,r=n.s,a=n.v,s=[],o=1/e;e--;)s.push(d({h:i,s:r,v:a})),a=(a+o)%1;return s}d.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,n,i=this.toRgb();return t=i.r/255,e=i.g/255,n=i.b/255,.2126*(t<=.03928?t/12.92:r.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:r.pow((e+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:r.pow((n+.055)/1.055,2.4))},setAlpha:function(t){return this._a=D(t),this._roundA=l(100*this._a)/100,this},toHsv:function(){var t=f(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=f(this._r,this._g,this._b),e=l(360*t.h),n=l(100*t.s),i=l(100*t.v);return 1==this._a?"hsv("+e+", "+n+"%, "+i+"%)":"hsva("+e+", "+n+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var t=p(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=p(this._r,this._g,this._b),e=l(360*t.h),n=l(100*t.s),i=l(100*t.l);return 1==this._a?"hsl("+e+", "+n+"%, "+i+"%)":"hsla("+e+", "+n+"%, "+i+"%, "+this._roundA+")"},toHex:function(t){return m(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,n,i,r){var a=[B(l(t).toString(16)),B(l(e).toString(16)),B(l(n).toString(16)),B(O(i))];if(r&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1))return a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0);return a.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:l(this._r),g:l(this._g),b:l(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+l(this._r)+", "+l(this._g)+", "+l(this._b)+")":"rgba("+l(this._r)+", "+l(this._g)+", "+l(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:l(100*I(this._r,255))+"%",g:l(100*I(this._g,255))+"%",b:l(100*I(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+l(100*I(this._r,255))+"%, "+l(100*I(this._g,255))+"%, "+l(100*I(this._b,255))+"%)":"rgba("+l(100*I(this._r,255))+"%, "+l(100*I(this._g,255))+"%, "+l(100*I(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(P[m(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+g(this._r,this._g,this._b,this._a),n=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var r=d(t);n="#"+g(r._r,r._g,r._b,r._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+n+")"},toString:function(t){var e=!!t;t=t||this._format;var n=!1,i=this._a<1&&this._a>=0;return e||!i||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(n=this.toRgbString()),"prgb"===t&&(n=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(n=this.toHexString()),"hex3"===t&&(n=this.toHexString(!0)),"hex4"===t&&(n=this.toHex8String(!0)),"hex8"===t&&(n=this.toHex8String()),"name"===t&&(n=this.toName()),"hsl"===t&&(n=this.toHslString()),"hsv"===t&&(n=this.toHsvString()),n||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return d(this.toString())},_applyModification:function(t,e){var n=t.apply(null,[this].concat([].slice.call(e)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(x,arguments)},brighten:function(){return this._applyModification(_,arguments)},darken:function(){return this._applyModification(w,arguments)},desaturate:function(){return this._applyModification(v,arguments)},saturate:function(){return this._applyModification(y,arguments)},greyscale:function(){return this._applyModification(b,arguments)},spin:function(){return this._applyModification(M,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(C,arguments)},complement:function(){return this._applyCombination(E,arguments)},monochromatic:function(){return this._applyCombination(L,arguments)},splitcomplement:function(){return this._applyCombination(T,arguments)},triad:function(){return this._applyCombination(S,arguments)},tetrad:function(){return this._applyCombination(A,arguments)}},d.fromRatio=function(t,e){if("object"==typeof t){var n={};for(var i in t)t.hasOwnProperty(i)&&(n[i]="a"===i?t[i]:k(t[i]));t=n}return d(t,e)},d.equals=function(t,e){return!(!t||!e)&&d(t).toRgbString()==d(e).toRgbString()},d.random=function(){return d.fromRatio({r:u(),g:u(),b:u()})},d.mix=function(t,e,n){n=0===n?0:n||50;var i=d(t).toRgb(),r=d(e).toRgb(),a=n/100;return d({r:(r.r-i.r)*a+i.r,g:(r.g-i.g)*a+i.g,b:(r.b-i.b)*a+i.b,a:(r.a-i.a)*a+i.a})},d.readability=function(t,e){var n=d(t),i=d(e);return(r.max(n.getLuminance(),i.getLuminance())+.05)/(r.min(n.getLuminance(),i.getLuminance())+.05)},d.isReadable=function(t,e,n){var i,r,a=d.readability(t,e);switch(r=!1,(i=function(t){var e,n;e=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA");"small"!==n&&"large"!==n&&(n="small");return{level:e,size:n}}(n)).level+i.size){case"AAsmall":case"AAAlarge":r=a>=4.5;break;case"AAlarge":r=a>=3;break;case"AAAsmall":r=a>=7}return r},d.mostReadable=function(t,e,n){var i,r,a,s,o=null,l=0;r=(n=n||{}).includeFallbackColors,a=n.level,s=n.size;for(var h=0;h<e.length;h++)(i=d.readability(t,e[h]))>l&&(l=i,o=d(e[h]));return d.isReadable(t,o,{level:a,size:s})||!r?o:(n.includeFallbackColors=!1,d.mostReadable(t,["#fff","#000"],n))};var R=d.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},P=d.hexNames=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}(R);function D(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function I(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var n=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=h(e,c(0,parseFloat(t))),n&&(t=parseInt(t*e,10)/100),r.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function z(t){return h(1,c(0,t))}function N(t){return parseInt(t,16)}function B(t){return 1==t.length?"0"+t:""+t}function k(t){return t<=1&&(t=100*t+"%"),t}function O(t){return r.round(255*parseFloat(t)).toString(16)}function F(t){return N(t)/255}var U,H,V,G=(H="[\\s|\\(]+("+(U="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+U+")[,|\\s]+("+U+")\\s*\\)?",V="[\\s|\\(]+("+U+")[,|\\s]+("+U+")[,|\\s]+("+U+")[,|\\s]+("+U+")\\s*\\)?",{CSS_UNIT:new RegExp(U),rgb:new RegExp("rgb"+H),rgba:new RegExp("rgba"+V),hsl:new RegExp("hsl"+H),hsla:new RegExp("hsla"+V),hsv:new RegExp("hsv"+H),hsva:new RegExp("hsva"+V),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function W(t){return!!G.CSS_UNIT.exec(t)}t.exports?t.exports=d:void 0===(i=function(){return d}.call(e,n,e,t))||(t.exports=i)}(Math)},function(t,e,n){t.exports=function(t){var e=n(44),u=n(45),d=n(4);if(t){if(void 0!==t.springCoeff)throw new Error("springCoeff was renamed to springCoefficient");if(void 0!==t.dragCoeff)throw new Error("dragCoeff was renamed to dragCoefficient")}t=u(t,{springLength:10,springCoefficient:.8,gravity:-12,theta:.8,dragCoefficient:.9,timeStep:.5,adaptiveTimeStepWeight:0,dimensions:2,debug:!1});var p=h[t.dimensions];if(!p){var f=t.dimensions;p={Body:i(f,t.debug),createQuadTree:r(f),createBounds:a(f),createDragForce:s(f),createSpringForce:o(f),integrate:l(f)},h[f]=p}var m=p.Body,g=p.createQuadTree,v=p.createBounds,y=p.createDragForce,b=p.createSpringForce,x=p.integrate,_=n(46).random(42),w=[],M=[],E=g(t,_),S=v(w,t,_),A=b(t,_),T=y(t),C=[],L=new Map,R=0;I("nbody",(function(){if(0===w.length)return;E.insertBodies(w);var t=w.length;for(;t--;){var e=w[t];e.isPinned||(e.reset(),E.updateBodyForce(e),T.update(e))}})),I("spring",(function(){var t=M.length;for(;t--;)A.update(M[t])}));var P={bodies:w,quadTree:E,springs:M,settings:t,addForce:I,removeForce:function(t){var e=C.indexOf(L.get(t));if(e<0)return;C.splice(e,1),L.delete(t)},getForces:function(){return L},step:function(){for(var e=0;e<C.length;++e)C[e](R);var n=x(w,t.timeStep,t.adaptiveTimeStepWeight);return R+=1,n},addBody:function(t){if(!t)throw new Error("Body is required");return w.push(t),t},addBodyAt:function(t){if(!t)throw new Error("Body position is required");var e=(t=>new m(t))(t);return w.push(e),e},removeBody:function(t){if(t){var e=w.indexOf(t);if(!(e<0))return w.splice(e,1),0===w.length&&S.reset(),!0}},addSpring:function(t,n,i,r){if(!t||!n)throw new Error("Cannot add null spring to force simulator");"number"!=typeof i&&(i=-1);var a=new e(t,n,i,r>=0?r:-1);return M.push(a),a},getTotalMovement:function(){return 0},removeSpring:function(t){if(t){var e=M.indexOf(t);return e>-1?(M.splice(e,1),!0):void 0}},getBestNewBodyPosition:function(t){return S.getBestNewPosition(t)},getBBox:D,getBoundingBox:D,invalidateBBox:function(){console.warn("invalidateBBox() is deprecated, bounds always recomputed on `getBBox()` call")},gravity:function(e){return void 0!==e?(t.gravity=e,E.options({gravity:e}),this):t.gravity},theta:function(e){return void 0!==e?(t.theta=e,E.options({theta:e}),this):t.theta},random:_};return function(t,e){for(var n in t)c(t,e,n)}(t,P),d(P),P;function D(){return S.update(),S.box}function I(t,e){if(L.has(t))throw new Error("Force "+t+" is already added");L.set(t,e),C.push(e)}};var i=n(38),r=n(39),a=n(40),s=n(41),o=n(42),l=n(43),h={};function c(t,e,n){if(t.hasOwnProperty(n)&&"function"!=typeof e[n]){var i=Number.isFinite(t[n]);e[n]=i?function(i){if(void 0!==i){if(!Number.isFinite(i))throw new Error("Value of "+n+" should be a valid number.");return t[n]=i,e}return t[n]}:function(i){return void 0!==i?(t[n]=i,e):t[n]}}}},function(t,e){t.exports=function(t){return 0===t?"x":1===t?"y":2===t?"z":"c"+(t+1)}},function(t,e,n){t.exports=function(t){"uniqueLinkId"in(t=t||{})&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n","\n","Note: there is also change in default behavior: From now on each graph\nis considered to be not a multigraph by default (each edge is unique)."),t.multigraph=t.uniqueLinkId);void 0===t.multigraph&&(t.multigraph=!1);if("function"!=typeof Map)throw new Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var e=new Map,n=[],h={},c=0,u=t.multigraph?function(t,e,n){var i=l(t,e),r=h.hasOwnProperty(i);if(r||A(t,e)){r||(h[i]=0);var a="@"+ ++h[i];i=l(t+a,e+a)}return new o(t,e,n,i)}:function(t,e,n){var i=l(t,e);return new o(t,e,n,i)},d=[],p=T,f=T,m=T,g=T,v={addNode:x,addLink:function(t,e,i){m();var r=_(t)||x(t),a=_(e)||x(e),o=u(t,e,i);n.push(o),s(r,o),t!==e&&s(a,o);return p(o,"add"),g(),o},removeLink:S,removeNode:w,getNode:_,getNodeCount:M,getLinkCount:E,getLinksCount:E,getNodesCount:M,getLinks:function(t){var e=_(t);return e?e.links:null},forEachNode:R,forEachLinkedNode:function(t,n,i){var r=_(t);if(r&&r.links&&"function"==typeof n)return i?function(t,n,i){for(var r=0;r<t.length;++r){var a=t[r];if(a.fromId===n&&i(e.get(a.toId),a))return!0}}(r.links,t,n):function(t,n,i){for(var r=0;r<t.length;++r){var a=t[r],s=a.fromId===n?a.toId:a.fromId;if(i(e.get(s),a))return!0}}(r.links,t,n)},forEachLink:function(t){var e,i;if("function"==typeof t)for(e=0,i=n.length;e<i;++e)t(n[e])},beginUpdate:m,endUpdate:g,clear:function(){m(),R((function(t){w(t.id)})),g()},hasLink:A,hasNode:_,getLink:A};return i(v),function(){var t=v.on;v.on=function(){return v.beginUpdate=m=C,v.endUpdate=g=L,p=y,f=b,v.on=t,t.apply(v,arguments)}}(),v;function y(t,e){d.push({link:t,changeType:e})}function b(t,e){d.push({node:t,changeType:e})}function x(t,n){if(void 0===t)throw new Error("Invalid node identifier");m();var i=_(t);return i?(i.data=n,f(i,"update")):(i=new a(t,n),f(i,"add")),e.set(t,i),g(),i}function _(t){return e.get(t)}function w(t){var n=_(t);if(!n)return!1;m();var i=n.links;if(i){n.links=null;for(var r=0;r<i.length;++r)S(i[r])}return e.delete(t),f(n,"remove"),g(),!0}function M(){return e.size}function E(){return n.length}function S(t){if(!t)return!1;var e=r(t,n);if(e<0)return!1;m(),n.splice(e,1);var i=_(t.fromId),a=_(t.toId);return i&&(e=r(t,i.links))>=0&&i.links.splice(e,1),a&&(e=r(t,a.links))>=0&&a.links.splice(e,1),p(t,"remove"),g(),!0}function A(t,e){var n,i=_(t);if(!i||!i.links)return null;for(n=0;n<i.links.length;++n){var r=i.links[n];if(r.fromId===t&&r.toId===e)return r}return null}function T(){}function C(){c+=1}function L(){0===(c-=1)&&d.length>0&&(v.fire("changed",d),d.length=0)}function R(t){if("function"!=typeof t)throw new Error("Function is expected to iterate over graph nodes. You passed "+t);for(var n=e.values(),i=n.next();!i.done;){if(t(i.value))return!0;i=n.next()}}};var i=n(4);function r(t,e){if(!e)return-1;if(e.indexOf)return e.indexOf(t);var n,i=e.length;for(n=0;n<i;n+=1)if(e[n]===t)return n;return-1}function a(t,e){this.id=t,this.links=null,this.data=e}function s(t,e){t.links?t.links.push(e):t.links=[e]}function o(t,e,n,i){this.fromId=t,this.toId=e,this.data=n,this.id=i}function l(t,e){return t.toString()+"👉 "+e.toString()}},function(t,e,n){t.exports=function(t,e){if(!t)throw new Error("Graph structure cannot be undefined");var a=(e&&e.createSimulator||n(6))(e);if(Array.isArray(e))throw new Error("Physics settings is expected to be an object");var s=t.version>19?function(e){var n=t.getLinks(e);return n?1+n.size/3:1}:function(e){var n=t.getLinks(e);return n?1+n.length/3:1};e&&"function"==typeof e.nodeMass&&(s=e.nodeMass);var o=new Map,l={},h=0,c=a.settings.springTransform||r;h=0,t.forEachNode((function(t){g(t.id),h+=1})),t.forEachLink(y),t.on("changed",m);var u=!1,d={step:function(){if(0===h)return p(!0),!0;var t=a.step();d.lastMove=t,d.fire("step");var e=t/h<=.01;return p(e),e},getNodePosition:function(t){return _(t).pos},setNodePosition:function(t){var e=_(t);e.setPosition.apply(e,Array.prototype.slice.call(arguments,1))},getLinkPosition:function(t){var e=l[t];if(e)return{from:e.from.pos,to:e.to.pos}},getGraphRect:function(){return a.getBBox()},forEachBody:f,pinNode:function(t,e){_(t.id).isPinned=!!e},isNodePinned:function(t){return _(t.id).isPinned},dispose:function(){t.off("changed",m),d.fire("disposed")},getBody:function(t){return o.get(t)},getSpring:function(e,n){var i;if(void 0===n)i="object"!=typeof e?e:e.id;else{var r=t.hasLink(e,n);if(!r)return;i=r.id}return l[i]},getForceVectorLength:function(){var t=0,e=0;return f((function(n){t+=Math.abs(n.force.x),e+=Math.abs(n.force.y)})),Math.sqrt(t*t+e*e)},simulator:a,graph:t,lastMove:0};return i(d),d;function p(t){var e;u!==t&&(u=t,e=t,d.fire("stable",e))}function f(t){o.forEach(t)}function m(e){for(var n=0;n<e.length;++n){var i=e[n];"add"===i.changeType?(i.node&&g(i.node.id),i.link&&y(i.link)):"remove"===i.changeType&&(i.node&&v(i.node),i.link&&b(i.link))}h=t.getNodesCount()}function g(e){var n=o.get(e);if(!n){var i=t.getNode(e);if(!i)throw new Error("initBody() was called with unknown node id");var r=i.position;if(!r){var s=function(t){var e=[];if(!t.links)return e;for(var n=Math.min(t.links.length,2),i=0;i<n;++i){var r=t.links[i],a=r.fromId!==t.id?o.get(r.fromId):o.get(r.toId);a&&a.pos&&e.push(a)}return e}(i);r=a.getBestNewBodyPosition(s)}(n=a.addBodyAt(r)).id=e,o.set(e,n),x(e),function(t){return t&&(t.isPinned||t.data&&t.data.isPinned)}(i)&&(n.isPinned=!0)}}function v(t){var e=t.id,n=o.get(e);n&&(o.delete(e),a.removeBody(n))}function y(t){x(t.fromId),x(t.toId);var e=o.get(t.fromId),n=o.get(t.toId),i=a.addSpring(e,n,t.length);c(t,i),l[t.id]=i}function b(e){var n=l[e.id];if(n){var i=t.getNode(e.fromId),r=t.getNode(e.toId);i&&x(i.id),r&&x(r.id),delete l[e.id],a.removeSpring(n)}}function x(t){var e=o.get(t);if(e.mass=s(t),Number.isNaN(e.mass))throw new Error("Node mass should be a number")}function _(t){var e=o.get(t);return e||(g(t),e=o.get(t)),e}},t.exports.simulator=n(6);var i=n(4);function r(){}},function(t,e){function n(t,e,n){var i,r,a,s,o;function l(){var h=Date.now()-s;h<e&&h>=0?i=setTimeout(l,e-h):(i=null,n||(o=t.apply(a,r),a=r=null))}null==e&&(e=100);var h=function(){a=this,r=arguments,s=Date.now();var h=n&&!i;return i||(i=setTimeout(l,e)),h&&(o=t.apply(a,r),a=r=null),o};return h.clear=function(){i&&(clearTimeout(i),i=null)},h.flush=function(){i&&(o=t.apply(a,r),a=r=null,clearTimeout(i),i=null)},h}n.debounce=n,t.exports=n},function(t,e,n){n(13),n(14),n(15),n(16),n(17),n(18),n(19),n(20),n(21),n(22),n(23),n(24),n(25),n(26),n(27),n(28),n(29),n(30),n(31),n(32),n(33),n(34),n(35),n(36),n(37),n(47),n(48),n(0),n(49),n(50),n(51),n(52),n(53),n(2)},,function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-querygithub",{schema:{user:{type:"string"},token:{type:"string"},repos:{type:"array"},data:{type:"string"}},multiple:!1,init:function(){},update:function(t){let e=this.data,r=this.el,s=this;e.data&&t.data!==e.data?a(e.data,r,s):t.user===e.user&&t.repos===e.repos&&t.token===e.token||(e.user&&0===e.repos.length?i(e,r,s):e.repos.length>0&&n(e,r,s))},remove:function(){},pause:function(){},play:function(){},babiaData:void 0,babiaMetadata:{id:0},register:function(t){this.el;this.interestedElements.push(t),this.babiaData&&o(t,"babiaData")},unregister:function(t){const e=this.interestedElements.indexOf(t);e>-1&&this.interestedElements.splice(e,1)},interestedElements:[]});let n=(t,e,n)=>{let i=[];t.repos.forEach((n,r)=>{let a=new XMLHttpRequest,s="https://api.github.com/repos/"+t.user+"/"+n+"?_="+(new Date).getTime();a.open("get",s,!1),a.onload=function(){if(this.status>=200&&this.status<300){console.log("data OK in request.response",e.id);let t=JSON.parse(a.response);i.push(t)}else reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},a.onerror=function(){reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},a.send()}),n.babiaData=i,n.babiaMetadata={id:n.babiaMetadata.id++},s("babiaData",n)},i=(t,e,n)=>{let i=new XMLHttpRequest,a="https://api.github.com/users/"+t.user+"/repos?_="+(new Date).getTime();i.open("get",a),i.onload=function(){this.status>=200&&this.status<300?(console.log("data OK in request.response",e.id),n.babiaData=r(JSON.parse(i.response)),n.babiaMetadata={id:n.babiaMetadata.id++},s("babiaData",n)):(reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText))},i.onerror=function(){reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},i.send()},r=t=>{let e=[];return t.forEach((t,n)=>{e.push(t)}),e},a=(t,e,n)=>{let i=JSON.parse(t);n.babiaData=i,n.babiaMetadata={id:n.babiaMetadata.id++},s("babiaData",n)},s=(t,e)=>{e.interestedElements.forEach(e=>{o(e,t)})},o=(t,e)=>{t.emit("babiaQuerierDataReady",e)}},function(t,e,n){let i=n(0).parseJson;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const r=n(2).NotiBuffer;AFRAME.registerComponent("babia-queryjson",{schema:{url:{type:"string"},data:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new r},update:function(t){let e=this.data;if(e.data&&t.data!==e.data){let t=i(e.data);this.notiBuffer.set(t)}else t.url!==e.url&&this.getJSON(e.url)},remove:function(){},pause:function(){},play:function(){},getJSON:async function(t){let e=await fetch(t);if(200!=e.status)throw new Error(e.status);{let t=await e.json(),n=i(t);this.notiBuffer.set(n)}}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-queryes",{schema:{elasticsearch_url:{type:"string"},index:{type:"string"},query:{type:"string"},size:{type:"int",default:10},user:{type:"string"},password:{type:"string"},data:{type:"string"}},multiple:!1,init:function(){},update:function(t){let e=this.data,r=this.el,a=this;if(e.data&&t.data!==e.data)i(e.data,r,a);else if(e.elasticsearch_url!==t.elasticsearch_url||e.index!==t.index||e.query!==t.query||e.size!==t.size){if(!e.elasticsearch_url||!e.index)return void console.error("elasicsearch_url and index must be defined");n(e,r,a)}},remove:function(){},pause:function(){},play:function(){},babiaData:void 0,babiaMetadata:{id:0},register:function(t){this.el;this.interestedElements.push(t),this.babiaData&&a(t,"babiaData")},unregister:function(t){const e=this.interestedElements.indexOf(t);e>-1&&this.interestedElements.splice(e,1)},interestedElements:[]});let n=(t,e,n)=>{let i=new XMLHttpRequest;i.open("get",`${t.elasticsearch_url}/${t.index}/_search?size=${t.size}&${t.query}`),i.onload=function(){if(this.status>=200&&this.status<300){if("string"==typeof i.response||i.response instanceof String){dataRaw=JSON.parse(i.response).hits.hits;let t=[];for(let e=0;e<dataRaw.length;e++)t[e]=dataRaw[e]._source}else{console.error("Unexpected response",i.response)}n.babiaData=dataRetrieved,n.babiaMetadata={id:n.babiaMetadata.id++},r("babiaData",n)}else reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},i.onerror=function(){reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},i.send()},i=(t,e,n)=>{let i=JSON.parse(t);n.babiaData=i,n.babiaMetadata={id:n.babiaMetadata.id++},r("babiaData",n)},r=(t,e)=>{e.interestedElements.forEach(e=>{a(e,t)})},a=(t,e)=>{t.emit("babiaQuerierDataReady",e)}},function(t,e,n){let i=n(0).findTargetComponent;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-ui",{schema:{target:{type:"string"}},multiple:!1,init:function(){console.log("WELCOME TO UI: Control your data.")},update:function(t){let e=this.data;this.targetComponent&&this.targetComponent.notiBuffer.unregister(this.notiBufferId),this.targetComponent=i(e,this),this.findQuerierComponents(this),this.targetComponent.visProperties&&(this.targetComponentVisProperties=this.targetComponent.visProperties),this.targetComponent.notiBuffer&&(this.notiBufferId=this.targetComponent.notiBuffer.register(this.updateInterfaceEventCallback.bind(this)))},targetComponent:void 0,targetComponentVisProperties:void 0,dataMetrics:void 0,interface:void 0,dataQueriers:void 0,handController:void 0,updateInterfaceEventCallback:function(t){let e=this;for(t&&a(e,t,e.targetComponentVisProperties);e.el.firstChild;)e.el.firstChild.remove();if(console.log("Generating interface..."),document.querySelector("#babia-menu-hand")){let t=document.querySelector("#babia-menu-hand");t.parentNode.removeChild(t),r(e,e.handController)}else e.interface=o(e,e.dataMetrics,e.el);document.addEventListener("controllerconnected",t=>{for(;e.el.firstChild;)e.el.firstChild.remove();controller=t.detail.name,"left"!==t.target.getAttribute(controller).hand||document.querySelector("#babia-menu-hand")||(e.handController=t.target.id,r(e,e.handController))})},findQuerierComponents:function(){this.dataQueriers=[],document.querySelectorAll("[babia-queryjson]").forEach(t=>{(t.id!=this.data.target||t.id==this.data.target&&"babia-filter"==!this.targetComponent.prodComponent.attrName)&&this.dataQueriers.push(t.id)}),document.querySelectorAll("[babia-queryes]").forEach(t=>{this.dataQueriers.push(t.id)}),document.querySelectorAll("[babia-querygithub]").forEach(t=>{this.dataQueriers.push(t.id)}),document.querySelectorAll("[babia-filter]").forEach(t=>{this.dataQueriers.push(t.id)})}});let r=(t,e)=>{let n=document.getElementById(e);t.interface=o(t,t.dataMetrics,n),t.interface.id="babia-menu-hand",t.interface.setAttribute("scale",{x:.03,y:.03,z:.03}),t.interface.setAttribute("position",{x:-.03*t.interface.width/2,y:.03*t.interface.height/2,z:-.1}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),d(t.handController,t.interface)},a=(t,e,n)=>{t.dataMetrics=[];let i,r=["height","radius","width","size","farea","fheight","area","depth"],a=[];i="babia-city"==t.targetComponent.attrName?s(e):"babia-boats"==t.targetComponent.attrName?s(e[0]):e[0],Object.keys(i).forEach(t=>{"number"==typeof i[t]&&a.push(t)}),n.forEach(n=>{r.includes(n)?t.dataMetrics.push({property:n,metrics:a}):t.dataMetrics.push({property:n,metrics:Object.keys(e[0])})})},s=t=>(t.children?child=s(t.children[0]):child=t,child),o=(t,e,n)=>{t.interface=document.createElement("a-entity"),t.interface.id="babia-menu";let i=0,r=0,a=0;if(t.dataQueriers.length>1){let e=c("Data",r,i);t.interface.appendChild(e),t.dataQueriers.forEach(e=>{r+=3.25;let n=u(t,e,r,i);n.classList.add("babiaxraycasterclass"),t.interface.appendChild(n)})}return--i,a<r&&(a=r),r=0,e.forEach(e=>{let n=c(e.property,r,i);t.interface.appendChild(n),e.metrics.forEach(n=>{r+=3.25;let a=l(t,e.property,n,r,i);a.classList.add("babiaxraycasterclass"),t.interface.appendChild(a)}),--i,a<r&&(a=r),r=0}),t.interface.width=a+3,t.interface.height=Math.abs(i),t.interface.setAttribute("position",{x:-t.interface.width/2,y:t.interface.height,z:0}),n.appendChild(t.interface),t.interface},l=(t,e,n,i,r)=>{let a=document.createElement("a-box");a.property=e,a.metric=n,a.classList.add("babiaxraycasterclass"),a.setAttribute("position",{x:i,y:r,z:0}),a.setAttribute("rotation",{x:0,y:0,z:0}),a.setAttribute("height",.8),a.setAttribute("width",3),a.setAttribute("depth",.01);let s=document.createElement("a-entity");return s.setAttribute("text",{value:n,align:"center",width:"10",color:"black"}),s.setAttribute("position","0 0 0.01"),a.appendChild(s),t.targetComponent.data[e]==n&&a.setAttribute("color","#555555"),h(a,t.targetComponent,!1),a},h=(t,e,n)=>{t.addEventListener("mouseenter",(function(){t.children[0].setAttribute("text",{color:"#FFFFFF"}),t.setAttribute("color","#333333")})),n?t.addEventListener("mouseleave",(function(){t.children[0].setAttribute("text",{color:"black"}),e.data.from==t.from?t.setAttribute("color","#555555"):""!=e.data.from&&e.data.from==t.from||t.setAttribute("color","#FFFFFF")})):t.addEventListener("mouseleave",(function(){t.children[0].setAttribute("text",{color:"black"}),e.data[t.property]==t.metric?t.setAttribute("color","#555555"):t.setAttribute("color","#FFFFFF")})),t.addEventListener("click",(function(){t.property&&t.metric?("babia-boats"==e.attrName&&"area"==t.property?(e.el.removeAttribute(e.attrName,"width"),e.el.removeAttribute(e.attrName,"depth")):"babia-boats"!=e.attrName||"width"!=t.property&&"depth"!=t.property||!e.el.getAttribute("babia-boats").area||(e.el.removeAttribute(e.attrName,"area"),"width"==t.property?e.el.setAttribute(e.attrName,"depth",t.metric):e.el.setAttribute(e.attrName,"width",t.metric)),e.el.setAttribute(e.attrName,t.property,t.metric)):t.from&&e.el.setAttribute(e.attrName,"from",t.from)}))},c=(t,e,n)=>{let i=document.createElement("a-plane");return i.setAttribute("position",{x:e,y:n,z:0}),i.setAttribute("rotation",{x:0,y:0,z:0}),i.setAttribute("height",.8),i.setAttribute("width",3),i.setAttribute("text",{value:t,align:"center",width:"10",color:"#FFFFFF"}),i.setAttribute("color","black"),i},u=(t,e,n,i)=>{let r=document.createElement("a-box");r.from=e,r.classList.add("babiaxraycasterclass"),r.setAttribute("position",{x:n,y:i,z:0}),r.setAttribute("rotation",{x:0,y:0,z:0}),r.setAttribute("height",.8),r.setAttribute("width",3),r.setAttribute("depth",.01);let a=document.createElement("a-entity");return a.setAttribute("text",{value:e,align:"center",width:"10",color:"black"}),a.setAttribute("position","0 0 0.01"),r.appendChild(a),t.targetComponent.prodComponent&&t.targetComponent.prodComponent.el.id==e?r.setAttribute("color","#555555"):r.setAttribute("color","#FFFFFF"),h(r,t.targetComponent,!0),r},d=(t,e)=>{let n=!0;document.getElementById(t).addEventListener("gripdown",(function(){n?(n=!1,e.setAttribute("visible",!1)):(n=!0,e.setAttribute("visible",!0))}))}},function(t,e,n){let i=n(0).findProdComponent,r=n(0).parseJson;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const a=n(2).NotiBuffer;AFRAME.registerComponent("babia-filter",{schema:{from:{type:"string"},filter:{type:"string"},data:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new a},update:function(t){let e=this.data,n=this.el;if(!e.data||t.data===e.data&&e.filter===t.filter)e.from===t.from&&e.filter===t.filter||(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=i(e,n,"babia-filter"),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))));else{let t=r(e.data);this.processData(t)}},remove:function(){},pause:function(){},play:function(){},prodComponent:void 0,notiBufferId:void 0,processData:function(t){let e,n=this.data.filter.split("=");n[0]&&n[1]?(e=t.filter(t=>t[n[0]]==n[1]),this.notiBuffer.set(e)):console.error("Error on filter, please use key=value syntax")}})},function(e,n,i){let r=i(0).findProdComponent,a=i(0).parseJson;const s=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function o(e,n,i){for(t=0;t<e.length&&e[t][n]!==i;)t++;return t<e.length&&e[t]}AFRAME.registerComponent("babia-treebuilder",{schema:{from:{type:"string"},field:{type:"string"},split_by:{type:"string"},data:{type:"string"}},multiple:!1,prodComponent:void 0,notiBufferId:void 0,init:function(){this.notiBuffer=new s},update:function(t){let e=this.data,n=this.el;if(!e.data||t.data===e.data&&e.field===t.field&&e.split_by===t.split_by)e.from===t.from&&e.field===t.field&&e.split_by===t.split_by||(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=r(e,n,"babia-treebuilder"),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))));else{let t=a(e.data);this.processData(t)}},processData:function(t){let e=this.data,n=[];for(let i=0;i<t.length;i++){let r=t[i][e.field].split(e.split_by),a=n;for(let n=0;n<r.length;n++){if(!r[n])continue;let s=r[n],l=o(a,"uid",s);if(l)a=l.children;else{let o={};n===r.length-1?(o=t[i],o.uid=s):(o.children=[],o.uid=t[i][e.field].split(s)[0]+s),o.uid=s,a.push(o),a=o.children}}}console.log(n),this.notiBuffer.set(n)}})},function(t,e,n){let i=n(0).findProdComponent,r=n(0).findNavComponent,a=n(0).parseJson;class s{constructor(t,e){this.data={};for(let n of t){let t=n[e];this.data[t]?this.data[t].push(n):this.data[t]=[n]}this.selectors=Object.keys(this.data).sort(),this.length=this.selectors.length,this.current=0,this.step=1}next(){let t=this.data[this.selectors[this.current]];return this.current+this.step<=this.length-1?this.current+=this.step:(this.current=this.length-1,this.current=this.length),console.log("next: ",this.data),t}prev(){let t=this.data[this.selectors[this.current]];return this.current+this.step>0?this.current-=this.step:this.current=0,console.log("prev: ",this.data),t}setValue(t){let e=this.data[this.selectors[t]];return this.current=t+1,console.log("setValue: ",this.data),e}}if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const o=n(2).NotiBuffer;AFRAME.registerComponent("babia-selector",{schema:{from:{type:"string"},controller:{type:"string"},select:{type:"string",default:"date"},timeout:{type:"number",default:6e3},data:{type:"string"}},multiple:!1,isPaused:void 0,toPresent:void 0,speed:void 0,interval:void 0,init:function(){this.notiBuffer=new o,this.navNotiBuffer=new o,this.isPaused=!1,this.toPresent=!0,this.speed=1},babiaMetadata:{id:0},update:function(t){let e=this.data,n=this.el;if(e.data&&t.data!==e.data){let t=a(e.data);this.processData(t)}else e.from!==t.from&&(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=i(e,n,"babia-selector"),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))));e.controller&&(this.selectorController=document.querySelector("#"+e.controller),this.navComponent&&this.navComponent.notiBuffer.unregister(this.navNotiBufferId,this),this.navComponent=r(e,n),this.navComponent.notiBuffer&&(this.navNotiBufferId=this.navComponent.notiBuffer.register(this.processEvent.bind(this),this)))},nextSelect:function(){this.selectable.current>this.selectable.length-1?(this.selectable.current=this.selectable.length-1,this.isPaused=!0,this.navNotiBuffer.set("babiaStop")):(this.newData=this.selectable.next(),this.notiBuffer.set(this.newData),this.navNotiBuffer.set(this.selectable.current),this.babiaMetadata={id:this.selectable.current})},prevSelect:function(){this.selectable.current>=0?(this.newData=this.selectable.prev(),this.notiBuffer.set(this.newData),this.navNotiBuffer.set(this.selectable.current),this.babiaMetadata={id:this.selectable.current}):(this.selectable.current=0,this.isPaused=!0,this.navNotiBuffer.set("babiaStop"))},setSelect:function(t){(t!=this.selectable.current-1&&this.toPresent||t!=this.selectable.current+1&&!this.toPresent)&&(this.newData=this.selectable.setValue(t),this.toPresent?this.babiaMetadata={id:t++}:(this.babiaMetadata={id:t--},this.selectable.current-=2),this.notiBuffer.set(this.newData),this.navNotiBuffer.set(t))},loop:function(){this.isPaused||(this.toPresent?this.nextSelect():this.prevSelect())},prodComponent:void 0,navComponent:void 0,prodNotiBufferId:void 0,navNotiBufferId:void 0,newData:void 0,processData:function(t){this.selectable=new s(t,this.data.select),this.navNotiBuffer.set(this.selectable.current);let e=this;this.nextSelect(),this.interval=window.setInterval((function(){e.loop()}),e.data.timeout*e.speed)},processEvent:function(t){if(t.includes("babiaStop")?this.isPaused=!0:t.includes("babiaContinue")?this.isPaused=!1:t.includes("babiaToPresent")?(this.toPresent=!0,this.selectable.current!=this.selectable.length&&(this.selectable.current+=2)):t.includes("babiaToPast")?(this.toPresent=!1,this.selectable.current<1?this.selectable.current=0:this.selectable.current-=2):t.includes("babiaSetPosition")?(this.isPaused=!0,this.setSelect(parseInt(t.substring(16),10)),this.navNotiBuffer.set("babiaStop")):t.includes("babiaSetStep")&&(this.selectable.step=parseInt(t.substring(12),10),this.toPresent?this.current+this.selectable.step>this.selectable.length?this.current=this.selectable.length-1:this.current+=this.selectable.step-1:this.current-this.selectable.step<0?this.current=0:this.current-=this.selectable.step+1),t.includes("babiaSetSpeed")){this.speed=parseInt(t.substring(13),10);let e=this.data.timeout/this.speed,n=this;clearInterval(this.interval),this.interval=window.setInterval((function(){n.loop()}),e)}}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babiaxr-interaction-mapper",{schema:{input:{type:"string"},output:{type:"string"}},multiple:!1,init:function(){let t=this.data,e=this.el;t.input&&t.output&&n(t,e)},update:function(t){let e=this.data,i=this.el;e!==t&&(e.input===t.input&&e.output===t.output||(console.log("Change event because from has changed"),i.removeEventListener(t.input,(function(t){})),n(e,i)))},remove:function(){},pause:function(){},play:function(){}});let n=(t,e)=>{e.addEventListener(t.input,(function(n){e.emit(t.output,n,!1)}))}},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babiaxr-debug-data",{schema:{inputEvent:{type:"string"}},multiple:!1,init:function(){let t=this.data,e=this.el;t.input&&t.output&&n(t,e)},update:function(t){let e=this.data,i=this.el;e!==t&&e.inputEvent!==t.inputEvent&&(console.log("Change event because from has changed"),i.removeEventListener(e.inputEvent,(function(t){})),n(e,i))},remove:function(){},pause:function(){},play:function(){}});let n=(t,e)=>{e.addEventListener(t.inputEvent,(function(n){i(t,e)}))},i=(t,e)=>{if(!e.querySelector(".debug-data")){let t=function(t,e,n){let i=document.createElement("a-plane");i.setAttribute("color","white"),i.setAttribute("class","debug_data"),i.setAttribute("width",10),i.setAttribute("height",10);let r=e.getAttribute("position"),a=0,s=0;e.getAttribute("geometry")&&("box"===e.components.geometry.data.primitive?(a=e.getAttribute("geometry").width/2,s=e.getAttribute("geometry").height/2):"sphere"===e.components.geometry.data.primitive?a=e.getAttribute("geometry").radius:(a=0,s=0));i.setAttribute("position",{x:r.x+a+5,y:0-s+5,z:r.z});let o=document.createElement("a-text");return o.setAttribute("value",JSON.stringify(n)),o.setAttribute("width",10),o.setAttribute("height",10),o.setAttribute("color","black"),o.setAttribute("position",{x:0-i.getAttribute("width")/2,y:0-e.getAttribute("height")/2,z:0}),i.appendChild(o),i}(0,e,e.getAttribute("babiaData"));e.appendChild(t)}}},function(t,e,n){let i=n(0).findProdComponent,r=n(0).updateTitle,a=n(0).parseJson;const s=n(0).colors,o=n(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function l(t,e,n,i,r){let a=s.get(i,r);console.log("Generating slice...");let o=document.createElement("a-cylinder");return o.setAttribute("color",a),o.setAttribute("theta-start",t),o.setAttribute("theta-length",e),o.setAttribute("side","double"),o.setAttribute("radius",n),o}function h(t,e,n,i){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e){let n=e[t.key]+": "+e[t.size],i=2;n.length>16&&(i=n.length/8);let r=document.createElement("a-plane");return r.setAttribute("position",{x:0,y:0,z:-2}),r.setAttribute("rotation",{x:-90,y:0,z:0}),r.setAttribute("height","1"),r.setAttribute("width",i),r.setAttribute("color","white"),r.setAttribute("text",{value:e[t.key]+": "+e[t.size],align:"center",width:6,color:"black"}),r.classList.add("babiaxrLegend"),r}(t,n),i.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),i.removeChild(legend)}))}AFRAME.registerComponent("babia-pie",{schema:{data:{type:"string"},size:{type:"string",default:"size"},key:{type:"string",default:"key"},from:{type:"string"},legend:{type:"boolean"},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},animation:{type:"boolean",default:!1}},visProperties:["size","key"],multiple:!1,init:function(){this.notiBuffer=new o},update:function(t){let e=this.data,n=this.el;if(e.data&&t.data!==e.data){let t=a(e.data);this.processData(t)}else e.from!==t.from?(this.slice_array=[],this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=i(e,n),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))):e!==t&&this.newData&&(this.slice_array=[],this.processData(this.newData))},tick:function(t,e){if(this.data.animation&&this.loaded){let n=document.getElementsByClassName("babiaxrChart")[0].children;for(let i in this.slice_array){let r=this.slice_array[i].delay,a=this.slice_array[i].degreeLenght,s=parseFloat(n[i].getAttribute("theta-length"));t>=r&&s<a&&(s+=360*e/this.total_duration,s>a&&(s=a),n[i].setAttribute("theta-length",s))}}},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},loaded:!1,slice_array:[],total_duration:4e3,updateTitle:function(){const t=r(this.data,{x:-90,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-pie:",t);const e=this.data,n=this.el,i=e.animation,r=e.palette;let a=0,s=0,o=0,c=0;for(let n of t)c+=n[e.size];this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),n.appendChild(this.chartEl);let u=0;for(let d of t){let t;if(s=360*d[e.size]/c,i){let e=this.total_duration*s/360;this.slice_array.push({degreeLenght:s,duration:e,delay:u}),u+=e,t=l(a,.01,1,o,r)}else t=l(a,s,1,o,r);t.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(t),a+=s,e.legend&&h(e,t,d,n),o++}this.updateTitle()},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating pie..."),this.updateChart(),this.loaded=!0,this.notiBuffer.set(this.newData)}})},function(t,e,n){let i=n(0).findProdComponent,r=n(0).updateTitle,a=n(0).parseJson;const s=n(0).colors,o=n(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-bars",{schema:{data:{type:"string"},height:{type:"string",default:"height"},x_axis:{type:"string",default:"x_axis"},from:{type:"string"},legend:{type:"boolean",default:!1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"vec3",default:{x:0,y:0,z:0}},chartHeight:{type:"number",default:10},keepHeight:{type:"boolean",default:!0},incremental:{type:"boolean",default:!1},index:{type:"string"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},uiLink:{type:"boolean",default:!1},uiLinkPosition:{type:"vec3",default:{x:-4.5,y:2,z:2.5}}},visProperties:["height","x_axis"],multiple:!1,init:function(){this.notiBuffer=new o,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){let e=this.data,n=this.el;if(e.index||(e.index=e.x_axis),console.log("Starting Bars"),this.animation=e.animation,this.bar_array=[],e.data&&t.data!==e.data){let t=a(e.data);this.processData(t)}else e.from!==t.from?(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=i(e,n),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))):e!==t&&this.newData&&(this.slice_array=[],this.processData(this.newData));e.uiLink&&h(n,e.uiLinkPosition)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,currentData:void 0,babiaMetadata:{id:0},widthBars:1,total_duration:3e3,proportion:void 0,valueMax:void 0,xLabels:[],xTicks:[],updateTitle:function(){this.titleEl=r(this.data,{x:0,y:0,z:0})},updateAxis:function(t,e,n,i){const r=this.data;r.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:n,palette:r.palette}),this.xAxisEl.setAttribute("position",{x:0,y:0,z:this.widthBars/2}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:i,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:-this.widthBars/2,y:0,z:this.widthBars/2}),r.axis_name&&(r.index?this.xAxisEl.setAttribute("babia-axis-x","name",r.index):this.xAxisEl.setAttribute("babia-axis-x","name",r.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",r.height)))},updateChart:function(){let t;t=this.currentData?this.currentData:this.newData,console.log("Data babia-bars:",t);const e=this.data,n=e.palette;this.updateTitle();let i=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*i/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=i;let r=this.chartEl,a=r.querySelectorAll("a-entity[babia-bar]"),o={};for(let t of a){o[t.getAttribute("babia-name")]={el:t,found:!1}}let l=[],h=[],c=0;for(let i=0;i<t.length;i++){let a,u=t[i],d=u[e.x_axis],p=i*this.widthBars*1.25;o[d]&&!u._not?(a=o[d].el,o[d].found=!0):(a=document.createElement("a-entity"),a.setAttribute("babia-name",d),a.id=u[e.index],a.object3D.position.x=p,r.appendChild(a)),a.setAttribute("babia-bar",{height:u[e.height]*this.lengthY/this.maxValue,width:this.widthBars,depth:this.widthBars,color:s.get(c,n),label:"events",animation:e.animation}),e.legend&&a.setAttribute("babia-bar",{labelText:d+": "+u[e.height]}),p!==a.object3D.position.x&&(e.animation?a.setAttribute("animation",{property:"object3D.position.x",to:p,dur:e.dur}):a.object3D.position.x=p),l.push(u[e.x_axis]),h.push(p),c++}for(let t in o)o[t].found||o[t].el.remove();const u=this.widthBars*(1.25*t.length);this.updateAxis(l,h,u,this.maxValue)},processData:function(t){console.log("processData",this);let e=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},this.notiBuffer.set(this.newData),e.incremental)if(this.newData.forEach(t=>{let n=!1;for(let i in this.currentData)this.currentData[i][e.index]==t[e.index]&&(this.currentData[i]=t,n=!0);n||this.currentData.push(t)}),e.keepHeight)this.maxValue=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]}))),console.log("Re-draw the chart"),this.updateChart();else{this.newData.forEach(t=>{if(t._not)this.chartEl.querySelector("#"+t[e.index]).setAttribute("babia-bar","height",-.1);else if(this.chartEl.querySelector("#"+t[e.index]))this.chartEl.querySelector("#"+t[e.index]).setAttribute("babia-bar",{height:t[e.height]*e.chartHeight/this.maxValue,labelText:t[e.index]+": "+t[e.height]});else{let n=this.chartEl.querySelectorAll("[babia-bar]").length,i=this.chartEl.querySelectorAll("[babia-bar]")[n-1].getAttribute("position").x+this.widthBars+this.widthBars/4,r=l(this,e,t,n,e.palette,i);this.chartEl.appendChild(r),this.xLabels.push(r.id),this.xTicks.push(i)}});let t=this.xTicks[this.xTicks.length-1]+3*this.widthBars/4;if(!e.chartHeight||!e.keepHeight){let t=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]})));this.lengthY=t*e.chartHeight/this.maxValue,this.maxValue=t}this.updateAxis(this.xLabels,this.xTicks,t,this.maxValue)}else this.currentData=JSON.parse(JSON.stringify(this.newData)),this.updateChart()}});let l=(t,e,n,i,r,a)=>{let o=document.createElement("a-entity");return o.setAttribute("babia-bar",{height:n[t.data.height]*e.chartHeight/t.maxValue,width:t.widthBars,depth:t.widthBars,color:s.get(i,r),label:"events",animation:e.animation}),e.legend&&o.setAttribute("babia-bar",{labelText:n[t.data.x_axis]+": "+n[t.data.height]}),o.setAttribute("position",{x:a,y:0,z:0}),o.id=n[t.data.index],o},h=(t,e)=>{let n=document.createElement("a-entity");if(!t.id){let e="bars"+Math.floor(1e3*Math.random());t.id=e}console.log("id:",t.id),n.setAttribute("babia-ui-link",{viz:t.id}),n.setAttribute("position",{x:e.x,y:e.y,z:e.z}),t.appendChild(n),console.log("Create Button",t)}},function(t,e,n){var i=this;let r=n(0).findProdComponent,a=n(0).updateTitle,s=n(0).parseJson;const o=n(0).colors,l=n(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-barsmap",{schema:{data:{type:"string"},height:{type:"string",default:"height"},x_axis:{type:"string",default:"x_axis"},z_axis:{type:"string",default:"z_axis"},from:{type:"string"},legend:{type:"boolean"},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},chartHeight:{type:"number",default:10},keepHeight:{type:"boolean",default:!0},incremental:{type:"boolean",default:!1},index:{type:"string",default:"x_axis"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3}},visProperties:["height","x_axis","z_axis"],multiple:!1,init:function(){this.notiBuffer=new l,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){let e=this.data,n=this.el;if(e.index||(e.index=e.x_axis),console.log("Starting Barsmap"),this.animation=e.animation,this.bar_array=[],e.data&&t.data!==e.data){let t=s(e.data);this.processData(t)}else this.data.from!==t.from?(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=r(this.data,n),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))):e!==t&&this.newData&&(this.slice_array=[],this.processData(this.newData))},prodComponent:void 0,notiBufferId:void 0,newData:void 0,currentData:void 0,babiaMetadata:{id:0},widthBars:1,proportion:void 0,valueMax:void 0,xLabels:[],zLabels:[],xTicks:[],zTicks:[],total_duration:3e3,updateTitle:function(){this.titleEl=a(this.data,{x:0,y:0,z:0})},updateAxis:function(t,e,n,i,r,a,s){const o=this.data;o.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:n,palette:o.palette,align:"behind"}),this.xAxisEl.setAttribute("position",{x:-this.widthBars/2,y:0,z:-this.widthBars/2}),this.zAxisEl||(this.zAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.zAxisEl)),this.zAxisEl.setAttribute("babia-axis-z",{labels:r,ticks:a,length:s,palette:o.palette,align:"left"}),this.zAxisEl.setAttribute("position",{x:0-this.widthBars/2,y:0,z:-this.widthBars/2}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:i,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:-this.widthBars/2,y:0,z:-this.widthBars/2}),o.axis_name&&((o.index=!1)?this.xAxisEl.setAttribute("babia-axis-x","name",o.index):this.xAxisEl.setAttribute("babia-axis-x","name",o.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",o.height),this.zAxisEl.setAttribute("babia-axis-z","name",o.z_axis)))},updateChart:function(){let t;t=this.currentData?this.currentData:this.newData,console.log("Data babia-barsmap:",t);const e=this.data,n=e.palette;this.updateTitle();let i=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*i/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=i;let r=[],a=[],s=[],l=[],h=this.chartEl;console.log(t);for(let c=0;c<t.length;c++){let u,d,p=t[c],f=p[e.x_axis],m=p[e.z_axis];r.includes(f)||(r.push(f),u=(r.length-1)*this.widthBars*1.25,a.push(u+this.widthBars/2)),u||(u=r.indexOf(f)*this.widthBars*1.25),s.includes(m)||(s.push(m),d=(s.length-1)*this.widthBars*1.25,l.push(d+this.widthBars/2)),d||(d=s.indexOf(m)*this.widthBars*1.25),console.log(f+" "+m+" "+u+" "+d);let g,v=r.indexOf(f);g||(g=document.createElement("a-entity"),g.id=f+m,g.classList.add("babiaxraycasterclass"),g.object3D.position.x=u,g.object3D.position.z=d,h.appendChild(g)),p._not?g.setAttribute("babia-bar",{height:-.1,color:o.get(v,n)}):g.setAttribute("babia-bar",{height:p[e.height]*this.lengthY/i,width:this.widthBars,depth:this.widthBars,color:o.get(v,n),label:"events",animation:e.animation}),e.legend&&g.setAttribute("babia-bar",{labelText:f+", "+m+": "+p[e.height]})}const c=this.widthBars*(1.25*r.length+.75),u=this.widthBars*(1.25*s.length+.75);this.updateAxis(r,a,c,i,s,l,u),this.xLabels=r,this.xTicks=a,this.zLabels=s,this.zTicks=l},processData:function(t){console.log("processData",this);let e=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},this.notiBuffer.set(this.newData),e.incremental)if(this.newData.forEach(t=>{let n=!1;for(let i in this.currentData)this.currentData[i][e.x_axis]==t[e.x_axis]&&this.currentData[i][e.z_axis]==t[e.z_axis]&&(this.currentData[i]=t,n=!0);n||this.currentData.push(t)}),e.keepHeight)this.maxValue=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]}))),console.log("Re-draw the chart"),this.updateChart();else{console.log("Keep ---\x3e Update"),this.newData.forEach(t=>{t._not?this.chartEl.querySelector("#"+t[e.x_axis]+t[e.z_axis]).setAttribute("babia-bar","height",-.1):this.chartEl.querySelector("#"+t[e.x_axis]+t[e.z_axis])?this.chartEl.querySelector("#"+t[e.x_axis]+t[e.z_axis]).setAttribute("babia-bar",{height:t[e.height]*e.chartHeight/this.maxValue,labelText:t[e.x_axis]+","+t[e.z_axis]+": "+t[e.height]}):h(this,e,t,this.maxValue,o,this.xLabels,this.zLabels,this.xTicks,this.zTicks)});let t=this.xTicks[this.xTicks.length-1]+3*this.widthBars/4,n=this.zTicks[this.zTicks.length-1]+3*this.widthBars/4;if(!e.chartHeight||!e.keepHeight){let t=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]})));this.lengthY=t*e.chartHeight/this.maxValue,this.maxValue=t}this.updateAxis(this.xLabels,this.xTicks,t,this.maxValue,this.zLabels,this.zTicks,n)}else this.currentData=JSON.parse(JSON.stringify(this.newData)),this.updateChart()}});let h=(t,e,n,r,a,s,l,h,c)=>{let u,d,p=n[e.x_axis],f=n[e.z_axis];s.includes(p)||(s.push(p),u=(s.length-1)*i.widthBars*1.25,h.push(u+i.widthBars/2)),u||(u=s.indexOf(p)*i.widthBars*1.25),l.includes(f)||(l.push(f),d=(l.length-1)*i.widthBars*1.25,c.push(d+i.widthBars/2)),d||(d=l.indexOf(f)*i.widthBars*1.25);let m=s.indexOf(p),g=document.createElement("a-entity");return g.id=p+f,g.classList.add("babiaxraycasterclass"),g.setAttribute("babia-bar",{height:n[e.height]*i.lengthY/r,width:i.widthBars,depth:i.widthBars,color:o.get(m,a),label:"events",animation:e.animation}),g.object3D.position.x=u,g.object3D.position.z=d,chartEl.appendChild(g),e.legend&&g.setAttribute("babia-bar",{labelText:n[t.data.x_axis]+": "+n[t.data.height]}),i.xLabels=s,i.xTicks=h,i.zLabels=l,i.zTicks=c,bar}},function(t,e,n){let i=n(0).findProdComponent,r=n(0).updateTitle,a=n(0).parseJson;const s=n(0).colors;n(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function o(t,e,n,i,r,a,o,l,h,c){let u=s.get(n,i);console.log("Generating bubble..."),l?(t/=l,e/=l):(h||c)&&(h&&(t*=h),c&&(e*=c));let d=document.createElement("a-sphere");if(d.setAttribute("color",u),d.setAttribute("radius",e),o){let n=r.toString()+" "+e.toString()+" "+a.toString(),i=r.toString()+" "+(e+t).toString()+" "+a.toString();d.setAttribute("animation__position",{property:"position",from:n,to:i,dur:"3000",easing:"linear"})}else d.setAttribute("position",{x:r,y:e+t,z:a});return d}function l(t,e,n,i){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e,n){let i=e[t.x_axis]+": \n Radius:"+e[t.radius]+"\nHeight:"+e[t.height],r=2;i.length>16&&(r=i.length/8);let a=n.getAttribute("position"),s=parseFloat(n.getAttribute("radius")),o=document.createElement("a-plane");return o.setAttribute("position",{x:a.x,y:a.y+s+1,z:a.z+.1}),o.setAttribute("rotation",{x:0,y:0,z:0}),o.setAttribute("height","1"),o.setAttribute("width",r),o.setAttribute("color","white"),o.setAttribute("text",{value:i,align:"center",width:6,color:"black"}),o.classList.add("babiaxrLegend"),o}(t,n,e),i.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),i.removeChild(legend)}))}AFRAME.registerComponent("babia-bubbles",{schema:{data:{type:"string"},height:{type:"string",default:"height"},radius:{type:"string",default:"radius"},x_axis:{type:"string",default:"x_axis"},z_axis:{type:"string",default:"z_axis"},from:{type:"string"},legend:{type:"boolean"},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},animation:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},scale:{type:"number"},heightMax:{type:"number"},radiusMax:{type:"number"}},visProperties:["height","radius","x_axis","z_axis"],multiple:!1,update:function(t){let e=this.data,n=this.el;if(e.data&&t.data!==e.data){let t=a(e.data);this.processData(t)}else e.from!==t.from?(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=i(e,n),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))):e!==t&&this.newData&&this.processData(this.newData)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},updateTitle:function(){const t=r(this.data,{x:0,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-bubbles:",t);const e=this.data,n=this.el,i=e.animation,r=e.palette,a=e.scale;let s=e.heightMax,h=e.radiusMax,c=[],u=[],d=[],p=[],f=0,m=0,g=0,v=0,y=0,b=0,x={},_={},w=Math.max.apply(Math,t.map((function(t){return t[e.height]}))),M=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));a&&(w/=a,M/=a),s||(s=w),proportion=s/w,h||(h=M),radius_scale=h/M,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),n.appendChild(this.chartEl),a?(y=M/a,b=M/a):(y=M*radius_scale,b=M*radius_scale);for(let s of t){let t=s[e.x_axis],h=s[e.z_axis],w=s[e.height],E=s[e.radius];x[t]?(g=x[t].posX,f=x[t].colorId):(g+=a?2*M/a+.5:2*M*radius_scale+.5,f=m,x[t]={posX:g,colorId:f},c.push(t),u.push(g),m++),_[h]?v=_[h].posZ:(v=a?b+2*M/a+.5:b+2*M*radius_scale+.5,_[h]={posZ:v},d.push(h),p.push(v)),g>y&&(y=g),v>b&&(b=v);let S=o(w,E,f,r,g,v,i,a,proportion,radius_scale);S.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(S),e.legend&&l(e,S,s,n)}if(e.axis){const t=y,e=b,n=s;this.updateAxis(c,u,t,d,p,e,w,n)}this.updateTitle()},updateAxis:function(t,e,n,i,r,a,s,o){let l=document.createElement("a-entity");this.chartEl.appendChild(l),l.setAttribute("babia-axis-x",{labels:t,ticks:e,length:n,palette:this.data.palette}),l.setAttribute("position",{x:0,y:0,z:0});let h=document.createElement("a-entity");this.chartEl.appendChild(h),h.setAttribute("babia-axis-y",{maxValue:s,length:o}),h.setAttribute("position",{x:0,y:0,z:0});let c=document.createElement("a-entity");this.chartEl.appendChild(c),c.setAttribute("babia-axis-z",{labels:i,ticks:r,length:a}),c.setAttribute("position",{x:0,y:0,z:0}),this.data.axis_name&&(l.setAttribute("babia-axis-x","name",this.data.x_axis),h.setAttribute("babia-axis-y","name",this.data.height),c.setAttribute("babia-axis-z","name",this.data.z_axis))},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating bubbles..."),this.updateChart(),this.notiBuffer.set(this.newData)}})},function(t,e,n){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let i;AFRAME.registerComponent("babiaxr-codecity",{schema:{absolute:{type:"boolean",default:!1},width:{type:"number",default:20},depth:{type:"number",default:20},split:{type:"string",default:"naive"},data:{type:"string",default:JSON.stringify({id:"CodeCity",area:1,height:1})},farea:{type:"string",default:"area"},fmaxarea:{type:"string",default:"max_area"},fheight:{type:"string",default:"height"},titles:{type:"boolean",default:!0},building_color:{type:"color",default:"#E6B9A1"},building_model:{type:"string",default:null},base:{type:"boolean",default:!0},base_thick:{type:"number",default:.2},base_color:{type:"color",default:"#98e690"},border:{type:"number",default:1},extra:{type:"number",default:1.4},zone_elevation:{type:"number",default:1},unicolor:{type:"color",default:!1},wireframe:{type:"boolean",default:!1},colormap:{type:"array",default:["blue","green","yellow","brown","orange","magenta","grey","cyan","azure","beige","blueviolet","coral","crimson","darkblue","darkgrey","orchid","olive","navy","palegreen"]},time_evolution_delta:{type:"number",default:8e3},time_evolution_init:{type:"string",default:"data_0"},time_evolution_past_present:{type:"boolean",default:!1},time_evolution_animation:{type:"boolean",default:!0},time_evolution_color:{type:"boolean",default:!1},ui_navbar:{type:"string",default:""}},multiple:!1,init:function(){},update:function(t){this.loader=new THREE.FileLoader;let e=this.data,n=this.el;E=e.building_color,i=n,"string"==typeof e.data?e.data.endsWith("json")?raw_items=l(e):raw_items=JSON.parse(e.data):raw_items=e.data,n.emit("babiaxr-dataLoaded",{data:raw_items,codecity:!0}),g=e.time_evolution_delta,this.zone_data=raw_items;let a,o,d=new r({data:this.zone_data,extra:function(t){return t*e.extra},farea:e.farea,fheight:e.fheight,fmaxarea:e.fmaxarea});1==e.absolute?(a=Math.sqrt(d.areas.canvas)*e.width/e.depth,o=d.areas.canvas/a):(a=e.width,o=e.depth);let v=new s({width:a,depth:o,x:0,z:0});d.add_rects({rect:v,split:e.split,relative:!1});let y=document.createElement("a-entity");this.base=y;d.draw_rects({ground:v,el:y,base:e.base,level:0,elevation:0,relative:!1,base_thick:e.base_thick,wireframe:e.wireframe,building_color:e.building_color,base_color:e.base_color,model:e.building_model,visible:!0,titles:e.titles}),n.appendChild(y),h&&(time_evolution_past_present=e.time_evolution_past_present,c=e.time_evolution_animation,u=e.time_evolution_color,w(e),function(){const t=Object.keys(m).length;let e=0;p&&(document.addEventListener("babiaxrToPast",(function(){time_evolution_past_present=!1})),document.addEventListener("babiaxrToPresent",(function(){time_evolution_past_present=!0})),document.addEventListener("babiaxrStop",(function(){clearInterval(_)})),document.addEventListener("babiaxrContinue",(function(){_=setTimeout((function(){S(t,e),e<t-1&&n()}),g)})),document.addEventListener("babiaxrSkipNext",(function(){time_evolution_past_present=!1,clearInterval(_),z(t-x-1),f=t-x-1,e--,x--,A()})),document.addEventListener("babiaxrSkipPrev",(function(){time_evolution_past_present=!0,clearInterval(_),z(t-x-3),f=t-x-3,e++,x++,A()})),document.addEventListener("babiaxrShow",(function(n){clearInterval(_),eventData=n.detail.data,e=eventData.data,z(t-e-1),f=t-e-1,x=e-1,A(!0)})));let n=()=>{_=setTimeout((function(){p&&z(t-x-2),f=t-x-2,S(t,e),e<t-1&&n()}),g)};n()}())},remove:function(){},play:function(){}});let r=class{constructor({data:t,extra:e=function(t){return t},farea:n="area",fmaxarea:i="max_area",fheight:r="height"}){this.data=t,this.id=this.data.id,this.extra=e,this.farea=n,this.fmaxarea=i,this.fheight=r,this.areas=this.areas_tree(),this.el=null,this.pending_rects=0}areas_tree({data:t=this.data,level:e=0}={}){let n=t,i={data:n};if("children"in n){i.inner=0,i.area=0,i.children=[];for(const t of n.children){let n=this.areas_tree({data:t,level:e+1});i.inner+=n.canvas,i.area+=n.area,i.children.push(n)}}else i.area=n[this.farea],i.max_area=n[this.fmaxarea],i.inner=i.max_area,i.inner_real=i.area;return i.canvas=this.extra(i.inner,e),i}add_rects({rect:t,area:e=this.areas,relative:n=!0,split:i="naive"}={}){if(e.rect=t,e.rect.inner(e.canvas,e.inner,e.inner_real),"children"in e){let t,r=new a(e.children.map(t=>t.canvas),e.inner);if("naive"===i)t=e.rect.split(r,n);else{if("pivot"!==i)throw new Error("CodeCity: Unknwon split method");t=e.rect.split_pivot(r,n)}for(const r in e.children)this.add_rects({rect:t[r],area:e.children[r],relative:n,split:i})}}draw_rects({ground:t,el:e,area:n=this.areas,level:r=0,elevation:a=0,relative:s=!0,base_thick:o=.2,wireframe:l=!1,building_color:h="red",base_color:c="green",model:u=null,visible:d=!0,titles:p=!0}){0===r&&(this.el=e);this.pending_rects;if("children"in n){let t=n.rect.box({elevation:a,height:o,color:c,inner:!1,wireframe:l,visible:d,id:n.data.id,rawarea:0});if(p){let e,n;t.addEventListener("click",(function(){if(e)i.removeChild(n),i.removeChild(e),e=void 0,n=void 0;else{n=document.createElement("a-entity");let r=t.getAttribute("geometry"),a=t.getAttribute("position");n.setAttribute("geometry",{height:r.height+10,depth:r.depth,width:r.width}),n.setAttribute("position",a),n.setAttribute("material",{visible:!0,opacity:.4}),e=M(this.getAttribute("id"),r.height+10,a,null,i),i.appendChild(e),i.appendChild(n)}}))}t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t);let f=t;s||(f=e);for(const t of n.children){let e=o/2;s||(e=a+o),this.draw_rects({ground:n.rect,el:f,area:t,level:r+1,elevation:e,relative:s,building_color:h,base_color:c,model:u,base_thick:o,wireframe:l,visible:d,titles:p})}}else{n.data[this.fheight];let t=n.rect.box({height:n.data[this.fheight],elevation:a,wireframe:l,color:h,model:u,visible:d,id:n.data.id,rawarea:n.data[this.farea],inner_real:!0});if(t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t),p){let e,n,r=!1;t.addEventListener("click",(function(){r?(i.removeChild(e),i.removeChild(n),e=void 0,n=void 0,r=!1):r=!0})),t.addEventListener("mouseenter",(function(){if(!r){n=document.createElement("a-entity");let r=t.getAttribute("geometry"),a=t.getAttribute("position");n.setAttribute("position",a),n.setAttribute("material",{visible:!0}),n.setAttribute("geometry",{height:r.height+.1,depth:r.depth+.1,width:r.width+.1}),e=M(this.getAttribute("id"),r.height+.1,a,null,i),i.appendChild(e),i.appendChild(n)}})),t.addEventListener("mouseleave",(function(){!r&&e&&(i.removeChild(e),i.removeChild(n),e=void 0,n=void 0)}))}}}},a=class{constructor(t,e){this.items=t,this.total=void 0!==e?e:t.reduce((t,e)=>t+e,0)}imax(){let t=this.items[0],e=0;for(let n=0;n<this.items.length;n++)t<this.items[n]&&(t=this.items[n],e=n);return e}static range(t,e){var n=[];for(let i=t;i<t+e;i++)n.push(i);return n}scaled_area(t,e){return this.items[e]*t/this.total}values_i(t){let e=[];for(const n of t)e.push(this.items[n]);return new a(e)}pivot_regions(t,e){if(this.items.length<3)throw new Error("CodeCity - Values.pivot_regions: less than three items");if(t<e)throw new Error("Codecity - Values.pivot_regions: rectangle should be laying");let n,i,r=this.imax();if(this.items.lenght==r+1)return{pivot:r,a1:a.range(0,r),a2:[],a3:[]};if(this.items.length==r+2)return{pivot:r,a1:a.range(0,r),a2:[r+1],a3:[]};let s=t*e,o=this.scaled_area(s,r),l=Math.sqrt(o)*e-o,h=0,c=h,u=r+1;for(;h<l&&u<this.items.length;)c=h,h+=this.scaled_area(s,u),u++;let d=u;return u-1>r&&Math.abs(h-l)>Math.abs(c-l)&&(d=u-1),n=d-r-1,i=this.items.length-d,{pivot:r,a1:a.range(0,r),a2:a.range(r+1,n),a3:a.range(r+1+n,i)}}pivot_region_width(t,e){let n=0;for(const e of t)n+=this.items[e];return n/this.total*e}},s=class{constructor({width:t,depth:e,x:n=0,z:i=0}){this.width=t,this.depth=e,this.x=n,this.z=i}is_ilaying(){return Math.max(this.width,this.depth)==this.width}inner(t,e,n){if(t<e)throw"Rectangle.inner: Area for inner rectangle larger than my area";if(void 0!==t){let i=Math.sqrt(e/t);if(this.iwidth=i*this.width,this.idepth=i*this.depth,n){let e=Math.sqrt(n/t);this.iwidth_real=e*this.width,this.idepth_real=e*this.depth}}else this.iwidth=this.width,this.idepth=this.depth}reflect(){[this.width,this.depth]=[this.depth,this.width],[this.x,this.z]=[this.z,this.x]}idims_as_laying(){return this.is_ilaying()?[this.iwidth,this.idepth,this.x,this.z,!1]:[this.idepth,this.iwidth,this.z,this.x,!0]}split(t,e=!0){let[n,i,r,a,o]=this.idims_as_laying(),l=n/t.total,h=-n/2,c=0;e||(h+=r,c=a);let u=[];for(const e of t.items){let t=e*l,n=new s({width:t,depth:i,x:h+t/2,z:c});o&&n.reflect(),u.push(n),h+=t}return u}split_pivot(t,e=!0){if(t.items.length<=2)return this.split(t,e);let[n,i,r,a,o]=this.idims_as_laying();e&&(r=0,a=0);let{pivot:l,a1:h,a2:c,a3:u}=t.pivot_regions(n,i),d=t.pivot_region_width(h,n),p=t.pivot_region_width(c.concat(l),n),f=t.pivot_region_width(u,n),m=r-n/2+d/2,g=r-n/2+d+p/2,v=r-n/2+d+p+f/2,y=[],b=t.scaled_area(n*i,l)/p;y[l]=new s({width:p,depth:b,x:g,z:a+i/2-b/2});let x=[[h,d,i,m,a],[c,p,i-b,g,a-b/2],[u,f,i,v,a]];for(const[e,n,i,r,a]of x)if(e.length>0){let o=new s({width:n,depth:i,x:r,z:a});o.inner();let l=t.values_i(e),h=o.split_pivot(l,!1),c=0;for(const t of e)y[t]=h[c],c++}if(o)for(const t of y)t.reflect();return y}box({height:t,elevation:e=0,color:n="red",model:i=null,inner:r=!0,wireframe:a=!1,visible:s=!0,id:o="",rawarea:l=0,inner_real:h=!1}){let c,u;[c,u]=h?[this.idepth_real,this.iwidth_real]:r?[this.idepth,this.iwidth]:[this.depth,this.width];let d=document.createElement("a-entity");return d.setAttribute("geometry",{primitive:"box",skipCache:!0,depth:c,width:u,height:t}),d.setAttribute("material",{color:n}),d.setAttribute("position",{x:this.x,y:e+t/2,z:this.z}),d.setAttribute("id",o),d.setAttribute("babiaxr-rawarea",l),d}};t.exports={Values:a,Rectangle:s,Zone:r};let o,l=t=>{let e,n=t.data,i=new XMLHttpRequest;if(i.open("get",n,!1),i.onload=function(){this.status>=200&&this.status<300?e="string"==typeof i.response||i.response instanceof String?JSON.parse(i.response):i.response:reject({status:this.status,statusText:xhr.statusText})},i.onerror=function(){reject({status:this.status,statusText:xhr.statusText})},i.send(),e.time_evolution){v=e,h=!0,d=e.time_evolution_commit_by_commit;let n=e.data_files.find(t=>"data_0_tree"===t.key_tree);e=n.data_0_tree,y=n.data_0;let i=[];for(let t=0;t<v.data_files.length;t++){m["data_"+t]=v.data_files[t],i.push({date:new Date(1e3*v.data_files[t].date).toLocaleDateString(),commit:v.data_files[t].commit_sha,data:t})}if(t.ui_navbar&&(f=t.time_evolution_past_present?parseInt(t.time_evolution_init.split("_")[1]):v.data_files.length-1,p=t.ui_navbar,document.getElementById(p).setAttribute("babiaxr-navigation-bar","commits",JSON.stringify(i.reverse()))),"data_0"!==t.time_evolution_init){let n;n=m[t.time_evolution_init][t.time_evolution_init+"_allfiles"]?t.time_evolution_init+"_allfiles":t.time_evolution_init;let i=I(e.children,{});m[t.time_evolution_init][n].forEach(t=>{i[t.id]&&(i[t.id].height=t.height,i[t.id].area=t.area,i[t.id].max_area=t.max_area)}),x=parseInt(t.time_evolution_init.split("_")[1])}}return e},h=!1,c=!0,u=!1,d=!1,p=void 0,f=void 0,m={},g=8e3,v={},y=void 0,b=[],x=0,_=void 0,w=t=>{let e;if(document.getElementById("scene"))e=document.getElementById("scene");else{e=document.getElementsByTagName("a-scene");document.getElementsByTagName("a-entity")}let n=document.createElement("a-entity");n.classList.add("babiaxrDateBar"),n.setAttribute("position",{x:-13,y:10,z:-3}),n.setAttribute("rotation",{x:0,y:0,z:0}),n.setAttribute("material",{color:"black"}),n.setAttribute("height",.5),n.setAttribute("width",2),n.setAttribute("scale",{x:1,y:1,z:1});let i="Date: "+new Date(1e3*m[t.time_evolution_init].date).toLocaleDateString();m[t.time_evolution_init].commit_sha&&(i+="\n\nCommit: "+m[t.time_evolution_init].commit_sha),n.setAttribute("text-geometry",{value:i}),o=n,e.appendChild(n)},M=(t,e,n,i,r)=>{let a=2;t.length>16&&(a=t.length/8);let s=e,o=document.createElement("a-plane");o.setAttribute("babia-lookat","[camera]"),o.setAttribute("position",{x:n.x,y:n.y+s/2+1,z:n.z}),o.setAttribute("rotation",{x:0,y:0,z:0}),o.setAttribute("height","1"),o.setAttribute("width",a),o.setAttribute("color","white"),o.setAttribute("material",{side:"double"}),o.setAttribute("text",{value:t,align:"center",width:6,color:"black"});let l=r.getAttribute("scale");return!l||l.x===l.y&&l.x===l.z||o.setAttribute("scale",{x:1/l.x,y:1/l.y,z:1/l.z}),o};let E,S=(t,e)=>{console.log("Loop number",e),A(),time_evolution_past_present?(x--,0==x&&console.log("finished"),e--):(x++,e++,x>t-1&&(x=0))},A=t=>{let e,n="data_"+(x+1);e=t?"data_"+(x+1)+"_allfiles":time_evolution_past_present?"data_reverse_"+(x+1):"data_"+(x+1);let i="Date: "+new Date(1e3*m[n].date).toLocaleDateString();m[n].commit_sha&&(i+="\n\nCommit: "+m[n].commit_sha),o.setAttribute("text-geometry","value",i),b=[],u&&(T+=5,80!==T?E=function(t,e){let n,i=parseInt(t.slice(1,3),16),r=parseInt(t.slice(3,5),16),a=parseInt(t.slice(5,7),16),s=function(t,e,n){t/=255,e/=255,n/=255;let i,r,a=Math.max(t,e,n),s=Math.min(t,e,n),o=(a+s)/2;if(a==s)i=r=0;else{let l=a-s;switch(r=o>.5?l/(2-a-s):l/(a+s),a){case t:i=(e-n)/l+(e<n?6:0);break;case e:i=(n-t)/l+2;break;case n:i=(t-e)/l+4}i/=6}return[i,r,o]}(i,r,a);return n=function(t,e,n){let i,r,a;if(0==e)i=r=a=n;else{function s(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}let o=n<.5?n*(1+e):n+e-n*e,l=2*n-o;i=s(l,o,t+1/3),r=s(l,o,t),a=s(l,o,t-1/3)}return[255*i,255*r,255*a]}(s[0],s[1],e/100),t="#"+N(n[0])+N(n[1])+N(n[2])}(E,T):(L++,L>C.length-1&&(L=0),E=C[L],T=20)),m[n][e]?m[n][e].forEach(t=>{R(t)}):m[n][n].forEach(t=>{R(t)}),d||y.forEach(t=>{b.includes(t.id)||P(t.id)}),D()},T=20,C=["#000066","#006600","#666600","#660000"],L=0,R=t=>{if(null!=document.getElementById(t.id)&&0!=t.area){b.push(t.id);let e=document.getElementById(t.id).getAttribute("position"),n=document.getElementById(t.id).getAttribute("position").x,i=document.getElementById(t.id).getAttribute("position").y,r=document.getElementById(t.id).getAttribute("position").z,a=document.getElementById(t.id).getAttribute("geometry").width,s=document.getElementById(t.id).getAttribute("geometry").depth,o=document.getElementById(t.id).getAttribute("geometry").height,l=parseFloat(document.getElementById(t.id).getAttribute("babiaxr-rawarea"));if(o.toFixed(6)!==t.height.toFixed(6)||l.toFixed(6)!==t.area.toFixed(6)){u&&document.getElementById(t.id).setAttribute("material",{color:E});let h=!1,d=a/s;d<1&&(h=!0,d=s/a);let p=t.area*(s*a)/l,f=Math.sqrt(p*d),m=Math.sqrt(p/d);if(h&&(m=Math.sqrt(p*d),f=Math.sqrt(p/d)),document.getElementById(t.id).setAttribute("babiaxr-rawarea",t.area),c){let e=500;if(f>a||m>s){let n=20*(f-a)/e,i=20*(m-s)/e,r=a,o=s,l=setInterval((function(){r>=f||o>=m?(document.getElementById(t.id).setAttribute("geometry","width",f),document.getElementById(t.id).setAttribute("geometry","depth",m),clearInterval(l)):(r+=n,o+=i,document.getElementById(t.id).setAttribute("geometry","width",r),document.getElementById(t.id).setAttribute("geometry","depth",o))}),1)}else if(f<a||m<s){let n=20*(a-f)/e,i=20*(s-m)/e,r=a,o=s,l=setInterval((function(){r<=f||o<=m?(document.getElementById(t.id).setAttribute("geometry","width",f),document.getElementById(t.id).setAttribute("geometry","depth",m),clearInterval(l)):(r-=n,o-=i,document.getElementById(t.id).setAttribute("geometry","width",r),document.getElementById(t.id).setAttribute("geometry","depth",o))}),1)}if(t.height<0)P(t.id);else if(t.height>o){let a=20*(t.height-o)/e,s=o,l=setInterval((function(){s>=t.height?(document.getElementById(t.id).setAttribute("position",{x:n,y:i-o/2+t.height/2,z:r}),clearInterval(l)):(s+=a,document.getElementById(t.id).setAttribute("geometry","height",s),document.getElementById(t.id).setAttribute("position",{x:n,y:i-o/2+s/2,z:r}))}),1)}else if(t.height<o){let a=20*(o-t.height)/e,s=o,l=setInterval((function(){s<=t.height?(document.getElementById(t.id).setAttribute("position",{x:n,y:i-o/2+t.height/2,z:r}),clearInterval(l)):(s-=a,document.getElementById(t.id).setAttribute("geometry","height",s),document.getElementById(t.id).setAttribute("position",{x:n,y:i-o/2+s/2,z:r}))}),1)}}else document.getElementById(t.id).setAttribute("geometry","width",f),document.getElementById(t.id).setAttribute("geometry","depth",m),document.getElementById(t.id).setAttribute("geometry","height",t.height),document.getElementById(t.id).setAttribute("position",{x:e.x,y:e.y-o/2+t.height/2,z:e.z})}}},P=t=>{let e=document.getElementById(t).getAttribute("material").color;document.getElementById(t).setAttribute("material",{color:"black"}),document.getElementById(t).setAttribute("material",{opacity:"0.3"});let n=setInterval((function(){!function(){let i=document.getElementById(t).getAttribute("position"),r=document.getElementById(t).getAttribute("geometry").height;document.getElementById(t).setAttribute("geometry","height",-.1),document.getElementById(t).setAttribute("position",{x:i.x,y:i.y-r/2-.05,z:i.z}),document.getElementById(t).setAttribute("material",{color:e}),document.getElementById(t).setAttribute("material",{opacity:"1.0"}),clearInterval(n)}()}),1e3)},D=()=>{console.log("Changing city")},I=(t,e)=>(t.forEach(t=>{t.children?I(t.children,e):e[t.id]=t}),e),z=t=>{let e=document.getElementsByClassName("babiaxrTimeBar")[0].children;if(f||0==f){e[f].emit("removeinfo")}e[t].emit("showinfo")};function N(t){let e=Math.round(t).toString(16);return e.length>1||(e="0"+e),e}},function(t,e,n){let i=n(0).findProdComponent;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-city",{schema:{from:{type:"string"},absolute:{type:"boolean",default:!1},width:{type:"number",default:20},depth:{type:"number",default:20},split:{type:"string",default:"naive"},data:{type:"string"},farea:{type:"string",default:"area"},fmaxarea:{type:"string",default:"max_area"},fheight:{type:"string",default:"height"},titles:{type:"boolean",default:!0},building_color:{type:"color",default:"#E6B9A1"},building_model:{type:"string",default:null},base:{type:"boolean",default:!0},base_thick:{type:"number",default:.2},base_color:{type:"color",default:"#98e690"},border:{type:"number",default:1},extra:{type:"number",default:1.4},zone_elevation:{type:"number",default:1},unicolor:{type:"color",default:!1},wireframe:{type:"boolean",default:!1},colormap:{type:"array",default:["blue","green","yellow","brown","orange","magenta","grey","cyan","azure","beige","blueviolet","coral","crimson","darkblue","darkgrey","orchid","olive","navy","palegreen"]},time_evolution_delta:{type:"number",default:8e3},time_evolution_init:{type:"string",default:"data_0"},time_evolution_past_present:{type:"boolean",default:!1},time_evolution_animation:{type:"boolean",default:!0},time_evolution_color:{type:"boolean",default:!1},ui_navbar:{type:"string",default:""}},multiple:!1,update:function(t){let e=this.data,n=this.el;if(e.data&&t.data!==e.data){let t=JSON.parse(e.data);this.processData(t)}else e.from!==t.from&&(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=i(e,n),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))),e!==t&&this.newData&&(console.log("Generating city..."),this.processData(this.newData)))},dataComponent:void 0,dataComponentDataPropertyName:"babiaData",dataComponentEventName:void 0,babiaData:void 0,babiaMetadata:{id:0},visProperties:["fheight","farea"],processData:function(t){let e;console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},e=this.newData.length>0?{id:"init",children:this.newData}:this.newData.length<=0?this.newData[0]:this.newData,r(this,e)}});let r=(t,e)=>{t.loader=new THREE.FileLoader;let n=t.data,i=t.el;c=n.building_color;let r=i;i.emit("babiaxr-dataLoaded",{data:e,codecity:!0}),l=n.time_evolution_delta,t.zone_data=e;let s,h,u=new a({data:t.zone_data,extra:function(t){return t*n.extra},farea:n.farea,fheight:n.fheight,fmaxarea:n.fmaxarea});1==n.absolute?(s=Math.sqrt(u.areas.canvas)*n.width/n.depth,h=u.areas.canvas/s):(s=n.width,h=n.depth);let d=new o({width:s,depth:h,x:0,z:0});u.add_rects({rect:d,split:n.split,relative:!1});let p=document.createElement("a-entity");t.base=p;u.draw_rects({ground:d,el:p,base:n.base,level:0,elevation:0,relative:!1,base_thick:n.base_thick,wireframe:n.wireframe,building_color:n.building_color,base_color:n.base_color,model:n.building_model,visible:!0,titles:n.titles,rootCodecityEntity:r}),i.appendChild(p)},a=class{constructor({data:t,extra:e=function(t){return t},farea:n="area",fmaxarea:i="max_area",fheight:r="height"}){this.data=t,this.id=this.data.id,this.extra=e,this.farea=n,this.fmaxarea=i,this.fheight=r,this.areas=this.areas_tree(),this.el=null,this.pending_rects=0}areas_tree({data:t=this.data,level:e=0}={}){let n=t,i={data:n};if("children"in n){i.inner=0,i.area=0,i.children=[];for(const t of n.children){let n=this.areas_tree({data:t,level:e+1});i.inner+=n.canvas,i.area+=n.area,i.children.push(n)}}else i.area=n[this.farea]||.5,i.max_area=n[this.fmaxarea]||.5,i.inner=i.max_area,i.inner_real=i.area;return i.canvas=this.extra(i.inner,e),i}add_rects({rect:t,area:e=this.areas,relative:n=!0,split:i="naive"}={}){if(e.rect=t,e.rect.inner(e.canvas,e.inner,e.inner_real),"children"in e){let t,r=new s(e.children.map(t=>t.canvas),e.inner);if("naive"===i)t=e.rect.split(r,n);else{if("pivot"!==i)throw new Error("CodeCity: Unknwon split method");t=e.rect.split_pivot(r,n)}for(const r in e.children)this.add_rects({rect:t[r],area:e.children[r],relative:n,split:i})}}draw_rects({ground:t,el:e,area:n=this.areas,level:i=0,elevation:r=0,relative:a=!0,base_thick:s=.2,wireframe:o=!1,building_color:l="red",base_color:c="green",model:u=null,visible:d=!0,titles:p=!0,rootCodecityEntity:f}){let m=this;0===i&&(this.el=e);this.pending_rects;if("children"in n){let t=n.rect.box({elevation:r,height:s,color:c,inner:!1,wireframe:o,visible:d,id:n.data.id,rawarea:0});if(p){let e,n;t.addEventListener("click",(function(){if(e)f.removeChild(n),f.parentElement.removeChild(e),e=void 0,n=void 0;else{n=document.createElement("a-entity");let i=t.getAttribute("geometry"),r=t.getAttribute("position"),a=f.getAttribute("scale"),s=i.height+11;a&&(s=(i.height+11)/a.y),n.setAttribute("geometry",{height:s,depth:i.depth,width:i.width}),n.setAttribute("position",r),n.setAttribute("material",{visible:!0,opacity:.4}),f.appendChild(n),e=h(this.getAttribute("id"),"black","white");let o=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),l={x:o.x,y:12,z:o.z};e.setAttribute("position",l),e.setAttribute("visible",!0),f.parentElement.appendChild(e)}}))}t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t);let m=t;a||(m=e);for(const t of n.children){let e=s/2;a||(e=r+s),this.draw_rects({ground:n.rect,el:m,area:t,level:i+1,elevation:e,relative:a,building_color:l,base_color:c,model:u,base_thick:s,wireframe:o,visible:d,titles:p,rootCodecityEntity:f})}}else{let t=n.rect.box({height:n.data[this.fheight],elevation:r,wireframe:o,color:l,model:u,visible:d,id:n.data.id,rawarea:n.data[this.farea],inner_real:!0});if(t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t),p){let e,i,r=!1;t.addEventListener("click",(function(){r?(e.setAttribute("visible",!1),i.setAttribute("visible",!1),f.parentElement.removeChild(e),f.removeChild(i),e=void 0,i=void 0,r=!1):r=!0})),t.addEventListener("mouseenter",(function(){if(!r){i=document.createElement("a-entity");let r=t.getAttribute("geometry"),a=t.getAttribute("position");i.setAttribute("position",a),i.setAttribute("material",{visible:!0}),i.setAttribute("geometry",{height:r.height+.1,depth:r.depth+.1,width:r.width+.1}),e=h(this.getAttribute("id"),"white","black",n.data,m.fheight,m.farea);let s=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),o=(new THREE.Box3).setFromObject(t.object3D),l={x:s.x,y:o.max.y+1,z:s.z};e.setAttribute("position",l),e.setAttribute("visible",!0),f.parentElement.appendChild(e),f.appendChild(i)}})),t.addEventListener("mouseleave",(function(){!r&&e&&(e.setAttribute("visible",!1),i.setAttribute("visible",!1),f.parentElement.removeChild(e),f.removeChild(i),e=void 0,i=void 0)}))}}}},s=class{constructor(t,e){this.items=t,this.total=void 0!==e?e:t.reduce((t,e)=>t+e,0)}imax(){let t=this.items[0],e=0;for(let n=0;n<this.items.length;n++)t<this.items[n]&&(t=this.items[n],e=n);return e}static range(t,e){var n=[];for(let i=t;i<t+e;i++)n.push(i);return n}scaled_area(t,e){return this.items[e]*t/this.total}values_i(t){let e=[];for(const n of t)e.push(this.items[n]);return new s(e)}pivot_regions(t,e){if(this.items.length<3)throw new Error("CodeCity - Values.pivot_regions: less than three items");if(t<e)throw new Error("Codecity - Values.pivot_regions: rectangle should be laying");let n,i,r=this.imax();if(this.items.lenght==r+1)return{pivot:r,a1:s.range(0,r),a2:[],a3:[]};if(this.items.length==r+2)return{pivot:r,a1:s.range(0,r),a2:[r+1],a3:[]};let a=t*e,o=this.scaled_area(a,r),l=Math.sqrt(o)*e-o,h=0,c=h,u=r+1;for(;h<l&&u<this.items.length;)c=h,h+=this.scaled_area(a,u),u++;let d=u;return u-1>r&&Math.abs(h-l)>Math.abs(c-l)&&(d=u-1),n=d-r-1,i=this.items.length-d,{pivot:r,a1:s.range(0,r),a2:s.range(r+1,n),a3:s.range(r+1+n,i)}}pivot_region_width(t,e){let n=0;for(const e of t)n+=this.items[e];return n/this.total*e}},o=class{constructor({width:t,depth:e,x:n=0,z:i=0}){this.width=t,this.depth=e,this.x=n,this.z=i}is_ilaying(){return Math.max(this.width,this.depth)==this.width}inner(t,e,n){if(t<e)throw"Rectangle.inner: Area for inner rectangle larger than my area";if(void 0!==t){let i=Math.sqrt(e/t);if(this.iwidth=i*this.width,this.idepth=i*this.depth,n){let e=Math.sqrt(n/t);this.iwidth_real=e*this.width,this.idepth_real=e*this.depth}}else this.iwidth=this.width,this.idepth=this.depth}reflect(){[this.width,this.depth]=[this.depth,this.width],[this.x,this.z]=[this.z,this.x]}idims_as_laying(){return this.is_ilaying()?[this.iwidth,this.idepth,this.x,this.z,!1]:[this.idepth,this.iwidth,this.z,this.x,!0]}split(t,e=!0){let[n,i,r,a,s]=this.idims_as_laying(),l=n/t.total,h=-n/2,c=0;e||(h+=r,c=a);let u=[];for(const e of t.items){let t=e*l,n=new o({width:t,depth:i,x:h+t/2,z:c});s&&n.reflect(),u.push(n),h+=t}return u}split_pivot(t,e=!0){if(t.items.length<=2)return this.split(t,e);let[n,i,r,a,s]=this.idims_as_laying();e&&(r=0,a=0);let{pivot:l,a1:h,a2:c,a3:u}=t.pivot_regions(n,i),d=t.pivot_region_width(h,n),p=t.pivot_region_width(c.concat(l),n),f=t.pivot_region_width(u,n),m=r-n/2+d/2,g=r-n/2+d+p/2,v=r-n/2+d+p+f/2,y=[],b=t.scaled_area(n*i,l)/p;y[l]=new o({width:p,depth:b,x:g,z:a+i/2-b/2});let x=[[h,d,i,m,a],[c,p,i-b,g,a-b/2],[u,f,i,v,a]];for(const[e,n,i,r,a]of x)if(e.length>0){let s=new o({width:n,depth:i,x:r,z:a});s.inner();let l=t.values_i(e),h=s.split_pivot(l,!1),c=0;for(const t of e)y[t]=h[c],c++}if(s)for(const t of y)t.reflect();return y}box({height:t,elevation:e=0,color:n="red",model:i=null,inner:r=!0,wireframe:a=!1,visible:s=!0,id:o="",rawarea:l=0,inner_real:h=!1}){let c,u;[c,u]=h?[this.idepth_real,this.iwidth_real]:r?[this.idepth,this.iwidth]:[this.depth,this.width];let d=document.createElement("a-entity");return d.setAttribute("geometry",{primitive:"box",skipCache:!0,depth:c,width:u,height:t}),d.setAttribute("material",{color:n}),d.setAttribute("position",{x:this.x,y:e+t/2,z:this.z}),d.setAttribute("id",o),d.setAttribute("babiaxr-rawarea",l),d}};t.exports={Values:s,Rectangle:o,Zone:a};let l=8e3,h=(t,e,n,i,r,a)=>{let s=2;if(t.length>16&&(s=t.length/8),i){let e="\n "+r+" (height): "+i[r];e.length>16&&(s=e.length/8),t+=e;let n="\n "+a+" (area): "+i[a];n.length>16&&n>e&&(s=n.length/8),t+=n}let o=document.createElement("a-plane");return o.setAttribute("babia-lookat","[camera]"),o.setAttribute("rotation",{x:0,y:0,z:0}),o.setAttribute("height","1"),o.setAttribute("width",s),o.setAttribute("color",e),o.setAttribute("material",{side:"double"}),o.setAttribute("text",{value:t,align:"center",width:6,color:n}),o.setAttribute("visible",!1),o};let c},function(t,e,n){let i=n(0).findProdComponent,r=n(0).updateTitle,a=n(0).parseJson;const s=n(0).colors,o=n(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function l(t,e,n,i,r,a,o,l,h){let c=s.get(n,i),u=document.createElement("a-cylinder");if(o?(t/=o,e/=o):(l||h)&&(l&&(t*=l),h&&(e*=h)),u.setAttribute("color",c),u.setAttribute("height",0),u.setAttribute("radius",e),a){var d=20*t/4e3,p=0,f=setInterval(a,1);function a(){p>=t?clearInterval(f):(p+=d,u.setAttribute("height",p),u.setAttribute("position",{x:r,y:p/2,z:0}))}}else u.setAttribute("height",t),u.setAttribute("position",{x:r,y:t/2,z:0});return u}function h(t,e,n,i,r){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e,n,i){let r=e[t.x_axis]+": "+e[t.height],a=5;r.length>16&&(a=r.length/2);let s=n.getAttribute("position"),o=document.createElement("a-plane");return o.setAttribute("position",{x:s.x,y:2*s.y+2,z:s.z+i+.5}),o.setAttribute("rotation",{x:0,y:0,z:0}),o.setAttribute("height","1.5"),o.setAttribute("width",a),o.setAttribute("color","white"),o.setAttribute("text",{value:e[t.x_axis]+": "+e[t.height],align:"center",width:20,color:"black"}),o.classList.add("babiaxrLegend"),o}(t,n,e,r),i.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),i.removeChild(legend)}))}AFRAME.registerComponent("babia-cyls",{schema:{data:{type:"string"},height:{type:"string",default:"height"},radius:{type:"string",default:"radius"},x_axis:{type:"string",default:"x_axis"},from:{type:"string"},legend:{type:"boolean"},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},animation:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},scale:{type:"number"},heightMax:{type:"number"},radiusMax:{type:"number"}},visProperties:["height","radius","x_axis"],multiple:!1,init:function(){this.notiBuffer=new o},update:function(t){let e=this.data,n=this.el;if(e.data&&t.data!==e.data){let t=a(e.data);this.processData(t)}else e.from!==t.from?(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=i(e,n),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))):e!==t&&this.newData&&this.processData(this.newData)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},updateTitle:function(){const t=r(this.data,{x:0,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-cyls:",t);const e=this.data,n=this.el,i=e.animation,r=e.palette,a=e.scale;let s=e.heightMax,o=e.radiusMax,c=[],u=[],d=0,p=1,f=0,m=0,g=Math.max.apply(Math,t.map((function(t){return t[e.height]}))),v=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));a&&(g/=a,v/=a),s||(s=g),proportion=s/g,o||(o=v),radius_scale=o/v,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),n.appendChild(this.chartEl);for(let s of t){let o=s[e.x_axis],g=s[e.radius],y=s[e.height];s!==t[0]?p+=a?m+g/a+.5:m+g*radius_scale+.5:f=a?g/a:g*radius_scale;let b=l(y,g,d,r,p,i,a,proportion,radius_scale);b.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(b),e.legend&&h(e,b,s,n,v),m=a||radius_scale?a?g/a:radius_scale*g:g,c.push(o),u.push(f+p),d++}if(e.axis){const t=f+p+m+.5,e=s;this.updateAxis(c,u,t,f,v,g,e)}this.updateTitle()},updateAxis:function(t,e,n,i,r,a,s){let o=document.createElement("a-entity");this.chartEl.appendChild(o),o.setAttribute("babia-axis-x",{labels:t,ticks:e,length:n,palette:this.data.palette}),o.setAttribute("position",{x:-i,y:0,z:r+1});let l=document.createElement("a-entity");this.chartEl.appendChild(l),l.setAttribute("babia-axis-y",{maxValue:a,length:s}),l.setAttribute("position",{x:-i,y:0,z:r+1}),this.data.axis_name&&(o.setAttribute("babia-axis-x","name",this.data.x_axis),l.setAttribute("babia-axis-y","name",this.data.height))},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating cyls..."),this.updateChart(),this.notiBuffer.set(this.newData)}})},function(t,e,n){let i=n(0).findProdComponent,r=n(0).updateTitle,a=n(0).parseJson;const s=n(0).colors,o=n(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function l(t,e,n,i,r,a,o,l,h,c){let u=s.get(n,i),d=document.createElement("a-cylinder");if(l?(t/=l,e/=l):(h||c)&&(h&&(t*=h),c&&(e*=c)),d.setAttribute("color",u),d.setAttribute("height",0),d.setAttribute("radius",e),o){var p=20*t/4e3,f=0,m=setInterval(o,1);function o(){f>=t?clearInterval(m):(f+=p,d.setAttribute("height",f),d.setAttribute("position",{x:r,y:f/2,z:a}))}}else d.setAttribute("height",t),d.setAttribute("position",{x:r,y:t/2,z:a});return d}function h(t,e,n,i){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e,n,i){let r="",a=[];a.push(e[t.x_axis]+" "+e[t.z_axis]+"\n"),a.push("Height: "+e[t.height]+"\n"),a.push("Radius: "+e[t.radius]);let s=5;for(let t of a)t.length>10&&s<t.length/2&&(s=t.length/2),r+=t;let o=n.getAttribute("position"),l=document.createElement("a-plane"),h=o.z;h+=i?e[t.radius]/2*i.z:e[t.radius]/2;return l.setAttribute("position",{x:o.x,y:2*o.y+3,z:h}),l.setAttribute("rotation",{x:0,y:0,z:0}),l.setAttribute("height","4"),l.setAttribute("width",s),l.setAttribute("color","white"),l.setAttribute("text",{value:r,align:"center",width:20,color:"black"}),l.classList.add("babiaxrLegend"),l}(t,n,e,i.getAttribute("scale")),i.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),i.removeChild(legend)}))}AFRAME.registerComponent("babia-cylsmap",{schema:{data:{type:"string"},height:{type:"string",default:"height"},radius:{type:"string",default:"radius"},x_axis:{type:"string",default:"x_axis"},z_axis:{type:"string",default:"z_axis"},from:{type:"string"},legend:{type:"boolean"},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},animation:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},scale:{type:"number"},heightMax:{type:"number"},radiusMax:{type:"number"}},visProperties:["height","radius","x_axis","z_axis"],multiple:!1,init:function(){this.notiBuffer=new o},update:function(t){let e=this.data,n=this.el;if(e.data&&t.data!==e.data){let t=a(e.data);this.processData(t)}else e.from!==t.from?(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=i(e,n),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))):e!==t&&this.newData&&this.processData(this.newData)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},updateTitle:function(){const t=r(this.data,{x:0,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-cylsmap:",t);const e=this.data,n=this.el,i=e.animation,r=e.palette,a=e.scale;let s=e.heightMax,o=e.radiusMax,c=[],u=[],d=[],p=[],f=0,m=0,g=0,v=0,y=0,b=0,x={},_={},w=Math.max.apply(Math,t.map((function(t){return t[e.height]}))),M=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));a&&(w/=a,M/=a),s||(s=w),proportion=s/w,o||(o=M),radius_scale=o/M,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),n.appendChild(this.chartEl),a?(y=M/a,b=M/a):(y=M*radius_scale,b=M*radius_scale);for(let s of t){let t=s[e.x_axis],o=s[e.z_axis],w=s[e.height],E=s[e.radius];x[t]?(g=x[t].posX,f=x[t].colorId):(g+=a?2*M/a+.5:2*M*radius_scale+.5,f=m,x[t]={posX:g,colorId:f},c.push(t),u.push(g),m++),_[o]?v=_[o].posZ:(v=a?b+2*M/a+.5:b+2*M*radius_scale+.5,_[o]={posZ:v},d.push(o),p.push(v)),g>y&&(y=g),v>b&&(b=v);let S=l(w,E,f,r,g,v,i,a,proportion,radius_scale);S.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(S,n),e.legend&&h(e,S,s,n)}if(e.axis){const t=y,e=b,n=s;this.updateAxis(c,u,t,d,p,e,w,n)}this.updateTitle()},updateAxis:function(t,e,n,i,r,a,s,o){let l=document.createElement("a-entity");this.chartEl.appendChild(l),l.setAttribute("babia-axis-x",{labels:t,ticks:e,length:n,palette:this.data.palette}),l.setAttribute("position",{x:0,y:0,z:0});let h=document.createElement("a-entity");this.chartEl.appendChild(h),h.setAttribute("babia-axis-y",{maxValue:s,length:o}),h.setAttribute("position",{x:0,y:0,z:0});let c=document.createElement("a-entity");this.chartEl.appendChild(c),c.setAttribute("babia-axis-z",{labels:i,ticks:r,length:a}),c.setAttribute("position",{x:0,y:0,z:0}),this.data.axis_name&&(l.setAttribute("babia-axis-x","name",this.data.x_axis),h.setAttribute("babia-axis-y","name",this.data.height),c.setAttribute("babia-axis-z","name",this.data.z_axis))},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating cylsmap..."),this.updateChart(),this.notiBuffer.set(this.newData)}})},function(t,e,n){let i=n(0).findProdComponent,r=n(0).updateTitle,a=n(0).parseJson;const s=n(0).colors,o=n(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function l(t,e,n,i,r){let a=s.get(i,r);console.log("Generating slice...");let o=document.createElement("a-torus");return o.setAttribute("color",a),o.setAttribute("rotation",{x:90,y:0,z:t}),o.setAttribute("arc",e),o.setAttribute("side","double"),o.setAttribute("radius",n),o.setAttribute("radius-tubular",n/4),o}function h(t,e,n,i){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e){let n=e[t.key]+": "+e[t.size],i=2;n.length>16&&(i=n.length/8);let r=document.createElement("a-plane");return r.setAttribute("position",{x:0,y:1,z:-2}),r.setAttribute("rotation",{x:-90,y:0,z:0}),r.setAttribute("height","1"),r.setAttribute("width",i),r.setAttribute("color","white"),r.setAttribute("text",{value:e[t.key]+": "+e[t.size],align:"center",width:6,color:"black"}),r.classList.add("babiaxrLegend"),r}(t,n),i.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),i.removeChild(legend)}))}AFRAME.registerComponent("babia-doughnut",{schema:{data:{type:"string"},size:{type:"string",default:"size"},key:{type:"string",default:"key"},from:{type:"string"},legend:{type:"boolean"},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},animation:{type:"boolean",default:!1}},visProperties:["size","key"],multiple:!1,init:function(){this.notiBuffer=new o},update:function(t){let e=this.data,n=this.el;if(e.data&&t.data!==e.data){let t=a(e.data);this.processData(t)}else e.from!==t.from?(this.slice_array=[],this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=i(e,n),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))):e!==t&&this.newData&&(this.slice_array=[],this.processData(this.newData))},tick:function(t,e){if(this.data.animation&&this.loaded){let n=document.getElementsByClassName("babiaxrChart")[0].children;for(let i in this.slice_array){let r=this.slice_array[i].delay,a=this.slice_array[i].arc,s=parseFloat(n[i].getAttribute("arc"));t>=r&&s<a&&(s+=360*e/this.total_duration,s>a&&(s=a),n[i].setAttribute("arc",s))}}},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},loaded:!1,slice_array:[],total_duration:4e3,updateTitle:function(){const t=r(this.data,{x:-90,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-doughnut",t);const e=this.data,n=this.el,i=e.animation,r=e.palette;let a=0,s=0,o=0,c=0;for(let n of t)c+=n[e.size];this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.chartEl.setAttribute("rotation",{y:90}),n.appendChild(this.chartEl);let u=0;for(let d of t){let t;if(s=360*d[e.size]/c,i){let e=this.total_duration*s/360;this.slice_array.push({arc:s,duration:e,delay:u}),u+=e,t=l(a,.01,1,o,r)}else t=l(a,s,1,o,r);t.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(t),a+=s,e.legend&&h(e,t,d,n),o++}this.updateTitle()},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating doughnut..."),this.updateChart(),this.loaded=!0,this.notiBuffer.set(this.newData)}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babiaxr-totem",{schema:{charts_id:{type:"string"},data_list:{type:"string"}},multiple:!1,init:function(){let t=this.data,e=this.el;n=e.id,t&&(s.push({id:e.id,charts_id:JSON.parse(t.charts_id)}),t.data_list&&(i=JSON.parse(t.data_list),function(t){let e=new THREE.FileLoader;for(let n of t)if(n.from_querier){let t=document.getElementById(n.from_querier);if(t.getAttribute("babiaData")){let e=JSON.parse(t.getAttribute("babiaData"));a.push({file:e,path:n.from_querier})}else t.addEventListener("dataReady"+n.from_querier,(function(t){a.push({file:t.detail,path:n.from_querier})}))}else if(n.path){let t=n.path;e.load(t,(function(e){a.push({file:e,path:t})}),(function(e){console.log(t.toString()+": "+e.loaded/e.total*100+"% loaded")}),(function(t){console.error("An error happened")}))}}(i)))},update:function(t){let e=this.data;if(r=this.el,e!==t){for(;this.el.firstChild;)this.el.firstChild.remove();console.log("Generating totemchart..."),o(r)}},remove:function(){},pause:function(){},play:function(){}});let n,i,r,a=[],s=[],o=t=>{a&&function(t,e){console.log("Generating Totem...");let n=7.5;if(e.length%2==1){let t=Math.trunc(e.length/2);n+=t}let i=function(t){let e=5;for(let n of t)n.data&&(n=n.data),n.length>10&&e<n.length/4&&(e=n.length/4);return e}(e);document.createElement;(function(t,e,n,i,r,a,s){let o=document.createElement("a-plane");o.setAttribute("class","title"),o.setAttribute("position",{x:e,y:n,z:i}),o.setAttribute("rotation",{x:0,y:r,z:0}),o.setAttribute("height",1),o.setAttribute("width",a),o.setAttribute("color","blue"),o.setAttribute("text",{value:s,align:"center",width:"10",color:"white"}),t.appendChild(o)})(t,-3,n,6,0,i,"Select Data"),n-=1,function(t,e,n,i,r,a,s,o){for(let h of s){h.data&&(h=h.data);let c=document.createElement("a-plane");c.setAttribute("position",{x:e,y:n,z:i}),c.setAttribute("rotation",{x:0,y:r,z:0}),c.setAttribute("height",1),c.setAttribute("width",a),c.setAttribute("text",{value:h,align:"center",width:"10"}),c.setAttribute("color","white"),c.setAttribute("text",{color:"black"}),t.appendChild(c),n-=1,c.classList.add("babiaxraycasterclass"),c.addEventListener("click",(function(){let t=c.parentElement.id,e=c.parentElement.children;o=h;for(let e of s)(e.path||e.from_querier)&&o==e.data&&l(e.path||e.from_querier,t);for(let t in e)e[t]===c?(c.setAttribute("color","black"),c.setAttribute("text",{color:"white"})):e[t].id||"title"!==e[t].className&&(e[t].setAttribute("color","white"),e[t].setAttribute("text",{color:"black"}))}))}}(t,-3,n,6,0,i,e)}(t,i)};function l(t,e){n=e,document.getElementById(n);var n;for(let n in s)if(e==s[n].id){let e=s[n].charts_id;for(obj in e){let n,i=e[obj].type,r=e[obj].id;for(let e in a)a[e].path==t&&(n=a[e].file,"babiaxr-vismapper"===i?document.getElementById(r).setAttribute(i,"dataToShow",JSON.stringify(n)):document.getElementById(r).setAttribute(i,"data",n))}}}},function(t,e){AFRAME.registerComponent("babia-terrain",{schema:{width:{type:"number",default:1},height:{type:"number",default:1},segmentsHeight:{type:"number",default:1},segmentsWidth:{type:"number",default:1},data:{type:"array"},color:{type:"string",default:"0xdddddd"},filled:{type:"boolean",default:!1}},init:function(){var t=this.data,e=this.el,n=t.data;console.log("Vertices:"),console.log(n),this.geometry=new THREE.PlaneGeometry(t.width,t.height,t.segmentsHeight,t.segmentsWidth);for(var i=0,r=this.geometry.vertices.length;i<r;i++)this.geometry.vertices[i].z=n[i];var a=t.color;t.filled?this.material=new THREE.MeshPhongMaterial({color:a,wireframe:!1}):this.material=new THREE.MeshPhongMaterial({color:a,wireframe:!0}),this.mesh=new THREE.Mesh(this.geometry,this.material),e.setObject3D("mesh",this.mesh)}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let n,r,a,s,o,l,h,c,u,d,p;function f(t){let e=document.createElement("a-sphere");var n;return e.setAttribute("radius",.05),e.setAttribute("material",{color:"#FF0000"}),function(t,e){let n,i;t.addEventListener("mouseenter",(function(){c=this.getAttribute("material").color,this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),this.setAttribute("material",{color:"#AAAA00"}),i=m(e),this.appendChild(i)})),t.addEventListener("showinfo",(function(){n=m(e),this.setAttribute("material",{color:"#00AA00"}),this.appendChild(n)})),t.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),this.setAttribute("material",{color:c}),this.removeChild(i)})),t.addEventListener("removeinfo",(function(){n&&(this.removeChild(n),this.setAttribute("material",{color:"#FF0000"}))}))}(e,t),n=t,e.addEventListener("click",(function(){this.setAttribute("material",{color:"#00AA00"}),c=this.getAttribute("material").color,l.emit("babiaxrShow",{data:n}),document.getElementsByClassName("babiaxrPause")[0]&&(o.removeChild(s),o.appendChild(a))})),e}function m(t){let e="",n=[];n.push("Date: "+t.date+"\n"),n.push("commit: "+t.commit+"\n");let i=1;for(let t of n)t.length>10&&i<t.length/2&&(i=t.length/7),e+=t;let r=document.createElement("a-plane");return r.setAttribute("position",{x:0,y:.4,z:.1}),r.setAttribute("scale",{x:.5,y:.5,z:1}),r.setAttribute("height","1"),r.setAttribute("width",i),r.setAttribute("color","white"),r.setAttribute("text",{value:e,align:"center",width:6,color:"black"}),r.setAttribute("material",{opacity:.6}),r}function g(t){let e=t.length,n=[];for(i=0;i<e;i++){let e=.11*t[i][0],r=.11*t[i][1],a=.11*t[i][2],s=new THREE.Vector3(e,r,a);n.push(s)}let r=new THREE.Shape(n),a=new THREE.MeshBasicMaterial({color:16777215,side:THREE.DoubleSide,wireframe:!1}),s=new THREE.ExtrudeGeometry(r,{depth:.05,bevelEnabled:!1,bevelSegments:1,steps:1,bevelThickness:1});return new THREE.Mesh(s,a)}function v(t){t.addEventListener("mouseenter",(function(){h=Object.assign({},this.object3DMap.mesh.material.color),this.object3DMap.mesh.material.color={r:170/255,g:170/255,b:170/255}})),t.addEventListener("mouseleave",(function(){this.object3DMap.mesh.material.color=h}))}function y(t,e){t.addEventListener("click",(function(){if(t.classList.contains("babiaxrPlay"))o.removeChild(t),o.appendChild(s);else if(t.classList.contains("babiaxrPause"))o.removeChild(s),o.appendChild(a);else if(t.classList.contains("babiaxrSkipNext")||t.classList.contains("babiaxrSkipPrev"))document.getElementsByClassName("babiaxrPause")[0]&&(o.removeChild(s),o.appendChild(a));else if(t.classList.contains("babiaxrForward")){h={r:85/255,g:85/255,b:85/255},document.getElementsByClassName("babiaxrRewind")[0].object3DMap.mesh.material.color={r:1,g:1,b:1}}else if(t.classList.contains("babiaxrRewind")){h={r:85/255,g:85/255,b:85/255},document.getElementsByClassName("babiaxrForward")[0].object3DMap.mesh.material.color={r:1,g:1,b:1}}console.log("Emit..... "+e),l.emit(e)}))}AFRAME.registerComponent("babiaxr-navigation-bar",{schema:{commits:{type:"string"},size:{type:"number",default:"5"},points_by_line:{type:"number",default:"5"},to:{type:"string",default:"left"},start_point:{type:"number",default:"0"}},multiple:!1,init:function(){let t=this.data;l=this.el,n=JSON.parse(t.commits),r=t.size,u=t.to,d=t.start_point,p=t.points_by_line;let e=function(t,e,n){let i=document.createElement("a-entity");i.classList.add("babiaxrTimeBar");let r=0,a=Math.ceil(t.length/n)/5-.2,s=e/(n-1),o=0,l=1;for(let e in t){let h=f(t[e]);h.classList.add("babiaxraycasterclass"),h.setAttribute("position",{x:r,y:a,z:0}),i.appendChild(h),e%n==n-1&&e!=t.length-1?(l++,a-=.2,r=0):e!=t.length-1&&(r+=s),o=r}for(let t=0;t<l;t++){let n=document.createElement("a-entity");0!=o&&0==t||1==p||0==o&&0==t?n.setAttribute("line",{start:"0 "+a+" 0",end:o+" "+a+" 0",color:"#FF0000"}):n.setAttribute("line",{start:"0 "+a+" 0",end:e+" "+a+" 0",color:"#FF0000"}),a+=.2,i.appendChild(n)}return i}(n,r,p);this.el.appendChild(e),o=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrPlayer"),t.setAttribute("position",{x:(r-5)/2,y:0,z:0}),t.classList.add("babiaxraycasterclass"),a=function(t){let e=document.createElement("a-entity");e.classList.add("babiaxrPlay");let n=g([[0,0,0],[0,3,0],[2.5,1.5,0],[0,0,0]]);return e.setObject3D("mesh",n),y(e,"babiaxrContinue"),v(e),e}(),a.setAttribute("position",{x:2.35,y:-.65,z:0}),a.classList.add("babiaxraycasterclass"),s=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrPause");let e=function(t,e){let n=t.length,r=e.length,a=[],s=[];for(i=0;i<n;i++){let e=.11*t[i][0],n=.11*t[i][1],r=.11*t[i][2],s=new THREE.Vector3(e,n,r);a.push(s)}for(i=0;i<r;i++){let t=.11*e[i][0],n=.11*e[i][1],r=.11*e[i][2],a=new THREE.Vector3(t,n,r);s.push(a)}let o=new THREE.Shape(a),l=new THREE.Shape(s),h={depth:.05,bevelEnabled:!1,bevelSegments:1,steps:1,bevelThickness:1},c=new THREE.MeshBasicMaterial({color:16777215,side:THREE.DoubleSide,wireframe:!1}),u=new THREE.ExtrudeGeometry(o,h),d=new THREE.ExtrudeGeometry(l,h),p=new THREE.Mesh(u,c);return p.updateMatrix(),d.merge(p.geometry,p.matrix),new THREE.Mesh(d,c)}([[0,0,0],[0,3,0],[1,3,0],[1,0,0],[0,0,0]],[[1.5,0,0],[1.5,3,0],[2.5,3,0],[2.5,0,0],[1.5,0,0]]);return t.setObject3D("mesh",e),y(t,"babiaxrStop"),v(t),t}(),s.setAttribute("position",{x:2.35,y:-.65,z:0}),s.classList.add("babiaxraycasterclass"),t.appendChild(s);let e=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrRewind");let e=g([[0,0,0],[0,3,0],[1.25,1.5,0],[1.25,3,0],[2.5,1.5,0],[1.25,0,0],[1.25,1.5,0],[0,0,0]]);t.setObject3D("mesh",e),t.setAttribute("rotation",{x:0,y:180,z:0}),"left"==u&&(t.object3DMap.mesh.material.color={r:85/255,g:85/255,b:85/255});return y(t,"babiaxrToPast"),v(t),t}();e.setAttribute("position",{x:1.25,y:-.65,z:0}),e.classList.add("babiaxraycasterclass"),t.appendChild(e);let n=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrForward");let e=g([[0,0,0],[0,3,0],[1.25,1.5,0],[1.25,3,0],[2.5,1.5,0],[1.25,0,0],[1.25,1.5,0],[0,0,0]]);t.setObject3D("mesh",e),"right"==u&&(t.object3DMap.mesh.material.color={r:85/255,g:85/255,b:85/255});return y(t,"babiaxrToPresent"),v(t),t}();n.setAttribute("position",{x:3.7,y:-.65,z:0}),n.classList.add("babiaxraycasterclass"),t.appendChild(n);let o=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrSkipPrev");let e=g([[0,0,0],[0,3,0],[1,1.5,0],[1,3,0],[2,1.5,0],[2,3,0],[2.5,3,0],[2.5,0,0],[2,0,0],[2,1.5,0],[1,0,0],[1,1.5,0],[0,0,0]]);return t.setObject3D("mesh",e),t.setAttribute("rotation",{x:0,y:180,z:0}),y(t,"babiaxrSkipPrev"),v(t),t}();o.setAttribute("position",{x:1.95,y:-.65,z:0}),o.classList.add("babiaxraycasterclass"),t.appendChild(o);let l=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrSkipNext");let e=g([[0,0,0],[0,3,0],[1,1.5,0],[1,3,0],[2,1.5,0],[2,3,0],[2.5,3,0],[2.5,0,0],[2,0,0],[2,1.5,0],[1,0,0],[1,1.5,0],[0,0,0]]);return t.setObject3D("mesh",e),y(t,"babiaxrSkipNext"),v(t),t}();return l.setAttribute("position",{x:3,y:-.65,z:0}),l.classList.add("babiaxraycasterclass"),t.appendChild(l),t}(),this.el.appendChild(o),function(){let t=document.getElementsByClassName("babiaxrTimeBar")[0].children;for(let e in t)e==d&&t[e].emit("showinfo")}()},update:function(t){},remove:function(){},pause:function(){},play:function(){}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let n,i,r;var a;AFRAME.registerComponent("babiaxr-event-controller",{schema:{navigation:{type:"string"},targets:{type:"string"}},multiple:!1,init:function(){},update:function(t){n=this.el;let e=this.data;i=e.navigation,r=JSON.parse(e.targets),function(t){let e=document.getElementById(t).getAttribute("babiaxr-navigation-bar").commits;if(e&&c){a=JSON.parse(e);for(let t in a)s.push(a[t]);if(s.reverse(),h){let t=a.length-1-0;o=s[0],l=t}else o=a[0],l=0;c=!1,function(){u(h?s:a);document.addEventListener("babiaxrShow",(function(t){!function(t){for(let e in a)if(a[e].commit==t.commit){o=a[e],f(e),l=e;break}p()}(t.detail.data),n.emit("babiaxrStop")})),document.addEventListener("babiaxrContinue",(function(){console.log("PLAY"),u(h?s:a)})),document.addEventListener("babiaxrToPresent",(function(){console.log("TO PRESENT"),h=!1,n.emit("babiaxrStop"),u(a)})),document.addEventListener("babiaxrToPast",(function(){console.log("TO PAST"),h=!0,n.emit("babiaxrStop"),u(s)})),document.addEventListener("babiaxrSkipNext",(function(){console.log("SKIP NEXT"),n.emit("babiaxrStop"),d("next")})),document.addEventListener("babiaxrSkipPrev",(function(){console.log("SKIP PREV"),n.emit("babiaxrStop"),d("prev")}))}()}}(i)},remove:function(){},pause:function(){},play:function(){}});var s=[];let o,l,h=!1,c=!0;function u(t){let e=0;for(let n in t)t[n]==o&&(e=parseInt(n)+1);let i=setInterval((function(){if(e<t.length){if(o=t[e],h){let n=t.length-1-e;f(n),l=n}else f(e),l=e;if(p(),e++,document.addEventListener("babiaxrStop",(function(){clearInterval(i)})),e==t.length){document.getElementsByClassName("babiaxrPause")[0].emit("click")}}else n.emit("babiaxrStop")}),3e3)}function d(t){for(let e in a)if(a[e]==o){"next"==t&&e<a.length-1?e++:"prev"==t&&e>=1&&e--,o=a[e],f(e),l=e;break}p()}function p(){let t=document.getElementById(o.commit).getAttribute("babiadata");for(let e in r){let n=document.getElementById(r[e].id);n&&n.setAttribute("babiaxr-vismapper","dataToShow",t)}}function f(t){let e=document.getElementsByClassName("babiaxrTimeBar")[0].children;if(l||0==l){e[l].emit("removeinfo")}e[t].emit("showinfo")}},function(t,e,n){let r=n(0).findProdComponent;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-boats",{schema:{data:{type:"asset"},from:{type:"string"},border:{type:"number",default:.5},width:{type:"string",default:"width"},depth:{type:"string",default:"depth"},area:{type:"string"},color:{type:"string"},height:{type:"string",default:"height"},zone_elevation:{type:"number",default:.3},building_separation:{type:"number",default:.25},extra:{type:"number",default:1},levels:{type:"number"},building_color:{type:"string",default:"#E6B9A1"},base_color:{type:"color",default:"#98e690"},min_building_height:{type:"number",default:1},height_quarter_legend_box:{type:"number",default:11},height_quarter_legend_title:{type:"number",default:12},height_building_legend:{type:"number",default:0},legend_scale:{type:"number",default:1}},entitiesWithLegend:[],dataComponent:void 0,newData:void 0,babiaMetadata:{id:0},visProperties:["height","area","width","depth"],multiple:!1,duration:2e3,figures_del:[],figures_in:[],animation:!1,update:function(t){let e=this.data,n=this.el;if(this.figures||(this.figures=[]),e.data&&t.data!==e.data){let t=JSON.parse(e.data);this.processData(t)}else e.from!==t.from?(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=r(e,n),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))):e!==t&&this.newData&&(console.log("Generating city..."),this.processData(this.newData))},tick:function(t,e){if(this.animation){let t={x:0,y:0,z:0};Date.now()-this.start_time>this.duration?(this.animation=!1,this.setFigures(this.figures,t)):this.Animation(this.el,this.figures,this.figures_old,e,t,t)}},updateChart:function(t){console.log("Data Loaded.");let e={x:0,y:0,z:0};this.animation&&(this.figures_del.forEach(t=>{s(document.getElementById(t.id),0)}),this.figures_in.forEach(t=>{s(document.getElementById(t.id),1)}),this.setFigures(this.figures,e),this.animation=!1,this.figures_del=[],this.figures_in=[]),this.figures_old=this.figures,this.figures=[];let n,i=this.el,r=t;if(this.data.levels)n=this.data.border*this.data.extra*this.data.levels;else{let t=o(r,0);n=this.data.border*this.data.extra*(t+1)}if([x,y,e,this.figures]=this.generateElements(r,this.figures,e,n),e.x=0,e.z=0,0==this.figures_old.length){for(;this.el.firstChild;)this.el.firstChild.remove();this.drawElements(i,this.figures,e)}else this.figures_old!==this.figures&&(this.animation=!0,this.start_time=Date.now())},generateElements:function(t,e,n,i){var r=i,a=0,s=0,o=0,l=0,h=0,c=0,u=0,d=0,p=0,f=0,m=0,g=0,v=!1,y=!1,b=!1,x=!0;for(let n=0;n<t.length;n++){let M,E={};if(this.data.width&&(E.width=t[n][this.data.width]||.5),this.data.height&&(E.height=t[n][this.data.height]||this.data.min_building_height),this.data.depth&&(E.depth=t[n][this.data.depth]||.5),this.data.area&&(E.area=t[n][this.data.area]||.5),t[n].children){E.children=t[n].children,this.quarter=!0;var _,w=[];E.height=this.data.zone_elevation,r-=this.data.border*this.data.extra,[E.width,E.depth,_,w]=this.generateElements(E.children,w,_,r),_.y=E.height,r=i}0==n?(this.data.area&&!t[n].children?(a+=Math.sqrt(E.area)/2,s-=Math.sqrt(E.area)/2,o+=Math.sqrt(E.area)/2,l-=Math.sqrt(E.area)/2):(a+=E.depth/2,s-=E.depth/2,o+=E.width/2,l-=E.width/2),g=a+this.data.building_separation/2):E.height>0&&(v?([m,h,c,f]=this.UpSide(E,a,m,f),m>o&&(u=m+=this.data.building_separation/2,v=!1,x=!0,d<l&&(l=d),g=a+this.data.building_separation/2)):x?([g,h,c,u]=this.RightSide(E,o,g,u),g<s&&(p=g+=this.data.building_separation/2,x=!1,y=!0,f>a&&(a=f),m=o+this.data.building_separation/2)):y?([m,h,c,p]=this.DownSide(E,s,m,p),m<l&&(d=m-=this.data.building_separation/2,y=!1,b=!0,u>o&&(o=u),g=s-this.data.building_separation/2)):b&&([g,h,c,d]=this.LeftSide(E,l,g,d),g>a&&(f=g-=this.data.building_separation/2,b=!1,v=!0,p<s&&(s=p),m=l-this.data.building_separation/2))),M=t[n].children?{id:"boat-"+t[n].uid,name:t[n].uid,posX:h,posY:c,width:E.width,height:E.height,depth:E.depth,children:w,translate_matrix:_}:this.data.area?{id:"boat-"+t[n].uid,name:t[n].uid,posX:h,posY:c,width:Math.sqrt(E.area),height:E.height,depth:Math.sqrt(E.area)}:{id:"boat-"+t[n].uid,name:t[n].uid,posX:h,posY:c,width:E.width,height:E.height,depth:E.depth},M.rawData=t[n],e.push(M)}p<s&&(s=p),d<l&&(l=d),f>a&&(a=f),u>o&&(o=u),m<l&&(l=m+this.data.building_separation/2),m>o&&(o=m-this.data.building_separation/2),g>a&&(a=g-this.data.building_separation/2),g<s&&(s=g+this.data.building_separation/2);var M=Math.abs(l)+Math.abs(o),E=Math.abs(s)+Math.abs(a);return[M+=2*r,E+=2*r,{x:l+M/2-r,y:0,z:s+E/2-r},e]},drawElements:function(t,e,n){let i=this;for(let r in e){let s=e[r].height,o=e[r].posX,l=e[r].posY,h={x:o-n.x,y:s/2+n.y/2,z:-l+n.z},c=this.createElement(e[r],h);if(e[r].children){let t,n;c.addEventListener("click",(function(s){if(s.target===this)if(t){c.removeChild(n),i.el.parentElement.removeChild(t),t=void 0,n=void 0;const e=i.entitiesWithLegend.indexOf(c);e>-1&&i.entitiesWithLegend.splice(e,1)}else{n=document.createElement("a-entity"),n.setAttribute("class","babialegend");let s=c.getAttribute("geometry"),o=i.el.getAttribute("scale"),l=s.height+i.data.height_quarter_legend_box;o&&(l=(s.height+i.data.height_quarter_legend_box)/o.y),n.setAttribute("geometry",{height:l,depth:s.depth,width:s.width}),n.setAttribute("material",{visible:!0,opacity:.4}),c.appendChild(n),t=a(e[r].name,i.data.legend_scale,"black","white");let h=(new THREE.Vector3).setFromMatrixPosition(c.object3D.matrixWorld),u={x:h.x,y:i.data.height_quarter_legend_title,z:h.z};t.setAttribute("position",u),t.setAttribute("visible",!0),i.el.parentElement.appendChild(t),i.entitiesWithLegend.push(c)}})),this.drawElements(c,e[r].children,e[r].translate_matrix)}else{let t,n,s=!1;c.addEventListener("click",(function(o){if(o.target===this)if(s){t.setAttribute("visible",!1),c.setAttribute("geometry",{height:n.height-.1,depth:n.depth-.1,width:n.width-.1}),c.setAttribute("material",{color:c.getAttribute("babiaxrFirstColor")}),i.el.parentElement.removeChild(t),t=void 0,s=!1;const e=i.entitiesWithLegend.indexOf(c);e>-1&&i.entitiesWithLegend.splice(e,1)}else{if(s=!0,!t){n=c.getAttribute("geometry");let s=c.getAttribute("position");c.setAttribute("position",s),c.setAttribute("babiaxrFirstColor",c.getAttribute("material").color),c.setAttribute("material",{color:"white"}),c.setAttribute("geometry",{height:n.height+.1,depth:n.depth+.1,width:n.width+.1}),t=a(e[r].name,i.data.legend_scale,"white","black",JSON.parse(c.getAttribute("babiaRawData")),i.data.height,i.data.area,i.data.depth,i.data.width,i.data.color);let o=(new THREE.Vector3).setFromMatrixPosition(c.object3D.matrixWorld),l=(new THREE.Box3).setFromObject(c.object3D),h={x:o.x,y:l.max.y+1+i.data.height_building_legend,z:o.z};t.setAttribute("position",h),t.setAttribute("visible",!0),i.el.parentElement.appendChild(t)}i.entitiesWithLegend.push(c)}})),c.addEventListener("mouseenter",(function(){if(!s){n=c.getAttribute("geometry");let s=c.getAttribute("position");c.setAttribute("position",s),c.setAttribute("babiaxrFirstColor",c.getAttribute("material").color),c.setAttribute("material",{color:"white"}),c.setAttribute("geometry",{height:n.height+.1,depth:n.depth+.1,width:n.width+.1}),t=a(e[r].name,i.data.legend_scale,"white","black",JSON.parse(c.getAttribute("babiaRawData")),i.data.height,i.data.area,i.data.depth,i.data.width,i.data.color);let o=(new THREE.Vector3).setFromMatrixPosition(c.object3D.matrixWorld),l=(new THREE.Box3).setFromObject(c.object3D),h={x:o.x,y:l.max.y+1+i.data.height_building_legend,z:o.z};t.setAttribute("position",h),t.setAttribute("visible",!0),i.el.parentElement.appendChild(t)}})),c.addEventListener("mouseleave",(function(){!s&&t&&(t.setAttribute("visible",!1),c.setAttribute("geometry",{height:n.height-.1,depth:n.depth-.1,width:n.width-.1}),c.setAttribute("material",{color:c.getAttribute("babiaxrFirstColor")}),i.el.parentElement.removeChild(t),t=void 0)}))}t.appendChild(c)}},RightSide:function(t,e,n,i){let r,a,s=parseFloat(this.data.building_separation);this.data.area&&!t.children?(r=Math.sqrt(t.area),a=Math.sqrt(t.area)+s):(r=parseFloat(t.width),a=parseFloat(t.depth)+s);let o=n-a/2,l=e+r+s;return l>i&&(i=l),[n-=a,e+r/2+s,o,i]},DownSide:function(t,e,n,i){let r,a,s=parseFloat(this.data.building_separation);this.data.area&&!t.children?(r=Math.sqrt(t.area)+s,a=Math.sqrt(t.area)):(r=parseFloat(t.width)+s,a=parseFloat(t.depth));let o=n-r/2,l=e-a-s;return l<i&&(i=l),[n-=r,o,e-a/2-s,i]},LeftSide:function(t,e,n,i){let r,a,s=parseFloat(this.data.building_separation);this.data.area&&!t.children?(r=Math.sqrt(t.area),a=Math.sqrt(t.area)+s):(r=parseFloat(t.width),a=parseFloat(t.depth)+s);let o=n+a/2,l=e-r-s;return l<i&&(i=l),[n+=a,e-r/2-s,o,i]},UpSide:function(t,e,n,i){let r,a,s=parseFloat(this.data.building_separation);this.data.area&&!t.children?(r=Math.sqrt(t.area)+s,a=Math.sqrt(t.area)):(r=parseFloat(t.width)+s,a=parseFloat(t.depth));let o=n+r/2,l=e+a+s;return l>i&&(i=l),[n+=r,o,e+a/2+s,i]},Animation:function(t,e,n,i,r,a){let o,l=this,c=Date.now();for(let u in e)if(document.getElementById(e[u].id))if(o=document.getElementById(e[u].id),e[u].inserted){let t=i/this.duration,n=parseFloat(o.getAttribute("material").opacity);n+t<1?n+=t:(n=1,e[u].inserted=!1),s(o,n);let r="id="+e[u].id;h(l.figures_in,r)<0&&l.figures_in.push(e[u])}else{let t="id="+e[u].id,s=h(n,t);s<0?(e[u].inserted=!0,o.getAttribute("width")!=e[u].width&&o.setAttribute("width",e[u].width),o.getAttribute("height")!=e[u].height&&o.setAttribute("height",e[u].height),o.getAttribute("depth")!=e[u].depth&&o.setAttribute("depth",e[u].depth)):(this.resize(o,c,i,e[u],n[s]),this.traslate(o,c,i,e[u],n[s],r,a),e[u].children&&this.Animation(o,e[u].children,n[s].children,i,e[u].translate_matrix,n[s].translate_matrix))}else{position={x:e[u].posX-r.x,y:e[u].height/2+r.y/2,z:-e[u].posY+r.z};let n=this.createElement(e[u],position);e[u].children&&this.drawElements(n,e[u].children,e[u].translate_matrix),s(n,0),t.appendChild(n),e[u].inserted=!0}let u=i/this.duration;for(let t in n){let i="id="+n[t].id;if(h(e,i)<0){h(l.figures_del,i)<0&&l.figures_del.push(n[t]);let e=document.getElementById(n[t].id),r=parseFloat(e.getAttribute("material").opacity);r-u>0?r-=u:r=0,s(e,r)}}},setFigures:function(t,e){t.forEach(t=>{let n=document.getElementById(t.id);n.getAttribute("width")!=t.width&&n.setAttribute("width",t.width),n.getAttribute("height")!=t.height&&n.setAttribute("height",t.height),n.getAttribute("depth")!=t.depth&&n.setAttribute("depth",t.depth),n.setAttribute("position",{x:t.posX-e.x,y:(parseFloat(t.height)+e.y)/2,z:-t.posY+e.z}),t.children&&this.setFigures(t.children,t.translate_matrix)})},resize:function(t,e,n,i,r){if(e-this.start_time<this.duration&&(i.width!=r.width||i.height!=r.height||i.depth!=r.depth)){let e,a,s,o=Math.abs(i.width-r.width),l=Math.abs(i.height-r.height),h=Math.abs(i.depth-r.depth),c=n*o/this.duration,u=n*l/this.duration,d=n*h/this.duration,p=parseFloat(t.getAttribute("width")),f=parseFloat(t.getAttribute("height")),m=parseFloat(t.getAttribute("depth"));e=i.width-r.width<0?p-c:p+c,a=i.height-r.height<0?f-u:f+u,s=i.depth-r.depth<0?m-d:m+d,t.setAttribute("width",e),t.setAttribute("height",a),t.setAttribute("depth",s)}else e-this.start_time>this.duration&&(i.width!=r.width||i.height!=r.height||i.depth!=r.depth)&&(t.setAttribute("width",i.width),t.setAttribute("height",i.height),t.setAttribute("depth",i.depth),t.setAttribute("babiaRawData",JSON.stringify(i.rawData)))},traslate:function(t,e,n,i,r,a,s){let o=r.posX-s.x-(i.posX-a.x),l=i.height-r.height,h=r.posY-s.z-(i.posY-a.z);if(0!=o||0!=l||0!=h)if(e-this.start_time<this.duration){let e=n*o/this.duration,i=n*l/(2*this.duration),r=n*h/this.duration,a=parseFloat(t.getAttribute("position").x)-e,s=parseFloat(t.getAttribute("position").y)+i,c=parseFloat(t.getAttribute("position").z)+r;t.setAttribute("position",{x:a,y:s,z:c})}else e-this.start_time>this.duration&&t.setAttribute("position",{x:i.posX-a.x,y:(parseFloat(i.height)+a.y)/2,z:-i.posY+a.z})},createElement:function(t,e){let n=this,i=document.createElement("a-box");i.id=t.id,i.setAttribute("class","babiaxraycasterclass");let r=t.width,a=t.height,s=t.depth;return t.children?color=n.data.base_color:n.data.color?color=function(t,e,n){let i=[19,82,138],r=[255,94,83];var a=((((t||0)-n)/(e-n)*2-1)/1+1)/2,s=1-a,o=[Math.round(r[0]*a+i[0]*s),Math.round(r[1]*a+i[1]*s),Math.round(r[2]*a+i[2]*s)];return"rgb("+o[0]+","+o[1]+","+o[2]+")"}(t.rawData[n.data.color],n.babiaMetadata.color_max,n.babiaMetadata.color_min):color=n.data.building_color,i.setAttribute("color",color),i.setAttribute("width",r),i.setAttribute("height",a),i.setAttribute("depth",s),t.rawData&&i.setAttribute("babiaRawData",JSON.stringify(t.rawData)),i.setAttribute("position",{x:e.x,y:e.y,z:e.z}),i},processData:function(t){console.log("processData",t);let e=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},e.color){let[t,n]=l(this.newData,e.color);this.babiaMetadata.color_max=t,this.babiaMetadata.color_min=n}this.updateChart(this.newData)}});let a=(t,e,n,i,r,a,s,o,l,h)=>{let c=2,u=1;if(t.length>16&&(c=t.length/5),r){let e="\n "+a+" (height): "+Math.round(100*r[a])/100;if(e.length>16&&(c=e.length/5),t+=e,s){let n="\n "+s+" (area): "+Math.round(100*r[s])/100;n.length>16&&n>e&&(c=n.length/5),t+=n}else{let n="\n "+o+" (depth): "+Math.round(100*r[o])/100;n.length>16&&n>e&&(c=n.length/5),t+=n;let i="\n "+l+" (width): "+Math.round(100*r[l])/100;i.length>16&&i>e&&i>n&&(c=i.length/5),t+=i,u=1.5}if(h){let n="\n "+h+" (color): "+Math.round(100*r[h])/100;n.length>16&&n>e&&(c=n.length/5),t+=n,u+=.2}}let d=document.createElement("a-plane");return d.setAttribute("babia-lookat","[camera]"),d.setAttribute("rotation",{x:0,y:0,z:0}),d.setAttribute("height",u),d.setAttribute("width",c),d.setAttribute("color",n),d.setAttribute("material",{side:"double"}),d.setAttribute("text",{value:t,align:"center",width:6,color:i,alphaTest:6,opacity:6,transparent:!1}),d.setAttribute("visible",!1),d.setAttribute("class","babialegend"),d.setAttribute("scale",{x:e,y:e,z:e}),d};function s(t,e){if(t.setAttribute("material","opacity",e),t.childNodes)for(let n=0;n<t.childNodes.length;n++)s(t.childNodes[n],e)}let o=(t,e)=>{let n=e,i=e;for(let r in t)t[r].children&&(n++,i<(e=o(t[r].children,n))&&(i=e),n--);return i},l=(t,e,n,i)=>{for(let r=0;r<t.length;r++)t[r].children?[n,i]=l(t[r].children,e,n,i):(("null"!==t[r][e]&&!n||t[r][e]>n)&&(n=t[r][e]),("null"!==t[r][e]&&!i||t[r][e]<i)&&(i=t[r][e]));return[n,i]};let h=(t,e)=>{for(e=e.split("="),i=0;i<t.length;i++)if(t[i][e[0]]===e[1])return i;return-1}},function(t,e){var n,i=AFRAME.utils.debug,r=AFRAME.utils.coordinates,a=i("components:babia-lookat:warn"),s=r.isCoordinates||r.isCoordinate;delete AFRAME.components["babia-lookat"],AFRAME.registerComponent("babia-lookat",{schema:{default:"0 0 0",parse:function(t){return s(t)||"object"==typeof t?r.parse(t):t},stringify:function(t){return"object"==typeof t?r.stringify(t):t}},init:function(){this.target3D=null,this.vector=new THREE.Vector3,this.cameraListener=AFRAME.utils.bind(this.cameraListener,this),this.el.addEventListener("componentinitialized",this.cameraListener),this.el.addEventListener("componentremoved",this.cameraListener)},update:function(){var t,e=this,n=e.data;return!n||"object"==typeof n&&!Object.keys(n).length?e.remove():"object"==typeof n?this.lookAt(new THREE.Vector3(n.x,n.y,n.z)):(t=e.el.sceneEl.querySelector(n))?t.hasLoaded?e.beginTracking(t):t.addEventListener("loaded",(function(){e.beginTracking(t)})):void a('"'+n+'" does not point to a valid entity to babia-lookat')},tick:(n=new THREE.Vector3,function(t){var e=this.target3D;e&&(e.getWorldPosition(n),this.lookAt(n))}),remove:function(){this.el.removeEventListener("componentinitialized",this.cameraListener),this.el.removeEventListener("componentremoved",this.cameraListener)},beginTracking:function(t){this.target3D=t.object3D},cameraListener:function(t){t.detail&&"camera"===t.detail.name&&this.update()},lookAt:function(t){var e=this.vector,n=this.el.object3D;this.el.getObject3D("camera")?e.subVectors(n.position,t).add(n.position):e.copy(t),n.lookAt(e)}})},function(t,e,n){let i=n(0).findProdComponent,r=n(0).parseJson;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let a=n(1);"default"in a&&(a=a.default);let s=n(54);"default"in s&&(s=s.default);let o=function(t){if("function"==typeof t)return t;let e=eval;try{return e("("+t+")")}catch(t){}return null},l=function(t){return isNaN(parseFloat(t))?o(t)?o(t):t:parseFloat(t)},h="";AFRAME.registerComponent("babia-network",{schema:{nodeLegend:{type:"boolean",default:!1},linkLegend:{type:"boolean",default:!1},from:{type:"string"},nodesFrom:{type:"string"},linksFrom:{type:"string"},data:{type:"string",default:""},nodes:{type:"string",default:""},links:{type:"string",default:""},nodeId:{type:"string",default:"id"},nodeLabel:{parse:l,default:"id"},linkId:{type:"string",default:""},linkSource:{type:"string",default:"source"},linkTarget:{type:"string",default:"target"},nodeVal:{type:"string",default:""},nodeRelSize:{type:"number",default:4},nodeColor:{parse:l,default:"color"},nodeAutoColorBy:{parse:l,default:""},nodeResolution:{type:"number",default:8},linkColor:{parse:l,default:"color"},linkAutoColorBy:{parse:l,default:""},linkWidth:{parse:l,default:0},linkResolution:{type:"number",default:6},linkLabel:{parse:l,default:""},nodeDesc:{parse:l,default:"desc"},linkDesc:{parse:l,default:"desc"},nodeVisibility:{parse:l,default:!0},nodeOpacity:{type:"number",default:1},linkVisibility:{parse:l,default:!0},linkOpacity:{type:"number",default:1},nodeThreeObject:{parse:l,default:null},nodeThreeObjectExtend:{parse:l,default:!1},linkCurvature:{parse:l,default:0},linkCurveRotation:{parse:l,default:0},linkMaterial:{parse:l,default:null},linkThreeObject:{parse:l,default:null},linkThreeObjectExtend:{parse:l,default:!1},linkPositionUpdate:{parse:o,default:null},linkDirectionalArrowLength:{parse:l,default:0},linkDirectionalArrowColor:{parse:l,default:null},linkDirectionalArrowRelPos:{parse:l,default:.5},linkDirectionalArrowResolution:{type:"number",default:8},linkDirectionalParticles:{parse:l,default:0},linkDirectionalParticleSpeed:{parse:l,default:.01},linkDirectionalParticleWidth:{parse:l,default:.5},linkDirectionalParticleColor:{parse:l,default:null},linkDirectionalParticleResolution:{type:"number",default:4},linkHoverPrecision:{type:"number",default:2},onNodeCenterHover:{parse:o,default:function(){}},onLinkCenterHover:{parse:o,default:function(){}},numDimensions:{type:"number",default:3},dagMode:{type:"string",default:""},dagLevelDistance:{type:"number",default:0},dagNodeFilter:{parse:o,function:()=>!0},onDagError:{parse:o,default:void 0},forceEngine:{type:"string",default:"d3"},d3AlphaMin:{type:"number",default:0},d3AlphaDecay:{type:"number",default:.0228},d3VelocityDecay:{type:"number",default:.4},ngraphPhysics:{parse:r,default:null},warmupTicks:{type:"int",default:0},cooldownTicks:{type:"int",default:1e18},cooldownTime:{type:"int",default:15e3},onEngineTick:{parse:o,default:function(){}},onEngineStop:{parse:o,default:function(){}}},getGraphBbox:function(){return this.forceGraph||(this.forceGraph=new s),this.forceGraph.getGraphBbox()},emitParticle:function(){this.forceGraph||(this.forceGraph=new s);const t=this.forceGraph,e=t.emitParticle.apply(t,arguments);return e===t?this:e},d3Force:function(){this.forceGraph||(this.forceGraph=new s);const t=this.forceGraph,e=t.d3Force.apply(t,arguments);return e===t?this:e},d3ReheatSimulation:function(){return this.forceGraph&&this.forceGraph.d3ReheatSimulation(),this},refresh:function(){return this.forceGraph&&this.forceGraph.refresh(),this},init:function(){let t=this.state={},e=document.querySelector("a-entity[camera], a-camera");t.cameraObj=e.object3D.children.filter((function(t){return"PerspectiveCamera"===t.type}))[0],this.el.sceneEl.addEventListener("camera-set-active",(function(e){t.cameraObj=e.detail.cameraEl.components.camera.camera})),this.forceGraph||(this.forceGraph=new s),this.el.object3D.add(this.forceGraph),h=document.querySelector("[cursor]"),document.addEventListener("controllerconnected",t=>{h=document.querySelector("[laser-controls]")})},update:function(t){let e=this.el,n=this.data;if(this.currentData=t,n.data&&t.data!==n.data){let t=r(n.data);this.processData(t)}else if(n.nodes){if(t.nodes!==n.nodes){let t=r(n.nodes);this.processNodes(t)}if(t.links!==n.links){let t=r(n.links);this.processLinks(t)}}else{if(n.from===t.from||n.nodesFrom){if(n.nodesFrom!==t.nodesFrom||n.linksFrom!==t.linksFrom){this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.nodesProdComponent&&this.nodesProdComponent.notiBuffer.unregister(this.notiBufferId),this.linksProdComponent&&this.linksProdComponent.notiBuffer.unregister(this.notiBufferId);let t=i(n,e);this.nodesProdComponent=t.nodes,this.nodesProdComponent.notiBuffer&&(this.notiBufferId=this.nodesProdComponent.notiBuffer.register(this.processNodes.bind(this))),this.linksProdComponent=t.links,this.linksProdComponent.notiBuffer&&(this.notiBufferId=this.linksProdComponent.notiBuffer.register(this.processLinks.bind(this)))}}else this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.nodesProdComponent&&this.nodesProdComponent.notiBuffer.unregister(this.notiBufferId),this.linksProdComponent&&this.linksProdComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=i(n,e),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)));if(n!==t)if(n.data){let t=r(n.data);this.processData(t)}else if(n.nodes){let t=r(n.nodes);this.processNodes(t)}}},tick:function(t,e){let n=h.components.raycaster.raycaster.intersectObjects(this.forceGraph.children).filter((function(t){return-1!==["node","link"].indexOf(t.object.__graphObjType)})).sort((function(t,e){return n(e)-n(t);function n(t){return"node"===t.object.__graphObjType}})),i=n.length?n[0].object:null;if(i!==this.state.hoverObj){const t=this.state.hoverObj?this.state.hoverObj.__graphObjType:null,e=this.state.hoverObj?this.state.hoverObj.__data:null,n=i?i.__graphObjType:null,r=i?i.__data:null;t&&t!==n&&this.data["on"+("node"===t?"Node":"Link")+"CenterHover"](null,e),(this.data.nodeLegend&&"node"===t||this.data.linkLegend&&""!=this.data.linkLabel&&"link"===t)&&this.removeLegend(this),n&&this.data["on"+("node"===n?"Node":"Link")+"CenterHover"](r,t===n?e:null),this.state.hoverObj=i,i&&(this.data.nodeLegend&&"node"===i.__graphObjType?this.showLegend(i,i.__data,this.data.nodeLabel,this.el.getAttribute("scale")):this.data.linkLegend&&"link"===i.__graphObjType&&""!=this.data.linkLabel&&this.showLinkLegend(i,i.__data,this.data.linkLabel,this.el.getAttribute("scale")))}this.forceGraph.tickFrame()},prodComponent:void 0,nodesProdComponent:void 0,linksProdComponent:void 0,notiBufferId:void 0,newData:void 0,currentData:void 0,babiaMetadata:{id:0},legend:"",updateChart:function(t,e){if(e.currentData){let n=AFRAME.utils.diff(t,e.currentData);["jsonUrl","numDimensions","dagMode","dagLevelDistance","dagNodeFilter","onDagError","nodeRelSize","nodeId","nodeVal","nodeResolution","nodeVisibility","nodeColor","nodeAutoColorBy","nodeOpacity","nodeThreeObject","nodeThreeObjectExtend","linkSource","linkTarget","linkVisibility","linkColor","linkAutoColorBy","linkOpacity","linkWidth","linkResolution","linkCurvature","linkCurveRotation","linkMaterial","linkThreeObject","linkThreeObjectExtend","linkPositionUpdate","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","forceEngine","d3AlphaMin","d3AphaDecay","d3VelocityDecay","ngraphPhysics","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"].filter((function(t){return t in n})).forEach((function(n){e.forceGraph[n](""!==t[n]?t[n]:null)})),("nodes"in n||"links"in n)&&e.forceGraph.graphData({nodes:t.nodes,links:t.links})}},processData:function(t){console.log("processData",this);let e=this.data;e.data=t,e=this.elDataFromData(e),this.data=e,this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."),this.updateChart(e,this)},processNodes:function(t){console.log("processNodes",this);let e=this.data;if(e.nodes=t,this.data.nodes=e.nodes,e=this.elDataFromNodesAndLinks(e),e)this.data=e,this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."),this.updateChart(e,this);else if(this.data.links){let t=r(this.data.links);this.processLinks(t)}else this.data.linksFrom&&(this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."))},processLinks:function(t){console.log("processLinks",this);let e=this.data;if(e.links="string"==typeof t||t instanceof String?JSON.parse(t):t,this.data.links=e.links,e=this.elDataFromNodesAndLinks(e),e)this.data=e,this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."),this.updateChart(e,this);else if(this.data.nodes){let t=r(this.data.nodes);this.processLinks(t)}else this.data.nodesFrom&&(this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."))},elDataFromData:function(t){let e=[],n=[];const i=t.data,r=t.nodeId,a=t.linkId,s=t.nodeVal,o=t.linkSource,l=t.linkTarget,h=t.linkLabel;return i.forEach(t=>{let n={};Object.keys(t).forEach((function(e){e===r?n[r]=t[e]:e===a?n.linkId=t[e]:e===s&&(n[s]=t[e])})),e.push(n)}),e.forEach(t=>{e.forEach(e=>{if(t[r]!==e[r]&&t.linkId===e.linkId)if(n.length>0){let i=!1;if(n.forEach(n=>{(n[o]===t[r]&&n[l]===e[r]||n[o]===e[r]&&n[l]===t[r])&&(i=!0)}),!i){let i={};i[h]=t[h],i[o]=t[r],i[l]=e[r],n.push(i)}}else{let i={};i[h]=t[h],i[o]=t[r],i[l]=e[r],n.push(i)}})}),t.nodes=e,t.links=n,t},elDataFromNodesAndLinks:function(t){let e=t.nodes,n=t.links;const i=t.nodeId,r=t.nodeVal,a=t.linkSource,s=t.linkTarget;return!(!Array.isArray(e)||!Array.isArray(n))&&(e.forEach(t=>{Object.keys(t).forEach((function(e){e===i?t[i]=t[e]:e===r&&(t[r]=t[e])}))}),n.map(t=>{e.forEach(e=>{t[a]===e[i]?t[a]=e[i]:t[s]===e[i]&&(t[s]=e[i])})}),t.nodes=e,t.links=n,t)},showLegend:function(t,e,n,i){let r=new THREE.Vector3;t.getWorldPosition(r);let a=t.geometry.boundingSphere.radius,s=document.querySelector("a-scene");this.legend=function(t,e,n,i,r){let a=t[e],s=2,o=3,l=3,h=3;a.length>16&&(s=a.length/8);r&&(o*=r.x,l*=r.y,h*=r.z,i=(i+3)*r.y);let c=document.createElement("a-plane");return c.setAttribute("position",{x:n.x,y:n.y+i,z:n.z}),c.setAttribute("babia-lookat","[camera]"),c.setAttribute("width",s),c.setAttribute("height","1"),c.setAttribute("color","white"),c.setAttribute("scale",{x:o,y:l,z:h}),c.setAttribute("text",{value:t[e],align:"center",width:6,color:"black"}),c.classList.add("babiaxrLegend"),c}(e,n,r,a,i),s.appendChild(this.legend)},showLinkLegend:function(t,e,n,i){let r=new THREE.Vector3,a=t.geometry.boundingSphere.radius,s=new THREE.Vector3,o=new THREE.Vector3;this.forceGraph.children.filter(t=>"node"==t.__graphObjType).forEach(t=>{t.__data[this.data.nodeId]==e.source[this.data.nodeId]&&t.getWorldPosition(s),t.__data[this.data.nodeId]==e.target[this.data.nodeId]&&t.getWorldPosition(o)}),r.x=(s.x+o.x)/2,r.y=(s.y+o.y)/2,r.z=(s.z+o.z)/2;let l=document.querySelector("a-scene");this.legend=function(t,e,n,i,r){let a=t[e],s=2,o=3,l=3,h=3;a.length>16&&(s=a.length/8);r&&(o*=r.x,l*=r.y,h*=r.z,i=(i+3)*r.y);let c=document.createElement("a-plane");return c.setAttribute("position",{x:n.x,y:n.y+i,z:n.z}),c.setAttribute("babia-lookat","[camera]"),c.setAttribute("width",s),c.setAttribute("height","1"),c.setAttribute("color","white"),c.setAttribute("scale",{x:o,y:l,z:h}),c.setAttribute("text",{value:t[e],align:"center",width:6,color:"black"}),c.classList.add("babiaxrLegend"),c}(e,n,r,a,i),l.appendChild(this.legend)},removeLegend:function(){if(this.legend){document.querySelector("a-scene").removeChild(this.legend)}}})},function(t,e,n){const i=n(3);function r(t,e){return`\n${s(t,e)}\n${a(t)}\nreturn {Body: Body, Vector: Vector};\n`}function a(t){let e=i(t),n=e("{var}",{join:", "});return`\nfunction Body(${n}) {\n this.isPinned = false;\n this.pos = new Vector(${n});\n this.force = new Vector();\n this.velocity = new Vector();\n this.mass = 1;\n\n this.springCount = 0;\n this.springLength = 0;\n}\n\nBody.prototype.reset = function() {\n this.force.reset();\n this.springCount = 0;\n this.springLength = 0;\n}\n\nBody.prototype.setPosition = function (${n}) {\n ${e("this.pos.{var} = {var} || 0;",{indent:2})}\n};`}function s(t,e){let n=i(t),r="";return e&&(r=""+n("\n var v{var};\nObject.defineProperty(this, '{var}', {\n set: function(v) { \n if (!Number.isFinite(v)) throw new Error('Cannot set non-numbers to {var}');\n v{var} = v; \n },\n get: function() { return v{var}; }\n});")),`function Vector(${n("{var}",{join:", "})}) {\n ${r}\n if (typeof arguments[0] === 'object') {\n // could be another vector\n let v = arguments[0];\n ${n('if (!Number.isFinite(v.{var})) throw new Error("Expected value is not a finite number at Vector constructor ({var})");',{indent:4})}\n ${n("this.{var} = v.{var};",{indent:4})}\n } else {\n ${n('this.{var} = typeof {var} === "number" ? {var} : 0;',{indent:4})}\n }\n }\n \n Vector.prototype.reset = function () {\n ${n("this.{var} = ",{join:""})}0;\n };`}t.exports=function(t,e){let n=r(t,e),{Body:i}=new Function(n)();return i},t.exports.generateCreateBodyFunctionBody=r,t.exports.getVectorCode=s,t.exports.getBodyCode=a},function(t,e,n){const i=n(3),r=n(7);function a(t){let e=i(t),n=Math.pow(2,t);return`\n${c()}\n${h(t)}\n${s(t)}\n${l(t)}\n${o(t)}\n\nfunction createQuadTree(options, random) {\n options = options || {};\n options.gravity = typeof options.gravity === 'number' ? options.gravity : -1;\n options.theta = typeof options.theta === 'number' ? options.theta : 0.8;\n\n var gravity = options.gravity;\n var updateQueue = [];\n var insertStack = new InsertStack();\n var theta = options.theta;\n\n var nodesCache = [];\n var currentInCache = 0;\n var root = newNode();\n\n return {\n insertBodies: insertBodies,\n\n /**\n * Gets root node if it is present\n */\n getRoot: function() {\n return root;\n },\n\n updateBodyForce: update,\n\n options: function(newOptions) {\n if (newOptions) {\n if (typeof newOptions.gravity === 'number') {\n gravity = newOptions.gravity;\n }\n if (typeof newOptions.theta === 'number') {\n theta = newOptions.theta;\n }\n\n return this;\n }\n\n return {\n gravity: gravity,\n theta: theta\n };\n }\n };\n\n function newNode() {\n // To avoid pressure on GC we reuse nodes.\n var node = nodesCache[currentInCache];\n if (node) {\n${function(t){let e=[];for(let i=0;i<n;++i)e.push(`${t}quad${i} = null;`);return e.join("\n")}(" node.")}\n node.body = null;\n node.mass = ${e("node.mass_{var} = ",{join:""})}0;\n ${e("node.min_{var} = node.max_{var} = ",{join:""})}0;\n } else {\n node = new QuadNode();\n nodesCache[currentInCache] = node;\n }\n\n ++currentInCache;\n return node;\n }\n\n function update(sourceBody) {\n var queue = updateQueue;\n var v;\n ${e("var d{var};",{indent:4})}\n var r; \n ${e("var f{var} = 0;",{indent:4})}\n var queueLength = 1;\n var shiftIdx = 0;\n var pushIdx = 1;\n\n queue[0] = root;\n\n while (queueLength) {\n var node = queue[shiftIdx];\n var body = node.body;\n\n queueLength -= 1;\n shiftIdx += 1;\n var differentBody = (body !== sourceBody);\n if (body && differentBody) {\n // If the current node is a leaf node (and it is not source body),\n // calculate the force exerted by the current node on body, and add this\n // amount to body's net force.\n ${e("d{var} = body.pos.{var} - sourceBody.pos.{var};",{indent:8})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n // Poor man's protection against zero distance.\n ${e("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:10})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n }\n\n // This is standard gravitation force calculation but we divide\n // by r^3 to save two operations when normalizing force vector.\n v = gravity * body.mass * sourceBody.mass / (r * r * r);\n ${e("f{var} += v * d{var};",{indent:8})}\n } else if (differentBody) {\n // Otherwise, calculate the ratio s / r, where s is the width of the region\n // represented by the internal node, and r is the distance between the body\n // and the node's center-of-mass\n ${e("d{var} = node.mass_{var} / node.mass - sourceBody.pos.{var};",{indent:8})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n // Sorry about code duplication. I don't want to create many functions\n // right away. Just want to see performance first.\n ${e("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:10})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n }\n // If s / r < θ, treat this internal node as a single body, and calculate the\n // force it exerts on sourceBody, and add this amount to sourceBody's net force.\n if ((node.max_${r(0)} - node.min_${r(0)}) / r < theta) {\n // in the if statement above we consider node's width only\n // because the region was made into square during tree creation.\n // Thus there is no difference between using width or height.\n v = gravity * node.mass * sourceBody.mass / (r * r * r);\n ${e("f{var} += v * d{var};",{indent:10})}\n } else {\n // Otherwise, run the procedure recursively on each of the current node's children.\n\n // I intentionally unfolded this loop, to save several CPU cycles.\n${function(){let t=Array(11).join(" "),e=[];for(let i=0;i<n;++i)e.push(t+`if (node.quad${i}) {`),e.push(t+` queue[pushIdx] = node.quad${i};`),e.push(t+" queueLength += 1;"),e.push(t+" pushIdx += 1;"),e.push(t+"}");return e.join("\n")}()}\n }\n }\n }\n\n ${e("sourceBody.force.{var} += f{var};",{indent:4})}\n }\n\n function insertBodies(bodies) {\n ${e("var {var}min = Number.MAX_VALUE;",{indent:4})}\n ${e("var {var}max = Number.MIN_VALUE;",{indent:4})}\n var i = bodies.length;\n\n // To reduce quad tree depth we are looking for exact bounding box of all particles.\n while (i--) {\n var pos = bodies[i].pos;\n ${e("if (pos.{var} < {var}min) {var}min = pos.{var};",{indent:6})}\n ${e("if (pos.{var} > {var}max) {var}max = pos.{var};",{indent:6})}\n }\n\n // Makes the bounds square.\n var maxSideLength = -Infinity;\n ${e("if ({var}max - {var}min > maxSideLength) maxSideLength = {var}max - {var}min ;",{indent:4})}\n\n currentInCache = 0;\n root = newNode();\n ${e("root.min_{var} = {var}min;",{indent:4})}\n ${e("root.max_{var} = {var}min + maxSideLength;",{indent:4})}\n\n i = bodies.length - 1;\n if (i >= 0) {\n root.body = bodies[i];\n }\n while (i--) {\n insert(bodies[i], root);\n }\n }\n\n function insert(newBody) {\n insertStack.reset();\n insertStack.push(root, newBody);\n\n while (!insertStack.isEmpty()) {\n var stackItem = insertStack.pop();\n var node = stackItem.node;\n var body = stackItem.body;\n\n if (!node.body) {\n // This is internal node. Update the total mass of the node and center-of-mass.\n ${e("var {var} = body.pos.{var};",{indent:8})}\n node.mass += body.mass;\n ${e("node.mass_{var} += body.mass * {var};",{indent:8})}\n\n // Recursively insert the body in the appropriate quadrant.\n // But first find the appropriate quadrant.\n var quadIdx = 0; // Assume we are in the 0's quad.\n ${e("var min_{var} = node.min_{var};",{indent:8})}\n ${e("var max_{var} = (min_{var} + node.max_{var}) / 2;",{indent:8})}\n\n${function(e){let n=[],i=Array(e+1).join(" ");for(let e=0;e<t;++e)n.push(i+`if (${r(e)} > max_${r(e)}) {`),n.push(i+` quadIdx = quadIdx + ${Math.pow(2,e)};`),n.push(i+` min_${r(e)} = max_${r(e)};`),n.push(i+` max_${r(e)} = node.max_${r(e)};`),n.push(i+"}");return n.join("\n")}(8)}\n\n var child = getChild(node, quadIdx);\n\n if (!child) {\n // The node is internal but this quadrant is not taken. Add\n // subnode to it.\n child = newNode();\n ${e("child.min_{var} = min_{var};",{indent:10})}\n ${e("child.max_{var} = max_{var};",{indent:10})}\n child.body = body;\n\n setChild(node, quadIdx, child);\n } else {\n // continue searching in this quadrant.\n insertStack.push(child, body);\n }\n } else {\n // We are trying to add to the leaf node.\n // We have to convert current leaf into internal node\n // and continue adding two nodes.\n var oldBody = node.body;\n node.body = null; // internal nodes do not cary bodies\n\n if (isSamePosition(oldBody.pos, body.pos)) {\n // Prevent infinite subdivision by bumping one node\n // anywhere in this quadrant\n var retriesCount = 3;\n do {\n var offset = random.nextDouble();\n ${e("var d{var} = (node.max_{var} - node.min_{var}) * offset;",{indent:12})}\n\n ${e("oldBody.pos.{var} = node.min_{var} + d{var};",{indent:12})}\n retriesCount -= 1;\n // Make sure we don't bump it out of the box. If we do, next iteration should fix it\n } while (retriesCount > 0 && isSamePosition(oldBody.pos, body.pos));\n\n if (retriesCount === 0 && isSamePosition(oldBody.pos, body.pos)) {\n // This is very bad, we ran out of precision.\n // if we do not return from the method we'll get into\n // infinite loop here. So we sacrifice correctness of layout, and keep the app running\n // Next layout iteration should get larger bounding box in the first step and fix this\n return;\n }\n }\n // Next iteration should subdivide node further.\n insertStack.push(node, oldBody);\n insertStack.push(node, body);\n }\n }\n }\n}\nreturn createQuadTree;\n\n`}function s(t){let e=i(t);return`\n function isSamePosition(point1, point2) {\n ${e("var d{var} = Math.abs(point1.{var} - point2.{var});",{indent:2})}\n \n return ${e("d{var} < 1e-8",{join:" && "})};\n } \n`}function o(t){var e=Math.pow(2,t);return`\nfunction setChild(node, idx, child) {\n ${function(){let t=[];for(let n=0;n<e;++n){let e=0===n?" ":" else ";t.push(`${e}if (idx === ${n}) node.quad${n} = child;`)}return t.join("\n")}()}\n}`}function l(t){return`function getChild(node, idx) {\n${function(){let e=[],n=Math.pow(2,t);for(let t=0;t<n;++t)e.push(` if (idx === ${t}) return node.quad${t};`);return e.join("\n")}()}\n return null;\n}`}function h(t){let e=i(t),n=Math.pow(2,t);return`\nfunction QuadNode() {\n // body stored inside this node. In quad tree only leaf nodes (by construction)\n // contain bodies:\n this.body = null;\n\n // Child nodes are stored in quads. Each quad is presented by number:\n // 0 | 1\n // -----\n // 2 | 3\n${function(t){let e=[];for(let i=0;i<n;++i)e.push(`${t}quad${i} = null;`);return e.join("\n")}(" this.")}\n\n // Total mass of current node\n this.mass = 0;\n\n // Center of mass coordinates\n ${e("this.mass_{var} = 0;",{indent:2})}\n\n // bounding box coordinates\n ${e("this.min_{var} = 0;",{indent:2})}\n ${e("this.max_{var} = 0;",{indent:2})}\n}\n`}function c(){return"\n/**\n * Our implementation of QuadTree is non-recursive to avoid GC hit\n * This data structure represent stack of elements\n * which we are trying to insert into quad tree.\n */\nfunction InsertStack () {\n this.stack = [];\n this.popIdx = 0;\n}\n\nInsertStack.prototype = {\n isEmpty: function() {\n return this.popIdx === 0;\n },\n push: function (node, body) {\n var item = this.stack[this.popIdx];\n if (!item) {\n // we are trying to avoid memory pressure: create new element\n // only when absolutely necessary\n this.stack[this.popIdx] = new InsertStackElement(node, body);\n } else {\n item.node = node;\n item.body = body;\n }\n ++this.popIdx;\n },\n pop: function () {\n if (this.popIdx > 0) {\n return this.stack[--this.popIdx];\n }\n },\n reset: function () {\n this.popIdx = 0;\n }\n};\n\nfunction InsertStackElement(node, body) {\n this.node = node; // QuadTree node\n this.body = body; // physical body which needs to be inserted to node\n}\n"}t.exports=function(t){let e=a(t);return new Function(e)()},t.exports.generateQuadTreeFunctionBody=a,t.exports.getInsertStackCode=c,t.exports.getQuadNodeCode=h,t.exports.isSamePosition=s,t.exports.getChildBodyCode=l,t.exports.setChildBodyCode=o},function(t,e,n){t.exports=function(t){let e=r(t);return new Function("bodies","settings","random",e)},t.exports.generateFunctionBody=r;const i=n(3);function r(t){let e=i(t);return`\n var boundingBox = {\n ${e("min_{var}: 0, max_{var}: 0,",{indent:4})}\n };\n\n return {\n box: boundingBox,\n\n update: updateBoundingBox,\n\n reset: resetBoundingBox,\n\n getBestNewPosition: function (neighbors) {\n var ${e("base_{var} = 0",{join:", "})};\n\n if (neighbors.length) {\n for (var i = 0; i < neighbors.length; ++i) {\n let neighborPos = neighbors[i].pos;\n ${e("base_{var} += neighborPos.{var};",{indent:10})}\n }\n\n ${e("base_{var} /= neighbors.length;",{indent:8})}\n } else {\n ${e("base_{var} = (boundingBox.min_{var} + boundingBox.max_{var}) / 2;",{indent:8})}\n }\n\n var springLength = settings.springLength;\n return {\n ${e("{var}: base_{var} + (random.nextDouble() - 0.5) * springLength,",{indent:8})}\n };\n }\n };\n\n function updateBoundingBox() {\n var i = bodies.length;\n if (i === 0) return; // No bodies - no borders.\n\n ${e("var max_{var} = -Infinity;",{indent:4})}\n ${e("var min_{var} = Infinity;",{indent:4})}\n\n while(i--) {\n // this is O(n), it could be done faster with quadtree, if we check the root node bounds\n var bodyPos = bodies[i].pos;\n ${e("if (bodyPos.{var} < min_{var}) min_{var} = bodyPos.{var};",{indent:6})}\n ${e("if (bodyPos.{var} > max_{var}) max_{var} = bodyPos.{var};",{indent:6})}\n }\n\n ${e("boundingBox.min_{var} = min_{var};",{indent:4})}\n ${e("boundingBox.max_{var} = max_{var};",{indent:4})}\n }\n\n function resetBoundingBox() {\n ${e("boundingBox.min_{var} = boundingBox.max_{var} = 0;",{indent:4})}\n }\n`}},function(t,e,n){const i=n(3);function r(t){return`\n if (!Number.isFinite(options.dragCoefficient)) throw new Error('dragCoefficient is not a finite number');\n\n return {\n update: function(body) {\n ${i(t)("body.force.{var} -= options.dragCoefficient * body.velocity.{var};",{indent:6})}\n }\n };\n`}t.exports=function(t){let e=r(t);return new Function("options",e)},t.exports.generateCreateDragForceFunctionBody=r},function(t,e,n){const i=n(3);function r(t){let e=i(t);return`\n if (!Number.isFinite(options.springCoefficient)) throw new Error('Spring coefficient is not a number');\n if (!Number.isFinite(options.springLength)) throw new Error('Spring length is not a number');\n\n return {\n /**\n * Updates forces acting on a spring\n */\n update: function (spring) {\n var body1 = spring.from;\n var body2 = spring.to;\n var length = spring.length < 0 ? options.springLength : spring.length;\n ${e("var d{var} = body2.pos.{var} - body1.pos.{var};",{indent:6})}\n var r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n ${e("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:8})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n }\n\n var d = r - length;\n var coefficient = ((spring.coefficient > 0) ? spring.coefficient : options.springCoefficient) * d / r;\n\n ${e("body1.force.{var} += coefficient * d{var}",{indent:6})};\n body1.springCount += 1;\n body1.springLength += r;\n\n ${e("body2.force.{var} -= coefficient * d{var}",{indent:6})};\n body2.springCount += 1;\n body2.springLength += r;\n }\n };\n`}t.exports=function(t){let e=r(t);return new Function("options","random",e)},t.exports.generateCreateSpringForceFunctionBody=r},function(t,e,n){const i=n(3);function r(t){let e=i(t);return`\n var length = bodies.length;\n if (length === 0) return 0;\n\n ${e("var d{var} = 0, t{var} = 0;",{indent:2})}\n\n for (var i = 0; i < length; ++i) {\n var body = bodies[i];\n if (body.isPinned) continue;\n\n if (adaptiveTimeStepWeight && body.springCount) {\n timeStep = (adaptiveTimeStepWeight * body.springLength/body.springCount);\n }\n\n var coeff = timeStep / body.mass;\n\n ${e("body.velocity.{var} += coeff * body.force.{var};",{indent:4})}\n ${e("var v{var} = body.velocity.{var};",{indent:4})}\n var v = Math.sqrt(${e("v{var} * v{var}",{join:" + "})});\n\n if (v > 1) {\n // We normalize it so that we move within timeStep range. \n // for the case when v <= 1 - we let velocity to fade out.\n ${e("body.velocity.{var} = v{var} / v;",{indent:6})}\n }\n\n ${e("d{var} = timeStep * body.velocity.{var};",{indent:4})}\n\n ${e("body.pos.{var} += d{var};",{indent:4})}\n\n ${e("t{var} += Math.abs(d{var});",{indent:4})}\n }\n\n return (${e("t{var} * t{var}",{join:" + "})})/length;\n`}t.exports=function(t){let e=r(t);return new Function("bodies","timeStep","adaptiveTimeStepWeight",e)},t.exports.generateIntegratorFunctionBody=r},function(t,e){t.exports=function(t,e,n,i){this.from=t,this.to=e,this.length=n,this.coefficient=i}},function(t,e){t.exports=function t(e,n){var i;e||(e={});if(n)for(i in n)if(n.hasOwnProperty(i)){var r=e.hasOwnProperty(i),a=typeof n[i];!r||typeof e[i]!==a?e[i]=n[i]:"object"===a&&(e[i]=t(e[i],n[i]))}return e}},function(t,e){function n(t){return new i("number"==typeof t?t:+new Date)}function i(t){this.seed=t}function r(t){return Math.sqrt(2*Math.PI/t)*Math.pow(1/Math.E*(t+1/(12*t-1/(10*t))),t)}function a(){var t=this.seed;return t=4294967295&(3042594569^(t=(t=4294967295&((t=(t=4294967295&(3345072700^(t=t+2127912214+(t<<12)&4294967295)^t>>>19))+374761393+(t<<5)&4294967295)+3550635116^t<<9))+4251993797+(t<<3)&4294967295)^t>>>16),this.seed=t,(268435455&t)/268435456}t.exports=n,t.exports.random=n,t.exports.randomIterator=function(t,e){var i=e||n();if("function"!=typeof i.next)throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:function(e){var n,r,a;for(n=t.length-1;n>0;--n)r=i.next(n+1),a=t[r],t[r]=t[n],t[n]=a,e(a);t.length&&e(t[0])},shuffle:function(){var e,n,r;for(e=t.length-1;e>0;--e)n=i.next(e+1),r=t[n],t[n]=t[e],t[e]=r;return t}}},i.prototype.next=function(t){return Math.floor(this.nextDouble()*t)},i.prototype.nextDouble=a,i.prototype.uniform=a,i.prototype.gaussian=function(){var t,e,n;do{e=2*this.nextDouble()-1,n=2*this.nextDouble()-1,t=e*e+n*n}while(t>=1||0===t);return e*Math.sqrt(-2*Math.log(t)/t)},i.prototype.levy=function(){var t=Math.pow(r(2.5)*Math.sin(1.5*Math.PI/2)/(1.5*r(1.25)*Math.pow(2,.25)),1/1.5);return this.gaussian()*t/Math.pow(Math.abs(this.gaussian()),1/1.5)}},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-label",{schema:{text:{type:"string"},height:{type:"number",default:1},width:{type:"number",default:3},textWidth:{type:"number",default:6},color:{type:"color",default:"white"},font:{type:"string",default:"default"},background:{type:"color",default:"black"},align:{type:"string",default:"center"}},update:function(t){console.log("Starting label..."),this.el.setAttribute("geometry",{primitive:"plane",height:this.data.height,width:this.data.width}),this.el.setAttribute("material",{color:this.data.color}),this.el.setAttribute("text",{value:this.data.text,align:this.data.align,width:this.data.textWidth,color:this.data.background}),this.el.classList.add("babiaxrLegend")}})},function(t,e,n){const i=n(0).colors;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");class r{constructor(t,e,n,i){this.el=t,this.axis=e,this.anim=n,this.dur=i}updateLine(t,e){const n=this.axis,i=this.el,r=this.anim,a=this.dur,s=`line__${n}axis`;let o=i.components[s],l={x:0,y:0,z:0};l[n]=t,r&&o?(i.setAttribute(`animation__${n}axis`,{property:s+".end",to:l,dur:a}),i.setAttribute(s,{color:e})):i.setAttribute(s,{start:{x:0,y:0,z:0},end:l,color:e})}removeLabels(){const t=this.el,e=this.anim,n=this.dur;let i=t.querySelectorAll("[text]");for(const t of i)e?(t.addEventListener("animationcomplete",(function(t){t.target.remove()})),t.setAttribute("animation",{property:"text.opacity",to:0,dur:n})):t.remove()}updateLabels(t,e,n,r,a){const s=this.axis;let o=this.el;const l=this.anim,h=this.dur;for(let c=0;c<t.length;++c){let u,d=document.createElement("a-entity"),p=n;r&&(p=i.get(c,r)),d.setAttribute("text",{value:e[c],align:"right",width:10,color:p,opacity:0}),"behind"!=a&&"right"!=a||d.setAttribute("text",{align:"left"}),"x"===s?u="behind"==a?{x:t[c],y:0,z:-5.15}:{x:t[c],y:0,z:5.25}:"y"===s?u="right"==a?{x:5.2,y:t[c],z:0}:{x:-5.2,y:t[c],z:0}:"z"===s&&(u="right"==a?{x:5.2,y:0,z:t[c]}:{x:-5.2,y:0,z:t[c]}),d.setAttribute("position",u),"x"===s?d.setAttribute("rotation",{x:-90,y:90,z:0}):"z"===s&&d.setAttribute("rotation",{x:-90,y:0,z:0}),l?d.setAttribute("animation",{property:"text.opacity",to:1,dur:h}):d.setAttribute("text",{opacity:1}),o.appendChild(d)}}updateName(t,e,n){const i=this.axis;let r=this.el;const a=this.anim,s=this.dur;let o,l=document.createElement("a-entity");l.setAttribute("text",{value:t,align:"right",width:10,color:"#000",opacity:0}),"behind"!=e&&"right"!=e||l.setAttribute("text",{align:"left"}),"x"===i?o="behind"==e?{x:n+.5,y:0,z:-5.15}:{x:n+.5,y:0,z:5.25}:"y"===i?o="right"==e?{x:5.2,y:n+.5,z:0}:{x:-5.2,y:n+.5,z:0}:"z"===i&&(o="right"==e?{x:5.2,y:0,z:n+.5}:{x:-5.2,y:0,z:n+.5}),l.setAttribute("position",o),"x"===i?l.setAttribute("rotation",{x:-90,y:90,z:0}):"z"===i&&l.setAttribute("rotation",{x:-90,y:0,z:0}),a?l.setAttribute("animation",{property:"text.opacity",to:1,dur:s}):l.setAttribute("text",{opacity:1}),r.appendChild(l)}}AFRAME.registerComponent("babia-axis-y",{schema:{maxValue:{type:"number"},length:{type:"number"},minSteps:{type:"number",default:6},color:{type:"color",default:"#000"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},align:{type:"string",default:"left"},name:{type:"string",default:""}},init:function(){this.axis=new r(this.el,"y",this.data.animation,this.data.dur)},update:function(t){const e=this.data;let n=this.data.maxValue,i=this.data.length,r=this.data.minSteps;this.data.animation,this.data.dur;let a=0;if(console.log("Starting babia-axis-y:",n,i,this.data.color),n!=t.maxValue||i!=t.maxValue||r!=t.minSteps){let t=Math.floor(Math.log10(n));t<=0&&(a=1-t);let s=i/n,o=Math.pow(10,t),l=n/o;for(;l<=r;)o/=2,l=n/o;this.axis.updateLine(i,e.color),this.axis.removeLabels();let h=[],c=[];for(let t=1;o*t<n;t++)vtick=o*t,h.push(vtick*s),c.push(vtick.toFixed(a));this.axis.updateLabels(h,c,e.color,e.palette,e.align)}e.name&&this.axis.updateName(e.name,e.align,e.length)}}),AFRAME.registerComponent("babia-axis-x",{schema:{labels:{type:"array"},ticks:{type:"array"},length:{type:"number"},color:{type:"color",default:"#000"},palette:{type:"string",default:""},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},align:{type:"string",default:"front"},name:{type:"string",default:""}},init:function(){this.axis=new r(this.el,"x",this.data.animation,this.data.dur)},update:function(t){const e=this.data;console.log("Starting babia-axis-x:",e.ticks.length,e.length,this.data.color),this.axis.updateLine(e.length,e.color),this.axis.removeLabels(),this.axis.updateLabels(e.ticks,e.labels,e.color,e.palette,e.align),e.name&&this.axis.updateName(e.name,e.align,e.length)}}),AFRAME.registerComponent("babia-axis-z",{schema:{labels:{type:"array"},ticks:{type:"array"},length:{type:"number"},color:{type:"color",default:"#000"},palette:{type:"string",default:""},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},align:{type:"string",default:"left"},name:{type:"string",default:""}},init:function(){this.axis=new r(this.el,"z",this.data.animation,this.data.dur)},update:function(t){const e=this.data;console.log("Starting babia-axis-z:",e.ticks.length,e.length,this.data.color),this.axis.updateLine(e.length,e.color),this.axis.removeLabels(),this.axis.updateLabels(e.ticks,e.labels,e.color,e.palette,e.align),e.name&&this.axis.updateName(e.name,e.align,e.length)}})},function(t,e,n){n(0).colors;AFRAME.registerComponent("babia-bar",{schema:{height:{type:"number"},width:{type:"number"},depth:{type:"number"},color:{type:"color",default:"#000"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},label:{type:"string",default:""},labelText:{type:"string",default:""}},init:function(){console.log("Starting bar:",this.data.height,this.data.color);let t=this.data;this.box=document.createElement("a-entity"),this.box.classList.add("babiaxraycasterclass"),this.el.appendChild(this.box);let e={};e=t.animation?{height:0,width:t.width,depth:t.depth}:{height:t.height,width:t.width,depth:t.depth},this.box.setAttribute("geometry",{primitive:"box",height:e.height,width:e.width,depth:e.depth}),this.box.setAttribute("material",{color:t.color})},update:function(t){let e=this.data,n=this.box;this.updateProperty(n,"geometry","height",e.animation,e.height,t.height),e.height!=t.height&&(e.animation?(n.setAttribute("animation__pos",{property:"position",to:{x:0,y:e.height/2,z:0},dur:e.dur}),e.height<=0&&t.height>0?n.setAttribute("animation__opacity",{property:"material.opacity",to:0,dur:e.dur}):t.height<=0&&e.height>0&&n.setAttribute("animation__opacity",{property:"material.opacity",to:100,dur:e.dur})):(n.setAttribute("position",{x:0,y:e.height/2,z:0}),e.height<=0&&t.height>0?n.setAttribute("material","opacity",0):t.height<=0&&e.height>0&&n.setAttribute("material","opacity",100))),this.updateProperty(n,"geometry","width",e.animation,e.width,t.width),this.updateProperty(n,"geometry","depth",e.animation,e.depth,t.depth),this.updateProperty(n,"material","color",e.animation,e.color,t.color),"events"===this.data.label?(n.addEventListener("mouseenter",this.showLabel.bind(this)),n.addEventListener("mouseleave",this.hideLabel.bind(this))):"fixed"===this.data.label&&this.showLabel(t)},updateProperty:function(t,e,n,i,r,a){let s=this.data;if(r!==a)if(i){let i=e;n&&(i=i+"."+n),t.setAttribute("animation__"+e+"_"+n,{property:i,to:r,dur:s.dur})}else n?t.setAttribute(e,{[n]:r}):t.setAttribute(e,r)},showLabel:function(t){let e=this.data;"events"===e.label&&this.el.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),text=e.labelText;let n=2;text.length>16&&(n=text.length/8);oldHeight=t.height||0,oldDepth=t.depth||0;let i={x:0,y:oldHeight+.6,z:0};this.labelEl||(this.labelEl=document.createElement("a-entity"),this.labelEl.setAttribute("babia-label",{width:n,textWidth:6}),e.animation&&"fixed"===e.label&&this.labelEl.setAttribute("position",i),this.el.appendChild(this.labelEl));let r={x:0,y:e.height+.6,z:.7*e.depth},a=e.animation&&"fixed"===e.label;this.updateProperty(this.labelEl,"position","",a,r,i),this.labelEl.setAttribute("rotation",{x:0,y:0,z:0}),text!=t.labelText&&this.labelEl.setAttribute("babia-label",{text:e.labelText})},hideLabel:function(){"events"===this.data.label&&this.el.setAttribute("scale",{x:1,y:1,z:1}),this.labelEl&&(this.el.removeChild(this.labelEl),this.labelEl=null)}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function n(t,e){t.getObject3D("mesh")?i(t,e):t.addEventListener("model-loaded",(function(){t.color=e,i(t,e)}))}function i(t,e){t.object3D.traverse((function(t){last_material=t.material,last_material&&(t.material=new THREE.MeshBasicMaterial({color:e}))}))}AFRAME.registerComponent("babia-controls",{schema:{},multiple:!1,init:function(){this.createPlayer()},update:function(t){},player:void 0,createPlayer:function(){this.player=document.createElement("a-entity"),this.player.classList.add("babiaxrPlayer"),this.player.classList.add("babiaxraycasterclass"),this.el.appendChild(this.player),this.createButton("rewind","white"),this.createButton("skipPrev","white"),this.createButton("pause","white"),this.createButton("skipNext","white"),this.createButton("forward","grey")},createButton:function(t,e){let i,r,a,s,o=!1;if("play"===t)i="../../components/others/models/play_button.gltf",r=.2,a="babiaPlay",s="babiaContinue";else if("pause"===t)i="../../components/others/models/pause_button.gltf",r=0,a="babiaPause",s="babiaStop";else if("skipNext"===t)i="../../components/others/models/skip_button.gltf",r=3,a="babiaSkipNext",s=a,o=!0;else if("skipPrev"===t)i="../../components/others/models/skip_button.gltf",r=-3,a="babiaSkipPrev",s=a;else if("rewind"===t)i="../../components/others/models/rewind_button.gltf",r=-6,a="babiaRewind",s="babiaToPast";else{if("forward"!==t)throw new Error("That button type doesn't exist.");i="../../components/others/models/rewind_button.gltf",r=6,a="babiaForward",s="babiaToPresent",o=!0}let l=document.createElement("a-entity");l.setAttribute("gltf-model","url("+i+")"),l.classList.add("babiaxraycasterclass"),l.classList.add(a),l.setAttribute("position",{x:r,y:0,z:0}),n(l,e),o&&l.setAttribute("rotation",{x:0,y:180,z:0}),this.player.appendChild(l),this.emitEvents(l,s),this.mouseOver(l)},mouseOver:function(t){t.addEventListener("mouseenter",(function(){n(t,"grey")})),t.addEventListener("mouseleave",(function(){n(t,t.color)}))},emitEvents:function(t,e){let i=this;t.addEventListener("click",(function(){if(t.classList.contains("babiaPlay"))this.parentEl.removeChild(this),i.createButton("pause","white");else if(t.classList.contains("babiaPause"))this.parentEl.removeChild(this),i.createButton("play","white");else if(t.classList.contains("babiaSkipNext")||t.classList.contains("babiaSkipPrev")){let t=document.getElementsByClassName("babiaPause")[0];t&&(i.player.removeChild(t),i.createButton("play","white"))}else if(t.classList.contains("babiaForward")){this.color="grey",n(this,this.color);let t=document.getElementsByClassName("babiaRewind")[0];t.color="white",n(t,t.color)}else if(t.classList.contains("babiaRewind")){this.color="grey",n(this,this.color);let t=document.getElementsByClassName("babiaForward")[0];t.color="white",n(t,t.color)}i.el.parentEl.components["babia-navigator"].controlNavigator(e)}))}})},function(t,e,n){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const i=n(2).NotiBuffer;AFRAME.registerComponent("babia-navigator",{schema:{},multiple:!1,isPaused:void 0,sliderEl:void 0,toPresent:void 0,init:function(){this.notiBuffer=new i(this.registerBack.bind(this),this.unregisterBack.bind(this)),this.toPresent=!0,this.isPaused=!1},update:function(t){},initializeControls:function(){this.sliderEl=document.createElement("a-entity"),this.sliderEl.min=0,this.sliderEl.max=this.selector.selectable.length-1,this.current=this.selector.selectable.current,this.sliderEl.setAttribute("babia-slider",{size:1.5,min:this.sliderEl.min,max:this.sliderEl.max,value:this.current}),this.sliderEl.classList.add("babiaxraycasterclass"),this.sliderEl.id="timeline",this.sliderEl.setAttribute("scale",{x:2.3,y:2.3,z:2.3}),this.el.appendChild(this.sliderEl),this.controlsEl=document.createElement("a-entity"),this.controlsEl.setAttribute("babia-controls",""),this.controlsEl.classList.add("babiaxraycasterclass"),this.controlsEl.setAttribute("scale",{x:.15,y:.15,z:.3}),this.controlsEl.object3D.position.y=-.5,this.el.appendChild(this.controlsEl),this.stepControllerEl=document.createElement("a-entity"),this.stepControllerEl.setAttribute("babia-step-controller",""),this.stepControllerEl.classList.add("babiaxraycasterclass"),this.stepControllerEl.object3D.position.x=2.5,this.el.appendChild(this.stepControllerEl),this.speedControllerEl=document.createElement("a-entity"),this.speedControllerEl.setAttribute("babia-speed-controller",""),this.speedControllerEl.classList.add("babiaxraycasterclass"),this.speedControllerEl.object3D.position.x=3,this.el.appendChild(this.speedControllerEl)},updateSlider:function(t){let e=this.sliderEl.getAttribute("babia-slider").value;"babiaSkipNext"===t?e++:"babiaSkipPrev"===t&&e--,e>=0&&e<=this.sliderEl.max?(this.sliderEl.setAttribute("babia-slider","value",e),this.notiBuffer.set("babiaSetPosition"+e)):this.controlsEl.querySelector(".babiaPause")&&(this.notiBuffer.set("babiaSetPosition"+e),this.el.querySelector(".babiaPause").emit("click"))},registerBack:function(t){this.selector=t,this.prodComponent=t,this.prodComponent.navNotiBuffer&&(this.navNotiBufferId=this.prodComponent.navNotiBuffer.register(this.processData.bind(this)))},unregisterBack:function(t){t.navNotiBuffer.unregister(this.navNotiBufferId)},processData:function(t){"babiaStop"==t?(this.isPaused=!0,this.controlsEl.querySelector(".babiaPause")&&this.controlsEl.querySelector(".babiaPause").emit("click")):(this.sliderEl||this.initializeControls(),this.toPresent?this.current=t-1:this.current=t+1,this.current>=this.sliderEl.min&&this.current<=this.sliderEl.max&&this.sliderEl.setAttribute("babia-slider","value",this.current))},prodComponent:void 0,navNotiBufferId:void 0,sliderComp:void 0,controlsComp:void 0,stepComp:void 0,speedComp:void 0,controlNavigator:function(t,e){console.log("Navigator control: ",t),"babiaSkipNext"==t||"babiaSkipPrev"==t?(this.isPaused=!0,this.updateSlider(t)):(this.notiBuffer.set(t+e),"babiaContinue"===t?this.isPaused=!1:"babiaStop"===t?(this.isPaused=!0,this.controlsEl.querySelector(".babiaPause")&&this.controlsEl.querySelector(".babiaPause").emit("click")):"babiaToPresent"===t?this.toPresent=!0:"babiaToPast"===t&&(this.toPresent=!1))}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-slider",{schema:{color:{type:"color",default:"#fff"},size:{type:"number",default:.5},min:{type:"number",default:-6},max:{type:"number",default:-4},value:{type:"number",default:-5},innerSize:{type:"number",default:.8},precision:{type:"number",default:2},vertical:{type:"boolean",default:!1}},multiple:!0,init:function(){this.loader=new THREE.FontLoader;let t=new THREE.MeshBasicMaterial({color:this.data.color});this.material=t;let e=new THREE.Mesh(new THREE.BoxGeometry(.05,.15,.05),t),n=new THREE.Mesh(new THREE.CylinderGeometry(.015,.015,this.data.size,12),t);n.rotateZ(Math.PI/2);let i=new THREE.Group;this.lever=e,i.add(n),i.add(e),this.data.vertical&&i.rotateZ(Math.PI/2),this.el.setObject3D("mesh",i),this.el.classList.add("babiaxraycasterclass"),this.controllers=Array.prototype.slice.call(document.querySelectorAll("a-entity[hand-controls]")),this.fontURL="https://threejsfundamentals.org/threejs/resources/threejs/fonts/helvetiker_regular.typeface.json",this.loader.load(this.fontURL,t=>{this.font=t;let e=this.createTextGeometry(this.data.min,-this.data.size/2-.15,-.025),n=this.createTextGeometry(this.data.max,this.data.size/2+.08,-.025);i.add(e),i.add(n)})},createTextGeometry:function(t,e,n){let i=new THREE.TextGeometry(t.toString(),{font:this.font,size:.07,height:.01,curveSegments:12,bevelEnabled:!1}),r=new THREE.Mesh(i,this.material);return r.position.x=e,r.position.y=n,this.data.vertical&&(r.rotation.z=-Math.PI/2,r.position.y+=.05),r},setTextGeometry:function(t){this.textmesh&&(this.lever.children=[]),this.loader.load(this.fontURL,e=>{this.font=e,this.data.vertical?this.textmesh=this.createTextGeometry(t,-.025,-.2):this.textmesh=this.createTextGeometry(t,-.025,.15),this.lever.add(this.textmesh)})},play:function(){this.grabbed=!1,this.el.addEventListener("rangeout",this.onTriggerUp.bind(this)),this.controllers.forEach(function(t){t.addEventListener("triggerdown",this.onTriggerDown.bind(this)),t.addEventListener("triggerup",this.onTriggerUp.bind(this))}.bind(this))},pause:function(){this.el.removeEventListener("rangeout",this.onTriggerUp.bind(this)),this.controllers.forEach(function(t){t.removeEventListener("triggerdown",this.onTriggerDown.bind(this)),t.removeEventListener("triggerup",this.onTriggerUp.bind(this))}.bind(this))},onTriggerDown:function(t){var e=t.target.object3D,n=this.lever,i=(new THREE.Box3).setFromObject(e),r=(new THREE.Box3).setFromObject(n);if(i.intersectsBox(r)){let t=new THREE.Vector3;e.getWorldPosition(t);let i=new THREE.Vector3;n.getWorldPosition(i),t.distanceTo(i)<.1&&(this.grabbed=e,this.grabbed.visible=!1,this.knob.material=this.knobGrabbedMaterial)}},onTriggerUp:function(){this.grabbed&&(this.grabbed.visible=!0,this.grabbed=!1,this.knob.material=this.knobMaterial)},setValue:function(t){var e=this.lever;t<this.data.min?t=this.data.min:t>this.data.max&&(t=this.data.max),this.value=t,e.position.x=this.valueToLeverPosition(t),this.setTextGeometry(t)},valueToLeverPosition:function(t){var e=this.data.size*this.data.innerSize,n=Math.abs(this.data.max-this.data.min);let i=-1*e/2;return(t-this.data.min)*e/n+i},leverPositionToValue:function(t){var e=this.data.size*this.data.innerSize;return(t- -1*e/2)*Math.abs(this.data.max-this.data.min)/e+this.data.min},tick:function(){if(this.grabbed){var t=this.grabbed,e=this.lever,n=this.data.size*this.data.innerSize,i=(new THREE.Vector3).setFromMatrixPosition(t.matrixWorld);e.parent.worldToLocal(i),Math.abs(i.x)>n/2?e.position.x=n/2*Math.sign(e.position.x):e.position.x=i.x;var r=this.leverPositionToValue(e.position.x);Math.abs(this.value-r)>=Math.pow(10,-this.data.precision)&&(r=Math.round(r),this.value=r,this.setTextGeometry(r),this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetPosition",this.value))}},mousexPositionToValue:function(t){let e=this.el.object3D.getWorldPosition().x,n=this.data.size*this.data.innerSize*this.el.object3D.getWorldScale().x,i=(t-(e-n/2))*Math.abs(this.data.max-this.data.min)/n+this.data.min;return i<this.data.min?this.data.min:i>this.data.max?this.data.max:i},mouseyPositionToValue:function(t){let e=this.el.object3D.getWorldPosition().y,n=this.data.size*this.data.innerSize*this.el.object3D.getWorldScale().y,i=(t-(e-n/2))*Math.abs(this.data.max-this.data.min)/n+this.data.min;return i<this.data.min?this.data.min:i>this.data.max?this.data.max:i},update:function(t){this.data.value!==t.value&&this.setValue(this.data.value),this.el.addEventListener("click",_listener=t=>{let e,n=t.detail.intersection.point;e=this.data.vertical?this.mouseyPositionToValue(n.y):this.mousexPositionToValue(n.x),this.setValue(Math.round(e)),this.el.parentEl.components["babia-navigator"]?this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetPosition",Math.round(e)):this.el.parentEl.components["babia-step-controller"]?this.el.parentEl.components["babia-step-controller"].controlStep(Math.round(e)):this.el.parentEl.components["babia-speed-controller"]&&this.el.parentEl.components["babia-speed-controller"].controlSpeed(Math.round(e))})}}),AFRAME.registerComponent("babia-step-controller",{schema:{},multiple:!0,sliderEl:void 0,step:void 0,init:function(){this.createSlider()},createSlider:function(){this.sliderEl=document.createElement("a-entity"),this.sliderEl.setAttribute("babia-slider",{size:1,min:1,max:10,value:1,vertical:!0}),this.sliderEl.classList.add("babiaxraycasterclass"),this.sliderEl.id="step-controller",this.el.appendChild(this.sliderEl)},controlStep:function(t){this.step=t,this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetStep",this.step)}}),AFRAME.registerComponent("babia-speed-controller",{schema:{},multiple:!0,sliderEl:void 0,speed:void 0,init:function(){this.createSlider()},createSlider:function(){this.sliderEl=document.createElement("a-entity"),this.sliderEl.setAttribute("babia-slider",{size:1,min:1,max:3,value:1,vertical:!0}),this.sliderEl.classList.add("babiaxraycasterclass"),this.sliderEl.id="speed-controller",this.el.appendChild(this.sliderEl)},controlSpeed:function(t){this.speed=t,this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetSpeed",this.speed)}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-ui-link",{schema:{viz:{type:"string"},ui:{type:"string"}},linked_viz:void 0,ui_target:void 0,init:function(){this.createButton()},update:function(t){let e=this.data;i(e,this.el,this),n(e,this.el,this),console.log("VIZ",this.linked_viz)},createButton:function(){this.button=document.createElement("a-entity"),this.button.classList.add("babiaxraycasterclass"),this.button.setAttribute("geometry",{primitive:"plane",height:1,width:3}),this.button.setAttribute("material",{color:"#FFF"}),this.button.setAttribute("text",{value:"Manage me",align:"center",width:8,color:"#000"}),this.button.setAttribute("position",{x:0,y:-1,z:0}),this.addListeners(this.button,this),this.el.appendChild(this.button)},addListeners:function(t,e){t.addEventListener("mouseenter",(function(){t.setAttribute("text",{color:"#FFF"}),t.setAttribute("material",{color:"#333"})})),t.addEventListener("mouseleave",(function(){t.setAttribute("text",{color:"#000"}),t.setAttribute("material",{color:"#FFF"})})),t.addEventListener("click",(function(){let t=document.querySelector("#"+e.ui_target);console.log(e.linked_viz),t.setAttribute("babia-ui","target",e.linked_viz)}))}});let n=(t,e,n)=>t.ui?void(n.ui_target=t.ui):e.components["babia-ui"]?void(n.ui_target=e.components["babia-ui"]):document.querySelectorAll("[babia-ui]").length>0?void(n.ui_target=document.querySelectorAll("[babia-ui]")[0].id):void console.error("UI Component not found."),i=(t,e,n)=>{if(!t.viz)return e.components["babia-bars"]||e.components["babia-barsmap"]||e.components["babia-boats"]||e.components["babia-bubbles"]||e.components["babia-city"]||e.components["babia-cyls"]||e.components["babia-cylsmap"]||e.components["babia-doughnut"]||e.components["babia-network"]||e.components["babia-pie"]?void(n.linked_viz=e.id):void console.error("Visuzlizer not found.");n.linked_viz=t.viz}},function(t,e,n){"use strict";n.r(e);class i{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,i=n.length;e<i;e++)n[e].call(this,t);t.target=null}}}const r=[];for(let t=0;t<256;t++)r[t]=(t<16?"0":"")+t.toString(16);const a=Math.PI/180,s=180/Math.PI;function o(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(r[255&t]+r[t>>8&255]+r[t>>16&255]+r[t>>24&255]+"-"+r[255&e]+r[e>>8&255]+"-"+r[e>>16&15|64]+r[e>>24&255]+"-"+r[63&n|128]+r[n>>8&255]+"-"+r[n>>16&255]+r[n>>24&255]+r[255&i]+r[i>>8&255]+r[i>>16&255]+r[i>>24&255]).toUpperCase()}function l(t,e,n){return Math.max(e,Math.min(n,t))}function h(t,e){return(t%e+e)%e}function c(t,e,n){return(1-n)*t+n*e}function u(t){return 0==(t&t-1)&&0!==t}function d(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}class p{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(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}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){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}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*n-a*i+t.x,this.y=r*i+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}p.prototype.isVector2=!0;class f{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,i,r,a,s,o,l){const h=this.elements;return h[0]=t,h[1]=i,h[2]=s,h[3]=e,h[4]=r,h[5]=o,h[6]=n,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],h=n[4],c=n[7],u=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],y=i[4],b=i[7],x=i[2],_=i[5],w=i[8];return r[0]=a*f+s*v+o*x,r[3]=a*m+s*y+o*_,r[6]=a*g+s*b+o*w,r[1]=l*f+h*v+c*x,r[4]=l*m+h*y+c*_,r[7]=l*g+h*b+c*w,r[2]=u*f+d*v+p*x,r[5]=u*m+d*y+p*_,r[8]=u*g+d*b+p*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],h=t[8];return e*a*h-e*s*l-n*r*h+n*s*o+i*r*l-i*a*o}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],h=t[8],c=h*a-s*l,u=s*o-h*r,d=l*r-a*o,p=e*c+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=c*f,t[1]=(i*l-h*n)*f,t[2]=(s*n-i*a)*f,t[3]=u*f,t[4]=(h*e-i*o)*f,t[5]=(i*r-s*e)*f,t[6]=d*f,t[7]=(n*o-l*e)*f,t[8]=(a*e-n*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,a,s){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*a+l*s)+a+t,-i*l,i*o,-i*(-l*a+o*s)+s+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),i=this.elements,r=i[0],a=i[3],s=i[6],o=i[1],l=i[4],h=i[7];return i[0]=e*r+n*o,i[3]=e*a+n*l,i[6]=e*s+n*h,i[1]=-n*r+e*o,i[4]=-n*a+e*l,i[7]=-n*s+e*h,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<9;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}let m;f.prototype.isMatrix3=!0;class g{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===m&&(m=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),m.width=t.width,m.height=t.height;const n=m.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=m}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}}let v=0;class y extends i{constructor(t=y.DEFAULT_IMAGE,e=y.DEFAULT_MAPPING,n=1001,i=1001,r=1006,a=1008,s=1023,l=1009,h=1,c=3e3){super(),Object.defineProperty(this,"id",{value:v++}),this.uuid=o(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=h,this.format=s,this.internalFormat=null,this.type=l,this.offset=new p(0,0),this.repeat=new p(1,1),this.center=new p(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new f,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const i=this.image;if(void 0===i.uuid&&(i.uuid=o()),!e&&void 0===t.images[i.uuid]){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t<n;t++)i[t].isDataTexture?e.push(b(i[t].image)):e.push(b(i[t]))}else e=b(i);t.images[i.uuid]={uuid:i.uuid,url:e}}n.image=i.uuid}return e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function b(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?g.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}y.DEFAULT_IMAGE=void 0,y.DEFAULT_MAPPING=300,y.prototype.isTexture=!0;class x{constructor(t=0,e=0,n=0,i=1){this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .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.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .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.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*e+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*e+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*e+a[7]*n+a[11]*i+a[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const a=t.elements,s=a[0],o=a[4],l=a[8],h=a[1],c=a[5],u=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(o-h)<.01&&Math.abs(l-d)<.01&&Math.abs(u-p)<.01){if(Math.abs(o+h)<.1&&Math.abs(l+d)<.1&&Math.abs(u+p)<.1&&Math.abs(s+c+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(s+1)/2,a=(c+1)/2,m=(f+1)/2,g=(o+h)/4,v=(l+d)/4,y=(u+p)/4;return t>a&&t>m?t<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(t),i=g/n,r=v/n):a>m?a<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(a),n=g/i,r=y/i):m<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(m),n=v/r,i=y/r),this.set(n,i,r,e),this}let m=Math.sqrt((p-u)*(p-u)+(l-d)*(l-d)+(h-o)*(h-o));return Math.abs(m)<.001&&(m=1),this.x=(p-u)/m,this.y=(l-d)/m,this.z=(h-o)/m,this.w=Math.acos((s+c+f-1)/2),this}min(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.w=Math.min(this.w,t.w),this}max(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.w=Math.max(this.w,t.w),this}clamp(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.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(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.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){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.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(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.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}x.prototype.isVector4=!0;class _ extends i{constructor(t,e,n={}){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new x(0,0,t,e),this.scissorTest=!1,this.viewport=new x(0,0,t,e),this.texture=new y(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.image={width:t,height:e,depth:1},this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.internalFormat=void 0!==n.internalFormat?n.internalFormat:null,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:1006,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.image={...this.texture.image},this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}_.prototype.isWebGLRenderTarget=!0;(class extends _{constructor(t,e,n){super(t,e);const i=this.texture;this.texture=[];for(let t=0;t<n;t++)this.texture[t]=i.clone()}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let i=0,r=this.texture.length;i<r;i++)this.texture[i].image.width=t,this.texture[i].image.height=e,this.texture[i].image.depth=n;this.dispose()}return this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e),this}copy(t){this.dispose(),this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this.texture.length=0;for(let e=0,n=t.texture.length;e<n;e++)this.texture[e]=t.texture[e].clone();return this}}).prototype.isWebGLMultipleRenderTargets=!0;class w extends _{constructor(t,e,n){super(t,e,n),this.samples=4}copy(t){return super.copy.call(this,t),this.samples=t.samples,this}}w.prototype.isWebGLMultisampleRenderTarget=!0;class M{constructor(t=0,e=0,n=0,i=1){this._x=t,this._y=e,this._z=n,this._w=i}static slerp(t,e,n,i){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(t,e,i)}static slerpFlat(t,e,n,i,r,a,s){let o=n[i+0],l=n[i+1],h=n[i+2],c=n[i+3];const u=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(0===s)return t[e+0]=o,t[e+1]=l,t[e+2]=h,void(t[e+3]=c);if(1===s)return t[e+0]=u,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(c!==f||o!==u||l!==d||h!==p){let t=1-s;const e=o*u+l*d+h*p+c*f,n=e>=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),a=Math.atan2(r,e*n);t=Math.sin(t*a)/r,s=Math.sin(s*a)/r}const r=s*n;if(o=o*t+u*r,l=l*t+d*r,h=h*t+p*r,c=c*t+f*r,t===1-s){const t=1/Math.sqrt(o*o+l*l+h*h+c*c);o*=t,l*=t,h*=t,c*=t}}t[e]=o,t[e+1]=l,t[e+2]=h,t[e+3]=c}static multiplyQuaternionsFlat(t,e,n,i,r,a){const s=n[i],o=n[i+1],l=n[i+2],h=n[i+3],c=r[a],u=r[a+1],d=r[a+2],p=r[a+3];return t[e]=s*p+h*c+o*d-l*u,t[e+1]=o*p+h*u+l*c-s*d,t[e+2]=l*p+h*d+s*u-o*c,t[e+3]=h*p-s*c-o*u-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,i=t._y,r=t._z,a=t._order,s=Math.cos,o=Math.sin,l=s(n/2),h=s(i/2),c=s(r/2),u=o(n/2),d=o(i/2),p=o(r/2);switch(a){case"XYZ":this._x=u*h*c+l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c-u*d*p;break;case"YXZ":this._x=u*h*c+l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c+u*d*p;break;case"ZXY":this._x=u*h*c-l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c-u*d*p;break;case"ZYX":this._x=u*h*c-l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c+u*d*p;break;case"YZX":this._x=u*h*c+l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c-u*d*p;break;case"XZY":this._x=u*h*c-l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],a=e[1],s=e[5],o=e[9],l=e[2],h=e[6],c=e[10],u=n+s+c;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(h-o)*t,this._y=(r-l)*t,this._z=(a-i)*t}else if(n>s&&n>c){const t=2*Math.sqrt(1+n-s-c);this._w=(h-o)/t,this._x=.25*t,this._y=(i+a)/t,this._z=(r+l)/t}else if(s>c){const t=2*Math.sqrt(1+s-n-c);this._w=(r-l)/t,this._x=(i+a)/t,this._y=.25*t,this._z=(o+h)/t}else{const t=2*Math.sqrt(1+c-n-s);this._w=(a-i)/t,this._x=(r+l)/t,this._y=(o+h)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(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=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(l(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let 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(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(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,a=t._w,s=e._x,o=e._y,l=e._z,h=e._w;return this._x=n*h+a*s+i*l-r*o,this._y=i*h+a*o+r*s-n*l,this._z=r*h+a*l+n*o-i*s,this._w=a*h-n*s-i*o-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,a=this._w;let s=a*t._w+n*t._x+i*t._y+r*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;const o=1-s*s;if(o<=Number.EPSILON){const t=1-e;return this._w=t*a+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(o),h=Math.atan2(l,s),c=Math.sin((1-e)*h)/l,u=Math.sin(e*h)/l;return this._w=a*c+this._w*u,this._x=n*c+this._x*u,this._y=i*c+this._y*u,this._z=r*c+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,n){this.copy(t).slerp(e,n)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}M.prototype.isQuaternion=!0;class E{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(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(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(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(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(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(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(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(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(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(A.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(A.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,a=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,a=t.y,s=t.z,o=t.w,l=o*e+a*i-s*n,h=o*n+s*e-r*i,c=o*i+r*n-a*e,u=-r*e-a*n-s*i;return this.x=l*o+u*-r+h*-s-c*-a,this.y=h*o+u*-a+c*-r-l*-s,this.z=c*o+u*-s+l*-a-h*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(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(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(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(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(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){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(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(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(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(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(t,e){const n=t.x,i=t.y,r=t.z,a=e.x,s=e.y,o=e.z;return this.x=i*o-r*s,this.y=r*a-n*o,this.z=n*s-i*a,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return S.copy(this).projectOnVector(t),this.sub(S)}reflect(t){return this.sub(S.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(l(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return void 0!==n&&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}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}E.prototype.isVector3=!0;const S=new E,A=new M;class T{constructor(t=new E(1/0,1/0,1/0),e=new E(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,s=-1/0;for(let o=0,l=t.length;o<l;o+=3){const l=t[o],h=t[o+1],c=t[o+2];l<e&&(e=l),h<n&&(n=h),c<i&&(i=c),l>r&&(r=l),h>a&&(a=h),c>s&&(s=c)}return this.min.set(e,n,i),this.max.set(r,a,s),this}setFromBufferAttribute(t){let e=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,s=-1/0;for(let o=0,l=t.count;o<l;o++){const l=t.getX(o),h=t.getY(o),c=t.getZ(o);l<e&&(e=l),h<n&&(n=h),c<i&&(i=c),l>r&&(r=l),h>a&&(a=h),c>s&&(s=c)}return this.min.set(e,n,i),this.max.set(r,a,s),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=L.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){t.updateWorldMatrix(!1,!1);const e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),R.copy(e.boundingBox),R.applyMatrix4(t.matrixWorld),this.union(R));const n=t.children;for(let t=0,e=n.length;t<e;t++)this.expandByObject(n[t]);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,L),L.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(k),O.subVectors(this.max,k),P.subVectors(t.a,k),D.subVectors(t.b,k),I.subVectors(t.c,k),z.subVectors(D,P),N.subVectors(I,D),B.subVectors(P,I);let e=[0,-z.z,z.y,0,-N.z,N.y,0,-B.z,B.y,z.z,0,-z.x,N.z,0,-N.x,B.z,0,-B.x,-z.y,z.x,0,-N.y,N.x,0,-B.y,B.x,0];return!!H(e,P,D,I,O)&&(e=[1,0,0,0,1,0,0,0,1],!!H(e,P,D,I,O)&&(F.crossVectors(z,N),e=[F.x,F.y,F.z],H(e,P,D,I,O)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return L.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(L).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(C[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),C[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),C[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),C[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),C[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),C[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),C[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),C[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(C)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}T.prototype.isBox3=!0;const C=[new E,new E,new E,new E,new E,new E,new E,new E],L=new E,R=new T,P=new E,D=new E,I=new E,z=new E,N=new E,B=new E,k=new E,O=new E,F=new E,U=new E;function H(t,e,n,i,r){for(let a=0,s=t.length-3;a<=s;a+=3){U.fromArray(t,a);const s=r.x*Math.abs(U.x)+r.y*Math.abs(U.y)+r.z*Math.abs(U.z),o=e.dot(U),l=n.dot(U),h=i.dot(U);if(Math.max(-Math.max(o,l,h),Math.min(o,l,h))>s)return!1}return!0}const V=new T,G=new E,W=new E,j=new E;class q{constructor(t=new E,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):V.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;e<r;e++)i=Math.max(i,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){j.subVectors(t,this.center);const e=j.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.add(j.multiplyScalar(n/t)),this.radius+=n}return this}union(t){return W.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(G.copy(t.center).add(W)),this.expandByPoint(G.copy(t.center).sub(W)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const X=new E,Y=new E,J=new E,Z=new E,$=new E,Q=new E,K=new E;class tt{constructor(t=new E,e=new E(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,X)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=X.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(X.copy(this.direction).multiplyScalar(e).add(this.origin),X.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){Y.copy(t).add(e).multiplyScalar(.5),J.copy(e).sub(t).normalize(),Z.copy(this.origin).sub(Y);const r=.5*t.distanceTo(e),a=-this.direction.dot(J),s=Z.dot(this.direction),o=-Z.dot(J),l=Z.lengthSq(),h=Math.abs(1-a*a);let c,u,d,p;if(h>0)if(c=a*o-s,u=a*s-o,p=r*h,c>=0)if(u>=-p)if(u<=p){const t=1/h;c*=t,u*=t,d=c*(c+a*u+2*s)+u*(a*c+u+2*o)+l}else u=r,c=Math.max(0,-(a*u+s)),d=-c*c+u*(u+2*o)+l;else u=-r,c=Math.max(0,-(a*u+s)),d=-c*c+u*(u+2*o)+l;else u<=-p?(c=Math.max(0,-(-a*r+s)),u=c>0?-r:Math.min(Math.max(-r,-o),r),d=-c*c+u*(u+2*o)+l):u<=p?(c=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+l):(c=Math.max(0,-(a*r+s)),u=c>0?r:Math.min(Math.max(-r,-o),r),d=-c*c+u*(u+2*o)+l);else u=a>0?-r:r,c=Math.max(0,-(a*u+s)),d=-c*c+u*(u+2*o)+l;return n&&n.copy(this.direction).multiplyScalar(c).add(this.origin),i&&i.copy(J).multiplyScalar(u).add(Y),d}intersectSphere(t,e){X.subVectors(t.center,this.origin);const n=X.dot(this.direction),i=X.dot(X)-n*n,r=t.radius*t.radius;if(i>r)return null;const a=Math.sqrt(r-i),s=n-a,o=n+a;return s<0&&o<0?null:s<0?this.at(o,e):this.at(s,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,a,s,o;const l=1/this.direction.x,h=1/this.direction.y,c=1/this.direction.z,u=this.origin;return l>=0?(n=(t.min.x-u.x)*l,i=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,i=(t.min.x-u.x)*l),h>=0?(r=(t.min.y-u.y)*h,a=(t.max.y-u.y)*h):(r=(t.max.y-u.y)*h,a=(t.min.y-u.y)*h),n>a||r>i?null:((r>n||n!=n)&&(n=r),(a<i||i!=i)&&(i=a),c>=0?(s=(t.min.z-u.z)*c,o=(t.max.z-u.z)*c):(s=(t.max.z-u.z)*c,o=(t.min.z-u.z)*c),n>o||s>i?null:((s>n||n!=n)&&(n=s),(o<i||i!=i)&&(i=o),i<0?null:this.at(n>=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,X)}intersectTriangle(t,e,n,i,r){$.subVectors(e,t),Q.subVectors(n,t),K.crossVectors($,Q);let a,s=this.direction.dot(K);if(s>0){if(i)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}Z.subVectors(this.origin,t);const o=a*this.direction.dot(Q.crossVectors(Z,Q));if(o<0)return null;const l=a*this.direction.dot($.cross(Z));if(l<0)return null;if(o+l>s)return null;const h=-a*Z.dot(K);return h<0?null:this.at(h/s,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class et{constructor(){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.")}set(t,e,n,i,r,a,s,o,l,h,c,u,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=h,g[10]=c,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new et).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/nt.setFromMatrixColumn(t,0).length(),r=1/nt.setFromMatrixColumn(t,1).length(),a=1/nt.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,i=t.y,r=t.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(i),l=Math.sin(i),h=Math.cos(r),c=Math.sin(r);if("XYZ"===t.order){const t=a*h,n=a*c,i=s*h,r=s*c;e[0]=o*h,e[4]=-o*c,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-s*o,e[2]=r-t*l,e[6]=i+n*l,e[10]=a*o}else if("YXZ"===t.order){const t=o*h,n=o*c,i=l*h,r=l*c;e[0]=t+r*s,e[4]=i*s-n,e[8]=a*l,e[1]=a*c,e[5]=a*h,e[9]=-s,e[2]=n*s-i,e[6]=r+t*s,e[10]=a*o}else if("ZXY"===t.order){const t=o*h,n=o*c,i=l*h,r=l*c;e[0]=t-r*s,e[4]=-a*c,e[8]=i+n*s,e[1]=n+i*s,e[5]=a*h,e[9]=r-t*s,e[2]=-a*l,e[6]=s,e[10]=a*o}else if("ZYX"===t.order){const t=a*h,n=a*c,i=s*h,r=s*c;e[0]=o*h,e[4]=i*l-n,e[8]=t*l+r,e[1]=o*c,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=s*o,e[10]=a*o}else if("YZX"===t.order){const t=a*o,n=a*l,i=s*o,r=s*l;e[0]=o*h,e[4]=r-t*c,e[8]=i*c+n,e[1]=c,e[5]=a*h,e[9]=-s*h,e[2]=-l*h,e[6]=n*c+i,e[10]=t-r*c}else if("XZY"===t.order){const t=a*o,n=a*l,i=s*o,r=s*l;e[0]=o*h,e[4]=-c,e[8]=l*h,e[1]=t*c+r,e[5]=a*h,e[9]=n*c-i,e[2]=i*c-n,e[6]=s*h,e[10]=r*c+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(rt,t,at)}lookAt(t,e,n){const i=this.elements;return lt.subVectors(t,e),0===lt.lengthSq()&&(lt.z=1),lt.normalize(),st.crossVectors(n,lt),0===st.lengthSq()&&(1===Math.abs(n.z)?lt.x+=1e-4:lt.z+=1e-4,lt.normalize(),st.crossVectors(n,lt)),st.normalize(),ot.crossVectors(lt,st),i[0]=st.x,i[4]=ot.x,i[8]=lt.x,i[1]=st.y,i[5]=ot.y,i[9]=lt.y,i[2]=st.z,i[6]=ot.z,i[10]=lt.z,this}multiply(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(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],h=n[1],c=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],b=n[11],x=n[15],_=i[0],w=i[4],M=i[8],E=i[12],S=i[1],A=i[5],T=i[9],C=i[13],L=i[2],R=i[6],P=i[10],D=i[14],I=i[3],z=i[7],N=i[11],B=i[15];return r[0]=a*_+s*S+o*L+l*I,r[4]=a*w+s*A+o*R+l*z,r[8]=a*M+s*T+o*P+l*N,r[12]=a*E+s*C+o*D+l*B,r[1]=h*_+c*S+u*L+d*I,r[5]=h*w+c*A+u*R+d*z,r[9]=h*M+c*T+u*P+d*N,r[13]=h*E+c*C+u*D+d*B,r[2]=p*_+f*S+m*L+g*I,r[6]=p*w+f*A+m*R+g*z,r[10]=p*M+f*T+m*P+g*N,r[14]=p*E+f*C+m*D+g*B,r[3]=v*_+y*S+b*L+x*I,r[7]=v*w+y*A+b*R+x*z,r[11]=v*M+y*T+b*P+x*N,r[15]=v*E+y*C+b*D+x*B,this}multiplyScalar(t){const 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}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],a=t[1],s=t[5],o=t[9],l=t[13],h=t[2],c=t[6],u=t[10],d=t[14];return t[3]*(+r*o*c-i*l*c-r*s*u+n*l*u+i*s*d-n*o*d)+t[7]*(+e*o*d-e*l*u+r*a*u-i*a*d+i*l*h-r*o*h)+t[11]*(+e*l*c-e*s*d-r*a*c+n*a*d+r*s*h-n*l*h)+t[15]*(-i*s*h-e*o*c+e*s*u+i*a*c-n*a*u+n*o*h)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],h=t[8],c=t[9],u=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],v=c*m*l-f*u*l+f*o*d-s*m*d-c*o*g+s*u*g,y=p*u*l-h*m*l-p*o*d+a*m*d+h*o*g-a*u*g,b=h*f*l-p*c*l+p*s*d-a*f*d-h*s*g+a*c*g,x=p*c*o-h*f*o-p*s*u+a*f*u+h*s*m-a*c*m,_=e*v+n*y+i*b+r*x;if(0===_)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/_;return t[0]=v*w,t[1]=(f*u*r-c*m*r-f*i*d+n*m*d+c*i*g-n*u*g)*w,t[2]=(s*m*r-f*o*r+f*i*l-n*m*l-s*i*g+n*o*g)*w,t[3]=(c*o*r-s*u*r-c*i*l+n*u*l+s*i*d-n*o*d)*w,t[4]=y*w,t[5]=(h*m*r-p*u*r+p*i*d-e*m*d-h*i*g+e*u*g)*w,t[6]=(p*o*r-a*m*r-p*i*l+e*m*l+a*i*g-e*o*g)*w,t[7]=(a*u*r-h*o*r+h*i*l-e*u*l-a*i*d+e*o*d)*w,t[8]=b*w,t[9]=(p*c*r-h*f*r-p*n*d+e*f*d+h*n*g-e*c*g)*w,t[10]=(a*f*r-p*s*r+p*n*l-e*f*l-a*n*g+e*s*g)*w,t[11]=(h*s*r-a*c*r-h*n*l+e*c*l+a*n*d-e*s*d)*w,t[12]=x*w,t[13]=(h*f*i-p*c*i+p*n*u-e*f*u-h*n*m+e*c*m)*w,t[14]=(p*s*i-a*f*i-p*n*o+e*f*o+a*n*m-e*s*m)*w,t[15]=(a*c*i-h*s*i+h*n*o-e*c*o-a*n*u+e*s*u)*w,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,a=t.x,s=t.y,o=t.z,l=r*a,h=r*s;return this.set(l*a+n,l*s-i*o,l*o+i*s,0,l*s+i*o,h*s+n,h*o-i*a,0,l*o-i*s,h*o+i*a,r*o*o+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,a){return this.set(1,n,r,0,t,1,a,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,a=e._y,s=e._z,o=e._w,l=r+r,h=a+a,c=s+s,u=r*l,d=r*h,p=r*c,f=a*h,m=a*c,g=s*c,v=o*l,y=o*h,b=o*c,x=n.x,_=n.y,w=n.z;return i[0]=(1-(f+g))*x,i[1]=(d+b)*x,i[2]=(p-y)*x,i[3]=0,i[4]=(d-b)*_,i[5]=(1-(u+g))*_,i[6]=(m+v)*_,i[7]=0,i[8]=(p+y)*w,i[9]=(m-v)*w,i[10]=(1-(u+f))*w,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=nt.set(i[0],i[1],i[2]).length();const a=nt.set(i[4],i[5],i[6]).length(),s=nt.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],it.copy(this);const o=1/r,l=1/a,h=1/s;return it.elements[0]*=o,it.elements[1]*=o,it.elements[2]*=o,it.elements[4]*=l,it.elements[5]*=l,it.elements[6]*=l,it.elements[8]*=h,it.elements[9]*=h,it.elements[10]*=h,e.setFromRotationMatrix(it),n.x=r,n.y=a,n.z=s,this}makePerspective(t,e,n,i,r,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const s=this.elements,o=2*r/(e-t),l=2*r/(n-i),h=(e+t)/(e-t),c=(n+i)/(n-i),u=-(a+r)/(a-r),d=-2*a*r/(a-r);return s[0]=o,s[4]=0,s[8]=h,s[12]=0,s[1]=0,s[5]=l,s[9]=c,s[13]=0,s[2]=0,s[6]=0,s[10]=u,s[14]=d,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(t,e,n,i,r,a){const s=this.elements,o=1/(e-t),l=1/(n-i),h=1/(a-r),c=(e+t)*o,u=(n+i)*l,d=(a+r)*h;return s[0]=2*o,s[4]=0,s[8]=0,s[12]=-c,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-u,s[2]=0,s[6]=0,s[10]=-2*h,s[14]=-d,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}et.prototype.isMatrix4=!0;const nt=new E,it=new et,rt=new E(0,0,0),at=new E(1,1,1),st=new E,ot=new E,lt=new E,ht=new et,ct=new M;class ut{constructor(t=0,e=0,n=0,i=ut.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,r=i[0],a=i[4],s=i[8],o=i[1],h=i[5],c=i[9],u=i[2],d=i[6],p=i[10];switch(e){case"XYZ":this._y=Math.asin(l(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,p),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(d,h),this._z=0);break;case"YXZ":this._x=Math.asin(-l(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(o,h)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(l(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-l(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,h));break;case"YZX":this._z=Math.asin(l(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,h),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-l(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,h),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-c,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return ht.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ht,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return ct.setFromEuler(this),this.setFromQuaternion(ct,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(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(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new E(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}ut.prototype.isEuler=!0,ut.DefaultOrder="XYZ",ut.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class dt{constructor(){this.mask=1}set(t){this.mask=1<<t|0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}}let pt=0;const ft=new E,mt=new M,gt=new et,vt=new E,yt=new E,bt=new E,xt=new M,_t=new E(1,0,0),wt=new E(0,1,0),Mt=new E(0,0,1),Et={type:"added"},St={type:"removed"};class At extends i{constructor(){super(),Object.defineProperty(this,"id",{value:pt++}),this.uuid=o(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=At.DefaultUp.clone();const t=new E,e=new ut,n=new M,i=new E(1,1,1);e._onChange((function(){n.setFromEuler(e,!1)})),n._onChange((function(){e.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new et},normalMatrix:{value:new f}}),this.matrix=new et,this.matrixWorld=new et,this.matrixAutoUpdate=At.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new dt,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return mt.setFromAxisAngle(t,e),this.quaternion.multiply(mt),this}rotateOnWorldAxis(t,e){return mt.setFromAxisAngle(t,e),this.quaternion.premultiply(mt),this}rotateX(t){return this.rotateOnAxis(_t,t)}rotateY(t){return this.rotateOnAxis(wt,t)}rotateZ(t){return this.rotateOnAxis(Mt,t)}translateOnAxis(t,e){return ft.copy(t).applyQuaternion(this.quaternion),this.position.add(ft.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(_t,t)}translateY(t){return this.translateOnAxis(wt,t)}translateZ(t){return this.translateOnAxis(Mt,t)}localToWorld(t){return t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return t.applyMatrix4(gt.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?vt.copy(t):vt.set(t,e,n);const i=this.parent;this.updateWorldMatrix(!0,!1),yt.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?gt.lookAt(yt,vt,this.up):gt.lookAt(vt,yt,this.up),this.quaternion.setFromRotationMatrix(gt),i&&(gt.extractRotation(i.matrixWorld),mt.setFromRotationMatrix(gt),this.quaternion.premultiply(mt.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(Et)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(St)),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(St)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),gt.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),gt.multiply(t.parent.matrixWorld)),t.applyMatrix4(gt),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(yt,t,bt),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(yt,xt,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){const n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,n=t.length;e<n;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){const e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const i={};function r(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,i=n.length;e<i;e++){const i=n[e];r(t.shapes,i)}else r(t.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,i=this.material.length;n<i;n++)e.push(r(t.materials,this.material[n]));i.material=e}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(let e=0;e<this.children.length;e++)i.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];i.animations.push(r(t.animations,n))}}if(e){const e=a(t.geometries),i=a(t.materials),r=a(t.textures),s=a(t.images),o=a(t.shapes),l=a(t.skeletons),h=a(t.animations);e.length>0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),h.length>0&&(n.animations=h)}return n.object=i,n;function a(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const n=t.children[e];this.add(n.clone())}return this}}At.DefaultUp=new E(0,1,0),At.DefaultMatrixAutoUpdate=!0,At.prototype.isObject3D=!0;const Tt=new E,Ct=new E,Lt=new E,Rt=new E,Pt=new E,Dt=new E,It=new E,zt=new E,Nt=new E,Bt=new E;class kt{constructor(t=new E,e=new E,n=new E){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),Tt.subVectors(t,e),i.cross(Tt);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){Tt.subVectors(i,e),Ct.subVectors(n,e),Lt.subVectors(t,e);const a=Tt.dot(Tt),s=Tt.dot(Ct),o=Tt.dot(Lt),l=Ct.dot(Ct),h=Ct.dot(Lt),c=a*l-s*s;if(0===c)return r.set(-2,-1,-1);const u=1/c,d=(l*o-s*h)*u,p=(a*h-s*o)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,Rt),Rt.x>=0&&Rt.y>=0&&Rt.x+Rt.y<=1}static getUV(t,e,n,i,r,a,s,o){return this.getBarycoord(t,e,n,i,Rt),o.set(0,0),o.addScaledVector(r,Rt.x),o.addScaledVector(a,Rt.y),o.addScaledVector(s,Rt.z),o}static isFrontFacing(t,e,n,i){return Tt.subVectors(n,e),Ct.subVectors(t,e),Tt.cross(Ct).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Tt.subVectors(this.c,this.b),Ct.subVectors(this.a,this.b),.5*Tt.cross(Ct).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return kt.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return kt.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return kt.getUV(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return kt.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return kt.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let a,s;Pt.subVectors(i,n),Dt.subVectors(r,n),zt.subVectors(t,n);const o=Pt.dot(zt),l=Dt.dot(zt);if(o<=0&&l<=0)return e.copy(n);Nt.subVectors(t,i);const h=Pt.dot(Nt),c=Dt.dot(Nt);if(h>=0&&c<=h)return e.copy(i);const u=o*c-h*l;if(u<=0&&o>=0&&h<=0)return a=o/(o-h),e.copy(n).addScaledVector(Pt,a);Bt.subVectors(t,r);const d=Pt.dot(Bt),p=Dt.dot(Bt);if(p>=0&&d<=p)return e.copy(r);const f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),e.copy(n).addScaledVector(Dt,s);const m=h*p-d*c;if(m<=0&&c-h>=0&&d-p>=0)return It.subVectors(r,i),s=(c-h)/(c-h+(d-p)),e.copy(i).addScaledVector(It,s);const g=1/(m+f+u);return a=f*g,s=u*g,e.copy(n).addScaledVector(Pt,a).addScaledVector(Dt,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let Ot=0;class Ft extends i{constructor(){super(),Object.defineProperty(this,"id",{value:Ot++}),this.uuid=o(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.format=1023,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheenTint&&this.sheenTint.isColor&&(n.sheenTint=this.sheenTint.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularTint&&this.specularTint.isColor&&(n.specularTint=this.specularTint.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularTintMap&&this.specularTintMap.isTexture&&(n.specularTintMap=this.specularTintMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationTint&&(n.attenuationTint=this.attenuationTint.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),1023!==this.format&&(n.format=this.format),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.format=t.format,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}Ft.prototype.isMaterial=!0;const Ut={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ht={h:0,s:0,l:0},Vt={h:0,s:0,l:0};function Gt(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function Wt(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function jt(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class qt{constructor(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,n){return this.r=t,this.g=e,this.b=n,this}setHSL(t,e,n){if(t=h(t,1),e=l(e,0,1),n=l(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=Gt(r,i,t+1/3),this.g=Gt(r,i,t),this.b=Gt(r,i,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const i=n[1],r=n[2];switch(i){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){const n=parseFloat(t[1])/360,i=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(n,i,r)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=n[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=Ut[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=Wt(t.r),this.g=Wt(t.g),this.b=Wt(t.b),this}copyLinearToSRGB(t){return this.r=jt(t.r),this.g=jt(t.g),this.b=jt(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){const e=this.r,n=this.g,i=this.b,r=Math.max(e,n,i),a=Math.min(e,n,i);let s,o;const l=(a+r)/2;if(a===r)s=0,o=0;else{const t=r-a;switch(o=l<=.5?t/(r+a):t/(2-r-a),r){case e:s=(n-i)/t+(n<i?6:0);break;case n:s=(i-e)/t+2;break;case i:s=(e-n)/t+4}s/=6}return t.h=s,t.s=o,t.l=l,t}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(t,e,n){return this.getHSL(Ht),Ht.h+=t,Ht.s+=e,Ht.l+=n,this.setHSL(Ht.h,Ht.s,Ht.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(Ht),t.getHSL(Vt);const n=c(Ht.h,Vt.h,e),i=c(Ht.s,Vt.s,e),r=c(Ht.l,Vt.l,e);return this.setHSL(n,i,r),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}qt.NAMES=Ut,qt.prototype.isColor=!0,qt.prototype.r=1,qt.prototype.g=1,qt.prototype.b=1;class Xt extends Ft{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new qt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Xt.prototype.isMeshBasicMaterial=!0;const Yt=new E,Jt=new p;class Zt{constructor(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}copyColorsArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),r=new qt),e[n++]=r.r,e[n++]=r.g,e[n++]=r.b}return this}copyVector2sArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),r=new p),e[n++]=r.x,e[n++]=r.y}return this}copyVector3sArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),r=new E),e[n++]=r.x,e[n++]=r.y,e[n++]=r.z}return this}copyVector4sArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),r=new x),e[n++]=r.x,e[n++]=r.y,e[n++]=r.z,e[n++]=r.w}return this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)Jt.fromBufferAttribute(this,e),Jt.applyMatrix3(t),this.setXY(e,Jt.x,Jt.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)Yt.fromBufferAttribute(this,e),Yt.applyMatrix3(t),this.setXYZ(e,Yt.x,Yt.y,Yt.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)Yt.x=this.getX(e),Yt.y=this.getY(e),Yt.z=this.getZ(e),Yt.applyMatrix4(t),this.setXYZ(e,Yt.x,Yt.y,Yt.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Yt.x=this.getX(e),Yt.y=this.getY(e),Yt.z=this.getZ(e),Yt.applyNormalMatrix(t),this.setXYZ(e,Yt.x,Yt.y,Yt.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Yt.x=this.getX(e),Yt.y=this.getY(e),Yt.z=this.getZ(e),Yt.transformDirection(t),this.setXYZ(e,Yt.x,Yt.y,Yt.z);return this}set(t,e=0){return this.array.set(t,e),this}getX(t){return this.array[t*this.itemSize]}setX(t,e){return this.array[t*this.itemSize]=e,this}getY(t){return this.array[t*this.itemSize+1]}setY(t,e){return this.array[t*this.itemSize+1]=e,this}getZ(t){return this.array[t*this.itemSize+2]}setZ(t,e){return this.array[t*this.itemSize+2]=e,this}getW(t){return this.array[t*this.itemSize+3]}setW(t,e){return this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),35044!==this.usage&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}}Zt.prototype.isBufferAttribute=!0;class $t extends Zt{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class Qt extends Zt{constructor(t,e,n){super(new Uint32Array(t),e,n)}}(class extends Zt{constructor(t,e,n){super(new Uint16Array(t),e,n)}}).prototype.isFloat16BufferAttribute=!0;class Kt extends Zt{constructor(t,e,n){super(new Float32Array(t),e,n)}}function te(t){if(0===t.length)return-1/0;let e=t[0];for(let n=1,i=t.length;n<i;++n)t[n]>e&&(e=t[n]);return e}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let ee=0;const ne=new et,ie=new At,re=new E,ae=new T,se=new T,oe=new E;class le extends i{constructor(){super(),Object.defineProperty(this,"id",{value:ee++}),this.uuid=o(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(te(t)>65535?Qt:$t)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new f).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return ne.makeRotationFromQuaternion(t),this.applyMatrix4(ne),this}rotateX(t){return ne.makeRotationX(t),this.applyMatrix4(ne),this}rotateY(t){return ne.makeRotationY(t),this.applyMatrix4(ne),this}rotateZ(t){return ne.makeRotationZ(t),this.applyMatrix4(ne),this}translate(t,e,n){return ne.makeTranslation(t,e,n),this.applyMatrix4(ne),this}scale(t,e,n){return ne.makeScale(t,e,n),this.applyMatrix4(ne),this}lookAt(t){return ie.lookAt(t),ie.updateMatrix(),this.applyMatrix4(ie.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(re).negate(),this.translate(re.x,re.y,re.z),this}setFromPoints(t){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];e.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new Kt(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new T);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new E(-1/0,-1/0,-1/0),new E(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];ae.setFromBufferAttribute(n),this.morphTargetsRelative?(oe.addVectors(this.boundingBox.min,ae.min),this.boundingBox.expandByPoint(oe),oe.addVectors(this.boundingBox.max,ae.max),this.boundingBox.expandByPoint(oe)):(this.boundingBox.expandByPoint(ae.min),this.boundingBox.expandByPoint(ae.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new q);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new E,1/0);if(t){const n=this.boundingSphere.center;if(ae.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];se.setFromBufferAttribute(n),this.morphTargetsRelative?(oe.addVectors(ae.min,se.min),ae.expandByPoint(oe),oe.addVectors(ae.max,se.max),ae.expandByPoint(oe)):(ae.expandByPoint(se.min),ae.expandByPoint(se.max))}ae.getCenter(n);let i=0;for(let e=0,r=t.count;e<r;e++)oe.fromBufferAttribute(t,e),i=Math.max(i,n.distanceToSquared(oe));if(e)for(let r=0,a=e.length;r<a;r++){const a=e[r],s=this.morphTargetsRelative;for(let e=0,r=a.count;e<r;e++)oe.fromBufferAttribute(a,e),s&&(re.fromBufferAttribute(t,e),oe.add(re)),i=Math.max(i,n.distanceToSquared(oe))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.array,i=e.position.array,r=e.normal.array,a=e.uv.array,s=i.length/3;void 0===e.tangent&&this.setAttribute("tangent",new Zt(new Float32Array(4*s),4));const o=e.tangent.array,l=[],h=[];for(let t=0;t<s;t++)l[t]=new E,h[t]=new E;const c=new E,u=new E,d=new E,f=new p,m=new p,g=new p,v=new E,y=new E;function b(t,e,n){c.fromArray(i,3*t),u.fromArray(i,3*e),d.fromArray(i,3*n),f.fromArray(a,2*t),m.fromArray(a,2*e),g.fromArray(a,2*n),u.sub(c),d.sub(c),m.sub(f),g.sub(f);const r=1/(m.x*g.y-g.x*m.y);isFinite(r)&&(v.copy(u).multiplyScalar(g.y).addScaledVector(d,-m.y).multiplyScalar(r),y.copy(d).multiplyScalar(m.x).addScaledVector(u,-g.x).multiplyScalar(r),l[t].add(v),l[e].add(v),l[n].add(v),h[t].add(y),h[e].add(y),h[n].add(y))}let x=this.groups;0===x.length&&(x=[{start:0,count:n.length}]);for(let t=0,e=x.length;t<e;++t){const e=x[t],i=e.start;for(let t=i,r=i+e.count;t<r;t+=3)b(n[t+0],n[t+1],n[t+2])}const _=new E,w=new E,M=new E,S=new E;function A(t){M.fromArray(r,3*t),S.copy(M);const e=l[t];_.copy(e),_.sub(M.multiplyScalar(M.dot(e))).normalize(),w.crossVectors(S,e);const n=w.dot(h[t])<0?-1:1;o[4*t]=_.x,o[4*t+1]=_.y,o[4*t+2]=_.z,o[4*t+3]=n}for(let t=0,e=x.length;t<e;++t){const e=x[t],i=e.start;for(let t=i,r=i+e.count;t<r;t+=3)A(n[t+0]),A(n[t+1]),A(n[t+2])}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let n=this.getAttribute("normal");if(void 0===n)n=new Zt(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const i=new E,r=new E,a=new E,s=new E,o=new E,l=new E,h=new E,c=new E;if(t)for(let u=0,d=t.count;u<d;u+=3){const d=t.getX(u+0),p=t.getX(u+1),f=t.getX(u+2);i.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),a.fromBufferAttribute(e,f),h.subVectors(a,r),c.subVectors(i,r),h.cross(c),s.fromBufferAttribute(n,d),o.fromBufferAttribute(n,p),l.fromBufferAttribute(n,f),s.add(h),o.add(h),l.add(h),n.setXYZ(d,s.x,s.y,s.z),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let t=0,s=e.count;t<s;t+=3)i.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),a.fromBufferAttribute(e,t+2),h.subVectors(a,r),c.subVectors(i,r),h.cross(c),n.setXYZ(t+0,h.x,h.y,h.z),n.setXYZ(t+1,h.x,h.y,h.z),n.setXYZ(t+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const i in n){if(void 0===t.attributes[i])continue;const r=n[i].array,a=t.attributes[i],s=a.array,o=a.itemSize*e,l=Math.min(s.length,r.length-o);for(let t=0,e=o;t<l;t++,e++)r[e]=s[t]}return this}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)oe.fromBufferAttribute(t,e),oe.normalize(),t.setXYZ(e,oe.x,oe.y,oe.z)}toNonIndexed(){function t(t,e){const n=t.array,i=t.itemSize,r=t.normalized,a=new n.constructor(e.length*i);let s=0,o=0;for(let r=0,l=e.length;r<l;r++){s=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*i;for(let t=0;t<i;t++)a[o++]=n[s++]}return new Zt(a,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new le,n=this.index.array,i=this.attributes;for(const r in i){const a=t(i[r],n);e.setAttribute(r,a)}const r=this.morphAttributes;for(const i in r){const a=[],s=r[i];for(let e=0,i=s.length;e<i;e++){const i=t(s[e],n);a.push(i)}e.morphAttributes[i]=a}e.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let t=0,n=a.length;t<n;t++){const n=a[t];e.addGroup(n.start,n.count,n.materialIndex)}return e}toJSON(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const e in n){const i=n[e];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],a=[];for(let e=0,i=n.length;e<i;e++){const i=n[e];a.push(i.toJSON(t.data))}a.length>0&&(i[e]=a,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const s=this.boundingSphere;return null!==s&&(t.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),t}clone(){return(new le).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const i=t.attributes;for(const t in i){const n=i[t];this.setAttribute(t,n.clone(e))}const r=t.morphAttributes;for(const t in r){const n=[],i=r[t];for(let t=0,r=i.length;t<r;t++)n.push(i[t].clone(e));this.morphAttributes[t]=n}this.morphTargetsRelative=t.morphTargetsRelative;const a=t.groups;for(let t=0,e=a.length;t<e;t++){const e=a[t];this.addGroup(e.start,e.count,e.materialIndex)}const s=t.boundingBox;null!==s&&(this.boundingBox=s.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}le.prototype.isBufferGeometry=!0;const he=new et,ce=new tt,ue=new q,de=new E,pe=new E,fe=new E,me=new E,ge=new E,ve=new E,ye=new E,be=new E,xe=new E,_e=new p,we=new p,Me=new p,Ee=new E,Se=new E;class Ae extends At{constructor(t=new le,e=new Xt){super(),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),ue.copy(n.boundingSphere),ue.applyMatrix4(r),!1===t.ray.intersectsSphere(ue))return;if(he.copy(r).invert(),ce.copy(t.ray).applyMatrix4(he),null!==n.boundingBox&&!1===ce.intersectsBox(n.boundingBox))return;let a;if(n.isBufferGeometry){const r=n.index,s=n.attributes.position,o=n.morphAttributes.position,l=n.morphTargetsRelative,h=n.attributes.uv,c=n.attributes.uv2,u=n.groups,d=n.drawRange;if(null!==r)if(Array.isArray(i))for(let n=0,p=u.length;n<p;n++){const p=u[n],f=i[p.materialIndex];for(let n=Math.max(p.start,d.start),i=Math.min(p.start+p.count,d.start+d.count);n<i;n+=3){const i=r.getX(n),u=r.getX(n+1),d=r.getX(n+2);a=Te(this,f,t,ce,s,o,l,h,c,i,u,d),a&&(a.faceIndex=Math.floor(n/3),a.face.materialIndex=p.materialIndex,e.push(a))}}else{for(let n=Math.max(0,d.start),u=Math.min(r.count,d.start+d.count);n<u;n+=3){const u=r.getX(n),d=r.getX(n+1),p=r.getX(n+2);a=Te(this,i,t,ce,s,o,l,h,c,u,d,p),a&&(a.faceIndex=Math.floor(n/3),e.push(a))}}else if(void 0!==s)if(Array.isArray(i))for(let n=0,r=u.length;n<r;n++){const r=u[n],p=i[r.materialIndex];for(let n=Math.max(r.start,d.start),i=Math.min(r.start+r.count,d.start+d.count);n<i;n+=3){a=Te(this,p,t,ce,s,o,l,h,c,n,n+1,n+2),a&&(a.faceIndex=Math.floor(n/3),a.face.materialIndex=r.materialIndex,e.push(a))}}else{for(let n=Math.max(0,d.start),r=Math.min(s.count,d.start+d.count);n<r;n+=3){a=Te(this,i,t,ce,s,o,l,h,c,n,n+1,n+2),a&&(a.faceIndex=Math.floor(n/3),e.push(a))}}}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}function Te(t,e,n,i,r,a,s,o,l,h,c,u){de.fromBufferAttribute(r,h),pe.fromBufferAttribute(r,c),fe.fromBufferAttribute(r,u);const d=t.morphTargetInfluences;if(a&&d){ye.set(0,0,0),be.set(0,0,0),xe.set(0,0,0);for(let t=0,e=a.length;t<e;t++){const e=d[t],n=a[t];0!==e&&(me.fromBufferAttribute(n,h),ge.fromBufferAttribute(n,c),ve.fromBufferAttribute(n,u),s?(ye.addScaledVector(me,e),be.addScaledVector(ge,e),xe.addScaledVector(ve,e)):(ye.addScaledVector(me.sub(de),e),be.addScaledVector(ge.sub(pe),e),xe.addScaledVector(ve.sub(fe),e)))}de.add(ye),pe.add(be),fe.add(xe)}t.isSkinnedMesh&&(t.boneTransform(h,de),t.boneTransform(c,pe),t.boneTransform(u,fe));const f=function(t,e,n,i,r,a,s,o){let l;if(l=1===e.side?i.intersectTriangle(s,a,r,!0,o):i.intersectTriangle(r,a,s,2!==e.side,o),null===l)return null;Se.copy(o),Se.applyMatrix4(t.matrixWorld);const h=n.ray.origin.distanceTo(Se);return h<n.near||h>n.far?null:{distance:h,point:Se.clone(),object:t}}(t,e,n,i,de,pe,fe,Ee);if(f){o&&(_e.fromBufferAttribute(o,h),we.fromBufferAttribute(o,c),Me.fromBufferAttribute(o,u),f.uv=kt.getUV(Ee,de,pe,fe,_e,we,Me,new p)),l&&(_e.fromBufferAttribute(l,h),we.fromBufferAttribute(l,c),Me.fromBufferAttribute(l,u),f.uv2=kt.getUV(Ee,de,pe,fe,_e,we,Me,new p));const t={a:h,b:c,c:u,normal:new E,materialIndex:0};kt.getNormal(de,pe,fe,t.normal),f.face=t}return f}Ae.prototype.isMesh=!0;class Ce extends le{constructor(t=1,e=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const s=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const o=[],l=[],h=[],c=[];let u=0,d=0;function p(t,e,n,i,r,a,p,f,m,g,v){const y=a/m,b=p/g,x=a/2,_=p/2,w=f/2,M=m+1,S=g+1;let A=0,T=0;const C=new E;for(let a=0;a<S;a++){const s=a*b-_;for(let o=0;o<M;o++){const u=o*y-x;C[t]=u*i,C[e]=s*r,C[n]=w,l.push(C.x,C.y,C.z),C[t]=0,C[e]=0,C[n]=f>0?1:-1,h.push(C.x,C.y,C.z),c.push(o/m),c.push(1-a/g),A+=1}}for(let t=0;t<g;t++)for(let e=0;e<m;e++){const n=u+e+M*t,i=u+e+M*(t+1),r=u+(e+1)+M*(t+1),a=u+(e+1)+M*t;o.push(n,i,a),o.push(i,r,a),T+=6}s.addGroup(d,T,v),d+=T,u+=A}p("z","y","x",-1,-1,n,e,t,a,r,0),p("z","y","x",1,-1,n,e,-t,a,r,1),p("x","z","y",1,1,t,n,e,i,a,2),p("x","z","y",1,-1,t,n,-e,i,a,3),p("x","y","z",1,-1,t,e,n,i,r,4),p("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(o),this.setAttribute("position",new Kt(l,3)),this.setAttribute("normal",new Kt(h,3)),this.setAttribute("uv",new Kt(c,2))}static fromJSON(t){return new Ce(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Le(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function Re(t){const e={};for(let n=0;n<t.length;n++){const i=Le(t[n]);for(const t in i)e[t]=i[t]}return e}const Pe={clone:Le,merge:Re};class De extends Ft{constructor(t){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Le(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?e.uniforms[n]={type:"t",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?e.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?e.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?e.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[n]={type:"m4",value:i.toArray()}:e.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}De.prototype.isShaderMaterial=!0;class Ie extends At{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new et,this.projectionMatrix=new et,this.projectionMatrixInverse=new et}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}Ie.prototype.isCamera=!0;class ze extends Ie{constructor(t=50,e=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*s*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*a*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*s*Math.atan(Math.tan(.5*a*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,n,i,r,a){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*a*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,a=s.fullHeight;r+=s.offsetX*i/t,e-=s.offsetY*n/a,i*=s.width/t,n*=s.height/a}const o=this.filmOffset;0!==o&&(r+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}ze.prototype.isPerspectiveCamera=!0;class Ne extends At{constructor(t,e,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const i=new ze(90,1,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new E(1,0,0)),this.add(i);const r=new ze(90,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new E(-1,0,0)),this.add(r);const a=new ze(90,1,t,e);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new E(0,1,0)),this.add(a);const s=new ze(90,1,t,e);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new E(0,-1,0)),this.add(s);const o=new ze(90,1,t,e);o.layers=this.layers,o.up.set(0,-1,0),o.lookAt(new E(0,0,1)),this.add(o);const l=new ze(90,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new E(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,a,s,o,l]=this.children,h=t.xr.enabled,c=t.getRenderTarget();t.xr.enabled=!1;const u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,r),t.setRenderTarget(n,2),t.render(e,a),t.setRenderTarget(n,3),t.render(e,s),t.setRenderTarget(n,4),t.render(e,o),n.texture.generateMipmaps=u,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(c),t.xr.enabled=h}}class Be extends y{constructor(t,e,n,i,r,a,s,o,l,h){super(t=void 0!==t?t:[],e=void 0!==e?e:301,n,i,r,a,s=void 0!==s?s:1022,o,l,h),this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}Be.prototype.isCubeTexture=!0;class ke extends _{constructor(t,e,n){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=n),super(t,t,e),e=e||{},this.texture=new Be(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:1006,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=1023,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new Ce(5,5,5),r=new De({name:"CubemapFromEquirect",uniforms:Le(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const a=new Ae(i,r),s=e.minFilter;1008===e.minFilter&&(e.minFilter=1006);return new Ne(1,10,this).update(t,a),e.minFilter=s,a.geometry.dispose(),a.material.dispose(),this}clear(t,e,n,i){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,n,i);t.setRenderTarget(r)}}ke.prototype.isWebGLCubeRenderTarget=!0;const Oe=new E,Fe=new E,Ue=new f;class He{constructor(t=new E(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=Oe.subVectors(n,e).cross(Fe.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){const n=t.delta(Oe),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(n).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Ue.getNormalMatrix(t),i=this.coplanarPoint(Oe).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}He.prototype.isPlane=!0;const Ve=new q,Ge=new E;class We{constructor(t=new He,e=new He,n=new He,i=new He,r=new He,a=new He){this.planes=[t,e,n,i,r,a]}set(t,e,n,i,r,a){const s=this.planes;return s[0].copy(t),s[1].copy(e),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(a),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,i=n[0],r=n[1],a=n[2],s=n[3],o=n[4],l=n[5],h=n[6],c=n[7],u=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return e[0].setComponents(s-i,c-o,f-u,y-m).normalize(),e[1].setComponents(s+i,c+o,f+u,y+m).normalize(),e[2].setComponents(s+r,c+l,f+d,y+g).normalize(),e[3].setComponents(s-r,c-l,f-d,y-g).normalize(),e[4].setComponents(s-a,c-h,f-p,y-v).normalize(),e[5].setComponents(s+a,c+h,f+p,y+v).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ve.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Ve)}intersectsSprite(t){return Ve.center.set(0,0,0),Ve.radius=.7071067811865476,Ve.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ve)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(n)<i)return!1}return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const i=e[n];if(Ge.x=i.normal.x>0?t.max.x:t.min.x,Ge.y=i.normal.y>0?t.max.y:t.min.y,Ge.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Ge)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function je(){let t=null,e=!1,n=null,i=null;function r(e,a){n(e,a),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function qe(t,e){const n=e.isWebGL2,i=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=i.get(e);n&&(t.deleteBuffer(n.buffer),i.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=i.get(e);return void((!t||t.version<e.version)&&i.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const a=i.get(e);void 0===a?i.set(e,function(e,i){const r=e.array,a=e.usage,s=t.createBuffer();t.bindBuffer(i,s),t.bufferData(i,r,a),e.onUploadCallback();let o=5126;return r instanceof Float32Array?o=5126:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?e.isFloat16BufferAttribute?n?o=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):o=5123:r instanceof Int16Array?o=5122:r instanceof Uint32Array?o=5125:r instanceof Int32Array?o=5124:r instanceof Int8Array?o=5120:(r instanceof Uint8Array||r instanceof Uint8ClampedArray)&&(o=5121),{buffer:s,type:o,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}(e,r)):a.version<e.version&&(!function(e,i,r){const a=i.array,s=i.updateRange;t.bindBuffer(r,e),-1===s.count?t.bufferSubData(r,0,a):(n?t.bufferSubData(r,s.offset*a.BYTES_PER_ELEMENT,a,s.offset,s.count):t.bufferSubData(r,s.offset*a.BYTES_PER_ELEMENT,a.subarray(s.offset,s.offset+s.count)),s.count=-1)}(a.buffer,e,r),a.version=e.version)}}}class Xe extends le{constructor(t=1,e=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};const r=t/2,a=e/2,s=Math.floor(n),o=Math.floor(i),l=s+1,h=o+1,c=t/s,u=e/o,d=[],p=[],f=[],m=[];for(let t=0;t<h;t++){const e=t*u-a;for(let n=0;n<l;n++){const i=n*c-r;p.push(i,-e,0),f.push(0,0,1),m.push(n/s),m.push(1-t/o)}}for(let t=0;t<o;t++)for(let e=0;e<s;e++){const n=e+l*t,i=e+l*(t+1),r=e+1+l*(t+1),a=e+1+l*t;d.push(n,i,a),d.push(i,r,a)}this.setIndex(d),this.setAttribute("position",new Kt(p,3)),this.setAttribute("normal",new Kt(f,3)),this.setAttribute("uv",new Kt(m,2))}static fromJSON(t){return new Xe(t.width,t.height,t.widthSegments,t.heightSegments)}}const Ye={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotVH = saturate( dot( geometry.viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float NoH ) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float NoV, float NoL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( NoL + NoV - NoL * NoV ) ) );\n}\nvec3 BRDF_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getIBLIrradiance( const in GeometricContext geometry ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec;\n\t\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\t\treflectVec = reflect( - viewDir, normal );\n\t\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\t#else\n\t\t\t\treflectVec = refract( - viewDir, normal, refractionRatio );\n\t\t\t#endif\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tlightMapIrradiance *= PI;\n\t#endif\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularTintFactor = specularTint;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARTINTMAP\n\t\t\tspecularTintFactor *= specularTintMapTexelToLinear( texture2D( specularTintMap, vUv ) ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularTintFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularTintFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenTint = sheenTint;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenTint;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += irradiance * BRDF_Sheen( material.roughness, directLight.direction, geometry, material.sheenTint );\n\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationTint, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = transmission.a;\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationTint;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( float roughness, float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( vec2 fragCoord, float roughness, float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 diffuseColor, vec3 specularColor, float specularF90,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularTint;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARTINTMAP\n\t\tuniform sampler2D specularTintMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenTint;\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - clearcoat * Fcc ) + clearcoatSpecular * clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"},Je={common:{diffuse:{value:new qt(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new f},uv2Transform:{value:new f},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new p(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new qt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new qt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new f}},sprite:{diffuse:{value:new qt(16777215)},opacity:{value:1},center:{value:new p(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new f}}},Ze={basic:{uniforms:Re([Je.common,Je.specularmap,Je.envmap,Je.aomap,Je.lightmap,Je.fog]),vertexShader:Ye.meshbasic_vert,fragmentShader:Ye.meshbasic_frag},lambert:{uniforms:Re([Je.common,Je.specularmap,Je.envmap,Je.aomap,Je.lightmap,Je.emissivemap,Je.fog,Je.lights,{emissive:{value:new qt(0)}}]),vertexShader:Ye.meshlambert_vert,fragmentShader:Ye.meshlambert_frag},phong:{uniforms:Re([Je.common,Je.specularmap,Je.envmap,Je.aomap,Je.lightmap,Je.emissivemap,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.fog,Je.lights,{emissive:{value:new qt(0)},specular:{value:new qt(1118481)},shininess:{value:30}}]),vertexShader:Ye.meshphong_vert,fragmentShader:Ye.meshphong_frag},standard:{uniforms:Re([Je.common,Je.envmap,Je.aomap,Je.lightmap,Je.emissivemap,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.roughnessmap,Je.metalnessmap,Je.fog,Je.lights,{emissive:{value:new qt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ye.meshphysical_vert,fragmentShader:Ye.meshphysical_frag},toon:{uniforms:Re([Je.common,Je.aomap,Je.lightmap,Je.emissivemap,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.gradientmap,Je.fog,Je.lights,{emissive:{value:new qt(0)}}]),vertexShader:Ye.meshtoon_vert,fragmentShader:Ye.meshtoon_frag},matcap:{uniforms:Re([Je.common,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.fog,{matcap:{value:null}}]),vertexShader:Ye.meshmatcap_vert,fragmentShader:Ye.meshmatcap_frag},points:{uniforms:Re([Je.points,Je.fog]),vertexShader:Ye.points_vert,fragmentShader:Ye.points_frag},dashed:{uniforms:Re([Je.common,Je.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ye.linedashed_vert,fragmentShader:Ye.linedashed_frag},depth:{uniforms:Re([Je.common,Je.displacementmap]),vertexShader:Ye.depth_vert,fragmentShader:Ye.depth_frag},normal:{uniforms:Re([Je.common,Je.bumpmap,Je.normalmap,Je.displacementmap,{opacity:{value:1}}]),vertexShader:Ye.meshnormal_vert,fragmentShader:Ye.meshnormal_frag},sprite:{uniforms:Re([Je.sprite,Je.fog]),vertexShader:Ye.sprite_vert,fragmentShader:Ye.sprite_frag},background:{uniforms:{uvTransform:{value:new f},t2D:{value:null}},vertexShader:Ye.background_vert,fragmentShader:Ye.background_frag},cube:{uniforms:Re([Je.envmap,{opacity:{value:1}}]),vertexShader:Ye.cube_vert,fragmentShader:Ye.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ye.equirect_vert,fragmentShader:Ye.equirect_frag},distanceRGBA:{uniforms:Re([Je.common,Je.displacementmap,{referencePosition:{value:new E},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ye.distanceRGBA_vert,fragmentShader:Ye.distanceRGBA_frag},shadow:{uniforms:Re([Je.lights,Je.fog,{color:{value:new qt(0)},opacity:{value:1}}]),vertexShader:Ye.shadow_vert,fragmentShader:Ye.shadow_frag}};function $e(t,e,n,i,r){const a=new qt(0);let s,o,l=0,h=null,c=0,u=null;function d(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,r)}return{getClearColor:function(){return a},setClearColor:function(t,e=1){a.set(t),l=e,d(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(t){l=t,d(a,l)},render:function(n,r){let p=!1,f=!0===r.isScene?r.background:null;f&&f.isTexture&&(f=e.get(f));const m=t.xr,g=m.getSession&&m.getSession();g&&"additive"===g.environmentBlendMode&&(f=null),null===f?d(a,l):f&&f.isColor&&(d(f,1),p=!0),(t.autoClear||p)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),f&&(f.isCubeTexture||306===f.mapping)?(void 0===o&&(o=new Ae(new Ce(1,1,1),new De({name:"BackgroundCubeMaterial",uniforms:Le(Ze.cube.uniforms),vertexShader:Ze.cube.vertexShader,fragmentShader:Ze.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(o.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(o)),o.material.uniforms.envMap.value=f,o.material.uniforms.flipEnvMap.value=f.isCubeTexture&&!1===f.isRenderTargetTexture?-1:1,h===f&&c===f.version&&u===t.toneMapping||(o.material.needsUpdate=!0,h=f,c=f.version,u=t.toneMapping),n.unshift(o,o.geometry,o.material,0,0,null)):f&&f.isTexture&&(void 0===s&&(s=new Ae(new Xe(2,2),new De({name:"BackgroundMaterial",uniforms:Le(Ze.background.uniforms),vertexShader:Ze.background.vertexShader,fragmentShader:Ze.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(s)),s.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),s.material.uniforms.uvTransform.value.copy(f.matrix),h===f&&c===f.version&&u===t.toneMapping||(s.material.needsUpdate=!0,h=f,c=f.version,u=t.toneMapping),n.unshift(s,s.geometry,s.material,0,0,null))}}}function Qe(t,e,n,i){const r=t.getParameter(34921),a=i.isWebGL2?null:e.get("OES_vertex_array_object"),s=i.isWebGL2||null!==a,o={},l=d(null);let h=l;function c(e){return i.isWebGL2?t.bindVertexArray(e):a.bindVertexArrayOES(e)}function u(e){return i.isWebGL2?t.deleteVertexArray(e):a.deleteVertexArrayOES(e)}function d(t){const e=[],n=[],i=[];for(let t=0;t<r;t++)e[t]=0,n[t]=0,i[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:i,object:t,attributes:{},index:null}}function p(){const t=h.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function f(t){m(t,0)}function m(n,r){const a=h.newAttributes,s=h.enabledAttributes,o=h.attributeDivisors;if(a[n]=1,0===s[n]&&(t.enableVertexAttribArray(n),s[n]=1),o[n]!==r){(i.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,r),o[n]=r}}function g(){const e=h.newAttributes,n=h.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==e[i]&&(t.disableVertexAttribArray(i),n[i]=0)}function v(e,n,r,a,s,o){!0!==i.isWebGL2||5124!==r&&5125!==r?t.vertexAttribPointer(e,n,r,a,s,o):t.vertexAttribIPointer(e,n,r,s,o)}function y(){b(),h!==l&&(h=l,c(h.object))}function b(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,u,y,b){let x=!1;if(s){const e=function(e,n,r){const s=!0===r.wireframe;let l=o[e.id];void 0===l&&(l={},o[e.id]=l);let h=l[n.id];void 0===h&&(h={},l[n.id]=h);let c=h[s];void 0===c&&(c=d(i.isWebGL2?t.createVertexArray():a.createVertexArrayOES()),h[s]=c);return c}(y,u,l);h!==e&&(h=e,c(h.object)),x=function(t,e){const n=h.attributes,i=t.attributes;let r=0;for(const t in i){const e=n[t],a=i[t];if(void 0===e)return!0;if(e.attribute!==a)return!0;if(e.data!==a.data)return!0;r++}return h.attributesNum!==r||h.index!==e}(y,b),x&&function(t,e){const n={},i=t.attributes;let r=0;for(const t in i){const e=i[t],a={};a.attribute=e,e.data&&(a.data=e.data),n[t]=a,r++}h.attributes=n,h.attributesNum=r,h.index=e}(y,b)}else{const t=!0===l.wireframe;h.geometry===y.id&&h.program===u.id&&h.wireframe===t||(h.geometry=y.id,h.program=u.id,h.wireframe=t,x=!0)}!0===r.isInstancedMesh&&(x=!0),null!==b&&n.update(b,34963),x&&(!function(r,a,s,o){if(!1===i.isWebGL2&&(r.isInstancedMesh||o.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;p();const l=o.attributes,h=s.getAttributes(),c=a.defaultAttributeValues;for(const e in h){const i=h[e];if(i.location>=0){let a=l[e];if(void 0===a&&("instanceMatrix"===e&&r.instanceMatrix&&(a=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(a=r.instanceColor)),void 0!==a){const e=a.normalized,s=a.itemSize,l=n.get(a);if(void 0===l)continue;const h=l.buffer,c=l.type,u=l.bytesPerElement;if(a.isInterleavedBufferAttribute){const n=a.data,l=n.stride,d=a.offset;if(n&&n.isInstancedInterleavedBuffer){for(let t=0;t<i.locationSize;t++)m(i.location+t,n.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=n.meshPerAttribute*n.count)}else for(let t=0;t<i.locationSize;t++)f(i.location+t);t.bindBuffer(34962,h);for(let t=0;t<i.locationSize;t++)v(i.location+t,s/i.locationSize,c,e,l*u,(d+s/i.locationSize*t)*u)}else{if(a.isInstancedBufferAttribute){for(let t=0;t<i.locationSize;t++)m(i.location+t,a.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=a.meshPerAttribute*a.count)}else for(let t=0;t<i.locationSize;t++)f(i.location+t);t.bindBuffer(34962,h);for(let t=0;t<i.locationSize;t++)v(i.location+t,s/i.locationSize,c,e,s*u,s/i.locationSize*t*u)}}else if(void 0!==c){const n=c[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(i.location,n);break;case 3:t.vertexAttrib3fv(i.location,n);break;case 4:t.vertexAttrib4fv(i.location,n);break;default:t.vertexAttrib1fv(i.location,n)}}}}g()}(r,l,u,y),null!==b&&t.bindBuffer(34963,n.get(b).buffer))},reset:y,resetDefaultState:b,dispose:function(){y();for(const t in o){const e=o[t];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete o[t]}},releaseStatesOfGeometry:function(t){if(void 0===o[t.id])return;const e=o[t.id];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete o[t.id]},releaseStatesOfProgram:function(t){for(const e in o){const n=o[e];if(void 0===n[t.id])continue;const i=n[t.id];for(const t in i)u(i[t].object),delete i[t];delete n[t.id]}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:g}}function Ke(t,e,n,i){const r=i.isWebGL2;let a;this.setMode=function(t){a=t},this.render=function(e,i){t.drawArrays(a,e,i),n.update(i,a,1)},this.renderInstances=function(i,s,o){if(0===o)return;let l,h;if(r)l=t,h="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),h="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[h](a,i,s,o),n.update(s,a,o)}}function tn(t,e,n){let i;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const a="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let s=void 0!==n.precision?n.precision:"highp";const o=r(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);const l=a||e.has("WEBGL_draw_buffers"),h=!0===n.logarithmicDepthBuffer,c=t.getParameter(34930),u=t.getParameter(35660),d=t.getParameter(3379),p=t.getParameter(34076),f=t.getParameter(34921),m=t.getParameter(36347),g=t.getParameter(36348),v=t.getParameter(36349),y=u>0,b=a||e.has("OES_texture_float");return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:s,logarithmicDepthBuffer:h,maxTextures:c,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:m,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:b,floatVertexTextures:y&&b,maxSamples:a?t.getParameter(36183):0}}function en(t){const e=this;let n=null,i=0,r=!1,a=!1;const s=new He,o=new f,l={value:null,needsUpdate:!1};function h(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function c(t,n,i,r){const a=null!==t?t.length:0;let h=null;if(0!==a){if(h=l.value,!0!==r||null===h){const e=i+4*a,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===h||h.length<e)&&(h=new Float32Array(e));for(let e=0,n=i;e!==a;++e,n+=4)s.copy(t[e]).applyMatrix4(r,o),s.normal.toArray(h,n),h[n+3]=s.constant}l.value=h,l.needsUpdate=!0}return e.numPlanes=a,e.numIntersection=0,h}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,a){const s=0!==t.length||e||0!==i||r;return r=e,n=c(t,a,0),i=t.length,s},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1,h()},this.setState=function(e,s,o){const u=e.clippingPlanes,d=e.clipIntersection,p=e.clipShadows,f=t.get(e);if(!r||null===u||0===u.length||a&&!p)a?c(null):h();else{const t=a?0:i,e=4*t;let r=f.clippingState||null;l.value=r,r=c(u,s,e,o);for(let t=0;t!==e;++t)r[t]=n[t];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function nn(t){let e=new WeakMap;function n(t,e){return 303===e?t.mapping=301:304===e&&(t.mapping=302),t}function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){const a=r.mapping;if(303===a||304===a){if(e.has(r)){return n(e.get(r).texture,r.mapping)}{const a=r.image;if(a&&a.height>0){const s=t.getRenderTarget(),o=new ke(a.height/2);return o.fromEquirectangularTexture(t,r),e.set(r,o),t.setRenderTarget(s),r.addEventListener("dispose",i),n(o.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}Ze.physical={uniforms:Re([Ze.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new p(1,1)},clearcoatNormalMap:{value:null},sheenTint:{value:new qt(0)},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new p},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationTint:{value:new qt(0)},specularIntensity:{value:0},specularIntensityMap:{value:null},specularTint:{value:new qt(1,1,1)},specularTintMap:{value:null}}]),vertexShader:Ye.meshphysical_vert,fragmentShader:Ye.meshphysical_frag};class rn extends Ie{constructor(t=-1,e=1,n=1,i=-1,r=.1,a=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,a=n+t,s=i+e,o=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,a=r+t*this.view.width,s-=e*this.view.offsetY,o=s-e*this.view.height}this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}rn.prototype.isOrthographicCamera=!0;class an extends De{constructor(t){super(t),this.type="RawShaderMaterial"}}an.prototype.isRawShaderMaterial=!0;const sn=Math.pow(2,8),on=[.125,.215,.35,.446,.526,.582],ln=5+on.length,hn={3e3:0,3001:1,3002:2,3004:3,3005:4,3006:5,3007:6},cn=new rn,{_lodPlanes:un,_sizeLods:dn,_sigmas:pn}=_n(),fn=new qt;let mn=null;const gn=(1+Math.sqrt(5))/2,vn=1/gn,yn=[new E(1,1,1),new E(-1,1,1),new E(1,1,-1),new E(-1,1,-1),new E(0,gn,vn),new E(0,gn,-vn),new E(vn,0,gn),new E(-vn,0,gn),new E(gn,vn,0),new E(-gn,vn,0)];class bn{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=function(t){const e=new Float32Array(t),n=new E(0,1,0);return new an({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:hn[3e3]},outputEncoding:{value:hn[3e3]}},vertexShader:An(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t${Tn()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1})}(20),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){mn=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Sn(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=En(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t<un.length;t++)un[t].dispose()}_cleanup(t){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(mn),t.scissorTest=!1,Mn(t,0,0,t.width,t.height)}_fromTexture(t){mn=this._renderer.getRenderTarget();const e=this._allocateTargets(t);return this._textureToCubeUV(t,e),this._applyPMREM(e),this._cleanup(e),e}_allocateTargets(t){const e={magFilter:1003,minFilter:1003,generateMipmaps:!1,type:1009,format:1023,encoding:xn(t)?t.encoding:3002,depthBuffer:!1},n=wn(e);return n.depthBuffer=!t,this._pingPongRenderTarget=wn(e),n}_compileMaterial(t){const e=new Ae(un[0],t);this._renderer.compile(e,cn)}_sceneToCubeUV(t,e,n,i){const r=new ze(90,1,e,n),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,h=o.outputEncoding,c=o.toneMapping;o.getClearColor(fn),o.toneMapping=0,o.outputEncoding=3e3,o.autoClear=!1;const u=new Xt({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),d=new Ae(new Ce,u);let p=!1;const f=t.background;f?f.isColor&&(u.color.copy(f),t.background=null,p=!0):(u.color.copy(fn),p=!0);for(let e=0;e<6;e++){const n=e%3;0==n?(r.up.set(0,a[e],0),r.lookAt(s[e],0,0)):1==n?(r.up.set(0,0,a[e]),r.lookAt(0,s[e],0)):(r.up.set(0,a[e],0),r.lookAt(0,0,s[e])),Mn(i,n*sn,e>2?sn:0,sn,sn),o.setRenderTarget(i),p&&o.render(d,r),o.render(t,r)}d.geometry.dispose(),d.material.dispose(),o.toneMapping=c,o.outputEncoding=h,o.autoClear=l,t.background=f}_textureToCubeUV(t,e){const n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Sn()):null==this._equirectShader&&(this._equirectShader=En());const i=t.isCubeTexture?this._cubemapShader:this._equirectShader,r=new Ae(un[0],i),a=i.uniforms;a.envMap.value=t,t.isCubeTexture||a.texelSize.value.set(1/t.image.width,1/t.image.height),a.inputEncoding.value=hn[t.encoding],a.outputEncoding.value=hn[e.texture.encoding],Mn(e,0,0,3*sn,2*sn),n.setRenderTarget(e),n.render(r,cn)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let e=1;e<ln;e++){const n=Math.sqrt(pn[e]*pn[e]-pn[e-1]*pn[e-1]),i=yn[(e-1)%yn.length];this._blur(t,e-1,e,n,i)}e.autoClear=n}_blur(t,e,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(t,a,e,n,i,"latitudinal",r),this._halfBlur(a,t,n,n,i,"longitudinal",r)}_halfBlur(t,e,n,i,r,a,s){const o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");const h=new Ae(un[i],l),c=l.uniforms,u=dn[n]-1,d=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):20;f>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let t=0;t<20;++t){const e=t/p,n=Math.exp(-e*e/2);m.push(n),0==t?g+=n:t<f&&(g+=2*n)}for(let t=0;t<m.length;t++)m[t]=m[t]/g;c.envMap.value=t.texture,c.samples.value=f,c.weights.value=m,c.latitudinal.value="latitudinal"===a,s&&(c.poleAxis.value=s),c.dTheta.value=d,c.mipInt.value=8-n,c.inputEncoding.value=hn[t.texture.encoding],c.outputEncoding.value=hn[t.texture.encoding];const v=dn[i];Mn(e,3*Math.max(0,sn-2*v),(0===i?0:2*sn)+2*v*(i>4?i-8+4:0),3*v,2*v),o.setRenderTarget(e),o.render(h,cn)}}function xn(t){return void 0!==t&&1009===t.type&&(3e3===t.encoding||3001===t.encoding||3007===t.encoding)}function _n(){const t=[],e=[],n=[];let i=8;for(let r=0;r<ln;r++){const a=Math.pow(2,i);e.push(a);let s=1/a;r>4?s=on[r-8+4-1]:0==r&&(s=0),n.push(s);const o=1/(a-1),l=-o/2,h=1+o/2,c=[l,l,h,l,h,h,l,l,h,h,l,h],u=6,d=6,p=3,f=2,m=1,g=new Float32Array(p*d*u),v=new Float32Array(f*d*u),y=new Float32Array(m*d*u);for(let t=0;t<u;t++){const e=t%3*2/3-1,n=t>2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];g.set(i,p*d*t),v.set(c,f*d*t);const r=[t,t,t,t,t,t];y.set(r,m*d*t)}const b=new le;b.setAttribute("position",new Zt(g,p)),b.setAttribute("uv",new Zt(v,f)),b.setAttribute("faceIndex",new Zt(y,m)),t.push(b),i>4&&i--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function wn(t){const e=new _(3*sn,3*sn,t);return e.texture.mapping=306,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Mn(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function En(){const t=new p(1,1);return new an({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:hn[3e3]},outputEncoding:{value:hn[3e3]}},vertexShader:An(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t${Tn()}\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1})}function Sn(){return new an({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:hn[3e3]},outputEncoding:{value:hn[3e3]}},vertexShader:An(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t${Tn()}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1})}function An(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Tn(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}function Cn(t){let e=new WeakMap,n=null;function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){const a=r.mapping,s=303===a||304===a,o=301===a||302===a;if(s||o){if(e.has(r))return e.get(r).texture;{const a=r.image;if(s&&a&&a.height>0||o&&a&&function(t){let e=0;for(let n=0;n<6;n++)void 0!==t[n]&&e++;return 6===e}(a)){const a=t.getRenderTarget();null===n&&(n=new bn(t));const o=s?n.fromEquirectangular(r):n.fromCubemap(r);return e.set(r,o),t.setRenderTarget(a),r.addEventListener("dispose",i),o.texture}return null}}}return r},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function Ln(t){const e={};function n(n){if(void 0!==e[n])return e[n];let i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function Rn(t,e,n,i){const r={},a=new WeakMap;function s(t){const o=t.target;null!==o.index&&e.remove(o.index);for(const t in o.attributes)e.remove(o.attributes[t]);o.removeEventListener("dispose",s),delete r[o.id];const l=a.get(o);l&&(e.remove(l),a.delete(o)),i.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(t){const n=[],i=t.index,r=t.attributes.position;let s=0;if(null!==i){const t=i.array;s=i.version;for(let e=0,i=t.length;e<i;e+=3){const i=t[e+0],r=t[e+1],a=t[e+2];n.push(i,r,r,a,a,i)}}else{const t=r.array;s=r.version;for(let e=0,i=t.length/3-1;e<i;e+=3){const t=e+0,i=e+1,r=e+2;n.push(t,i,i,r,r,t)}}const o=new(te(n)>65535?Qt:$t)(n,1);o.version=s;const l=a.get(t);l&&e.remove(l),a.set(t,o)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",s),r[e.id]=!0,n.memory.geometries++),e},update:function(t){const n=t.attributes;for(const t in n)e.update(n[t],34962);const i=t.morphAttributes;for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t++)e.update(n[t],34962)}},getWireframeAttribute:function(t){const e=a.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&o(t)}else o(t);return a.get(t)}}}function Pn(t,e,n,i){const r=i.isWebGL2;let a,s,o;this.setMode=function(t){a=t},this.setIndex=function(t){s=t.type,o=t.bytesPerElement},this.render=function(e,i){t.drawElements(a,i,s,e*o),n.update(i,a,1)},this.renderInstances=function(i,l,h){if(0===h)return;let c,u;if(r)c=t,u="drawElementsInstanced";else if(c=e.get("ANGLE_instanced_arrays"),u="drawElementsInstancedANGLE",null===c)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[u](a,l,s,i*o,h),n.update(l,a,h)}}function Dn(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,n,i){switch(e.calls++,n){case 4:e.triangles+=i*(t/3);break;case 1:e.lines+=i*(t/2);break;case 3:e.lines+=i*(t-1);break;case 2:e.lines+=i*t;break;case 0:e.points+=i*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function In(t,e){return t[0]-e[0]}function zn(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Nn(t){const e={},n=new Float32Array(8),i=[];for(let t=0;t<8;t++)i[t]=[t,0];return{update:function(r,a,s,o){const l=r.morphTargetInfluences,h=void 0===l?0:l.length;let c=e[a.id];if(void 0===c||c.length!==h){c=[];for(let t=0;t<h;t++)c[t]=[t,0];e[a.id]=c}for(let t=0;t<h;t++){const e=c[t];e[0]=t,e[1]=l[t]}c.sort(zn);for(let t=0;t<8;t++)t<h&&c[t][1]?(i[t][0]=c[t][0],i[t][1]=c[t][1]):(i[t][0]=Number.MAX_SAFE_INTEGER,i[t][1]=0);i.sort(In);const u=a.morphAttributes.position,d=a.morphAttributes.normal;let p=0;for(let t=0;t<8;t++){const e=i[t],r=e[0],s=e[1];r!==Number.MAX_SAFE_INTEGER&&s?(u&&a.getAttribute("morphTarget"+t)!==u[r]&&a.setAttribute("morphTarget"+t,u[r]),d&&a.getAttribute("morphNormal"+t)!==d[r]&&a.setAttribute("morphNormal"+t,d[r]),n[t]=s,p+=s):(u&&!0===a.hasAttribute("morphTarget"+t)&&a.deleteAttribute("morphTarget"+t),d&&!0===a.hasAttribute("morphNormal"+t)&&a.deleteAttribute("morphNormal"+t),n[t]=0)}const f=a.morphTargetsRelative?1:1-p;o.getUniforms().setValue(t,"morphTargetBaseInfluence",f),o.getUniforms().setValue(t,"morphTargetInfluences",n)}}}function Bn(t,e,n,i){let r=new WeakMap;function a(t){const e=t.target;e.removeEventListener("dispose",a),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(t){const s=i.render.frame,o=t.geometry,l=e.get(t,o);return r.get(l)!==s&&(e.update(l),r.set(l,s)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",a)&&t.addEventListener("dispose",a),n.update(t.instanceMatrix,34962),null!==t.instanceColor&&n.update(t.instanceColor,34962)),l},dispose:function(){r=new WeakMap}}}class kn extends y{constructor(t=null,e=1,n=1,i=1){super(null),this.image={data:t,width:e,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}kn.prototype.isDataTexture2DArray=!0;class On extends y{constructor(t=null,e=1,n=1,i=1){super(null),this.image={data:t,width:e,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}On.prototype.isDataTexture3D=!0;const Fn=new y,Un=new kn,Hn=new On,Vn=new Be,Gn=[],Wn=[],jn=new Float32Array(16),qn=new Float32Array(9),Xn=new Float32Array(4);function Yn(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let a=Gn[r];if(void 0===a&&(a=new Float32Array(r),Gn[r]=a),0!==e){i.toArray(a,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(a,r)}return a}function Jn(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function Zn(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function $n(t,e){let n=Wn[e];void 0===n&&(n=new Int32Array(e),Wn[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function Qn(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Kn(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Jn(n,e))return;t.uniform2fv(this.addr,e),Zn(n,e)}}function ti(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(Jn(n,e))return;t.uniform3fv(this.addr,e),Zn(n,e)}}function ei(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Jn(n,e))return;t.uniform4fv(this.addr,e),Zn(n,e)}}function ni(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(Jn(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Zn(n,e)}else{if(Jn(n,i))return;Xn.set(i),t.uniformMatrix2fv(this.addr,!1,Xn),Zn(n,i)}}function ii(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(Jn(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Zn(n,e)}else{if(Jn(n,i))return;qn.set(i),t.uniformMatrix3fv(this.addr,!1,qn),Zn(n,i)}}function ri(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(Jn(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Zn(n,e)}else{if(Jn(n,i))return;jn.set(i),t.uniformMatrix4fv(this.addr,!1,jn),Zn(n,i)}}function ai(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function si(t,e){const n=this.cache;Jn(n,e)||(t.uniform2iv(this.addr,e),Zn(n,e))}function oi(t,e){const n=this.cache;Jn(n,e)||(t.uniform3iv(this.addr,e),Zn(n,e))}function li(t,e){const n=this.cache;Jn(n,e)||(t.uniform4iv(this.addr,e),Zn(n,e))}function hi(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function ci(t,e){const n=this.cache;Jn(n,e)||(t.uniform2uiv(this.addr,e),Zn(n,e))}function ui(t,e){const n=this.cache;Jn(n,e)||(t.uniform3uiv(this.addr,e),Zn(n,e))}function di(t,e){const n=this.cache;Jn(n,e)||(t.uniform4uiv(this.addr,e),Zn(n,e))}function pi(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.safeSetTexture2D(e||Fn,r)}function fi(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||Hn,r)}function mi(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.safeSetTextureCube(e||Vn,r)}function gi(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||Un,r)}function vi(t,e){t.uniform1fv(this.addr,e)}function yi(t,e){const n=Yn(e,this.size,2);t.uniform2fv(this.addr,n)}function bi(t,e){const n=Yn(e,this.size,3);t.uniform3fv(this.addr,n)}function xi(t,e){const n=Yn(e,this.size,4);t.uniform4fv(this.addr,n)}function _i(t,e){const n=Yn(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function wi(t,e){const n=Yn(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Mi(t,e){const n=Yn(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Ei(t,e){t.uniform1iv(this.addr,e)}function Si(t,e){t.uniform2iv(this.addr,e)}function Ai(t,e){t.uniform3iv(this.addr,e)}function Ti(t,e){t.uniform4iv(this.addr,e)}function Ci(t,e){t.uniform1uiv(this.addr,e)}function Li(t,e){t.uniform2uiv(this.addr,e)}function Ri(t,e){t.uniform3uiv(this.addr,e)}function Pi(t,e){t.uniform4uiv(this.addr,e)}function Di(t,e,n){const i=e.length,r=$n(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.safeSetTexture2D(e[t]||Fn,r[t])}function Ii(t,e,n){const i=e.length,r=$n(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.safeSetTextureCube(e[t]||Vn,r[t])}function zi(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Qn;case 35664:return Kn;case 35665:return ti;case 35666:return ei;case 35674:return ni;case 35675:return ii;case 35676:return ri;case 5124:case 35670:return ai;case 35667:case 35671:return si;case 35668:case 35672:return oi;case 35669:case 35673:return li;case 5125:return hi;case 36294:return ci;case 36295:return ui;case 36296:return di;case 35678:case 36198:case 36298:case 36306:case 35682:return pi;case 35679:case 36299:case 36307:return fi;case 35680:case 36300:case 36308:case 36293:return mi;case 36289:case 36303:case 36311:case 36292:return gi}}(e.type)}function Ni(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return vi;case 35664:return yi;case 35665:return bi;case 35666:return xi;case 35674:return _i;case 35675:return wi;case 35676:return Mi;case 5124:case 35670:return Ei;case 35667:case 35671:return Si;case 35668:case 35672:return Ai;case 35669:case 35673:return Ti;case 5125:return Ci;case 36294:return Li;case 36295:return Ri;case 36296:return Pi;case 35678:case 36198:case 36298:case 36306:case 35682:return Di;case 35680:case 36300:case 36308:case 36293:return Ii}}(e.type)}function Bi(t){this.id=t,this.seq=[],this.map={}}Ni.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),Zn(e,t)},Bi.prototype.setValue=function(t,e,n){const i=this.seq;for(let r=0,a=i.length;r!==a;++r){const a=i[r];a.setValue(t,e[a.id],n)}};const ki=/(\w+)(\])?(\[|\.)?/g;function Oi(t,e){t.seq.push(e),t.map[e.id]=e}function Fi(t,e,n){const i=t.name,r=i.length;for(ki.lastIndex=0;;){const a=ki.exec(i),s=ki.lastIndex;let o=a[1];const l="]"===a[2],h=a[3];if(l&&(o|=0),void 0===h||"["===h&&s+2===r){Oi(n,void 0===h?new zi(o,t,e):new Ni(o,t,e));break}{let t=n.map[o];void 0===t&&(t=new Bi(o),Oi(n,t)),n=t}}}function Ui(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,35718);for(let i=0;i<n;++i){const n=t.getActiveUniform(e,i);Fi(n,t.getUniformLocation(e,n.name),this)}}function Hi(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}Ui.prototype.setValue=function(t,e,n,i){const r=this.map[e];void 0!==r&&r.setValue(t,n,i)},Ui.prototype.setOptional=function(t,e,n){const i=e[n];void 0!==i&&this.setValue(t,n,i)},Ui.upload=function(t,e,n,i){for(let r=0,a=e.length;r!==a;++r){const a=e[r],s=n[a.id];!1!==s.needsUpdate&&a.setValue(t,s.value,i)}},Ui.seqWithValue=function(t,e){const n=[];for(let i=0,r=t.length;i!==r;++i){const r=t[i];r.id in e&&n.push(r)}return n};let Vi=0;function Gi(t){switch(t){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function Wi(t,e,n){const i=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();return i&&""===r?"":n.toUpperCase()+"\n\n"+r+"\n\n"+function(t){const e=t.split("\n");for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}(t.getShaderSource(e))}function ji(t,e){const n=Gi(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function qi(t,e){const n=Gi(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function Xi(t,e){let n;switch(e){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Yi(t){return""!==t}function Ji(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Zi(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const $i=/^[ \t]*#include +<([\w\d./]+)>/gm;function Qi(t){return t.replace($i,Ki)}function Ki(t,e){const n=Ye[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Qi(n)}const tr=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,er=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function nr(t){return t.replace(er,rr).replace(tr,ir)}function ir(t,e,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),rr(t,e,n,i)}function rr(t,e,n,i){let r="";for(let t=parseInt(e);t<parseInt(n);t++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function ar(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function sr(t,e,n,i){const r=t.getContext(),a=n.defines;let s=n.vertexShader,o=n.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(n),h=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case 301:case 302:e="ENVMAP_TYPE_CUBE";break;case 306:case 307:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),c=function(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case 302:case 307:e="ENVMAP_MODE_REFRACTION"}return e}(n),u=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(n),d=t.gammaFactor>0?t.gammaFactor:1,p=n.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Yi).join("\n")}(n),f=function(t){const e=[];for(const n in t){const i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}(a),m=r.createProgram();let g,v,y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=[f].filter(Yi).join("\n"),g.length>0&&(g+="\n"),v=[p,f].filter(Yi).join("\n"),v.length>0&&(v+="\n")):(g=[ar(n),"#define SHADER_NAME "+n.shaderName,f,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+d,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularTintMap?"#define USE_SPECULARTINTMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Yi).join("\n"),v=[p,ar(n),"#define SHADER_NAME "+n.shaderName,f,"#define GAMMA_FACTOR "+d,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.envMap?"#define "+c:"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularTintMap?"#define USE_SPECULARTINTMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheenTint?"#define USE_SHEEN":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Ye.tonemapping_pars_fragment:"",0!==n.toneMapping?Xi("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",1022===n.format?"#define OPAQUE":"",Ye.encodings_pars_fragment,n.map?ji("mapTexelToLinear",n.mapEncoding):"",n.matcap?ji("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?ji("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?ji("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.specularTintMap?ji("specularTintMapTexelToLinear",n.specularTintMapEncoding):"",n.lightMap?ji("lightMapTexelToLinear",n.lightMapEncoding):"",qi("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Yi).join("\n")),s=Qi(s),s=Ji(s,n),s=Zi(s,n),o=Qi(o),o=Ji(o,n),o=Zi(o,n),s=nr(s),o=nr(o),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",g=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in","300 es"===n.glslVersion?"":"out highp vec4 pc_fragColor;","300 es"===n.glslVersion?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+v);const b=y+v+o,x=Hi(r,35633,y+g+s),_=Hi(r,35632,b);if(r.attachShader(m,x),r.attachShader(m,_),void 0!==n.index0AttributeName?r.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(m,0,"position"),r.linkProgram(m),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(m).trim(),e=r.getShaderInfoLog(x).trim(),n=r.getShaderInfoLog(_).trim();let i=!0,a=!0;if(!1===r.getProgramParameter(m,35714)){i=!1;const e=Wi(r,x,"vertex"),n=Wi(r,_,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(m,35715)+"\n\nProgram Info Log: "+t+"\n"+e+"\n"+n)}else""!==t?console.warn("THREE.WebGLProgram: Program Info Log:",t):""!==e&&""!==n||(a=!1);a&&(this.diagnostics={runnable:i,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:n,prefix:v}})}let w,M;return r.deleteShader(x),r.deleteShader(_),this.getUniforms=function(){return void 0===w&&(w=new Ui(r,m)),w},this.getAttributes=function(){return void 0===M&&(M=function(t,e){const n={},i=t.getProgramParameter(e,35721);for(let r=0;r<i;r++){const i=t.getActiveAttrib(e,r),a=i.name;let s=1;35674===i.type&&(s=2),35675===i.type&&(s=3),35676===i.type&&(s=4),n[a]={type:i.type,location:t.getAttribLocation(e,a),locationSize:s}}return n}(r,m)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(m),this.program=void 0},this.name=n.shaderName,this.id=Vi++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=x,this.fragmentShader=_,this}function or(t,e,n,i,r,a,s){const o=[],l=r.isWebGL2,h=r.logarithmicDepthBuffer,c=r.floatVertexTextures,u=r.maxVertexUniforms,d=r.vertexTextures;let p=r.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},m=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoat","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","specularIntensityMap","specularTintMap","specularTintMapEncoding","roughnessMap","metalnessMap","gradientMap","alphaMap","alphaTest","combine","vertexColors","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","format","sheenTint","transmission","transmissionMap","thicknessMap"];function g(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=3e3,e}return{getParameters:function(a,o,m,v,y){const b=v.fog,x=a.isMeshStandardMaterial?v.environment:null,_=(a.isMeshStandardMaterial?n:e).get(a.envMap||x),w=f[a.type],M=y.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(c)return 1024;{const t=u,n=Math.floor((t-20)/4),i=Math.min(n,e.length);return i<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+i+"."),0):i}}(y):0;let E,S;if(null!==a.precision&&(p=r.getMaxPrecision(a.precision),p!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead.")),w){const t=Ze[w];E=t.vertexShader,S=t.fragmentShader}else E=a.vertexShader,S=a.fragmentShader;const A=t.getRenderTarget(),T=a.alphaTest>0,C=a.clearcoat>0;return{isWebGL2:l,shaderID:w,shaderName:a.type,vertexShader:E,fragmentShader:S,defines:a.defines,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,instancing:!0===y.isInstancedMesh,instancingColor:!0===y.isInstancedMesh&&null!==y.instanceColor,supportsVertexTextures:d,outputEncoding:null!==A?g(A.texture):t.outputEncoding,map:!!a.map,mapEncoding:g(a.map),matcap:!!a.matcap,matcapEncoding:g(a.matcap),envMap:!!_,envMapMode:_&&_.mapping,envMapEncoding:g(_),envMapCubeUV:!!_&&(306===_.mapping||307===_.mapping),lightMap:!!a.lightMap,lightMapEncoding:g(a.lightMap),aoMap:!!a.aoMap,emissiveMap:!!a.emissiveMap,emissiveMapEncoding:g(a.emissiveMap),bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,objectSpaceNormalMap:1===a.normalMapType,tangentSpaceNormalMap:0===a.normalMapType,clearcoat:C,clearcoatMap:C&&!!a.clearcoatMap,clearcoatRoughnessMap:C&&!!a.clearcoatRoughnessMap,clearcoatNormalMap:C&&!!a.clearcoatNormalMap,displacementMap:!!a.displacementMap,roughnessMap:!!a.roughnessMap,metalnessMap:!!a.metalnessMap,specularMap:!!a.specularMap,specularIntensityMap:!!a.specularIntensityMap,specularTintMap:!!a.specularTintMap,specularTintMapEncoding:g(a.specularTintMap),alphaMap:!!a.alphaMap,alphaTest:T,gradientMap:!!a.gradientMap,sheenTint:!!a.sheenTint&&(a.sheenTint.r>0||a.sheenTint.g>0||a.sheenTint.b>0),transmission:a.transmission>0,transmissionMap:!!a.transmissionMap,thicknessMap:!!a.thicknessMap,combine:a.combine,vertexTangents:!!a.normalMap&&!!y.geometry&&!!y.geometry.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!y.geometry&&!!y.geometry.attributes.color&&4===y.geometry.attributes.color.itemSize,vertexUvs:!!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatMap||a.clearcoatRoughnessMap||a.clearcoatNormalMap||a.displacementMap||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularTintMap),uvsVertexOnly:!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatNormalMap||a.transmission>0||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularTintMap||!a.displacementMap),fog:!!b,useFog:a.fog,fogExp2:b&&b.isFogExp2,flatShading:!!a.flatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:h,skinning:!0===y.isSkinnedMesh&&M>0,maxBones:M,useVertexTexture:c,morphTargets:!!y.geometry&&!!y.geometry.morphAttributes.position,morphNormals:!!y.geometry&&!!y.geometry.morphAttributes.normal,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,format:a.format,dithering:a.dithering,shadowMapEnabled:t.shadowMap.enabled&&m.length>0,shadowMapType:t.shadowMap.type,toneMapping:a.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,depthPacking:void 0!==a.depthPacking&&a.depthPacking,index0AttributeName:a.index0AttributeName,extensionDerivatives:a.extensions&&a.extensions.derivatives,extensionFragDepth:a.extensions&&a.extensions.fragDepth,extensionDrawBuffers:a.extensions&&a.extensions.drawBuffers,extensionShaderTextureLOD:a.extensions&&a.extensions.shaderTextureLOD,rendererExtensionFragDepth:l||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:l||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:l||i.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t<m.length;t++)n.push(e[m[t]]);n.push(t.outputEncoding),n.push(t.gammaFactor)}return n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=f[t.type];let n;if(e){const t=Ze[e];n=Pe.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,e=o.length;t<e;t++){const e=o[t];if(e.cacheKey===n){i=e,++i.usedTimes;break}}return void 0===i&&(i=new sr(t,n,e,a),o.push(i)),i},releaseProgram:function(t){if(0==--t.usedTimes){const e=o.indexOf(t);o[e]=o[o.length-1],o.pop(),t.destroy()}},programs:o}}function lr(){let t=new WeakMap;return{get:function(e){let n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,i){t.get(e)[n]=i},dispose:function(){t=new WeakMap}}}function hr(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function cr(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function ur(t){const e=[];let n=0;const i=[],r=[],a=[],s={id:-1};function o(i,r,a,o,l,h){let c=e[n];const u=t.get(a);return void 0===c?(c={id:i.id,object:i,geometry:r,material:a,program:u.program||s,groupOrder:o,renderOrder:i.renderOrder,z:l,group:h},e[n]=c):(c.id=i.id,c.object=i,c.geometry=r,c.material=a,c.program=u.program||s,c.groupOrder=o,c.renderOrder=i.renderOrder,c.z=l,c.group=h),n++,c}return{opaque:i,transmissive:r,transparent:a,init:function(){n=0,i.length=0,r.length=0,a.length=0},push:function(t,e,n,s,l,h){const c=o(t,e,n,s,l,h);n.transmission>0?r.push(c):!0===n.transparent?a.push(c):i.push(c)},unshift:function(t,e,n,s,l,h){const c=o(t,e,n,s,l,h);n.transmission>0?r.unshift(c):!0===n.transparent?a.unshift(c):i.unshift(c)},finish:function(){for(let t=n,i=e.length;t<i;t++){const n=e[t];if(null===n.id)break;n.id=null,n.object=null,n.geometry=null,n.material=null,n.program=null,n.group=null}},sort:function(t,e){i.length>1&&i.sort(t||hr),r.length>1&&r.sort(e||cr),a.length>1&&a.sort(e||cr)}}}function dr(t){let e=new WeakMap;return{get:function(n,i){let r;return!1===e.has(n)?(r=new ur(t),e.set(n,[r])):i>=e.get(n).length?(r=new ur(t),e.get(n).push(r)):r=e.get(n)[i],r},dispose:function(){e=new WeakMap}}}function pr(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new E,color:new qt};break;case"SpotLight":n={position:new E,direction:new E,color:new qt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new E,color:new qt,distance:0,decay:0};break;case"HemisphereLight":n={direction:new E,skyColor:new qt,groundColor:new qt};break;case"RectAreaLight":n={color:new qt,position:new E,halfWidth:new E,halfHeight:new E}}return t[e.id]=n,n}}}let fr=0;function mr(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function gr(t,e){const n=new pr,i=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new p};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new p,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)r.probe.push(new E);const a=new E,s=new et,o=new et;return{setup:function(a,s){let o=0,l=0,h=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let c=0,u=0,d=0,p=0,f=0,m=0,g=0,v=0;a.sort(mr);const y=!0!==s?Math.PI:1;for(let t=0,e=a.length;t<e;t++){const e=a[t],s=e.color,b=e.intensity,x=e.distance,_=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)o+=s.r*b*y,l+=s.g*b*y,h+=s.b*b*y;else if(e.isLightProbe)for(let t=0;t<9;t++)r.probe[t].addScaledVector(e.sh.coefficients[t],b);else if(e.isDirectionalLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*y),e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,r.directionalShadow[c]=n,r.directionalShadowMap[c]=_,r.directionalShadowMatrix[c]=e.shadow.matrix,m++}r.directional[c]=t,c++}else if(e.isSpotLight){const t=n.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(s).multiplyScalar(b*y),t.distance=x,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,r.spotShadow[d]=n,r.spotShadowMap[d]=_,r.spotShadowMatrix[d]=e.shadow.matrix,v++}r.spot[d]=t,d++}else if(e.isRectAreaLight){const t=n.get(e);t.color.copy(s).multiplyScalar(b),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),r.rectArea[p]=t,p++}else if(e.isPointLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*y),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,n.shadowCameraNear=t.camera.near,n.shadowCameraFar=t.camera.far,r.pointShadow[u]=n,r.pointShadowMap[u]=_,r.pointShadowMatrix[u]=e.shadow.matrix,g++}r.point[u]=t,u++}else if(e.isHemisphereLight){const t=n.get(e);t.skyColor.copy(e.color).multiplyScalar(b*y),t.groundColor.copy(e.groundColor).multiplyScalar(b*y),r.hemi[f]=t,f++}}p>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Je.LTC_FLOAT_1,r.rectAreaLTC2=Je.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Je.LTC_HALF_1,r.rectAreaLTC2=Je.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=l,r.ambient[2]=h;const b=r.hash;b.directionalLength===c&&b.pointLength===u&&b.spotLength===d&&b.rectAreaLength===p&&b.hemiLength===f&&b.numDirectionalShadows===m&&b.numPointShadows===g&&b.numSpotShadows===v||(r.directional.length=c,r.spot.length=d,r.rectArea.length=p,r.point.length=u,r.hemi.length=f,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=v,r.spotShadowMap.length=v,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=g,r.spotShadowMatrix.length=v,b.directionalLength=c,b.pointLength=u,b.spotLength=d,b.rectAreaLength=p,b.hemiLength=f,b.numDirectionalShadows=m,b.numPointShadows=g,b.numSpotShadows=v,r.version=fr++)},setupView:function(t,e){let n=0,i=0,l=0,h=0,c=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=r.directional[n];t.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(u),n++}else if(d.isSpotLight){const t=r.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),t.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(u),l++}else if(d.isRectAreaLight){const t=r.rectArea[h];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),o.identity(),s.copy(d.matrixWorld),s.premultiply(u),o.extractRotation(s),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(o),t.halfHeight.applyMatrix4(o),h++}else if(d.isPointLight){const t=r.point[i];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),i++}else if(d.isHemisphereLight){const t=r.hemi[c];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(u),t.direction.normalize(),c++}}},state:r}}function vr(t,e){const n=new gr(t,e),i=[],r=[];return{init:function(){i.length=0,r.length=0},state:{lightsArray:i,shadowsArray:r,lights:n},setupLights:function(t){n.setup(i,t)},setupLightsView:function(t){n.setupView(i,t)},pushLight:function(t){i.push(t)},pushShadow:function(t){r.push(t)}}}function yr(t,e){let n=new WeakMap;return{get:function(i,r=0){let a;return!1===n.has(i)?(a=new vr(t,e),n.set(i,[a])):r>=n.get(i).length?(a=new vr(t,e),n.get(i).push(a)):a=n.get(i)[r],a},dispose:function(){n=new WeakMap}}}class br extends Ft{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}br.prototype.isMeshDepthMaterial=!0;class xr extends Ft{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new E,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}xr.prototype.isMeshDistanceMaterial=!0;function _r(t,e,n){let i=new We;const r=new p,a=new p,s=new x,o=new br({depthPacking:3201}),l=new xr,h={},c=n.maxTextureSize,u={0:1,1:0,2:2},d=new De({uniforms:{shadow_pass:{value:null},resolution:{value:new p},radius:{value:4},samples:{value:8}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nuniform float samples;\n#include <packing>\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const m=new le;m.setAttribute("position",new Zt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new Ae(m,d),v=this;function y(n,i){const r=e.update(g);d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,d.uniforms.samples.value=n.blurSamples,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,r,d,g,null),f.uniforms.shadow_pass.value=n.mapPass.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,f.uniforms.samples.value=n.blurSamples,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,r,f,g,null)}function b(e,n,i,r,a,s,c){let d=null;const p=!0===r.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(d=void 0!==p?p:!0===r.isPointLight?l:o,t.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0){const t=d.uuid,e=i.uuid;let n=h[t];void 0===n&&(n={},h[t]=n);let r=n[e];void 0===r&&(r=d.clone(),n[e]=r),d=r}return d.visible=i.visible,d.wireframe=i.wireframe,d.side=3===c?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:u[i.side],d.alphaMap=i.alphaMap,d.alphaTest=i.alphaTest,d.clipShadows=i.clipShadows,d.clippingPlanes=i.clippingPlanes,d.clipIntersection=i.clipIntersection,d.displacementMap=i.displacementMap,d.displacementScale=i.displacementScale,d.displacementBias=i.displacementBias,d.wireframeLinewidth=i.wireframeLinewidth,d.linewidth=i.linewidth,!0===r.isPointLight&&!0===d.isMeshDistanceMaterial&&(d.referencePosition.setFromMatrixPosition(r.matrixWorld),d.nearDistance=a,d.farDistance=s),d}function w(n,r,a,s,o){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===o)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);const i=e.update(n),r=n.material;if(Array.isArray(r)){const e=i.groups;for(let l=0,h=e.length;l<h;l++){const h=e[l],c=r[h.materialIndex];if(c&&c.visible){const e=b(n,0,c,s,a.near,a.far,o);t.renderBufferDirect(a,null,i,e,n,h)}}}else if(r.visible){const e=b(n,0,r,s,a.near,a.far,o);t.renderBufferDirect(a,null,i,e,n,null)}}const l=n.children;for(let t=0,e=l.length;t<e;t++)w(l[t],r,a,s,o)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,n,o){if(!1===v.enabled)return;if(!1===v.autoUpdate&&!1===v.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),h=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),d=t.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(let l=0,h=e.length;l<h;l++){const h=e[l],u=h.shadow;if(void 0===u){console.warn("THREE.WebGLShadowMap:",h,"has no shadow.");continue}if(!1===u.autoUpdate&&!1===u.needsUpdate)continue;r.copy(u.mapSize);const p=u.getFrameExtents();if(r.multiply(p),a.copy(u.mapSize),(r.x>c||r.y>c)&&(r.x>c&&(a.x=Math.floor(c/p.x),r.x=a.x*p.x,u.mapSize.x=a.x),r.y>c&&(a.y=Math.floor(c/p.y),r.y=a.y*p.y,u.mapSize.y=a.y)),null===u.map&&!u.isPointLightShadow&&3===this.type){const t={minFilter:1006,magFilter:1006,format:1023};u.map=new _(r.x,r.y,t),u.map.texture.name=h.name+".shadowMap",u.mapPass=new _(r.x,r.y,t),u.camera.updateProjectionMatrix()}if(null===u.map){const t={minFilter:1003,magFilter:1003,format:1023};u.map=new _(r.x,r.y,t),u.map.texture.name=h.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const f=u.getViewportCount();for(let t=0;t<f;t++){const e=u.getViewport(t);s.set(a.x*e.x,a.y*e.y,a.x*e.z,a.y*e.w),d.viewport(s),u.updateMatrices(h,t),i=u.getFrustum(),w(n,o,u.camera,h,this.type)}u.isPointLightShadow||3!==this.type||y(u,o),u.needsUpdate=!1}v.needsUpdate=!1,t.setRenderTarget(l,h,u)}}function wr(t,e,n){const i=n.isWebGL2;const r=new function(){let e=!1;const n=new x;let i=null;const r=new x(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,a,s,o){!0===o&&(e*=s,i*=s,a*=s),n.set(e,i,a,s),!1===r.equals(n)&&(t.clearColor(e,i,a,s),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}},a=new function(){let e=!1,n=null,i=null,r=null;return{setTest:function(t){t?O(2929):F(2929)},setMask:function(i){n===i||e||(t.depthMask(i),n=i)},setFunc:function(e){if(i!==e){if(e)switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);i=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,n=null,i=null,r=null}}},s=new function(){let e=!1,n=null,i=null,r=null,a=null,s=null,o=null,l=null,h=null;return{setTest:function(t){e||(t?O(2960):F(2960))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,s){i===e&&r===n&&a===s||(t.stencilFunc(e,n,s),i=e,r=n,a=s)},setOp:function(e,n,i){s===e&&o===n&&l===i||(t.stencilOp(e,n,i),s=e,o=n,l=i)},setLocked:function(t){e=t},setClear:function(e){h!==e&&(t.clearStencil(e),h=e)},reset:function(){e=!1,n=null,i=null,r=null,a=null,s=null,o=null,l=null,h=null}}};let o={},l=null,h={},c=null,u=!1,d=null,p=null,f=null,m=null,g=null,v=null,y=null,b=!1,_=null,w=null,M=null,E=null,S=null;const A=t.getParameter(35661);let T=!1,C=0;const L=t.getParameter(7938);-1!==L.indexOf("WebGL")?(C=parseFloat(/^WebGL (\d)/.exec(L)[1]),T=C>=1):-1!==L.indexOf("OpenGL ES")&&(C=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),T=C>=2);let R=null,P={};const D=t.getParameter(3088),I=t.getParameter(2978),z=(new x).fromArray(D),N=(new x).fromArray(I);function B(e,n,i){const r=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<i;e++)t.texImage2D(n+e,0,6408,1,1,0,6408,5121,r);return a}const k={};function O(e){!0!==o[e]&&(t.enable(e),o[e]=!0)}function F(e){!1!==o[e]&&(t.disable(e),o[e]=!1)}k[3553]=B(3553,3553,1),k[34067]=B(34067,34069,6),r.setClear(0,0,0,1),a.setClear(1),s.setClear(0),O(2929),a.setFunc(3),G(!1),W(1),O(2884),V(0);const U={100:32774,101:32778,102:32779};if(i)U[103]=32775,U[104]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(U[103]=t.MIN_EXT,U[104]=t.MAX_EXT)}const H={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function V(e,n,i,r,a,s,o,l){if(0!==e){if(!1===u&&(O(3042),u=!0),5===e)a=a||n,s=s||i,o=o||r,n===p&&a===g||(t.blendEquationSeparate(U[n],U[a]),p=n,g=a),i===f&&r===m&&s===v&&o===y||(t.blendFuncSeparate(H[i],H[r],H[s],H[o]),f=i,m=r,v=s,y=o),d=e,b=null;else if(e!==d||l!==b){if(100===p&&100===g||(t.blendEquation(32774),p=100,g=100),l)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,0,769,771);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFunc(0,769);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}f=null,m=null,v=null,y=null,d=e,b=l}}else!0===u&&(F(3042),u=!1)}function G(e){_!==e&&(e?t.frontFace(2304):t.frontFace(2305),_=e)}function W(e){0!==e?(O(2884),e!==w&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):F(2884),w=e}function j(e,n,i){e?(O(32823),E===n&&S===i||(t.polygonOffset(n,i),E=n,S=i)):F(32823)}function q(e){void 0===e&&(e=33984+A-1),R!==e&&(t.activeTexture(e),R=e)}return{buffers:{color:r,depth:a,stencil:s},enable:O,disable:F,bindFramebuffer:function(e,n){return null===n&&null!==l&&(n=l),h[e]!==n&&(t.bindFramebuffer(e,n),h[e]=n,i&&(36009===e&&(h[36160]=n),36160===e&&(h[36009]=n)),!0)},bindXRFramebuffer:function(e){e!==l&&(t.bindFramebuffer(36160,e),l=e)},useProgram:function(e){return c!==e&&(t.useProgram(e),c=e,!0)},setBlending:V,setMaterial:function(t,e){2===t.side?F(2884):O(2884);let n=1===t.side;e&&(n=!n),G(n),1===t.blending&&!1===t.transparent?V(0):V(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),a.setFunc(t.depthFunc),a.setTest(t.depthTest),a.setMask(t.depthWrite),r.setMask(t.colorWrite);const i=t.stencilWrite;s.setTest(i),i&&(s.setMask(t.stencilWriteMask),s.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),s.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),j(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?O(32926):F(32926)},setFlipSided:G,setCullFace:W,setLineWidth:function(e){e!==M&&(T&&t.lineWidth(e),M=e)},setPolygonOffset:j,setScissorTest:function(t){t?O(3089):F(3089)},activeTexture:q,bindTexture:function(e,n){null===R&&q();let i=P[R];void 0===i&&(i={type:void 0,texture:void 0},P[R]=i),i.type===e&&i.texture===n||(t.bindTexture(e,n||k[e]),i.type=e,i.texture=n)},unbindTexture:function(){const e=P[R];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===z.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),z.copy(e))},viewport:function(e){!1===N.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),N.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.disable(32926),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.bindFramebuffer(36160,null),!0===i&&(t.bindFramebuffer(36009,null),t.bindFramebuffer(36008,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),o={},R=null,P={},l=null,h={},c=null,u=!1,d=null,p=null,f=null,m=null,g=null,v=null,y=null,b=!1,_=null,w=null,M=null,E=null,S=null,z.set(0,0,t.canvas.width,t.canvas.height),N.set(0,0,t.canvas.width,t.canvas.height),r.reset(),a.reset(),s.reset()}}}function Mr(t,e,n,i,r,a,s){const o=r.isWebGL2,l=r.maxTextures,h=r.maxCubemapSize,c=r.maxTextureSize,p=r.maxSamples,f=new WeakMap;let m,g=!1;try{g="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function v(t,e){return g?new OffscreenCanvas(t,e):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function y(t,e,n,i){let r=1;if((t.width>i||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const i=e?d:Math.floor,a=i(r*t.width),s=i(r*t.height);void 0===m&&(m=v(a,s));const o=n?v(a,s):m;o.width=a,o.height=s;return o.getContext("2d").drawImage(t,0,0,a,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+a+"x"+s+")."),o}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function b(t){return u(t.width)&&u(t.height)}function x(t,e){return t.generateMipmaps&&e&&1003!==t.minFilter&&1006!==t.minFilter}function _(e,n,r,a,s=1){t.generateMipmap(e);i.get(n).__maxMipLevel=Math.log2(Math.max(r,a,s))}function w(n,i,r){if(!1===o)return i;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let a=i;return 6403===i&&(5126===r&&(a=33326),5131===r&&(a=33325),5121===r&&(a=33321)),6407===i&&(5126===r&&(a=34837),5131===r&&(a=34843),5121===r&&(a=32849)),6408===i&&(5126===r&&(a=34836),5131===r&&(a=34842),5121===r&&(a=32856)),33325!==a&&33326!==a&&34842!==a&&34836!==a||e.get("EXT_color_buffer_float"),a}function M(t){return 1003===t||1004===t||1005===t?9728:9729}function E(e){const n=e.target;n.removeEventListener("dispose",E),function(e){const n=i.get(e);if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture),i.remove(e)}(n),n.isVideoTexture&&f.delete(n),s.memory.textures--}function S(e){const n=e.target;n.removeEventListener("dispose",S),function(e){const n=e.texture,r=i.get(e),a=i.get(n);if(!e)return;void 0!==a.__webglTexture&&(t.deleteTexture(a.__webglTexture),s.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&t.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(let e=0,r=n.length;e<r;e++){const r=i.get(n[e]);r.__webglTexture&&(t.deleteTexture(r.__webglTexture),s.memory.textures--),i.remove(n[e])}i.remove(n),i.remove(e)}(n)}let A=0;function T(t,e){const r=i.get(t);if(t.isVideoTexture&&function(t){const e=s.render.frame;f.get(t)!==e&&(f.set(t,e),t.update())}(t),t.version>0&&r.__version!==t.version){const n=t.image;if(void 0===n)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==n.complete)return void I(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,r.__webglTexture)}function C(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?function(e,i,r){if(6!==i.image.length)return;D(e,i),n.activeTexture(33984+r),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),t.pixelStorei(37443,0);const s=i&&(i.isCompressedTexture||i.image[0].isCompressedTexture),l=i.image[0]&&i.image[0].isDataTexture,c=[];for(let t=0;t<6;t++)c[t]=s||l?l?i.image[t].image:i.image[t]:y(i.image[t],!1,!0,h);const u=c[0],d=b(u)||o,p=a.convert(i.format),f=a.convert(i.type),m=w(i.internalFormat,p,f);let g;if(P(34067,i,d),s){for(let t=0;t<6;t++){g=c[t].mipmaps;for(let e=0;e<g.length;e++){const r=g[e];1023!==i.format&&1022!==i.format?null!==p?n.compressedTexImage2D(34069+t,e,m,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+t,e,m,r.width,r.height,0,p,f,r.data)}}e.__maxMipLevel=g.length-1}else{g=i.mipmaps;for(let t=0;t<6;t++)if(l){n.texImage2D(34069+t,0,m,c[t].width,c[t].height,0,p,f,c[t].data);for(let e=0;e<g.length;e++){const i=g[e].image[t].image;n.texImage2D(34069+t,e+1,m,i.width,i.height,0,p,f,i.data)}}else{n.texImage2D(34069+t,0,m,p,f,c[t]);for(let e=0;e<g.length;e++){const i=g[e];n.texImage2D(34069+t,e+1,m,p,f,i.image[t])}}e.__maxMipLevel=g.length}x(i,d)&&_(34067,i,u.width,u.height);e.__version=i.version,i.onUpdate&&i.onUpdate(i)}(s,e,r):(n.activeTexture(33984+r),n.bindTexture(34067,s.__webglTexture))}const L={1e3:10497,1001:33071,1002:33648},R={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function P(n,a,s){if(s?(t.texParameteri(n,10242,L[a.wrapS]),t.texParameteri(n,10243,L[a.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,L[a.wrapR]),t.texParameteri(n,10240,R[a.magFilter]),t.texParameteri(n,10241,R[a.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),1001===a.wrapS&&1001===a.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,10240,M(a.magFilter)),t.texParameteri(n,10241,M(a.minFilter)),1003!==a.minFilter&&1006!==a.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const s=e.get("EXT_texture_filter_anisotropic");if(1015===a.type&&!1===e.has("OES_texture_float_linear"))return;if(!1===o&&1016===a.type&&!1===e.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(t.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function D(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",E),e.__webglTexture=t.createTexture(),s.memory.textures++)}function I(e,i,r){let s=3553;i.isDataTexture2DArray&&(s=35866),i.isDataTexture3D&&(s=32879),D(e,i),n.activeTexture(33984+r),n.bindTexture(s,e.__webglTexture),t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),t.pixelStorei(37443,0);const l=function(t){return!o&&(1001!==t.wrapS||1001!==t.wrapT||1003!==t.minFilter&&1006!==t.minFilter)}(i)&&!1===b(i.image),h=y(i.image,l,!1,c),u=b(h)||o,d=a.convert(i.format);let p,f=a.convert(i.type),m=w(i.internalFormat,d,f);P(s,i,u);const g=i.mipmaps;if(i.isDepthTexture)m=6402,o?m=1015===i.type?36012:1014===i.type?33190:1020===i.type?35056:33189:1015===i.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===i.format&&6402===m&&1012!==i.type&&1014!==i.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=1012,f=a.convert(i.type)),1027===i.format&&6402===m&&(m=34041,1020!==i.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=1020,f=a.convert(i.type))),n.texImage2D(3553,0,m,h.width,h.height,0,d,f,null);else if(i.isDataTexture)if(g.length>0&&u){for(let t=0,e=g.length;t<e;t++)p=g[t],n.texImage2D(3553,t,m,p.width,p.height,0,d,f,p.data);i.generateMipmaps=!1,e.__maxMipLevel=g.length-1}else n.texImage2D(3553,0,m,h.width,h.height,0,d,f,h.data),e.__maxMipLevel=0;else if(i.isCompressedTexture){for(let t=0,e=g.length;t<e;t++)p=g[t],1023!==i.format&&1022!==i.format?null!==d?n.compressedTexImage2D(3553,t,m,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,t,m,p.width,p.height,0,d,f,p.data);e.__maxMipLevel=g.length-1}else if(i.isDataTexture2DArray)n.texImage3D(35866,0,m,h.width,h.height,h.depth,0,d,f,h.data),e.__maxMipLevel=0;else if(i.isDataTexture3D)n.texImage3D(32879,0,m,h.width,h.height,h.depth,0,d,f,h.data),e.__maxMipLevel=0;else if(g.length>0&&u){for(let t=0,e=g.length;t<e;t++)p=g[t],n.texImage2D(3553,t,m,d,f,p);i.generateMipmaps=!1,e.__maxMipLevel=g.length-1}else n.texImage2D(3553,0,m,d,f,h),e.__maxMipLevel=0;x(i,u)&&_(s,i,h.width,h.height),e.__version=i.version,i.onUpdate&&i.onUpdate(i)}function z(e,r,s,o,l){const h=a.convert(s.format),c=a.convert(s.type),u=w(s.internalFormat,h,c);32879===l||35866===l?n.texImage3D(l,0,u,r.width,r.height,r.depth,0,h,c,null):n.texImage2D(l,0,u,r.width,r.height,0,h,c,null),n.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,o,l,i.get(s).__webglTexture,0),n.bindFramebuffer(36160,null)}function N(e,n,i){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){let r=33189;if(i){const e=n.depthTexture;e&&e.isDepthTexture&&(1015===e.type?r=36012:1014===e.type&&(r=33190));const i=k(n);t.renderbufferStorageMultisample(36161,i,r,n.width,n.height)}else t.renderbufferStorage(36161,r,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){if(i){const e=k(n);t.renderbufferStorageMultisample(36161,e,35056,n.width,n.height)}else t.renderbufferStorage(36161,34041,n.width,n.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===n.isWebGLMultipleRenderTargets?n.texture[0]:n.texture,r=a.convert(e.format),s=a.convert(e.type),o=w(e.internalFormat,r,s);if(i){const e=k(n);t.renderbufferStorageMultisample(36161,e,o,n.width,n.height)}else t.renderbufferStorage(36161,o,n.width,n.height)}t.bindRenderbuffer(36161,null)}function B(e){const r=i.get(e),a=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(36160,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),T(r.depthTexture,0);const a=i.get(r.depthTexture).__webglTexture;if(1026===r.depthTexture.format)t.framebufferTexture2D(36160,36096,3553,a,0);else{if(1027!==r.depthTexture.format)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,a,0)}}(r.__webglFramebuffer,e)}else if(a){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)n.bindFramebuffer(36160,r.__webglFramebuffer[i]),r.__webglDepthbuffer[i]=t.createRenderbuffer(),N(r.__webglDepthbuffer[i],e,!1)}else n.bindFramebuffer(36160,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),N(r.__webglDepthbuffer,e,!1);n.bindFramebuffer(36160,null)}function k(t){return o&&t.isWebGLMultisampleRenderTarget?Math.min(p,t.samples):0}let O=!1,F=!1;this.allocateTextureUnit=function(){const t=A;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),A+=1,t},this.resetTextureUnits=function(){A=0},this.setTexture2D=T,this.setTexture2DArray=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?I(r,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?I(r,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=C,this.setupRenderTarget=function(e){const l=e.texture,h=i.get(e),c=i.get(l);e.addEventListener("dispose",S),!0!==e.isWebGLMultipleRenderTargets&&(c.__webglTexture=t.createTexture(),c.__version=l.version,s.memory.textures++);const u=!0===e.isWebGLCubeRenderTarget,d=!0===e.isWebGLMultipleRenderTargets,p=!0===e.isWebGLMultisampleRenderTarget,f=l.isDataTexture3D||l.isDataTexture2DArray,m=b(e)||o;if(!o||1022!==l.format||1015!==l.type&&1016!==l.type||(l.format=1023,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),u){h.__webglFramebuffer=[];for(let e=0;e<6;e++)h.__webglFramebuffer[e]=t.createFramebuffer()}else if(h.__webglFramebuffer=t.createFramebuffer(),d)if(r.drawBuffers){const n=e.texture;for(let e=0,r=n.length;e<r;e++){const r=i.get(n[e]);void 0===r.__webglTexture&&(r.__webglTexture=t.createTexture(),s.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(p)if(o){h.__webglMultisampledFramebuffer=t.createFramebuffer(),h.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,h.__webglColorRenderbuffer);const i=a.convert(l.format),r=a.convert(l.type),s=w(l.internalFormat,i,r),o=k(e);t.renderbufferStorageMultisample(36161,o,s,e.width,e.height),n.bindFramebuffer(36160,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,h.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(h.__webglDepthRenderbuffer=t.createRenderbuffer(),N(h.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(u){n.bindTexture(34067,c.__webglTexture),P(34067,l,m);for(let t=0;t<6;t++)z(h.__webglFramebuffer[t],e,l,36064,34069+t);x(l,m)&&_(34067,l,e.width,e.height),n.unbindTexture()}else if(d){const t=e.texture;for(let r=0,a=t.length;r<a;r++){const a=t[r],s=i.get(a);n.bindTexture(3553,s.__webglTexture),P(3553,a,m),z(h.__webglFramebuffer,e,a,36064+r,3553),x(a,m)&&_(3553,a,e.width,e.height)}n.unbindTexture()}else{let t=3553;if(f)if(o){t=l.isDataTexture3D?32879:35866}else console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.");n.bindTexture(t,c.__webglTexture),P(t,l,m),z(h.__webglFramebuffer,e,l,36064,t),x(l,m)&&_(t,l,e.width,e.height,e.depth),n.unbindTexture()}e.depthBuffer&&B(e)},this.updateRenderTargetMipmap=function(t){const e=b(t)||o,r=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture];for(let a=0,s=r.length;a<s;a++){const s=r[a];if(x(s,e)){const e=t.isWebGLCubeRenderTarget?34067:3553,r=i.get(s).__webglTexture;n.bindTexture(e,r),_(e,s,t.width,t.height),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(o){const r=e.width,a=e.height;let s=16384;e.depthBuffer&&(s|=256),e.stencilBuffer&&(s|=1024);const o=i.get(e);n.bindFramebuffer(36008,o.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,o.__webglFramebuffer),t.blitFramebuffer(0,0,r,a,0,0,r,a,s,9728),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,o.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===O&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),O=!0),t=t.texture),T(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===F&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),F=!0),t=t.texture),C(t,e)}}function Er(t,e,n){const i=n.isWebGL2;return{convert:function(t){let n;if(1009===t)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1019===t)return 33635;if(1010===t)return 5120;if(1011===t)return 5122;if(1012===t)return 5123;if(1013===t)return 5124;if(1014===t)return 5125;if(1015===t)return 5126;if(1016===t)return i?5131:(n=e.get("OES_texture_half_float"),null!==n?n.HALF_FLOAT_OES:null);if(1021===t)return 6406;if(1022===t)return 6407;if(1023===t)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(1026===t)return 6402;if(1027===t)return 34041;if(1028===t)return 6403;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1032===t)return 36248;if(1033===t)return 36249;if(33776===t||33777===t||33778===t||33779===t){if(n=e.get("WEBGL_compressed_texture_s3tc"),null===n)return null;if(33776===t)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===t)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===t)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===t)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===t||35841===t||35842===t||35843===t){if(n=e.get("WEBGL_compressed_texture_pvrtc"),null===n)return null;if(35840===t)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===t)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===t)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===t)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return n=e.get("WEBGL_compressed_texture_etc1"),null!==n?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===t||37496===t)&&(n=e.get("WEBGL_compressed_texture_etc"),null!==n)){if(37492===t)return n.COMPRESSED_RGB8_ETC2;if(37496===t)return n.COMPRESSED_RGBA8_ETC2_EAC}return 37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t||37840===t||37841===t||37842===t||37843===t||37844===t||37845===t||37846===t||37847===t||37848===t||37849===t||37850===t||37851===t||37852===t||37853===t?(n=e.get("WEBGL_compressed_texture_astc"),null!==n?t:null):36492===t?(n=e.get("EXT_texture_compression_bptc"),null!==n?t:null):1020===t?i?34042:(n=e.get("WEBGL_depth_texture"),null!==n?n.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class Sr extends ze{constructor(t=[]){super(),this.cameras=t}}Sr.prototype.isArrayCamera=!0;class Ar extends At{constructor(){super(),this.type="Group"}}Ar.prototype.isGroup=!0;const Tr={type:"move"};class Cr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Ar,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Ar,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new E,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new E),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Ar,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new E,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new E),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,n){let i=null,r=null,a=null;const s=this._targetRay,o=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==s&&(i=e.getPose(t.targetRaySpace,n),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(Tr))),l&&t.hand){a=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,n);if(void 0===l.joints[i.jointName]){const t=new Ar;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[i.jointName]=t,l.add(t)}const r=l.joints[i.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=i.position.distanceTo(r.position),o=.02,h=.005;l.inputState.pinching&&s>o+h?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&s<=o-h&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}}class Lr extends i{constructor(t,e){super();const n=this,i=t.state;let r=null,a=1,s=null,o="local-floor",l=null,h=null,c=null,u=null,d=null,p=!1,f=null,m=null,g=null,v=null,y=null,b=null;const _=[],w=new Map,M=new ze;M.layers.enable(1),M.viewport=new x;const S=new ze;S.layers.enable(2),S.viewport=new x;const A=[M,S],T=new Sr;T.layers.enable(1),T.layers.enable(2);let C=null,L=null;function R(t){const e=w.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function P(){w.forEach((function(t,e){t.disconnect(e)})),w.clear(),C=null,L=null,i.bindXRFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),c&&e.deleteFramebuffer(c),f&&e.deleteFramebuffer(f),m&&e.deleteRenderbuffer(m),g&&e.deleteRenderbuffer(g),c=null,f=null,m=null,g=null,d=null,u=null,h=null,r=null,k.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function D(t){const e=r.inputSources;for(let t=0;t<_.length;t++)w.set(e[t],_[t]);for(let e=0;e<t.removed.length;e++){const n=t.removed[e],i=w.get(n);i&&(i.dispatchEvent({type:"disconnected",data:n}),w.delete(n))}for(let e=0;e<t.added.length;e++){const n=t.added[e],i=w.get(n);i&&i.dispatchEvent({type:"connected",data:n})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=_[t];return void 0===e&&(e=new Cr,_[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=_[t];return void 0===e&&(e=new Cr,_[t]=e),e.getGripSpace()},this.getHand=function(t){let e=_[t];return void 0===e&&(e=new Cr,_[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){a=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){o=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return h},this.getFrame=function(){return v},this.getSession=function(){return r},this.setSession=async function(t){if(r=t,null!==r){r.addEventListener("select",R),r.addEventListener("selectstart",R),r.addEventListener("selectend",R),r.addEventListener("squeeze",R),r.addEventListener("squeezestart",R),r.addEventListener("squeezeend",R),r.addEventListener("end",P),r.addEventListener("inputsourceschange",D);const t=e.getContextAttributes();if(!0!==t.xrCompatible&&await e.makeXRCompatible(),void 0===r.renderState.layers){const n={antialias:t.antialias,alpha:t.alpha,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:a};d=new XRWebGLLayer(r,e,n),r.updateRenderState({baseLayer:d})}else if(e instanceof WebGLRenderingContext){const n={antialias:!0,alpha:t.alpha,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:a};d=new XRWebGLLayer(r,e,n),r.updateRenderState({layers:[d]})}else{p=t.antialias;let n=null;t.depth&&(b=256,t.stencil&&(b|=1024),y=t.stencil?33306:36096,n=t.stencil?35056:33190);const s={colorFormat:t.alpha?32856:32849,depthFormat:n,scaleFactor:a};h=new XRWebGLBinding(r,e),u=h.createProjectionLayer(s),c=e.createFramebuffer(),r.updateRenderState({layers:[u]}),p&&(f=e.createFramebuffer(),m=e.createRenderbuffer(),e.bindRenderbuffer(36161,m),e.renderbufferStorageMultisample(36161,4,32856,u.textureWidth,u.textureHeight),i.bindFramebuffer(36160,f),e.framebufferRenderbuffer(36160,36064,36161,m),e.bindRenderbuffer(36161,null),null!==n&&(g=e.createRenderbuffer(),e.bindRenderbuffer(36161,g),e.renderbufferStorageMultisample(36161,4,n,u.textureWidth,u.textureHeight),e.framebufferRenderbuffer(36160,y,36161,g),e.bindRenderbuffer(36161,null)),i.bindFramebuffer(36160,null))}s=await r.requestReferenceSpace(o),k.setContext(r),k.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};const I=new E,z=new E;function N(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===r)return;T.near=S.near=M.near=t.near,T.far=S.far=M.far=t.far,C===T.near&&L===T.far||(r.updateRenderState({depthNear:T.near,depthFar:T.far}),C=T.near,L=T.far);const e=t.parent,n=T.cameras;N(T,e);for(let t=0;t<n.length;t++)N(n[t],e);T.matrixWorld.decompose(T.position,T.quaternion,T.scale),t.position.copy(T.position),t.quaternion.copy(T.quaternion),t.scale.copy(T.scale),t.matrix.copy(T.matrix),t.matrixWorld.copy(T.matrixWorld);const i=t.children;for(let t=0,e=i.length;t<e;t++)i[t].updateMatrixWorld(!0);2===n.length?function(t,e,n){I.setFromMatrixPosition(e.matrixWorld),z.setFromMatrixPosition(n.matrixWorld);const i=I.distanceTo(z),r=e.projectionMatrix.elements,a=n.projectionMatrix.elements,s=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],h=(r[9]-1)/r[5],c=(r[8]-1)/r[0],u=(a[8]+1)/a[0],d=s*c,p=s*u,f=i/(-c+u),m=f*-c;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=s+f,v=o+f,y=d-m,b=p+(i-m),x=l*o/v*g,_=h*o/v*g;t.projectionMatrix.makePerspective(y,b,x,_,g,v)}(T,M,S):T.projectionMatrix.copy(M.projectionMatrix)},this.getCamera=function(){return T},this.getFoveation=function(){return null!==u?u.fixedFoveation:null!==d?d.fixedFoveation:void 0},this.setFoveation=function(t){null!==u&&(u.fixedFoveation=t),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=t)};let B=null;const k=new je;k.setAnimationLoop((function(t,n){if(l=n.getViewerPose(s),v=n,null!==l){const t=l.views;null!==d&&i.bindXRFramebuffer(d.framebuffer);let n=!1;t.length!==T.cameras.length&&(T.cameras.length=0,n=!0);for(let r=0;r<t.length;r++){const a=t[r];let s=null;if(null!==d)s=d.getViewport(a);else{const t=h.getViewSubImage(u,a);i.bindXRFramebuffer(c),void 0!==t.depthStencilTexture&&e.framebufferTexture2D(36160,y,3553,t.depthStencilTexture,0),e.framebufferTexture2D(36160,36064,3553,t.colorTexture,0),s=t.viewport}const o=A[r];o.matrix.fromArray(a.transform.matrix),o.projectionMatrix.fromArray(a.projectionMatrix),o.viewport.set(s.x,s.y,s.width,s.height),0===r&&T.matrix.copy(o.matrix),!0===n&&T.cameras.push(o)}p&&(i.bindXRFramebuffer(f),null!==b&&e.clear(b))}const a=r.inputSources;for(let t=0;t<_.length;t++){const e=_[t],i=a[t];e.update(i,n,s)}if(B&&B(t,n),p){const t=u.textureWidth,n=u.textureHeight;i.bindFramebuffer(36008,f),i.bindFramebuffer(36009,c),e.invalidateFramebuffer(36008,[y]),e.invalidateFramebuffer(36009,[y]),e.blitFramebuffer(0,0,t,n,0,0,t,n,16384,9728),e.invalidateFramebuffer(36008,[36064]),i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,null),i.bindFramebuffer(36160,f)}v=null})),this.setAnimationLoop=function(t){B=t},this.dispose=function(){}}}function Rr(t){function e(e,n){e.opacity.value=n.opacity,n.color&&e.diffuse.value.copy(n.color),n.emissive&&e.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(e.map.value=n.map),n.alphaMap&&(e.alphaMap.value=n.alphaMap),n.specularMap&&(e.specularMap.value=n.specularMap),n.alphaTest>0&&(e.alphaTest.value=n.alphaTest);const i=t.get(n).envMap;if(i){e.envMap.value=i,e.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,e.reflectivity.value=n.reflectivity,e.ior.value=n.ior,e.refractionRatio.value=n.refractionRatio;const r=t.get(i).__maxMipLevel;void 0!==r&&(e.maxMipLevel.value=r)}let r,a;n.lightMap&&(e.lightMap.value=n.lightMap,e.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(e.aoMap.value=n.aoMap,e.aoMapIntensity.value=n.aoMapIntensity),n.map?r=n.map:n.specularMap?r=n.specularMap:n.displacementMap?r=n.displacementMap:n.normalMap?r=n.normalMap:n.bumpMap?r=n.bumpMap:n.roughnessMap?r=n.roughnessMap:n.metalnessMap?r=n.metalnessMap:n.alphaMap?r=n.alphaMap:n.emissiveMap?r=n.emissiveMap:n.clearcoatMap?r=n.clearcoatMap:n.clearcoatNormalMap?r=n.clearcoatNormalMap:n.clearcoatRoughnessMap?r=n.clearcoatRoughnessMap:n.specularIntensityMap?r=n.specularIntensityMap:n.specularTintMap?r=n.specularTintMap:n.transmissionMap?r=n.transmissionMap:n.thicknessMap&&(r=n.thicknessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix)),n.aoMap?a=n.aoMap:n.lightMap&&(a=n.lightMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),e.uv2Transform.value.copy(a.matrix))}function n(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(e.emissiveMap.value=n.emissiveMap),n.bumpMap&&(e.bumpMap.value=n.bumpMap,e.bumpScale.value=n.bumpScale,1===n.side&&(e.bumpScale.value*=-1)),n.normalMap&&(e.normalMap.value=n.normalMap,e.normalScale.value.copy(n.normalScale),1===n.side&&e.normalScale.value.negate()),n.displacementMap&&(e.displacementMap.value=n.displacementMap,e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias);t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,i,r,a,s){i.isMeshBasicMaterial?e(t,i):i.isMeshLambertMaterial?(e(t,i),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,i)):i.isMeshToonMaterial?(e(t,i),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap);e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshPhongMaterial?(e(t,i),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshStandardMaterial?(e(t,i),i.isMeshPhysicalMaterial?function(t,e,i){n(t,e),t.ior.value=e.ior,e.sheenTint&&t.sheenTint.value.copy(e.sheenTint);e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate()));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap),t.attenuationDistance.value=e.attenuationDistance,t.attenuationTint.value.copy(e.attenuationTint));t.specularIntensity.value=e.specularIntensity,t.specularTint.value.copy(e.specularTint),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap);e.specularTintMap&&(t.specularTintMap.value=e.specularTintMap)}(t,i,s):n(t,i)):i.isMeshMatcapMaterial?(e(t,i),function(t,e){e.matcap&&(t.matcap.value=e.matcap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshDepthMaterial?(e(t,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshDistanceMaterial?(e(t,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,i)):i.isMeshNormalMaterial?(e(t,i),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,i),i.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,i)):i.isPointsMaterial?function(t,e,n,i){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*i,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let r;e.map?r=e.map:e.alphaMap&&(r=e.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,i,r,a):i.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let n;e.map?n=e.map:e.alphaMap&&(n=e.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(t,i):i.isShadowMaterial?(t.color.value.copy(i.color),t.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function Pr(t={}){const e=void 0!==t.canvas?t.canvas:function(){const t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.style.display="block",t}(),n=void 0!==t.context?t.context:null,i=void 0!==t.alpha&&t.alpha,r=void 0===t.depth||t.depth,a=void 0===t.stencil||t.stencil,s=void 0!==t.antialias&&t.antialias,o=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,h=void 0!==t.powerPreference?t.powerPreference:"default",c=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let u=null,d=null;const p=[],f=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const m=this;let g=!1,v=0,y=0,b=null,M=-1,S=null;const A=new x,T=new x;let C=null,L=e.width,R=e.height,P=1,D=null,I=null;const z=new x(0,0,L,R),N=new x(0,0,L,R);let B=!1;const k=[],O=new We;let F=!1,U=!1,H=null;const V=new et,G=new E,W={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function j(){return null===b?P:1}let q,X,Y,J,Z,$,Q,K,tt,nt,it,rt,at,st,ot,lt,ht,ct,ut,dt,pt,ft,mt,gt=n;function vt(t,n){for(let i=0;i<t.length;i++){const r=t[i],a=e.getContext(r,n);if(null!==a)return a}return null}try{const t={alpha:i,depth:r,stencil:a,antialias:s,premultipliedAlpha:o,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:c};if(e.addEventListener("webglcontextlost",xt,!1),e.addEventListener("webglcontextrestored",_t,!1),null===gt){const e=["webgl2","webgl","experimental-webgl"];if(!0===m.isWebGL1Renderer&&e.shift(),gt=vt(e,t),null===gt)throw vt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===gt.getShaderPrecisionFormat&&(gt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function yt(){q=new Ln(gt),X=new tn(gt,q,t),q.init(X),ft=new Er(gt,q,X),Y=new wr(gt,q,X),k[0]=1029,J=new Dn(gt),Z=new lr,$=new Mr(gt,q,Y,Z,X,ft,J),Q=new nn(m),K=new Cn(m),tt=new qe(gt,X),mt=new Qe(gt,q,tt,X),nt=new Rn(gt,tt,J,mt),it=new Bn(gt,nt,tt,J),ut=new Nn(gt),lt=new en(Z),rt=new or(m,Q,K,q,X,mt,lt),at=new Rr(Z),st=new dr(Z),ot=new yr(q,X),ct=new $e(m,Q,Y,it,o),ht=new _r(m,it,X),dt=new Ke(gt,q,J,X),pt=new Pn(gt,q,J,X),J.programs=rt.programs,m.capabilities=X,m.extensions=q,m.properties=Z,m.renderLists=st,m.shadowMap=ht,m.state=Y,m.info=J}yt();const bt=new Lr(m,gt);function xt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function _t(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1;const t=J.autoReset,e=ht.enabled,n=ht.autoUpdate,i=ht.needsUpdate,r=ht.type;yt(),J.autoReset=t,ht.enabled=e,ht.autoUpdate=n,ht.needsUpdate=i,ht.type=r}function wt(t){const e=t.target;e.removeEventListener("dispose",wt),function(t){(function(t){const e=Z.get(t).programs;void 0!==e&&e.forEach((function(t){rt.releaseProgram(t)}))})(t),Z.remove(t)}(e)}this.xr=bt,this.getContext=function(){return gt},this.getContextAttributes=function(){return gt.getContextAttributes()},this.forceContextLoss=function(){const t=q.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=q.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(t){void 0!==t&&(P=t,this.setSize(L,R,!1))},this.getSize=function(t){return t.set(L,R)},this.setSize=function(t,n,i){bt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(L=t,R=n,e.width=Math.floor(t*P),e.height=Math.floor(n*P),!1!==i&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return t.set(L*P,R*P).floor()},this.setDrawingBufferSize=function(t,n,i){L=t,R=n,P=i,e.width=Math.floor(t*i),e.height=Math.floor(n*i),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return t.copy(A)},this.getViewport=function(t){return t.copy(z)},this.setViewport=function(t,e,n,i){t.isVector4?z.set(t.x,t.y,t.z,t.w):z.set(t,e,n,i),Y.viewport(A.copy(z).multiplyScalar(P).floor())},this.getScissor=function(t){return t.copy(N)},this.setScissor=function(t,e,n,i){t.isVector4?N.set(t.x,t.y,t.z,t.w):N.set(t,e,n,i),Y.scissor(T.copy(N).multiplyScalar(P).floor())},this.getScissorTest=function(){return B},this.setScissorTest=function(t){Y.setScissorTest(B=t)},this.setOpaqueSort=function(t){D=t},this.setTransparentSort=function(t){I=t},this.getClearColor=function(t){return t.copy(ct.getClearColor())},this.setClearColor=function(){ct.setClearColor.apply(ct,arguments)},this.getClearAlpha=function(){return ct.getClearAlpha()},this.setClearAlpha=function(){ct.setClearAlpha.apply(ct,arguments)},this.clear=function(t,e,n){let i=0;(void 0===t||t)&&(i|=16384),(void 0===e||e)&&(i|=256),(void 0===n||n)&&(i|=1024),gt.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",xt,!1),e.removeEventListener("webglcontextrestored",_t,!1),st.dispose(),ot.dispose(),Z.dispose(),Q.dispose(),K.dispose(),it.dispose(),mt.dispose(),bt.dispose(),bt.removeEventListener("sessionstart",Et),bt.removeEventListener("sessionend",St),H&&(H.dispose(),H=null),At.stop()},this.renderBufferImmediate=function(t,e){mt.initAttributes();const n=Z.get(t);t.hasPositions&&!n.position&&(n.position=gt.createBuffer()),t.hasNormals&&!n.normal&&(n.normal=gt.createBuffer()),t.hasUvs&&!n.uv&&(n.uv=gt.createBuffer()),t.hasColors&&!n.color&&(n.color=gt.createBuffer());const i=e.getAttributes();t.hasPositions&&(gt.bindBuffer(34962,n.position),gt.bufferData(34962,t.positionArray,35048),mt.enableAttribute(i.position.location),gt.vertexAttribPointer(i.position.location,3,5126,!1,0,0)),t.hasNormals&&(gt.bindBuffer(34962,n.normal),gt.bufferData(34962,t.normalArray,35048),mt.enableAttribute(i.normal.location),gt.vertexAttribPointer(i.normal.location,3,5126,!1,0,0)),t.hasUvs&&(gt.bindBuffer(34962,n.uv),gt.bufferData(34962,t.uvArray,35048),mt.enableAttribute(i.uv.location),gt.vertexAttribPointer(i.uv.location,2,5126,!1,0,0)),t.hasColors&&(gt.bindBuffer(34962,n.color),gt.bufferData(34962,t.colorArray,35048),mt.enableAttribute(i.color.location),gt.vertexAttribPointer(i.color.location,3,5126,!1,0,0)),mt.disableUnusedAttributes(),gt.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,n,i,r,a){null===e&&(e=W);const s=r.isMesh&&r.matrixWorld.determinant()<0,o=Dt(t,e,i,r);Y.setMaterial(i,s);let l=n.index;const h=n.attributes.position;if(null===l){if(void 0===h||0===h.count)return}else if(0===l.count)return;let c,u=1;!0===i.wireframe&&(l=nt.getWireframeAttribute(n),u=2),void 0===n.morphAttributes.position&&void 0===n.morphAttributes.normal||ut.update(r,n,i,o),mt.setup(r,i,o,n,l);let d=dt;null!==l&&(c=tt.get(l),d=pt,d.setIndex(c));const p=null!==l?l.count:h.count,f=n.drawRange.start*u,m=n.drawRange.count*u,g=null!==a?a.start*u:0,v=null!==a?a.count*u:1/0,y=Math.max(f,g),b=Math.min(p,f+m,g+v)-1,x=Math.max(0,b-y+1);if(0!==x){if(r.isMesh)!0===i.wireframe?(Y.setLineWidth(i.wireframeLinewidth*j()),d.setMode(1)):d.setMode(4);else if(r.isLine){let t=i.linewidth;void 0===t&&(t=1),Y.setLineWidth(t*j()),r.isLineSegments?d.setMode(1):r.isLineLoop?d.setMode(2):d.setMode(3)}else r.isPoints?d.setMode(0):r.isSprite&&d.setMode(4);if(r.isInstancedMesh)d.renderInstances(y,x,r.count);else if(n.isInstancedBufferGeometry){const t=Math.min(n.instanceCount,n._maxInstanceCount);d.renderInstances(y,x,t)}else d.render(y,x)}},this.compile=function(t,e){d=ot.get(t),d.init(),f.push(d),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(d.pushLight(t),t.castShadow&&d.pushShadow(t))})),d.setupLights(m.physicallyCorrectLights),t.traverse((function(e){const n=e.material;if(n)if(Array.isArray(n))for(let i=0;i<n.length;i++){Rt(n[i],t,e)}else Rt(n,t,e)})),f.pop(),d=null};let Mt=null;function Et(){At.stop()}function St(){At.start()}const At=new je;function Tt(t,e,n,i){const r=t.opaque,a=t.transmissive,o=t.transparent;d.setupLightsView(n),a.length>0&&function(t,e,n){if(null===H){const t=!0===s&&!0===X.isWebGL2;H=new(t?w:_)(1024,1024,{generateMipmaps:!0,type:null!==ft.convert(1016)?1016:1009,minFilter:1008,magFilter:1003,wrapS:1001,wrapT:1001})}const i=m.getRenderTarget();m.setRenderTarget(H),m.clear();const r=m.toneMapping;m.toneMapping=0,Ct(t,e,n),m.toneMapping=r,$.updateMultisampleRenderTarget(H),$.updateRenderTargetMipmap(H),m.setRenderTarget(i)}(r,e,n),i&&Y.viewport(A.copy(i)),r.length>0&&Ct(r,e,n),a.length>0&&Ct(a,e,n),o.length>0&&Ct(o,e,n)}function Ct(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,a=t.length;r<a;r++){const a=t[r],s=a.object,o=a.geometry,l=null===i?a.material:i,h=a.group;s.layers.test(n.layers)&&Lt(s,e,n,o,l,h)}}function Lt(t,e,n,i,r,a){if(t.onBeforeRender(m,e,n,i,r,a),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){const i=Dt(n,e,r,t);Y.setMaterial(r),mt.reset(),function(t,e){t.render((function(t){m.renderBufferImmediate(t,e)}))}(t,i)}else!0===r.transparent&&2===r.side?(r.side=1,r.needsUpdate=!0,m.renderBufferDirect(n,e,i,r,t,a),r.side=0,r.needsUpdate=!0,m.renderBufferDirect(n,e,i,r,t,a),r.side=2):m.renderBufferDirect(n,e,i,r,t,a);t.onAfterRender(m,e,n,i,r,a)}function Rt(t,e,n){!0!==e.isScene&&(e=W);const i=Z.get(t),r=d.state.lights,a=d.state.shadowsArray,s=r.state.version,o=rt.getParameters(t,r.state,a,e,n),l=rt.getProgramCacheKey(o);let h=i.programs;i.environment=t.isMeshStandardMaterial?e.environment:null,i.fog=e.fog,i.envMap=(t.isMeshStandardMaterial?K:Q).get(t.envMap||i.environment),void 0===h&&(t.addEventListener("dispose",wt),h=new Map,i.programs=h);let c=h.get(l);if(void 0!==c){if(i.currentProgram===c&&i.lightsStateVersion===s)return Pt(t,o),c}else o.uniforms=rt.getUniforms(t),t.onBuild(o,m),t.onBeforeCompile(o,m),c=rt.acquireProgram(o,l),h.set(l,c),i.uniforms=o.uniforms;const u=i.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(u.clippingPlanes=lt.uniform),Pt(t,o),i.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),i.lightsStateVersion=s,i.needsLights&&(u.ambientLightColor.value=r.state.ambient,u.lightProbe.value=r.state.probe,u.directionalLights.value=r.state.directional,u.directionalLightShadows.value=r.state.directionalShadow,u.spotLights.value=r.state.spot,u.spotLightShadows.value=r.state.spotShadow,u.rectAreaLights.value=r.state.rectArea,u.ltc_1.value=r.state.rectAreaLTC1,u.ltc_2.value=r.state.rectAreaLTC2,u.pointLights.value=r.state.point,u.pointLightShadows.value=r.state.pointShadow,u.hemisphereLights.value=r.state.hemi,u.directionalShadowMap.value=r.state.directionalShadowMap,u.directionalShadowMatrix.value=r.state.directionalShadowMatrix,u.spotShadowMap.value=r.state.spotShadowMap,u.spotShadowMatrix.value=r.state.spotShadowMatrix,u.pointShadowMap.value=r.state.pointShadowMap,u.pointShadowMatrix.value=r.state.pointShadowMatrix);const p=c.getUniforms(),f=Ui.seqWithValue(p.seq,u);return i.currentProgram=c,i.uniformsList=f,c}function Pt(t,e){const n=Z.get(t);n.outputEncoding=e.outputEncoding,n.instancing=e.instancing,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents}function Dt(t,e,n,i){!0!==e.isScene&&(e=W),$.resetTextureUnits();const r=e.fog,a=n.isMeshStandardMaterial?e.environment:null,s=null===b?m.outputEncoding:b.texture.encoding,o=(n.isMeshStandardMaterial?K:Q).get(n.envMap||a),l=!0===n.vertexColors&&!!i.geometry&&!!i.geometry.attributes.color&&4===i.geometry.attributes.color.itemSize,h=!!i.geometry&&!!i.geometry.attributes.tangent,c=!!i.geometry&&!!i.geometry.morphAttributes.position,u=!!i.geometry&&!!i.geometry.morphAttributes.normal,p=Z.get(n),f=d.state.lights;if(!0===F&&(!0===U||t!==S)){const e=t===S&&n.id===M;lt.setState(n,t,e)}let g=!1;n.version===p.__version?p.needsLights&&p.lightsStateVersion!==f.state.version||p.outputEncoding!==s||i.isInstancedMesh&&!1===p.instancing?g=!0:i.isInstancedMesh||!0!==p.instancing?i.isSkinnedMesh&&!1===p.skinning?g=!0:i.isSkinnedMesh||!0!==p.skinning?p.envMap!==o||n.fog&&p.fog!==r?g=!0:void 0===p.numClippingPlanes||p.numClippingPlanes===lt.numPlanes&&p.numIntersection===lt.numIntersection?(p.vertexAlphas!==l||p.vertexTangents!==h||p.morphTargets!==c||p.morphNormals!==u)&&(g=!0):g=!0:g=!0:g=!0:(g=!0,p.__version=n.version);let v=p.currentProgram;!0===g&&(v=Rt(n,e,i));let y=!1,x=!1,_=!1;const w=v.getUniforms(),E=p.uniforms;if(Y.useProgram(v.program)&&(y=!0,x=!0,_=!0),n.id!==M&&(M=n.id,x=!0),y||S!==t){if(w.setValue(gt,"projectionMatrix",t.projectionMatrix),X.logarithmicDepthBuffer&&w.setValue(gt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),S!==t&&(S=t,x=!0,_=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){const e=w.map.cameraPosition;void 0!==e&&e.setValue(gt,G.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&w.setValue(gt,"isOrthographic",!0===t.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||i.isSkinnedMesh)&&w.setValue(gt,"viewMatrix",t.matrixWorldInverse)}if(i.isSkinnedMesh){w.setOptional(gt,i,"bindMatrix"),w.setOptional(gt,i,"bindMatrixInverse");const t=i.skeleton;t&&(X.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),w.setValue(gt,"boneTexture",t.boneTexture,$),w.setValue(gt,"boneTextureSize",t.boneTextureSize)):w.setOptional(gt,t,"boneMatrices"))}var A,T;return(x||p.receiveShadow!==i.receiveShadow)&&(p.receiveShadow=i.receiveShadow,w.setValue(gt,"receiveShadow",i.receiveShadow)),x&&(w.setValue(gt,"toneMappingExposure",m.toneMappingExposure),p.needsLights&&(T=_,(A=E).ambientLightColor.needsUpdate=T,A.lightProbe.needsUpdate=T,A.directionalLights.needsUpdate=T,A.directionalLightShadows.needsUpdate=T,A.pointLights.needsUpdate=T,A.pointLightShadows.needsUpdate=T,A.spotLights.needsUpdate=T,A.spotLightShadows.needsUpdate=T,A.rectAreaLights.needsUpdate=T,A.hemisphereLights.needsUpdate=T),r&&n.fog&&at.refreshFogUniforms(E,r),at.refreshMaterialUniforms(E,n,P,R,H),Ui.upload(gt,p.uniformsList,E,$)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(Ui.upload(gt,p.uniformsList,E,$),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&w.setValue(gt,"center",i.center),w.setValue(gt,"modelViewMatrix",i.modelViewMatrix),w.setValue(gt,"normalMatrix",i.normalMatrix),w.setValue(gt,"modelMatrix",i.matrixWorld),v}At.setAnimationLoop((function(t){Mt&&Mt(t)})),"undefined"!=typeof window&&At.setContext(window),this.setAnimationLoop=function(t){Mt=t,bt.setAnimationLoop(t),null===t?At.stop():At.start()},bt.addEventListener("sessionstart",Et),bt.addEventListener("sessionend",St),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===g)return;!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===bt.enabled&&!0===bt.isPresenting&&(!0===bt.cameraAutoUpdate&&bt.updateCamera(e),e=bt.getCamera()),!0===t.isScene&&t.onBeforeRender(m,t,e,b),d=ot.get(t,f.length),d.init(),f.push(d),V.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),O.setFromProjectionMatrix(V),U=this.localClippingEnabled,F=lt.init(this.clippingPlanes,U,e),u=st.get(t,p.length),u.init(),p.push(u),function t(e,n,i,r){if(!1===e.visible)return;if(e.layers.test(n.layers))if(e.isGroup)i=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(n);else if(e.isLight)d.pushLight(e),e.castShadow&&d.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||O.intersectsSprite(e)){r&&G.setFromMatrixPosition(e.matrixWorld).applyMatrix4(V);const t=it.update(e),n=e.material;n.visible&&u.push(e,t,n,i,G.z,null)}}else if(e.isImmediateRenderObject)r&&G.setFromMatrixPosition(e.matrixWorld).applyMatrix4(V),u.push(e,null,e.material,i,G.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==J.render.frame&&(e.skeleton.update(),e.skeleton.frame=J.render.frame),!e.frustumCulled||O.intersectsObject(e))){r&&G.setFromMatrixPosition(e.matrixWorld).applyMatrix4(V);const t=it.update(e),n=e.material;if(Array.isArray(n)){const r=t.groups;for(let a=0,s=r.length;a<s;a++){const s=r[a],o=n[s.materialIndex];o&&o.visible&&u.push(e,t,o,i,G.z,s)}}else n.visible&&u.push(e,t,n,i,G.z,null)}const a=e.children;for(let e=0,s=a.length;e<s;e++)t(a[e],n,i,r)}(t,e,0,m.sortObjects),u.finish(),!0===m.sortObjects&&u.sort(D,I),!0===F&&lt.beginShadows();const n=d.state.shadowsArray;if(ht.render(n,t,e),!0===F&&lt.endShadows(),!0===this.info.autoReset&&this.info.reset(),ct.render(u,t),d.setupLights(m.physicallyCorrectLights),e.isArrayCamera){const n=e.cameras;for(let e=0,i=n.length;e<i;e++){const i=n[e];Tt(u,t,i,i.viewport)}}else Tt(u,t,e);null!==b&&($.updateMultisampleRenderTarget(b),$.updateRenderTargetMipmap(b)),!0===t.isScene&&t.onAfterRender(m,t,e),Y.buffers.depth.setTest(!0),Y.buffers.depth.setMask(!0),Y.buffers.color.setMask(!0),Y.setPolygonOffset(!1),mt.resetDefaultState(),M=-1,S=null,f.pop(),d=f.length>0?f[f.length-1]:null,p.pop(),u=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return b},this.setRenderTarget=function(t,e=0,n=0){b=t,v=e,y=n,t&&void 0===Z.get(t).__webglFramebuffer&&$.setupRenderTarget(t);let i=null,r=!1,a=!1;if(t){const n=t.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(a=!0);const s=Z.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(i=s[e],r=!0):i=t.isWebGLMultisampleRenderTarget?Z.get(t).__webglMultisampledFramebuffer:s,A.copy(t.viewport),T.copy(t.scissor),C=t.scissorTest}else A.copy(z).multiplyScalar(P).floor(),T.copy(N).multiplyScalar(P).floor(),C=B;if(Y.bindFramebuffer(36160,i)&&X.drawBuffers){let e=!1;if(t)if(t.isWebGLMultipleRenderTargets){const n=t.texture;if(k.length!==n.length||36064!==k[0]){for(let t=0,e=n.length;t<e;t++)k[t]=36064+t;k.length=n.length,e=!0}}else 1===k.length&&36064===k[0]||(k[0]=36064,k.length=1,e=!0);else 1===k.length&&1029===k[0]||(k[0]=1029,k.length=1,e=!0);e&&(X.isWebGL2?gt.drawBuffers(k):q.get("WEBGL_draw_buffers").drawBuffersWEBGL(k))}if(Y.viewport(A),Y.scissor(T),Y.setScissorTest(C),r){const i=Z.get(t.texture);gt.framebufferTexture2D(36160,36064,34069+e,i.__webglTexture,n)}else if(a){const i=Z.get(t.texture),r=e||0;gt.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}M=-1},this.readRenderTargetPixels=function(t,e,n,i,r,a,s){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=Z.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){Y.bindFramebuffer(36160,o);try{const s=t.texture,o=s.format,l=s.type;if(1023!==o&&ft.convert(o)!==gt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const h=1016===l&&(q.has("EXT_color_buffer_half_float")||X.isWebGL2&&q.has("EXT_color_buffer_float"));if(!(1009===l||ft.convert(l)===gt.getParameter(35738)||1015===l&&(X.isWebGL2||q.has("OES_texture_float")||q.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===gt.checkFramebufferStatus(36160)?e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&gt.readPixels(e,n,i,r,ft.convert(o),ft.convert(l),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const t=null!==b?Z.get(b).__webglFramebuffer:null;Y.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),a=Math.floor(e.image.height*i);let s=ft.convert(e.format);X.isWebGL2&&(6407===s&&(s=32849),6408===s&&(s=32856)),$.setTexture2D(e,0),gt.copyTexImage2D(3553,n,s,t.x,t.y,r,a,0),Y.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i=0){const r=e.image.width,a=e.image.height,s=ft.convert(n.format),o=ft.convert(n.type);$.setTexture2D(n,0),gt.pixelStorei(37440,n.flipY),gt.pixelStorei(37441,n.premultiplyAlpha),gt.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?gt.texSubImage2D(3553,i,t.x,t.y,r,a,s,o,e.image.data):e.isCompressedTexture?gt.compressedTexSubImage2D(3553,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,s,e.mipmaps[0].data):gt.texSubImage2D(3553,i,t.x,t.y,s,o,e.image),0===i&&n.generateMipmaps&&gt.generateMipmap(3553),Y.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,i,r=0){if(m.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const a=t.max.x-t.min.x+1,s=t.max.y-t.min.y+1,o=t.max.z-t.min.z+1,l=ft.convert(i.format),h=ft.convert(i.type);let c;if(i.isDataTexture3D)$.setTexture3D(i,0),c=32879;else{if(!i.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");$.setTexture2DArray(i,0),c=35866}gt.pixelStorei(37440,i.flipY),gt.pixelStorei(37441,i.premultiplyAlpha),gt.pixelStorei(3317,i.unpackAlignment);const u=gt.getParameter(3314),d=gt.getParameter(32878),p=gt.getParameter(3316),f=gt.getParameter(3315),g=gt.getParameter(32877),v=n.isCompressedTexture?n.mipmaps[0]:n.image;gt.pixelStorei(3314,v.width),gt.pixelStorei(32878,v.height),gt.pixelStorei(3316,t.min.x),gt.pixelStorei(3315,t.min.y),gt.pixelStorei(32877,t.min.z),n.isDataTexture||n.isDataTexture3D?gt.texSubImage3D(c,r,e.x,e.y,e.z,a,s,o,l,h,v.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),gt.compressedTexSubImage3D(c,r,e.x,e.y,e.z,a,s,o,l,v.data)):gt.texSubImage3D(c,r,e.x,e.y,e.z,a,s,o,l,h,v),gt.pixelStorei(3314,u),gt.pixelStorei(32878,d),gt.pixelStorei(3316,p),gt.pixelStorei(3315,f),gt.pixelStorei(32877,g),0===r&&i.generateMipmaps&&gt.generateMipmap(c),Y.unbindTexture()},this.initTexture=function(t){$.setTexture2D(t,0),Y.unbindTexture()},this.resetState=function(){v=0,y=0,b=null,Y.reset(),mt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}(class extends Pr{}).prototype.isWebGL1Renderer=!0;class Dr{constructor(t,e=25e-5){this.name="",this.color=new qt(t),this.density=e}clone(){return new Dr(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}Dr.prototype.isFogExp2=!0;class Ir{constructor(t,e=1,n=1e3){this.name="",this.color=new qt(t),this.near=e,this.far=n}clone(){return new Ir(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}Ir.prototype.isFog=!0;class zr extends At{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}zr.prototype.isScene=!0;class Nr{constructor(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=o()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[n+i];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=o()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=o()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}Nr.prototype.isInterleavedBuffer=!0;const Br=new E;class kr{constructor(t,e,n,i=!1){this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)Br.x=this.getX(e),Br.y=this.getY(e),Br.z=this.getZ(e),Br.applyMatrix4(t),this.setXYZ(e,Br.x,Br.y,Br.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Br.x=this.getX(e),Br.y=this.getY(e),Br.z=this.getZ(e),Br.applyNormalMatrix(t),this.setXYZ(e,Br.x,Br.y,Br.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Br.x=this.getX(e),Br.y=this.getY(e),Br.z=this.getZ(e),Br.transformDirection(t),this.setXYZ(e,Br.x,Br.y,Br.z);return this}setX(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){return this.data.array[t*this.data.stride+this.offset]}getY(t){return this.data.array[t*this.data.stride+this.offset+1]}getZ(t){return this.data.array[t*this.data.stride+this.offset+2]}getW(t){return this.data.array[t*this.data.stride+this.offset+3]}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return new Zt(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new kr(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}kr.prototype.isInterleavedBufferAttribute=!0;class Or extends Ft{constructor(t){super(),this.type="SpriteMaterial",this.color=new qt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this}}let Fr;Or.prototype.isSpriteMaterial=!0;const Ur=new E,Hr=new E,Vr=new E,Gr=new p,Wr=new p,jr=new et,qr=new E,Xr=new E,Yr=new E,Jr=new p,Zr=new p,$r=new p;class Qr extends At{constructor(t){if(super(),this.type="Sprite",void 0===Fr){Fr=new le;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new Nr(t,5);Fr.setIndex([0,1,2,0,2,3]),Fr.setAttribute("position",new kr(e,3,0,!1)),Fr.setAttribute("uv",new kr(e,2,3,!1))}this.geometry=Fr,this.material=void 0!==t?t:new Or,this.center=new p(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Hr.setFromMatrixScale(this.matrixWorld),jr.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Vr.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Hr.multiplyScalar(-Vr.z);const n=this.material.rotation;let i,r;0!==n&&(r=Math.cos(n),i=Math.sin(n));const a=this.center;Kr(qr.set(-.5,-.5,0),Vr,a,Hr,i,r),Kr(Xr.set(.5,-.5,0),Vr,a,Hr,i,r),Kr(Yr.set(.5,.5,0),Vr,a,Hr,i,r),Jr.set(0,0),Zr.set(1,0),$r.set(1,1);let s=t.ray.intersectTriangle(qr,Xr,Yr,!1,Ur);if(null===s&&(Kr(Xr.set(-.5,.5,0),Vr,a,Hr,i,r),Zr.set(0,1),s=t.ray.intersectTriangle(qr,Yr,Xr,!1,Ur),null===s))return;const o=t.ray.origin.distanceTo(Ur);o<t.near||o>t.far||e.push({distance:o,point:Ur.clone(),uv:kt.getUV(Ur,qr,Xr,Yr,Jr,Zr,$r,new p),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function Kr(t,e,n,i,r,a){Gr.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(Wr.x=a*Gr.x-r*Gr.y,Wr.y=r*Gr.x+a*Gr.y):Wr.copy(Gr),t.copy(e),t.x+=Wr.x,t.y+=Wr.y,t.applyMatrix4(jr)}Qr.prototype.isSprite=!0;const ta=new E,ea=new x,na=new x,ia=new E,ra=new et;class aa extends Ae{constructor(t,e){super(t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new et,this.bindMatrixInverse=new et}copy(t){return super.copy(t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new x,e=this.geometry.attributes.skinWeight;for(let n=0,i=e.count;n<i;n++){t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.w=e.getW(n);const i=1/t.manhattanLength();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(t,e){const n=this.skeleton,i=this.geometry;ea.fromBufferAttribute(i.attributes.skinIndex,t),na.fromBufferAttribute(i.attributes.skinWeight,t),ta.fromBufferAttribute(i.attributes.position,t).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const i=na.getComponent(t);if(0!==i){const r=ea.getComponent(t);ra.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),e.addScaledVector(ia.copy(ta).applyMatrix4(ra),i)}}return e.applyMatrix4(this.bindMatrixInverse)}}aa.prototype.isSkinnedMesh=!0;class sa extends At{constructor(){super(),this.type="Bone"}}sa.prototype.isBone=!0;class oa extends y{constructor(t=null,e=1,n=1,i,r,a,s,o,l=1003,h=1003,c,u){super(null,a,s,o,l,h,i,r,c,u),this.image={data:t,width:e,height:n},this.magFilter=l,this.minFilter=h,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}oa.prototype.isDataTexture=!0;class la extends Zt{constructor(t,e,n,i=1){"number"==typeof n&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(t,e,n),this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}la.prototype.isInstancedBufferAttribute=!0;const ha=new et,ca=new et,ua=[],da=new Ae;class pa extends Ae{constructor(t,e,n){super(t,e),this.instanceMatrix=new la(new Float32Array(16*n),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(t){return super.copy(t),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}raycast(t,e){const n=this.matrixWorld,i=this.count;if(da.geometry=this.geometry,da.material=this.material,void 0!==da.material)for(let r=0;r<i;r++){this.getMatrixAt(r,ha),ca.multiplyMatrices(n,ha),da.matrixWorld=ca,da.raycast(t,ua);for(let t=0,n=ua.length;t<n;t++){const n=ua[t];n.instanceId=r,n.object=this,e.push(n)}ua.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new la(new Float32Array(3*this.instanceMatrix.count),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}pa.prototype.isInstancedMesh=!0;class fa extends Ft{constructor(t){super(),this.type="LineBasicMaterial",this.color=new qt(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this}}fa.prototype.isLineBasicMaterial=!0;const ma=new E,ga=new E,va=new et,ya=new tt,ba=new q;class xa extends At{constructor(t=new le,e=new fa){super(),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,i=e.count;t<i;t++)ma.fromBufferAttribute(e,t-1),ga.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=ma.distanceTo(ga);t.setAttribute("lineDistance",new Kt(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),ba.copy(n.boundingSphere),ba.applyMatrix4(i),ba.radius+=r,!1===t.ray.intersectsSphere(ba))return;va.copy(i).invert(),ya.copy(t.ray).applyMatrix4(va);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=new E,h=new E,c=new E,u=new E,d=this.isLineSegments?2:1;if(n.isBufferGeometry){const i=n.index,r=n.attributes.position;if(null!==i){for(let n=Math.max(0,a.start),s=Math.min(i.count,a.start+a.count)-1;n<s;n+=d){const a=i.getX(n),s=i.getX(n+1);l.fromBufferAttribute(r,a),h.fromBufferAttribute(r,s);if(ya.distanceSqToSegment(l,h,u,c)>o)continue;u.applyMatrix4(this.matrixWorld);const d=t.ray.origin.distanceTo(u);d<t.near||d>t.far||e.push({distance:d,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else{for(let n=Math.max(0,a.start),i=Math.min(r.count,a.start+a.count)-1;n<i;n+=d){l.fromBufferAttribute(r,n),h.fromBufferAttribute(r,n+1);if(ya.distanceSqToSegment(l,h,u,c)>o)continue;u.applyMatrix4(this.matrixWorld);const i=t.ray.origin.distanceTo(u);i<t.near||i>t.far||e.push({distance:i,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}xa.prototype.isLine=!0;const _a=new E,wa=new E;class Ma extends xa{constructor(t,e){super(t,e),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,i=e.count;t<i;t+=2)_a.fromBufferAttribute(e,t),wa.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+_a.distanceTo(wa);t.setAttribute("lineDistance",new Kt(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}Ma.prototype.isLineSegments=!0;class Ea extends xa{constructor(t,e){super(t,e),this.type="LineLoop"}}Ea.prototype.isLineLoop=!0;class Sa extends Ft{constructor(t){super(),this.type="PointsMaterial",this.color=new qt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this}}Sa.prototype.isPointsMaterial=!0;const Aa=new et,Ta=new tt,Ca=new q,La=new E;class Ra extends At{constructor(t=new le,e=new Sa){super(),this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Ca.copy(n.boundingSphere),Ca.applyMatrix4(i),Ca.radius+=r,!1===t.ray.intersectsSphere(Ca))return;Aa.copy(i).invert(),Ta.copy(t.ray).applyMatrix4(Aa);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s;if(n.isBufferGeometry){const r=n.index,s=n.attributes.position;if(null!==r){for(let n=Math.max(0,a.start),l=Math.min(r.count,a.start+a.count);n<l;n++){const a=r.getX(n);La.fromBufferAttribute(s,a),Pa(La,a,o,i,t,e,this)}}else{for(let n=Math.max(0,a.start),r=Math.min(s.count,a.start+a.count);n<r;n++)La.fromBufferAttribute(s,n),Pa(La,n,o,i,t,e,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function Pa(t,e,n,i,r,a,s){const o=Ta.distanceSqToPoint(t);if(o<n){const n=new E;Ta.closestPointToPoint(t,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:e,face:null,object:s})}}Ra.prototype.isPoints=!0;(class extends y{constructor(t,e,n,i,r,a,s,o,l){super(t,e,n,i,r,a,s,o,l),this.format=void 0!==s?s:1022,this.minFilter=void 0!==a?a:1006,this.magFilter=void 0!==r?r:1006,this.generateMipmaps=!1;const h=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){h.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}).prototype.isVideoTexture=!0;class Da extends y{constructor(t,e,n,i,r,a,s,o,l,h,c,u){super(null,a,s,o,l,h,i,r,c,u),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}Da.prototype.isCompressedTexture=!0;(class extends y{constructor(t,e,n,i,r,a,s,o,l){super(t,e,n,i,r,a,s,o,l),this.needsUpdate=!0}}).prototype.isCanvasTexture=!0;(class extends y{constructor(t,e,n,i,r,a,s,o,l,h){if(1026!==(h=void 0!==h?h:1026)&&1027!==h)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&1026===h&&(n=1012),void 0===n&&1027===h&&(n=1020),super(null,i,r,a,s,o,h,n,l),this.image={width:t,height:e},this.magFilter=void 0!==s?s:1003,this.minFilter=void 0!==o?o:1003,this.flipY=!1,this.generateMipmaps=!1}}).prototype.isDepthTexture=!0;class Ia extends le{constructor(t=1,e=1,n=1,i=8,r=1,a=!1,s=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:s,thetaLength:o};const l=this;i=Math.floor(i),r=Math.floor(r);const h=[],c=[],u=[],d=[];let f=0;const m=[],g=n/2;let v=0;function y(n){const r=f,a=new p,m=new E;let y=0;const b=!0===n?t:e,x=!0===n?1:-1;for(let t=1;t<=i;t++)c.push(0,g*x,0),u.push(0,x,0),d.push(.5,.5),f++;const _=f;for(let t=0;t<=i;t++){const e=t/i*o+s,n=Math.cos(e),r=Math.sin(e);m.x=b*r,m.y=g*x,m.z=b*n,c.push(m.x,m.y,m.z),u.push(0,x,0),a.x=.5*n+.5,a.y=.5*r*x+.5,d.push(a.x,a.y),f++}for(let t=0;t<i;t++){const e=r+t,i=_+t;!0===n?h.push(i,i+1,e):h.push(i+1,i,e),y+=3}l.addGroup(v,y,!0===n?1:2),v+=y}!function(){const a=new E,p=new E;let y=0;const b=(e-t)/n;for(let l=0;l<=r;l++){const h=[],v=l/r,y=v*(e-t)+t;for(let t=0;t<=i;t++){const e=t/i,r=e*o+s,l=Math.sin(r),m=Math.cos(r);p.x=y*l,p.y=-v*n+g,p.z=y*m,c.push(p.x,p.y,p.z),a.set(l,b,m).normalize(),u.push(a.x,a.y,a.z),d.push(e,1-v),h.push(f++)}m.push(h)}for(let t=0;t<i;t++)for(let e=0;e<r;e++){const n=m[e][t],i=m[e+1][t],r=m[e+1][t+1],a=m[e][t+1];h.push(n,i,a),h.push(i,r,a),y+=6}l.addGroup(v,y,0),v+=y}(),!1===a&&(t>0&&y(!0),e>0&&y(!1)),this.setIndex(h),this.setAttribute("position",new Kt(c,3)),this.setAttribute("normal",new Kt(u,3)),this.setAttribute("uv",new Kt(d,2))}static fromJSON(t){return new Ia(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class za extends Ia{constructor(t=1,e=1,n=8,i=1,r=!1,a=0,s=2*Math.PI){super(0,t,e,n,i,r,a,s),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:s}}static fromJSON(t){return new za(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}new E,new E,new E,new kt;class Na{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let a=1;a<=t;a++)n=this.getPoint(a/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let i=0;const r=n.length;let a;a=e||t*n[r-1];let s,o=0,l=r-1;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),s=n[i]-a,s<0)o=i+1;else{if(!(s>0)){l=i;break}l=i-1}if(i=l,n[i]===a)return i/(r-1);const h=n[i];return(i+(a-h)/(n[i+1]-h))/(r-1)}getTangent(t,e){let n=t-1e-4,i=t+1e-4;n<0&&(n=0),i>1&&(i=1);const r=this.getPoint(n),a=this.getPoint(i),s=e||(r.isVector2?new p:new E);return s.copy(a).sub(r).normalize(),s}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new E,i=[],r=[],a=[],s=new E,o=new et;for(let e=0;e<=t;e++){const n=e/t;i[e]=this.getTangentAt(n,new E),i[e].normalize()}r[0]=new E,a[0]=new E;let h=Number.MAX_VALUE;const c=Math.abs(i[0].x),u=Math.abs(i[0].y),d=Math.abs(i[0].z);c<=h&&(h=c,n.set(1,0,0)),u<=h&&(h=u,n.set(0,1,0)),d<=h&&n.set(0,0,1),s.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],s),a[0].crossVectors(i[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),a[e]=a[e-1].clone(),s.crossVectors(i[e-1],i[e]),s.length()>Number.EPSILON){s.normalize();const t=Math.acos(l(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(s,t))}a[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(l(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(s.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],e*n)),a[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:a}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Ba extends Na{constructor(t=0,e=0,n=1,i=1,r=0,a=2*Math.PI,s=!1,o=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(t,e){const n=e||new p,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const a=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=a?0:i),!0!==this.aClockwise||a||(r===i?r=-i:r-=i);const s=this.aStartAngle+t*r;let o=this.aX+this.xRadius*Math.cos(s),l=this.aY+this.yRadius*Math.sin(s);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=o-this.aX,i=l-this.aY;o=n*t-i*e+this.aX,l=n*e+i*t+this.aY}return n.set(o,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}Ba.prototype.isEllipseCurve=!0;class ka extends Ba{constructor(t,e,n,i,r,a){super(t,e,n,n,i,r,a),this.type="ArcCurve"}}function Oa(){let t=0,e=0,n=0,i=0;function r(r,a,s,o){t=r,e=s,n=-3*r+3*a-2*s-o,i=2*r-2*a+s+o}return{initCatmullRom:function(t,e,n,i,a){r(e,n,a*(n-t),a*(i-e))},initNonuniformCatmullRom:function(t,e,n,i,a,s,o){let l=(e-t)/a-(n-t)/(a+s)+(n-e)/s,h=(n-e)/s-(i-e)/(s+o)+(i-n)/o;l*=s,h*=s,r(e,n,l,h)},calc:function(r){const a=r*r;return t+e*r+n*a+i*(a*r)}}}ka.prototype.isArcCurve=!0;const Fa=new E,Ua=new Oa,Ha=new Oa,Va=new Oa;class Ga extends Na{constructor(t=[],e=!1,n="centripetal",i=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=i}getPoint(t,e=new E){const n=e,i=this.points,r=i.length,a=(r-(this.closed?0:1))*t;let s,o,l=Math.floor(a),h=a-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===h&&l===r-1&&(l=r-2,h=1),this.closed||l>0?s=i[(l-1)%r]:(Fa.subVectors(i[0],i[1]).add(i[0]),s=Fa);const c=i[l%r],u=i[(l+1)%r];if(this.closed||l+2<r?o=i[(l+2)%r]:(Fa.subVectors(i[r-1],i[r-2]).add(i[r-1]),o=Fa),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(s.distanceToSquared(c),t),n=Math.pow(c.distanceToSquared(u),t),i=Math.pow(u.distanceToSquared(o),t);n<1e-4&&(n=1),e<1e-4&&(e=n),i<1e-4&&(i=n),Ua.initNonuniformCatmullRom(s.x,c.x,u.x,o.x,e,n,i),Ha.initNonuniformCatmullRom(s.y,c.y,u.y,o.y,e,n,i),Va.initNonuniformCatmullRom(s.z,c.z,u.z,o.z,e,n,i)}else"catmullrom"===this.curveType&&(Ua.initCatmullRom(s.x,c.x,u.x,o.x,this.tension),Ha.initCatmullRom(s.y,c.y,u.y,o.y,this.tension),Va.initCatmullRom(s.z,c.z,u.z,o.z,this.tension));return n.set(Ua.calc(h),Ha.calc(h),Va.calc(h)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new E).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Wa(t,e,n,i,r){const a=.5*(i-e),s=.5*(r-n),o=t*t;return(2*n-2*i+a+s)*(t*o)+(-3*n+3*i-2*a-s)*o+a*t+n}function ja(t,e,n,i){return function(t,e){const n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,i)}function qa(t,e,n,i,r){return function(t,e){const n=1-t;return n*n*n*e}(t,e)+function(t,e){const n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,i)+function(t,e){return t*t*t*e}(t,r)}Ga.prototype.isCatmullRomCurve3=!0;class Xa extends Na{constructor(t=new p,e=new p,n=new p,i=new p){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new p){const n=e,i=this.v0,r=this.v1,a=this.v2,s=this.v3;return n.set(qa(t,i.x,r.x,a.x,s.x),qa(t,i.y,r.y,a.y,s.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}Xa.prototype.isCubicBezierCurve=!0;class Ya extends Na{constructor(t=new E,e=new E,n=new E,i=new E){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new E){const n=e,i=this.v0,r=this.v1,a=this.v2,s=this.v3;return n.set(qa(t,i.x,r.x,a.x,s.x),qa(t,i.y,r.y,a.y,s.y),qa(t,i.z,r.z,a.z,s.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}Ya.prototype.isCubicBezierCurve3=!0;class Ja extends Na{constructor(t=new p,e=new p){super(),this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new p){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){const n=e||new p;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Ja.prototype.isLineCurve=!0;class Za extends Na{constructor(t=new p,e=new p,n=new p){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new p){const n=e,i=this.v0,r=this.v1,a=this.v2;return n.set(ja(t,i.x,r.x,a.x),ja(t,i.y,r.y,a.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Za.prototype.isQuadraticBezierCurve=!0;class $a extends Na{constructor(t=new E,e=new E,n=new E){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new E){const n=e,i=this.v0,r=this.v1,a=this.v2;return n.set(ja(t,i.x,r.x,a.x),ja(t,i.y,r.y,a.y),ja(t,i.z,r.z,a.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}$a.prototype.isQuadraticBezierCurve3=!0;class Qa extends Na{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,e=new p){const n=e,i=this.points,r=(i.length-1)*t,a=Math.floor(r),s=r-a,o=i[0===a?a:a-1],l=i[a],h=i[a>i.length-2?i.length-1:a+1],c=i[a>i.length-3?i.length-1:a+2];return n.set(Wa(s,o.x,l.x,h.x,c.x),Wa(s,o.y,l.y,h.y,c.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new p).fromArray(n))}return this}}Qa.prototype.isSplineCurve=!0;var Ka=Object.freeze({__proto__:null,ArcCurve:ka,CatmullRomCurve3:Ga,CubicBezierCurve:Xa,CubicBezierCurve3:Ya,EllipseCurve:Ba,LineCurve:Ja,LineCurve3:class extends Na{constructor(t=new E,e=new E){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=e}getPoint(t,e=new E){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:Za,QuadraticBezierCurve3:$a,SplineCurve:Qa});const ts=function(t,e,n=2){const i=e&&e.length,r=i?e[0]*n:t.length;let a=es(t,0,r,n,!0);const s=[];if(!a||a.next===a.prev)return s;let o,l,h,c,u,d,p;if(i&&(a=function(t,e,n,i){const r=[];let a,s,o,l,h;for(a=0,s=e.length;a<s;a++)o=e[a]*i,l=a<s-1?e[a+1]*i:t.length,h=es(t,o,l,i,!1),h===h.next&&(h.steiner=!0),r.push(ds(h));for(r.sort(ls),a=0;a<r.length;a++)hs(r[a],n),n=ns(n,n.next);return n}(t,e,a,n)),t.length>80*n){o=h=t[0],l=c=t[1];for(let e=n;e<r;e+=n)u=t[e],d=t[e+1],u<o&&(o=u),d<l&&(l=d),u>h&&(h=u),d>c&&(c=d);p=Math.max(h-o,c-l),p=0!==p?1/p:0}return is(a,s,n,o,l,p),s};function es(t,e,n,i,r){let a,s;if(r===function(t,e,n,i){let r=0;for(let a=e,s=n-i;a<n;a+=i)r+=(t[s]-t[a])*(t[a+1]+t[s+1]),s=a;return r}(t,e,n,i)>0)for(a=e;a<n;a+=i)s=ws(a,t[a],t[a+1],s);else for(a=n-i;a>=e;a-=i)s=ws(a,t[a],t[a+1],s);return s&&gs(s,s.next)&&(Ms(s),s=s.next),s}function ns(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!gs(i,i.next)&&0!==ms(i.prev,i,i.next))i=i.next;else{if(Ms(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function is(t,e,n,i,r,a,s){if(!t)return;!s&&a&&function(t,e,n,i){let r=t;do{null===r.z&&(r.z=us(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,n,i,r,a,s,o,l,h=1;do{for(n=t,t=null,a=null,s=0;n;){for(s++,i=n,o=0,e=0;e<h&&(o++,i=i.nextZ,i);e++);for(l=h;o>0||l>0&&i;)0!==o&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,o--):(r=i,i=i.nextZ,l--),a?a.nextZ=r:t=r,r.prevZ=a,a=r;n=i}a.nextZ=null,h*=2}while(s>1)}(r)}(t,i,r,a);let o,l,h=t;for(;t.prev!==t.next;)if(o=t.prev,l=t.next,a?as(t,i,r,a):rs(t))e.push(o.i/n),e.push(t.i/n),e.push(l.i/n),Ms(t),t=l.next,h=l.next;else if((t=l)===h){s?1===s?is(t=ss(ns(t),e,n),e,n,i,r,a,2):2===s&&os(t,e,n,i,r,a):is(ns(t),e,n,i,r,a,1);break}}function rs(t){const e=t.prev,n=t,i=t.next;if(ms(e,n,i)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(ps(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&ms(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function as(t,e,n,i){const r=t.prev,a=t,s=t.next;if(ms(r,a,s)>=0)return!1;const o=r.x<a.x?r.x<s.x?r.x:s.x:a.x<s.x?a.x:s.x,l=r.y<a.y?r.y<s.y?r.y:s.y:a.y<s.y?a.y:s.y,h=r.x>a.x?r.x>s.x?r.x:s.x:a.x>s.x?a.x:s.x,c=r.y>a.y?r.y>s.y?r.y:s.y:a.y>s.y?a.y:s.y,u=us(o,l,e,n,i),d=us(h,c,e,n,i);let p=t.prevZ,f=t.nextZ;for(;p&&p.z>=u&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&ps(r.x,r.y,a.x,a.y,s.x,s.y,p.x,p.y)&&ms(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&ps(r.x,r.y,a.x,a.y,s.x,s.y,f.x,f.y)&&ms(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&ps(r.x,r.y,a.x,a.y,s.x,s.y,p.x,p.y)&&ms(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&ps(r.x,r.y,a.x,a.y,s.x,s.y,f.x,f.y)&&ms(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function ss(t,e,n){let i=t;do{const r=i.prev,a=i.next.next;!gs(r,a)&&vs(r,i,i.next,a)&&xs(r,a)&&xs(a,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(a.i/n),Ms(i),Ms(i.next),i=t=a),i=i.next}while(i!==t);return ns(i)}function os(t,e,n,i,r,a){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&fs(s,t)){let o=_s(s,t);return s=ns(s,s.next),o=ns(o,o.next),is(s,e,n,i,r,a),void is(o,e,n,i,r,a)}t=t.next}s=s.next}while(s!==t)}function ls(t,e){return t.x-e.x}function hs(t,e){if(e=function(t,e){let n=e;const i=t.x,r=t.y;let a,s=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const t=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=i&&t>s){if(s=t,t===i){if(r===n.y)return n;if(r===n.next.y)return n.next}a=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!a)return null;if(i===s)return a;const o=a,l=a.x,h=a.y;let c,u=1/0;n=a;do{i>=n.x&&n.x>=l&&i!==n.x&&ps(r<h?i:s,r,l,h,r<h?s:i,r,n.x,n.y)&&(c=Math.abs(r-n.y)/(i-n.x),xs(n,t)&&(c<u||c===u&&(n.x>a.x||n.x===a.x&&cs(a,n)))&&(a=n,u=c)),n=n.next}while(n!==o);return a}(t,e)){const n=_s(e,t);ns(e,e.next),ns(n,n.next)}}function cs(t,e){return ms(t.prev,t,e.prev)<0&&ms(e.next,t,t.next)<0}function us(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ds(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function ps(t,e,n,i,r,a,s,o){return(r-s)*(e-o)-(t-s)*(a-o)>=0&&(t-s)*(i-o)-(n-s)*(e-o)>=0&&(n-s)*(a-o)-(r-s)*(i-o)>=0}function fs(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&vs(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(xs(t,e)&&xs(e,t)&&function(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,a=(t.y+e.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)&&(ms(t.prev,t,e.prev)||ms(t,e.prev,e))||gs(t,e)&&ms(t.prev,t,t.next)>0&&ms(e.prev,e,e.next)>0)}function ms(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function gs(t,e){return t.x===e.x&&t.y===e.y}function vs(t,e,n,i){const r=bs(ms(t,e,n)),a=bs(ms(t,e,i)),s=bs(ms(n,i,t)),o=bs(ms(n,i,e));return r!==a&&s!==o||(!(0!==r||!ys(t,n,e))||(!(0!==a||!ys(t,i,e))||(!(0!==s||!ys(n,t,i))||!(0!==o||!ys(n,e,i)))))}function ys(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function bs(t){return t>0?1:t<0?-1:0}function xs(t,e){return ms(t.prev,t,t.next)<0?ms(t,e,t.next)>=0&&ms(t,t.prev,e)>=0:ms(t,e,t.prev)<0||ms(t,t.next,e)<0}function _s(t,e){const n=new Es(t.i,t.x,t.y),i=new Es(e.i,e.x,e.y),r=t.next,a=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function ws(t,e,n,i){const r=new Es(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Ms(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Es(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Ss{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;r<e;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*n}static isClockWise(t){return Ss.area(t)<0}static triangulateShape(t,e){const n=[],i=[],r=[];As(t),Ts(n,t);let a=t.length;e.forEach(As);for(let t=0;t<e.length;t++)i.push(a),a+=e[t].length,Ts(n,e[t]);const s=ts(n,i);for(let t=0;t<s.length;t+=3)r.push(s.slice(t,t+3));return r}}function As(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Ts(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class Cs extends le{constructor(t,e){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,i=[],r=[];for(let e=0,n=t.length;e<n;e++){a(t[e])}function a(t){const a=[],s=void 0!==e.curveSegments?e.curveSegments:12,o=void 0!==e.steps?e.steps:1;let l=void 0!==e.depth?e.depth:100,h=void 0===e.bevelEnabled||e.bevelEnabled,c=void 0!==e.bevelThickness?e.bevelThickness:6,u=void 0!==e.bevelSize?e.bevelSize:c-2,d=void 0!==e.bevelOffset?e.bevelOffset:0,f=void 0!==e.bevelSegments?e.bevelSegments:3;const m=e.extrudePath,g=void 0!==e.UVGenerator?e.UVGenerator:Ls;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=e.amount);let v,y,b,x,_,w=!1;m&&(v=m.getSpacedPoints(o),w=!0,h=!1,y=m.computeFrenetFrames(o,!1),b=new E,x=new E,_=new E),h||(f=0,c=0,u=0,d=0);const M=t.extractPoints(s);let S=M.shape;const A=M.holes;if(!Ss.isClockWise(S)){S=S.reverse();for(let t=0,e=A.length;t<e;t++){const e=A[t];Ss.isClockWise(e)&&(A[t]=e.reverse())}}const T=Ss.triangulateShape(S,A),C=S;for(let t=0,e=A.length;t<e;t++){const e=A[t];S=S.concat(e)}function L(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}const R=S.length,P=T.length;function D(t,e,n){let i,r,a;const s=t.x-e.x,o=t.y-e.y,l=n.x-t.x,h=n.y-t.y,c=s*s+o*o,u=s*h-o*l;if(Math.abs(u)>Number.EPSILON){const u=Math.sqrt(c),d=Math.sqrt(l*l+h*h),f=e.x-o/u,m=e.y+s/u,g=((n.x-h/d-f)*h-(n.y+l/d-m)*l)/(s*h-o*l);i=f+s*g-t.x,r=m+o*g-t.y;const v=i*i+r*r;if(v<=2)return new p(i,r);a=Math.sqrt(v/2)}else{let t=!1;s>Number.EPSILON?l>Number.EPSILON&&(t=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(h)&&(t=!0),t?(i=-o,r=s,a=Math.sqrt(c)):(i=s,r=o,a=Math.sqrt(c/2))}return new p(i/a,r/a)}const I=[];for(let t=0,e=C.length,n=e-1,i=t+1;t<e;t++,n++,i++)n===e&&(n=0),i===e&&(i=0),I[t]=D(C[t],C[n],C[i]);const z=[];let N,B=I.concat();for(let t=0,e=A.length;t<e;t++){const e=A[t];N=[];for(let t=0,n=e.length,i=n-1,r=t+1;t<n;t++,i++,r++)i===n&&(i=0),r===n&&(r=0),N[t]=D(e[t],e[i],e[r]);z.push(N),B=B.concat(N)}for(let t=0;t<f;t++){const e=t/f,n=c*Math.cos(e*Math.PI/2),i=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=C.length;t<e;t++){const e=L(C[t],I[t],i);F(e.x,e.y,-n)}for(let t=0,e=A.length;t<e;t++){const e=A[t];N=z[t];for(let t=0,r=e.length;t<r;t++){const r=L(e[t],N[t],i);F(r.x,r.y,-n)}}}const k=u+d;for(let t=0;t<R;t++){const e=h?L(S[t],B[t],k):S[t];w?(x.copy(y.normals[0]).multiplyScalar(e.x),b.copy(y.binormals[0]).multiplyScalar(e.y),_.copy(v[0]).add(x).add(b),F(_.x,_.y,_.z)):F(e.x,e.y,0)}for(let t=1;t<=o;t++)for(let e=0;e<R;e++){const n=h?L(S[e],B[e],k):S[e];w?(x.copy(y.normals[t]).multiplyScalar(n.x),b.copy(y.binormals[t]).multiplyScalar(n.y),_.copy(v[t]).add(x).add(b),F(_.x,_.y,_.z)):F(n.x,n.y,l/o*t)}for(let t=f-1;t>=0;t--){const e=t/f,n=c*Math.cos(e*Math.PI/2),i=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=C.length;t<e;t++){const e=L(C[t],I[t],i);F(e.x,e.y,l+n)}for(let t=0,e=A.length;t<e;t++){const e=A[t];N=z[t];for(let t=0,r=e.length;t<r;t++){const r=L(e[t],N[t],i);w?F(r.x,r.y+v[o-1].y,v[o-1].x+n):F(r.x,r.y,l+n)}}}function O(t,e){let n=t.length;for(;--n>=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=o+2*f;t<n;t++){const n=R*t,a=R*(t+1);H(e+i+n,e+r+n,e+r+a,e+i+a)}}}function F(t,e,n){a.push(t),a.push(e),a.push(n)}function U(t,e,r){V(t),V(e),V(r);const a=i.length/3,s=g.generateTopUV(n,i,a-3,a-2,a-1);G(s[0]),G(s[1]),G(s[2])}function H(t,e,r,a){V(t),V(e),V(a),V(e),V(r),V(a);const s=i.length/3,o=g.generateSideWallUV(n,i,s-6,s-3,s-2,s-1);G(o[0]),G(o[1]),G(o[3]),G(o[1]),G(o[2]),G(o[3])}function V(t){i.push(a[3*t+0]),i.push(a[3*t+1]),i.push(a[3*t+2])}function G(t){r.push(t.x),r.push(t.y)}!function(){const t=i.length/3;if(h){let t=0,e=R*t;for(let t=0;t<P;t++){const n=T[t];U(n[2]+e,n[1]+e,n[0]+e)}t=o+2*f,e=R*t;for(let t=0;t<P;t++){const n=T[t];U(n[0]+e,n[1]+e,n[2]+e)}}else{for(let t=0;t<P;t++){const e=T[t];U(e[2],e[1],e[0])}for(let t=0;t<P;t++){const e=T[t];U(e[0]+R*o,e[1]+R*o,e[2]+R*o)}}n.addGroup(t,i.length/3-t,0)}(),function(){const t=i.length/3;let e=0;O(C,e),e+=C.length;for(let t=0,n=A.length;t<n;t++){const n=A[t];O(n,e),e+=n.length}n.addGroup(t,i.length/3-t,1)}()}this.setAttribute("position",new Kt(i,3)),this.setAttribute("uv",new Kt(r,2)),this.computeVertexNormals()}toJSON(){const t=super.toJSON();return function(t,e,n){if(n.shapes=[],Array.isArray(t))for(let e=0,i=t.length;e<i;e++){const i=t[e];n.shapes.push(i.uuid)}else n.shapes.push(t.uuid);void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}const i=t.options.extrudePath;return void 0!==i&&(t.options.extrudePath=(new Ka[i.type]).fromJSON(i)),new Cs(n,t.options)}}const Ls={generateTopUV:function(t,e,n,i,r){const a=e[3*n],s=e[3*n+1],o=e[3*i],l=e[3*i+1],h=e[3*r],c=e[3*r+1];return[new p(a,s),new p(o,l),new p(h,c)]},generateSideWallUV:function(t,e,n,i,r,a){const s=e[3*n],o=e[3*n+1],l=e[3*n+2],h=e[3*i],c=e[3*i+1],u=e[3*i+2],d=e[3*r],f=e[3*r+1],m=e[3*r+2],g=e[3*a],v=e[3*a+1],y=e[3*a+2];return Math.abs(o-c)<Math.abs(s-h)?[new p(s,1-l),new p(h,1-u),new p(d,1-m),new p(g,1-y)]:[new p(o,1-l),new p(c,1-u),new p(f,1-m),new p(v,1-y)]}};class Rs extends le{constructor(t,e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],i=[],r=[],a=[];let s=0,o=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(s,o,e),s+=o,o=0;function l(t){const s=i.length/3,l=t.extractPoints(e);let h=l.shape;const c=l.holes;!1===Ss.isClockWise(h)&&(h=h.reverse());for(let t=0,e=c.length;t<e;t++){const e=c[t];!0===Ss.isClockWise(e)&&(c[t]=e.reverse())}const u=Ss.triangulateShape(h,c);for(let t=0,e=c.length;t<e;t++){const e=c[t];h=h.concat(e)}for(let t=0,e=h.length;t<e;t++){const e=h[t];i.push(e.x,e.y,0),r.push(0,0,1),a.push(e.x,e.y)}for(let t=0,e=u.length;t<e;t++){const e=u[t],i=e[0]+s,r=e[1]+s,a=e[2]+s;n.push(i,r,a),o+=3}}this.setIndex(n),this.setAttribute("position",new Kt(i,3)),this.setAttribute("normal",new Kt(r,3)),this.setAttribute("uv",new Kt(a,2))}toJSON(){const t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,i=t.length;n<i;n++){const i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}return new Rs(n,t.curveSegments)}}class Ps extends le{constructor(t=1,e=32,n=16,i=0,r=2*Math.PI,a=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:s},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const o=Math.min(a+s,Math.PI);let l=0;const h=[],c=new E,u=new E,d=[],p=[],f=[],m=[];for(let d=0;d<=n;d++){const g=[],v=d/n;let y=0;0==d&&0==a?y=.5/e:d==n&&o==Math.PI&&(y=-.5/e);for(let n=0;n<=e;n++){const o=n/e;c.x=-t*Math.cos(i+o*r)*Math.sin(a+v*s),c.y=t*Math.cos(a+v*s),c.z=t*Math.sin(i+o*r)*Math.sin(a+v*s),p.push(c.x,c.y,c.z),u.copy(c).normalize(),f.push(u.x,u.y,u.z),m.push(o+y,1-v),g.push(l++)}h.push(g)}for(let t=0;t<n;t++)for(let i=0;i<e;i++){const e=h[t][i+1],r=h[t][i],s=h[t+1][i],l=h[t+1][i+1];(0!==t||a>0)&&d.push(e,r,l),(t!==n-1||o<Math.PI)&&d.push(r,s,l)}this.setIndex(d),this.setAttribute("position",new Kt(p,3)),this.setAttribute("normal",new Kt(f,3)),this.setAttribute("uv",new Kt(m,2))}static fromJSON(t){return new Ps(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class Ds extends le{constructor(t,e=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r};const a=t.computeFrenetFrames(e,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const s=new E,o=new E,l=new p;let h=new E;const c=[],u=[],d=[],f=[];function m(r){h=t.getPointAt(r/e,h);const l=a.normals[r],d=a.binormals[r];for(let t=0;t<=i;t++){const e=t/i*Math.PI*2,r=Math.sin(e),a=-Math.cos(e);o.x=a*l.x+r*d.x,o.y=a*l.y+r*d.y,o.z=a*l.z+r*d.z,o.normalize(),u.push(o.x,o.y,o.z),s.x=h.x+n*o.x,s.y=h.y+n*o.y,s.z=h.z+n*o.z,c.push(s.x,s.y,s.z)}}!function(){for(let t=0;t<e;t++)m(t);m(!1===r?e:0),function(){for(let t=0;t<=e;t++)for(let n=0;n<=i;n++)l.x=t/e,l.y=n/i,d.push(l.x,l.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=i;e++){const n=(i+1)*(t-1)+(e-1),r=(i+1)*t+(e-1),a=(i+1)*t+e,s=(i+1)*(t-1)+e;f.push(n,r,s),f.push(r,a,s)}}()}(),this.setIndex(f),this.setAttribute("position",new Kt(c,3)),this.setAttribute("normal",new Kt(u,3)),this.setAttribute("uv",new Kt(d,2))}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new Ds((new Ka[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class Is extends Ft{constructor(t){super(),this.type="ShadowMaterial",this.color=new qt(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}Is.prototype.isShadowMaterial=!0;class zs extends Ft{constructor(t){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new qt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new qt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new p(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}zs.prototype.isMeshStandardMaterial=!0;class Ns extends zs{constructor(t){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new p(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return l(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenTint=new qt(0),this.transmission=0,this.transmissionMap=null,this.thickness=.01,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationTint=new qt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularTint=new qt(1,1,1),this.specularTintMap=null,this._clearcoat=0,this._transmission=0,this.setValues(t)}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.sheenTint.copy(t.sheenTint),this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationTint.copy(t.attenuationTint),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularTint.copy(t.specularTint),this.specularTintMap=t.specularTintMap,this}}Ns.prototype.isMeshPhysicalMaterial=!0;class Bs extends Ft{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new qt(16777215),this.specular=new qt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new qt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new p(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}Bs.prototype.isMeshPhongMaterial=!0;class ks extends Ft{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new qt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new qt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new p(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}ks.prototype.isMeshToonMaterial=!0;class Os extends Ft{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new p(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}Os.prototype.isMeshNormalMaterial=!0;class Fs extends Ft{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new qt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new qt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Fs.prototype.isMeshLambertMaterial=!0;class Us extends Ft{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new qt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new p(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this}}Us.prototype.isMeshMatcapMaterial=!0;class Hs extends fa{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}Hs.prototype.isLineDashedMaterial=!0;const Vs={arraySlice:function(t,e,n){return Vs.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,n=new Array(e);for(let t=0;t!==e;++t)n[t]=t;return n.sort((function(e,n){return t[e]-t[n]})),n},sortedArray:function(t,e,n){const i=t.length,r=new t.constructor(i);for(let a=0,s=0;s!==i;++a){const i=n[a]*e;for(let n=0;n!==e;++n)r[s++]=t[i+n]}return r},flattenJSON:function(t,e,n,i){let r=1,a=t[0];for(;void 0!==a&&void 0===a[i];)a=t[r++];if(void 0===a)return;let s=a[i];if(void 0!==s)if(Array.isArray(s))do{s=a[i],void 0!==s&&(e.push(a.time),n.push.apply(n,s)),a=t[r++]}while(void 0!==a);else if(void 0!==s.toArray)do{s=a[i],void 0!==s&&(e.push(a.time),s.toArray(n,n.length)),a=t[r++]}while(void 0!==a);else do{s=a[i],void 0!==s&&(e.push(a.time),n.push(s)),a=t[r++]}while(void 0!==a)},subclip:function(t,e,n,i,r=30){const a=t.clone();a.name=e;const s=[];for(let t=0;t<a.tracks.length;++t){const e=a.tracks[t],o=e.getValueSize(),l=[],h=[];for(let t=0;t<e.times.length;++t){const a=e.times[t]*r;if(!(a<n||a>=i)){l.push(e.times[t]);for(let n=0;n<o;++n)h.push(e.values[t*o+n])}}0!==l.length&&(e.times=Vs.convertArray(l,e.times.constructor),e.values=Vs.convertArray(h,e.values.constructor),s.push(e))}a.tracks=s;let o=1/0;for(let t=0;t<a.tracks.length;++t)o>a.tracks[t].times[0]&&(o=a.tracks[t].times[0]);for(let t=0;t<a.tracks.length;++t)a.tracks[t].shift(-1*o);return a.resetDuration(),a},makeClipAdditive:function(t,e=0,n=t,i=30){i<=0&&(i=30);const r=n.tracks.length,a=e/i;for(let e=0;e<r;++e){const i=n.tracks[e],r=i.ValueTypeName;if("bool"===r||"string"===r)continue;const s=t.tracks.find((function(t){return t.name===i.name&&t.ValueTypeName===r}));if(void 0===s)continue;let o=0;const l=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(o=l/3);let h=0;const c=s.getValueSize();s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=c/3);const u=i.times.length-1;let d;if(a<=i.times[0]){const t=o,e=l-o;d=Vs.arraySlice(i.values,t,e)}else if(a>=i.times[u]){const t=u*l+o,e=t+l-o;d=Vs.arraySlice(i.values,t,e)}else{const t=i.createInterpolant(),e=o,n=l-o;t.evaluate(a),d=Vs.arraySlice(t.resultBuffer,e,n)}if("quaternion"===r){(new M).fromArray(d).normalize().conjugate().toArray(d)}const p=s.times.length;for(let t=0;t<p;++t){const e=t*c+h;if("quaternion"===r)M.multiplyQuaternionsFlat(s.values,e,d,0,s.values,e);else{const t=c-2*h;for(let n=0;n<t;++n)s.values[e+n]-=d[n]}}}return t.blendMode=2501,t}};class Gs{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{let a;n:{i:if(!(t<i)){for(let a=n+2;;){if(void 0===i){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,r)}if(n===a)break;if(r=i,i=e[++n],t<i)break e}a=e.length;break n}if(t>=r)break t;{const s=e[1];t<s&&(n=2,r=s);for(let a=n-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(n===a)break;if(i=r,r=e[--n-1],t>=r)break e}a=n,n=0}}for(;n<a;){const i=n+a>>>1;t<e[i]?a=i:n=i+1}if(i=e[n],r=e[n-1],void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(void 0===i)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,r,t)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i;for(let t=0;t!==i;++t)e[t]=n[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}Gs.prototype.beforeStart_=Gs.prototype.copySampleValue_,Gs.prototype.afterEnd_=Gs.prototype.copySampleValue_;class Ws extends Gs{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(t,e,n){const i=this.parameterPositions;let r=t-2,a=t+1,s=i[r],o=i[a];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:r=t,s=2*e-n;break;case 2402:r=i.length-2,s=e+i[r]-i[r+1];break;default:r=t,s=n}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:a=t,o=2*n-e;break;case 2402:a=1,o=n+i[1]-i[0];break;default:a=t-1,o=e}const l=.5*(n-e),h=this.valueSize;this._weightPrev=l/(e-s),this._weightNext=l/(o-n),this._offsetPrev=r*h,this._offsetNext=a*h}interpolate_(t,e,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=t*s,l=o-s,h=this._offsetPrev,c=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),f=p*p,m=f*p,g=-u*m+2*u*f-u*p,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,b=d*m-d*f;for(let t=0;t!==s;++t)r[t]=g*a[h+t]+v*a[l+t]+y*a[o+t]+b*a[c+t];return r}}class js extends Gs{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=t*s,l=o-s,h=(n-e)/(i-e),c=1-h;for(let t=0;t!==s;++t)r[t]=a[l+t]*c+a[o+t]*h;return r}}class qs extends Gs{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class Xs{constructor(t,e,n,i){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Vs.convertArray(e,this.TimeBufferType),this.values=Vs.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:Vs.convertArray(t.times,Array),values:Vs.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new qs(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new js(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Ws(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){const n=this.times,i=n.length;let r=0,a=i-1;for(;r!==i&&n[r]<t;)++r;for(;-1!==a&&n[a]>e;)--a;if(++a,0!==r||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);const t=this.getValueSize();this.times=Vs.arraySlice(n,r,a),this.values=Vs.arraySlice(this.values,r*t,a*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let e=0;e!==r;e++){const i=n[e];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==a&&a>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,a),t=!1;break}a=i}if(void 0!==i&&Vs.isTypedArray(i))for(let e=0,n=i.length;e!==n;++e){const n=i[e];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,n),t=!1;break}}return t}optimize(){const t=Vs.arraySlice(this.times),e=Vs.arraySlice(this.values),n=this.getValueSize(),i=2302===this.getInterpolation(),r=t.length-1;let a=1;for(let s=1;s<r;++s){let r=!1;const o=t[s];if(o!==t[s+1]&&(1!==s||o!==t[0]))if(i)r=!0;else{const t=s*n,i=t-n,a=t+n;for(let s=0;s!==n;++s){const n=e[t+s];if(n!==e[i+s]||n!==e[a+s]){r=!0;break}}}if(r){if(s!==a){t[a]=t[s];const i=s*n,r=a*n;for(let t=0;t!==n;++t)e[r+t]=e[i+t]}++a}}if(r>0){t[a]=t[r];for(let t=r*n,i=a*n,s=0;s!==n;++s)e[i+s]=e[t+s];++a}return a!==t.length?(this.times=Vs.arraySlice(t,0,a),this.values=Vs.arraySlice(e,0,a*n)):(this.times=t,this.values=e),this}clone(){const t=Vs.arraySlice(this.times,0),e=Vs.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}Xs.prototype.TimeBufferType=Float32Array,Xs.prototype.ValueBufferType=Float32Array,Xs.prototype.DefaultInterpolation=2301;class Ys extends Xs{}Ys.prototype.ValueTypeName="bool",Ys.prototype.ValueBufferType=Array,Ys.prototype.DefaultInterpolation=2300,Ys.prototype.InterpolantFactoryMethodLinear=void 0,Ys.prototype.InterpolantFactoryMethodSmooth=void 0;class Js extends Xs{}Js.prototype.ValueTypeName="color";class Zs extends Xs{}Zs.prototype.ValueTypeName="number";class $s extends Gs{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(n-e)/(i-e);let l=t*s;for(let t=l+s;l!==t;l+=4)M.slerpFlat(r,0,a,l-s,a,l,o);return r}}class Qs extends Xs{InterpolantFactoryMethodLinear(t){return new $s(this.times,this.values,this.getValueSize(),t)}}Qs.prototype.ValueTypeName="quaternion",Qs.prototype.DefaultInterpolation=2301,Qs.prototype.InterpolantFactoryMethodSmooth=void 0;class Ks extends Xs{}Ks.prototype.ValueTypeName="string",Ks.prototype.ValueBufferType=Array,Ks.prototype.DefaultInterpolation=2300,Ks.prototype.InterpolantFactoryMethodLinear=void 0,Ks.prototype.InterpolantFactoryMethodSmooth=void 0;class to extends Xs{}to.prototype.ValueTypeName="vector";class eo{constructor(t,e=-1,n,i=2500){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=o(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let t=0,r=n.length;t!==r;++t)e.push(no(n[t]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,i=n.length;t!==i;++t)e.push(Xs.toJSON(n[t]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,a=[];for(let t=0;t<r;t++){let s=[],o=[];s.push((t+r-1)%r,t,(t+1)%r),o.push(0,1,0);const l=Vs.getKeyframeOrder(s);s=Vs.sortedArray(s,1,l),o=Vs.sortedArray(o,1,l),i||0!==s[0]||(s.push(r),o.push(o[0])),a.push(new Zs(".morphTargetInfluences["+e[t].name+"]",s,o).scale(1/n))}return new this(t,-1,a)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const e=t;n=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,n=t.length;e<n;e++){const n=t[e],a=n.name.match(r);if(a&&a.length>1){const t=a[1];let e=i[t];e||(i[t]=e=[]),e.push(n)}}const a=[];for(const t in i)a.push(this.CreateFromMorphTargetSequence(t,i[t],e,n));return a}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,i,r){if(0!==n.length){const a=[],s=[];Vs.flattenJSON(n,a,s,i),0!==a.length&&r.push(new t(e,a,s))}},i=[],r=t.name||"default",a=t.fps||30,s=t.blendMode;let o=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const r=l[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let n=0;n<r[e].morphTargets.length;n++)t[r[e].morphTargets[n]]=-1;for(const n in t){const t=[],a=[];for(let i=0;i!==r[e].morphTargets.length;++i){const i=r[e];t.push(i.time),a.push(i.morphTarget===n?1:0)}i.push(new Zs(".morphTargetInfluence["+n+"]",t,a))}o=t.length*(a||1)}else{const a=".bones["+e[t].name+"]";n(to,a+".position",r,"pos",i),n(Qs,a+".quaternion",r,"rot",i),n(to,a+".scale",r,"scl",i)}}if(0===i.length)return null;return new this(r,o,i,s)}resetDuration(){let t=0;for(let e=0,n=this.tracks.length;e!==n;++e){const n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function no(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Zs;case"vector":case"vector2":case"vector3":case"vector4":return to;case"color":return Js;case"quaternion":return Qs;case"bool":case"boolean":return Ys;case"string":return Ks}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],n=[];Vs.flattenJSON(t.keys,e,n,"value"),t.times=e,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const io={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class ro{constructor(t,e,n){const i=this;let r=!1,a=0,s=0,o=void 0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){s++,!1===r&&void 0!==i.onStart&&i.onStart(t,a,s),r=!0},this.itemEnd=function(t){a++,void 0!==i.onProgress&&i.onProgress(t,a,s),a===s&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return o?o(t):t},this.setURLModifier=function(t){return o=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=l.length;e<n;e+=2){const n=l[e],i=l[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return i}return null}}}const ao=new ro;class so{constructor(t){this.manager=void 0!==t?t:ao,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise((function(i,r){n.load(t,i,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}const oo={};class lo extends so{constructor(t){super(t)}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,a=io.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;if(void 0!==oo[t])return void oo[t].push({onLoad:e,onProgress:n,onError:i});const s=t.match(/^data:(.*?)(;base64)?,(.*)$/);let o;if(s){const n=s[1],a=!!s[2];let o=s[3];o=decodeURIComponent(o),a&&(o=atob(o));try{let i;const a=(this.responseType||"").toLowerCase();switch(a){case"arraybuffer":case"blob":const t=new Uint8Array(o.length);for(let e=0;e<o.length;e++)t[e]=o.charCodeAt(e);i="blob"===a?new Blob([t.buffer],{type:n}):t.buffer;break;case"document":const e=new DOMParser;i=e.parseFromString(o,n);break;case"json":i=JSON.parse(o);break;default:i=o}setTimeout((function(){e&&e(i),r.manager.itemEnd(t)}),0)}catch(e){setTimeout((function(){i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}),0)}}else{oo[t]=[],oo[t].push({onLoad:e,onProgress:n,onError:i}),o=new XMLHttpRequest,o.open("GET",t,!0),o.addEventListener("load",(function(e){const n=this.response,i=oo[t];if(delete oo[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),io.add(t,n);for(let t=0,e=i.length;t<e;t++){const e=i[t];e.onLoad&&e.onLoad(n)}r.manager.itemEnd(t)}else{for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}}),!1),o.addEventListener("progress",(function(e){const n=oo[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onProgress&&i.onProgress(e)}}),!1),o.addEventListener("error",(function(e){const n=oo[t];delete oo[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),o.addEventListener("abort",(function(e){const n=oo[t];delete oo[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),void 0!==this.responseType&&(o.responseType=this.responseType),void 0!==this.withCredentials&&(o.withCredentials=this.withCredentials),o.overrideMimeType&&o.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(const t in this.requestHeader)o.setRequestHeader(t,this.requestHeader[t]);o.send(null)}return r.manager.itemStart(t),o}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class ho extends so{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,a=io.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;const s=document.createElementNS("http://www.w3.org/1999/xhtml","img");function o(){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1),io.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}return s.addEventListener("load",o,!1),s.addEventListener("error",l,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),r.manager.itemStart(t),s.src=t,s}}class co extends so{constructor(t){super(t)}load(t,e,n,i){const r=new Be,a=new ho(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let s=0;function o(n){a.load(t[n],(function(t){r.images[n]=t,s++,6===s&&(r.needsUpdate=!0,e&&e(r))}),void 0,i)}for(let e=0;e<t.length;++e)o(e);return r}}class uo extends so{constructor(t){super(t)}load(t,e,n,i){const r=new y,a=new ho(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,(function(n){r.image=n;const i=t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/);r.format=i?1022:1023,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}class po extends Na{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ja(e,t))}getPoint(t){const e=t*this.getLength(),n=this.getCurveLengths();let i=0;for(;i<n.length;){if(n[i]>=e){const t=n[i]-e,r=this.curves[i],a=r.getLength(),s=0===a?0:1-t/a;return r.getPointAt(s)}i++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const a=r[i],s=a&&a.isEllipseCurve?2*t:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?t*a.points.length:t,o=a.getPoints(s);for(let t=0;t<o.length;t++){const i=o[t];n&&n.equals(i)||(e.push(i),n=i)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push((new Ka[n.type]).fromJSON(n))}return this}}class fo extends po{constructor(t){super(),this.type="Path",this.currentPoint=new p,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new Ja(this.currentPoint.clone(),new p(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,i){const r=new Za(this.currentPoint.clone(),new p(t,e),new p(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(t,e,n,i,r,a){const s=new Xa(this.currentPoint.clone(),new p(t,e),new p(n,i),new p(r,a));return this.curves.push(s),this.currentPoint.set(r,a),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new Qa(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,i,r,a){const s=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+s,e+o,n,i,r,a),this}absarc(t,e,n,i,r,a){return this.absellipse(t,e,n,n,i,r,a),this}ellipse(t,e,n,i,r,a,s,o){const l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(t+l,e+h,n,i,r,a,s,o),this}absellipse(t,e,n,i,r,a,s,o){const l=new Ba(t,e,n,i,r,a,s,o);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const h=l.getPoint(1);return this.currentPoint.copy(h),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class mo extends fo{constructor(t){super(t),this.uuid=o(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push((new fo).fromJSON(n))}return this}}class go extends At{constructor(t,e=1){super(),this.type="Light",this.color=new qt(t),this.intensity=e}dispose(){}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}go.prototype.isLight=!0;class vo extends go{constructor(t,e,n){super(t,n),this.type="HemisphereLight",this.position.copy(At.DefaultUp),this.updateMatrix(),this.groundColor=new qt(e)}copy(t){return go.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}vo.prototype.isHemisphereLight=!0;const yo=new et,bo=new E,xo=new E;class _o{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new p(512,512),this.map=null,this.mapPass=null,this.matrix=new et,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new We,this._frameExtents=new p(1,1),this._viewportCount=1,this._viewports=[new x(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;bo.setFromMatrixPosition(t.matrixWorld),e.position.copy(bo),xo.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(xo),e.updateMatrixWorld(),yo.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(yo),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e.projectionMatrix),n.multiply(e.matrixWorldInverse)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class wo extends _o{constructor(){super(new ze(50,1,.5,500)),this.focus=1}updateMatrices(t){const e=this.camera,n=2*s*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}wo.prototype.isSpotLightShadow=!0;class Mo extends go{constructor(t,e,n=0,i=Math.PI/3,r=0,a=1){super(t,e),this.type="SpotLight",this.position.copy(At.DefaultUp),this.updateMatrix(),this.target=new At,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.shadow=new wo}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Mo.prototype.isSpotLight=!0;const Eo=new et,So=new E,Ao=new E;class To extends _o{constructor(){super(new ze(90,1,.5,500)),this._frameExtents=new p(4,2),this._viewportCount=6,this._viewports=[new x(2,1,1,1),new x(0,1,1,1),new x(3,1,1,1),new x(1,1,1,1),new x(3,0,1,1),new x(1,0,1,1)],this._cubeDirections=[new E(1,0,0),new E(-1,0,0),new E(0,0,1),new E(0,0,-1),new E(0,1,0),new E(0,-1,0)],this._cubeUps=[new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,0,1),new E(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,i=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),So.setFromMatrixPosition(t.matrixWorld),n.position.copy(So),Ao.copy(n.position),Ao.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(Ao),n.updateMatrixWorld(),i.makeTranslation(-So.x,-So.y,-So.z),Eo.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Eo)}}To.prototype.isPointLightShadow=!0;class Co extends go{constructor(t,e,n=0,i=1){super(t,e),this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new To}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}Co.prototype.isPointLight=!0;class Lo extends _o{constructor(){super(new rn(-5,5,5,-5,.5,500))}}Lo.prototype.isDirectionalLightShadow=!0;class Ro extends go{constructor(t,e){super(t,e),this.type="DirectionalLight",this.position.copy(At.DefaultUp),this.updateMatrix(),this.target=new At,this.shadow=new Lo}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Ro.prototype.isDirectionalLight=!0;class Po extends go{constructor(t,e){super(t,e),this.type="AmbientLight"}}Po.prototype.isAmbientLight=!0;class Do extends go{constructor(t,e,n=10,i=10){super(t,e),this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}Do.prototype.isRectAreaLight=!0;class Io{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new E)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,i=t.y,r=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.282095),e.addScaledVector(a[1],.488603*i),e.addScaledVector(a[2],.488603*r),e.addScaledVector(a[3],.488603*n),e.addScaledVector(a[4],n*i*1.092548),e.addScaledVector(a[5],i*r*1.092548),e.addScaledVector(a[6],.315392*(3*r*r-1)),e.addScaledVector(a[7],n*r*1.092548),e.addScaledVector(a[8],.546274*(n*n-i*i)),e}getIrradianceAt(t,e){const n=t.x,i=t.y,r=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.886227),e.addScaledVector(a[1],1.023328*i),e.addScaledVector(a[2],1.023328*r),e.addScaledVector(a[3],1.023328*n),e.addScaledVector(a[4],.858086*n*i),e.addScaledVector(a[5],.858086*i*r),e.addScaledVector(a[6],.743125*r*r-.247708),e.addScaledVector(a[7],.858086*n*r),e.addScaledVector(a[8],.429043*(n*n-i*i)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(t,e+3*i);return this}toArray(t=[],e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(t,e+3*i);return t}static getBasisAt(t,e){const n=t.x,i=t.y,r=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-i*i)}}Io.prototype.isSphericalHarmonics3=!0;class zo extends go{constructor(t=new Io,e=1){super(void 0,e),this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}zo.prototype.isLightProbe=!0;class No{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let n=0,i=t.length;n<i;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch(t){return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}}class Bo extends le{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}clone(){return(new this.constructor).copy(this)}toJSON(){const t=super.toJSON(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}Bo.prototype.isInstancedBufferGeometry=!0;(class extends so{constructor(t){super(t),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,a=io.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;const s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,fetch(t,s).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){io.add(t,n),e&&e(n),r.manager.itemEnd(t)})).catch((function(e){i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)})),r.manager.itemStart(t)}}).prototype.isImageBitmapLoader=!0;class ko{constructor(){this.type="ShapePath",this.color=new qt,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new fo,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,i){return this.currentPath.quadraticCurveTo(t,e,n,i),this}bezierCurveTo(t,e,n,i,r,a){return this.currentPath.bezierCurveTo(t,e,n,i,r,a),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t,e){function n(t){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n],r=new mo;r.curves=i.curves,e.push(r)}return e}function i(t,e){const n=e.length;let i=!1;for(let r=n-1,a=0;a<n;r=a++){let n=e[r],s=e[a],o=s.x-n.x,l=s.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=e[a],o=-o,s=e[r],l=-l),t.y<n.y||t.y>s.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-o*(t.y-n.y);if(0===e)return!0;if(e<0)continue;i=!i}}else{if(t.y!==n.y)continue;if(s.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=s.x)return!0}}return i}const r=Ss.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===e)return n(a);let s,o,l;const h=[];if(1===a.length)return o=a[0],l=new mo,l.curves=o.curves,h.push(l),h;let c=!r(a[0].getPoints());c=t?!c:c;const u=[],d=[];let p,f,m=[],g=0;d[g]=void 0,m[g]=[];for(let e=0,n=a.length;e<n;e++)o=a[e],p=o.getPoints(),s=r(p),s=t?!s:s,s?(!c&&d[g]&&g++,d[g]={s:new mo,p:p},d[g].s.curves=o.curves,c&&g++,m[g]=[]):m[g].push({h:o,p:p[0]});if(!d[0])return n(a);if(d.length>1){let t=!1;const e=[];for(let t=0,e=d.length;t<e;t++)u[t]=[];for(let n=0,r=d.length;n<r;n++){const r=m[n];for(let a=0;a<r.length;a++){const s=r[a];let o=!0;for(let r=0;r<d.length;r++)i(s.p,d[r].p)&&(n!==r&&e.push({froms:n,tos:r,hole:a}),o?(o=!1,u[r].push(s)):t=!0);o&&u[n].push(s)}}e.length>0&&(t||(m=u))}for(let t=0,e=d.length;t<e;t++){l=d[t].s,h.push(l),f=m[t];for(let t=0,e=f.length;t<e;t++)l.holes.push(f[t].h)}return h}}class Oo{constructor(t){this.type="Font",this.data=t}generateShapes(t,e=100){const n=[],i=function(t,e,n){const i=Array.from(t),r=e/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*r,s=[];let o=0,l=0;for(let t=0;t<i.length;t++){const e=i[t];if("\n"===e)o=0,l-=a;else{const t=Fo(e,r,o,l,n);o+=t.offsetX,s.push(t.path)}}return s}(t,e,this.data);for(let t=0,e=i.length;t<e;t++)Array.prototype.push.apply(n,i[t].toShapes());return n}}function Fo(t,e,n,i,r){const a=r.glyphs[t]||r.glyphs["?"];if(!a)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+r.familyName+".");const s=new ko;let o,l,h,c,u,d,p,f;if(a.o){const t=a._cachedOutline||(a._cachedOutline=a.o.split(" "));for(let r=0,a=t.length;r<a;){switch(t[r++]){case"m":o=t[r++]*e+n,l=t[r++]*e+i,s.moveTo(o,l);break;case"l":o=t[r++]*e+n,l=t[r++]*e+i,s.lineTo(o,l);break;case"q":h=t[r++]*e+n,c=t[r++]*e+i,u=t[r++]*e+n,d=t[r++]*e+i,s.quadraticCurveTo(u,d,h,c);break;case"b":h=t[r++]*e+n,c=t[r++]*e+i,u=t[r++]*e+n,d=t[r++]*e+i,p=t[r++]*e+n,f=t[r++]*e+i,s.bezierCurveTo(u,d,p,f,h,c)}}}return{offsetX:a.ha*e,path:s}}Oo.prototype.isFont=!0;let Uo;const Ho=function(){return void 0===Uo&&(Uo=new(window.AudioContext||window.webkitAudioContext)),Uo};class Vo extends so{constructor(t){super(t)}load(t,e,n,i){const r=this,a=new lo(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(n){try{const t=n.slice(0);Ho().decodeAudioData(t,(function(t){e(t)}))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}}(class extends zo{constructor(t,e,n=1){super(void 0,n);const i=(new qt).set(t),r=(new qt).set(e),a=new E(i.r,i.g,i.b),s=new E(r.r,r.g,r.b),o=Math.sqrt(Math.PI),l=o*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(s).multiplyScalar(o),this.sh.coefficients[1].copy(a).sub(s).multiplyScalar(l)}}).prototype.isHemisphereLightProbe=!0;(class extends zo{constructor(t,e=1){super(void 0,e);const n=(new qt).set(t);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}).prototype.isAmbientLightProbe=!0;class Go extends At{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}class Wo{constructor(t,e,n){let i,r,a;switch(this.binding=t,this.valueSize=n,e){case"quaternion":i=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,i=this.valueSize,r=t*i+i;let a=this.cumulativeWeight;if(0===a){for(let t=0;t!==i;++t)n[r+t]=n[t];a=e}else{a+=e;const t=e/a;this._mixBufferRegion(n,r,0,t,i)}this.cumulativeWeight=a}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,i,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,i=t*e+e,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(n,i,t,1-r,e)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(n[t]!==n[t+e]){s.setValue(n,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let t=n,r=i;t!==r;++t)e[t]=e[i+t%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,i,r){if(i>=.5)for(let i=0;i!==r;++i)t[e+i]=t[n+i]}_slerp(t,e,n,i){M.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const a=this._workIndex*r;M.multiplyQuaternionsFlat(t,a,t,e,t,n),M.slerpFlat(t,e,t,e,t,a,i)}_lerp(t,e,n,i,r){const a=1-i;for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]*a+t[n+s]*i}}_lerpAdditive(t,e,n,i,r){for(let a=0;a!==r;++a){const r=e+a;t[r]=t[r]+t[n+a]*i}}}const jo=new RegExp("[\\[\\]\\.:\\/]","g"),qo="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",Xo=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Yo=/(WCOD+)?/.source.replace("WCOD",qo),Jo=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Zo=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),$o=new RegExp("^"+Xo+Yo+Jo+Zo+"$"),Qo=["material","materials","bones"];class Ko{constructor(t,e,n){this.path=e,this.parsedPath=n||Ko.parseTrackName(e),this.node=Ko.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new Ko.Composite(t,e,n):new Ko(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(jo,"")}static parseTrackName(t){const e=$o.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==Qo.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let i=0;i<t.length;i++){const r=t[i];if(r.name===e||r.uuid===e)return r;const a=n(r.children);if(a)return a}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,n=e.objectName,i=e.propertyName;let r=e.propertyIndex;if(t||(t=Ko.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(n){let i=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===i){i=e;break}break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==i){if(void 0===t[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[i]}}const a=t[i];if(void 0===a){const n=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",t)}let s=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else void 0!==a.fromArray&&void 0!==a.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(o=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Ko.Composite=class{constructor(t,e,n){const i=n||Ko.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},Ko.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Ko.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Ko.prototype.GetterByBindingType=[Ko.prototype._getValue_direct,Ko.prototype._getValue_array,Ko.prototype._getValue_arrayElement,Ko.prototype._getValue_toArray],Ko.prototype.SetterByBindingTypeAndVersioning=[[Ko.prototype._setValue_direct,Ko.prototype._setValue_direct_setNeedsUpdate,Ko.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Ko.prototype._setValue_array,Ko.prototype._setValue_array_setNeedsUpdate,Ko.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Ko.prototype._setValue_arrayElement,Ko.prototype._setValue_arrayElement_setNeedsUpdate,Ko.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Ko.prototype._setValue_fromArray,Ko.prototype._setValue_fromArray_setNeedsUpdate,Ko.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];(class{constructor(){this.uuid=o(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let e=0,n=arguments.length;e!==n;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,a=r.length;let s=void 0,o=t.length,l=this.nCachedObjects_;for(let h=0,c=arguments.length;h!==c;++h){const c=arguments[h],u=c.uuid;let d=e[u];if(void 0===d){d=o++,e[u]=d,t.push(c);for(let t=0,e=a;t!==e;++t)r[t].push(new Ko(c,n[t],i[t]))}else if(d<l){s=t[d];const o=--l,h=t[o];e[h.uuid]=d,t[d]=h,e[u]=o,t[o]=c;for(let t=0,e=a;t!==e;++t){const e=r[t],a=e[o];let s=e[d];e[d]=a,void 0===s&&(s=new Ko(c,n[t],i[t])),e[o]=s}}else t[d]!==s&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let a=0,s=arguments.length;a!==s;++a){const s=arguments[a],o=s.uuid,l=e[o];if(void 0!==l&&l>=r){const a=r++,h=t[a];e[h.uuid]=l,t[l]=h,e[o]=a,t[a]=s;for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[a],r=e[l];e[l]=i,e[a]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,a=t.length;for(let s=0,o=arguments.length;s!==o;++s){const o=arguments[s].uuid,l=e[o];if(void 0!==l)if(delete e[o],l<r){const s=--r,o=t[s],h=--a,c=t[h];e[o.uuid]=l,t[l]=o,e[c.uuid]=s,t[s]=c,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[s],r=e[h];e[l]=i,e[s]=r,e.pop()}}else{const r=--a,s=t[r];r>0&&(e[s.uuid]=l),t[l]=s,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const r=this._bindings;if(void 0!==i)return r[i];const a=this._paths,s=this._parsedPaths,o=this._objects,l=o.length,h=this.nCachedObjects_,c=new Array(l);i=r.length,n[t]=i,a.push(t),s.push(e),r.push(c);for(let n=h,i=o.length;n!==i;++n){const i=o[n];c[n]=new Ko(i,t,e)}return c}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const i=this._paths,r=this._parsedPaths,a=this._bindings,s=a.length-1,o=a[s];e[t[s]]=n,a[n]=o,a.pop(),r[n]=r[s],r.pop(),i[n]=i[s],i.pop()}}}).prototype.isAnimationObjectGroup=!0;class tl{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const r=e.tracks,a=r.length,s=new Array(a),o={endingStart:2400,endingEnd:2400};for(let t=0;t!==a;++t){const e=r[t].createInterpolant(null);s[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=s,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,i=t._clip.duration,r=i/n,a=n/i;t.warp(1,r,e),this.warp(a,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const i=this._mixer,r=i.time,a=this.timeScale;let s=this._timeScaleInterpolant;null===s&&(s=i._lendControlInterpolant(),this._timeScaleInterpolant=s);const o=s.parameterPositions,l=s.sampleValues;return o[0]=r,o[1]=r+n,l[0]=t/a,l[1]=e/a,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,i){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const i=(t-r)*n;if(i<0||0===n)return;this._startTime=null,e=n*i}e*=this._updateTimeScale(t);const a=this._updateTime(e),s=this._updateWeight(t);if(s>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case 2501:for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(a),e[n].accumulateAdditive(s);break;case 2500:default:for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(a),e[n].accumulate(i,s)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,r=this._loopCount;const a=2202===n;if(0===t)return-1===r?i:a&&1==(1&r)?e-i:i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else{if(!(i<0)){this.time=i;break t}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){const e=t<0;this._setEndings(e,!e,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(a&&1==(1&r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=2401,i.endingEnd=2401):(i.endingStart=t?this.zeroSlopeAtStart?2401:2400:2402,i.endingEnd=e?this.zeroSlopeAtEnd?2401:2400:2402)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const s=a.parameterPositions,o=a.sampleValues;return s[0]=r,o[0]=e,s[1]=r+t,o[1]=n,this}}(class extends i{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,a=t._propertyBindings,s=t._interpolants,o=n.uuid,l=this._bindingsByRootAndName;let h=l[o];void 0===h&&(h={},l[o]=h);for(let t=0;t!==r;++t){const r=i[t],l=r.name;let c=h[l];if(void 0!==c)a[t]=c;else{if(c=a[t],void 0!==c){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,o,l));continue}const i=e&&e._propertyBindings[t].binding.parsedPath;c=new Wo(Ko.create(n,l,i),r.ValueTypeName,r.getValueSize()),++c.referenceCount,this._addInactiveBinding(c,o,l),a[t]=c}s[t].resultBuffer=c.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,n){const i=this._actions,r=this._actionsByClip;let a=r[e];if(void 0===a)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=a;else{const e=a.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=i.length,i.push(t),a.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,a=this._actionsByClip,s=a[r],o=s.knownActions,l=o[o.length-1],h=t._byClipCacheIndex;l._byClipCacheIndex=h,o[h]=l,o.pop(),t._byClipCacheIndex=null;delete s.actionByRoot[(t._localRoot||this._root).uuid],0===o.length&&delete a[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(t){const e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackAction(t){const e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_addInactiveBinding(t,e,n){const i=this._bindingsByRootAndName,r=this._bindings;let a=i[e];void 0===a&&(a={},i[e]=a),a[n]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,s=a[i],o=e[e.length-1],l=t._cacheIndex;o._cacheIndex=l,e[l]=o,e.pop(),delete s[r],0===Object.keys(s).length&&delete a[i]}_lendBinding(t){const e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackBinding(t){const e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return void 0===n&&(n=new js(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r}clipAction(t,e,n){const i=e||this._root,r=i.uuid;let a="string"==typeof t?eo.findByName(i,t):t;const s=null!==a?a.uuid:t,o=this._actionsByClip[s];let l=null;if(void 0===n&&(n=null!==a?a.blendMode:2500),void 0!==o){const t=o.actionByRoot[r];if(void 0!==t&&t.blendMode===n)return t;l=o.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;const h=new tl(this,a,e,n);return this._bindAction(h,l),this._addInactiveAction(h,s,r),h}existingAction(t,e){const n=e||this._root,i=n.uuid,r="string"==typeof t?eo.findByName(n,t):t,a=r?r.uuid:t,s=this._actionsByClip[a];return void 0!==s&&s.actionByRoot[i]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),a=this._accuIndex^=1;for(let s=0;s!==n;++s){e[s]._update(i,t,r,a)}const s=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)s[t].apply(a);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){const t=r.knownActions;for(let n=0,i=t.length;n!==i;++n){const i=t[n];this._deactivateAction(i);const r=i._cacheIndex,a=e[e.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,a._cacheIndex=r,e[r]=a,e.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const t in n){const i=n[t].actionByRoot[e];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}const i=this._bindingsByRootAndName[e];if(void 0!==i)for(const t in i){const e=i[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}).prototype._controlInterpolantsResultBuffer=new Float32Array(1);class el{constructor(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new el(void 0===this.value.clone?this.value:this.value.clone())}}(class extends Nr{constructor(t,e,n=1){super(t,e),this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}).prototype.isInstancedInterleavedBuffer=!0;(class{constructor(t,e,n,i,r){this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}).prototype.isGLBufferAttribute=!0;const nl=new p;class il{constructor(t=new p(1/0,1/0),e=new p(-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=nl.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return nl.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}il.prototype.isBox2=!0;const rl=new E,al=new E;(class extends At{constructor(t){super(),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}}).prototype.isImmediateRenderObject=!0;const sl=new E,ol=new et,ll=new et;const hl=new Float32Array(1);new Int32Array(hl.buffer);Na.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Na.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},fo.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},class extends Ma{constructor(t=10,e=10,n=4473924,i=8947848){n=new qt(n),i=new qt(i);const r=e/2,a=t/e,s=t/2,o=[],l=[];for(let t=0,h=0,c=-s;t<=e;t++,c+=a){o.push(-s,0,c,s,0,c),o.push(c,0,-s,c,0,s);const e=t===r?n:i;e.toArray(l,h),h+=3,e.toArray(l,h),h+=3,e.toArray(l,h),h+=3,e.toArray(l,h),h+=3}const h=new le;h.setAttribute("position",new Kt(o,3)),h.setAttribute("color",new Kt(l,3));super(h,new fa({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},class extends Ma{constructor(t){const e=function t(e){const n=[];e&&e.isBone&&n.push(e);for(let i=0;i<e.children.length;i++)n.push.apply(n,t(e.children[i]));return n}(t),n=new le,i=[],r=[],a=new qt(0,0,1),s=new qt(0,1,0);for(let t=0;t<e.length;t++){const n=e[t];n.parent&&n.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(a.r,a.g,a.b),r.push(s.r,s.g,s.b))}n.setAttribute("position",new Kt(i,3)),n.setAttribute("color",new Kt(r,3));super(n,new fa({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,n=this.geometry,i=n.getAttribute("position");ll.copy(this.root.matrixWorld).invert();for(let t=0,n=0;t<e.length;t++){const r=e[t];r.parent&&r.parent.isBone&&(ol.multiplyMatrices(ll,r.matrixWorld),sl.setFromMatrixPosition(ol),i.setXYZ(n,sl.x,sl.y,sl.z),ol.multiplyMatrices(ll,r.parent.matrixWorld),sl.setFromMatrixPosition(ol),i.setXYZ(n+1,sl.x,sl.y,sl.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},so.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),No.extractUrlBase(t)},so.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},il.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},il.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},il.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},il.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},T.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},T.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},T.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},T.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},T.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},q.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},We.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},class{constructor(t=new E,e=new E){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){rl.subVectors(t,this.start),al.subVectors(this.end,this.start);const n=al.dot(al);let i=al.dot(rl)/n;return e&&(i=l(i,0,1)),i}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},f.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},f.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},f.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},f.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},f.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},f.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},et.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},et.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},et.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new E).setFromMatrixColumn(this,3)},et.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},et.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},et.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},et.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},et.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},et.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},et.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},et.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},et.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},et.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},et.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},et.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},et.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},et.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},et.prototype.makeFrustum=function(t,e,n,i,r,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,i,n,r,a)},et.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},He.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},M.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},M.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},tt.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},tt.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},tt.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},kt.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},kt.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},kt.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},kt.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},kt.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},kt.barycoordFromPoint=function(t,e,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),kt.getBarycoord(t,e,n,i,r)},kt.normal=function(t,e,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),kt.getNormal(t,e,n,i)},mo.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},mo.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Cs(this,t)},mo.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Rs(this,t)},p.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},p.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},p.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},E.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},E.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},E.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},E.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},E.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},E.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},E.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},E.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},E.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},x.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},x.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},At.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},At.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},At.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},At.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},At.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(At.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Ae.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(Ae.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),aa.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},ze.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(go.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(Zt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),35048===this.usage},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(35048)}}}),Zt.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?35048:35044),this},Zt.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Zt.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},le.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},le.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new Zt(arguments[1],arguments[2])))},le.prototype.addDrawCall=function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},le.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},le.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},le.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},le.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(le.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Nr.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?35048:35044),this},Nr.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Cs.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Cs.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Cs.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},zr.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},el.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(Ft.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new qt}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(De.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Pr.prototype.clearTarget=function(t,e,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,i)},Pr.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},Pr.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},Pr.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},Pr.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},Pr.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},Pr.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},Pr.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},Pr.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},Pr.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},Pr.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},Pr.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},Pr.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},Pr.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},Pr.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},Pr.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},Pr.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},Pr.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},Pr.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},Pr.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},Pr.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},Pr.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},Pr.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},Pr.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},Pr.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(Pr.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?3001:3e3}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(_r.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(_.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Go.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new Vo).load(t,(function(t){e.setBuffer(t)})),this},class{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}}.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Ne.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},Ne.prototype.clear=function(t,e,n,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,i)},g.crossOrigin=void 0,g.loadTexture=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new uo;r.setCrossOrigin(this.crossOrigin);const a=r.load(t,n,void 0,i);return e&&(a.mapping=e),a},g.loadTextureCube=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new co;r.setCrossOrigin(this.crossOrigin);const a=r.load(t,n,void 0,i);return e&&(a.mapping=e),a},g.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},g.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"132"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="132");var cl={value:()=>{}};function ul(){for(var t,e=0,n=arguments.length,i={};e<n;++e){if(!(t=arguments[e]+"")||t in i||/[\s.]/.test(t))throw new Error("illegal type: "+t);i[t]=[]}return new dl(i)}function dl(t){this._=t}function pl(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",i=t.indexOf(".");if(i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function fl(t,e){for(var n,i=0,r=t.length;i<r;++i)if((n=t[i]).name===e)return n.value}function ml(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=cl,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=n&&t.push({name:e,value:n}),t}dl.prototype=ul.prototype={constructor:dl,on:function(t,e){var n,i=this._,r=pl(t+"",i),a=-1,s=r.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=r[a]).type)i[n]=ml(i[n],t.name,e);else if(null==e)for(n in i)i[n]=ml(i[n],t.name,null);return this}for(;++a<s;)if((n=(t=r[a]).type)&&(n=fl(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new dl(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,i,r=new Array(n),a=0;a<n;++a)r[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,n=(i=this._[t]).length;a<n;++a)i[a].value.apply(e,r)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,a=i.length;r<a;++r)i[r].value.apply(e,n)}};var gl,vl,yl=ul,bl=0,xl=0,_l=0,wl=0,Ml=0,El=0,Sl="object"==typeof performance&&performance.now?performance:Date,Al="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Tl(){return Ml||(Al(Cl),Ml=Sl.now()+El)}function Cl(){Ml=0}function Ll(){this._call=this._time=this._next=null}function Rl(t,e,n){var i=new Ll;return i.restart(t,e,n),i}function Pl(){Ml=(wl=Sl.now())+El,bl=xl=0;try{!function(){Tl(),++bl;for(var t,e=gl;e;)(t=Ml-e._time)>=0&&e._call.call(void 0,t),e=e._next;--bl}()}finally{bl=0,function(){var t,e,n=gl,i=1/0;for(;n;)n._call?(i>n._time&&(i=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:gl=e);vl=t,Il(i)}(),Ml=0}}function Dl(){var t=Sl.now(),e=t-wl;e>1e3&&(El-=e,wl=t)}function Il(t){bl||(xl&&(xl=clearTimeout(xl)),t-Ml>24?(t<1/0&&(xl=setTimeout(Pl,t-Sl.now()-El)),_l&&(_l=clearInterval(_l))):(_l||(wl=Sl.now(),_l=setInterval(Dl,1e3)),bl=1,Al(Pl)))}Ll.prototype=Rl.prototype={constructor:Ll,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Tl():+n)+(null==e?0:+e),this._next||vl===this||(vl?vl._next=this:gl=this,vl=this),this._call=t,this._time=n,Il()},stop:function(){this._call&&(this._call=null,this._time=1/0,Il())}};const zl=4294967296;function Nl(t){return t.x}function Bl(t){return t.y}function kl(t){return t.z}var Ol=Math.PI*(3-Math.sqrt(5)),Fl=20*Math.PI/(9+Math.sqrt(221)),Ul=function(t,e){e=e||2;var n,i=Math.min(3,Math.max(1,Math.round(e))),r=1,a=.001,s=1-Math.pow(a,1/300),o=0,l=.6,h=new Map,c=Rl(p),u=yl("tick","end"),d=function(){let t=1;return()=>(t=(1664525*t+1013904223)%zl)/zl}();function p(){f(),u.call("tick",n),r<a&&(c.stop(),u.call("end",n))}function f(e){var a,c,u=t.length;void 0===e&&(e=1);for(var d=0;d<e;++d)for(r+=(o-r)*s,h.forEach((function(t){t(r)})),a=0;a<u;++a)null==(c=t[a]).fx?c.x+=c.vx*=l:(c.x=c.fx,c.vx=0),i>1&&(null==c.fy?c.y+=c.vy*=l:(c.y=c.fy,c.vy=0)),i>2&&(null==c.fz?c.z+=c.vz*=l:(c.z=c.fz,c.vz=0));return n}function m(){for(var e,n=0,r=t.length;n<r;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||i>1&&isNaN(e.y)||i>2&&isNaN(e.z)){var a=10*(i>2?Math.cbrt(.5+n):i>1?Math.sqrt(.5+n):n),s=n*Ol,o=n*Fl;1===i?e.x=a:2===i?(e.x=a*Math.cos(s),e.y=a*Math.sin(s)):(e.x=a*Math.sin(s)*Math.cos(o),e.y=a*Math.cos(s),e.z=a*Math.sin(s)*Math.sin(o))}(isNaN(e.vx)||i>1&&isNaN(e.vy)||i>2&&isNaN(e.vz))&&(e.vx=0,i>1&&(e.vy=0),i>2&&(e.vz=0))}}function g(e){return e.initialize&&e.initialize(t,d,i),e}return null==t&&(t=[]),m(),n={tick:f,restart:function(){return c.restart(p),n},stop:function(){return c.stop(),n},numDimensions:function(t){return arguments.length?(i=Math.min(3,Math.max(1,Math.round(t))),h.forEach(g),n):i},nodes:function(e){return arguments.length?(t=e,m(),h.forEach(g),n):t},alpha:function(t){return arguments.length?(r=+t,n):r},alphaMin:function(t){return arguments.length?(a=+t,n):a},alphaDecay:function(t){return arguments.length?(s=+t,n):+s},alphaTarget:function(t){return arguments.length?(o=+t,n):o},velocityDecay:function(t){return arguments.length?(l=1-t,n):1-l},randomSource:function(t){return arguments.length?(d=t,h.forEach(g),n):d},force:function(t,e){return arguments.length>1?(null==e?h.delete(t):h.set(t,g(e)),n):h.get(t)},find:function(){var e,n,r,a,s,o,l=Array.prototype.slice.call(arguments),h=l.shift()||0,c=(i>1?l.shift():null)||0,u=(i>2?l.shift():null)||0,d=l.shift()||1/0,p=0,f=t.length;for(d*=d,p=0;p<f;++p)(a=(e=h-(s=t[p]).x)*e+(n=c-(s.y||0))*n+(r=u-(s.z||0))*r)<d&&(o=s,d=a);return o},on:function(t,e){return arguments.length>1?(u.on(t,e),n):u.on(t)}}},Hl=function(t){return function(){return t}},Vl=function(t){return 1e-6*(t()-.5)};function Gl(t){return t.index}function Wl(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}var jl=function(t){var e,n,i,r,a,s,o,l=Gl,h=function(t){return 1/Math.min(a[t.source.index],a[t.target.index])},c=Hl(30),u=1;function d(i){for(var a=0,l=t.length;a<u;++a)for(var h,c,d,p,f,m=0,g=0,v=0,y=0;m<l;++m)c=(h=t[m]).source,g=(d=h.target).x+d.vx-c.x-c.vx||Vl(o),r>1&&(v=d.y+d.vy-c.y-c.vy||Vl(o)),r>2&&(y=d.z+d.vz-c.z-c.vz||Vl(o)),g*=p=((p=Math.sqrt(g*g+v*v+y*y))-n[m])/p*i*e[m],v*=p,y*=p,d.vx-=g*(f=s[m]),r>1&&(d.vy-=v*f),r>2&&(d.vz-=y*f),c.vx+=g*(f=1-f),r>1&&(c.vy+=v*f),r>2&&(c.vz+=y*f)}function p(){if(i){var r,o,h=i.length,c=t.length,u=new Map(i.map((t,e)=>[l(t,e,i),t]));for(r=0,a=new Array(h);r<c;++r)(o=t[r]).index=r,"object"!=typeof o.source&&(o.source=Wl(u,o.source)),"object"!=typeof o.target&&(o.target=Wl(u,o.target)),a[o.source.index]=(a[o.source.index]||0)+1,a[o.target.index]=(a[o.target.index]||0)+1;for(r=0,s=new Array(c);r<c;++r)o=t[r],s[r]=a[o.source.index]/(a[o.source.index]+a[o.target.index]);e=new Array(c),f(),n=new Array(c),m()}}function f(){if(i)for(var n=0,r=t.length;n<r;++n)e[n]=+h(t[n],n,t)}function m(){if(i)for(var e=0,r=t.length;e<r;++e)n[e]=+c(t[e],e,t)}return null==t&&(t=[]),d.initialize=function(t,...e){i=t,o=e.find(t=>"function"==typeof t)||Math.random,r=e.find(t=>[1,2,3].includes(t))||2,p()},d.links=function(e){return arguments.length?(t=e,p(),d):t},d.id=function(t){return arguments.length?(l=t,d):l},d.iterations=function(t){return arguments.length?(u=+t,d):u},d.strength=function(t){return arguments.length?(h="function"==typeof t?t:Hl(+t),f(),d):h},d.distance=function(t){return arguments.length?(c="function"==typeof t?t:Hl(+t),m(),d):c},d};function ql(t,e,n){if(isNaN(e))return t;var i,r,a,s,o,l,h=t._root,c={data:n},u=t._x0,d=t._x1;if(!h)return t._root=c,t;for(;h.length;)if((s=e>=(r=(u+d)/2))?u=r:d=r,i=h,!(h=h[o=+s]))return i[o]=c,t;if(e===(a=+t._x.call(null,h.data)))return c.next=h,i?i[o]=c:t._root=c,t;do{i=i?i[o]=new Array(2):t._root=new Array(2),(s=e>=(r=(u+d)/2))?u=r:d=r}while((o=+s)==(l=+(a>=r)));return i[l]=h,i[o]=c,t}var Xl=function(t,e,n){this.node=t,this.x0=e,this.x1=n};function Yl(t){return t[0]}function Jl(t,e){var n=new Zl(null==e?Yl:e,NaN,NaN);return null==t?n:n.addAll(t)}function Zl(t,e,n){this._x=t,this._x0=e,this._x1=n,this._root=void 0}function $l(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var Ql=Jl.prototype=Zl.prototype;Ql.copy=function(){var t,e,n=new Zl(this._x,this._x0,this._x1),i=this._root;if(!i)return n;if(!i.length)return n._root=$l(i),n;for(t=[{source:i,target:n._root=new Array(2)}];i=t.pop();)for(var r=0;r<2;++r)(e=i.source[r])&&(e.length?t.push({source:e,target:i.target[r]=new Array(2)}):i.target[r]=$l(e));return n},Ql.add=function(t){var e=+this._x.call(null,t);return ql(this.cover(e),e,t)},Ql.addAll=function(t){var e,n,i=t.length,r=new Array(i),a=1/0,s=-1/0;for(e=0;e<i;++e)isNaN(n=+this._x.call(null,t[e]))||(r[e]=n,n<a&&(a=n),n>s&&(s=n));if(a>s)return this;for(this.cover(a).cover(s),e=0;e<i;++e)ql(this,r[e],t[e]);return this},Ql.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,n=this._x1;if(isNaN(e))n=(e=Math.floor(t))+1;else{for(var i,r,a=n-e||1,s=this._root;e>t||t>=n;)switch(r=+(t<e),(i=new Array(2))[r]=s,s=i,a*=2,r){case 0:n=e+a;break;case 1:e=n-a}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._x1=n,this},Ql.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},Ql.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},Ql.find=function(t,e){var n,i,r,a,s,o=this._x0,l=this._x1,h=[],c=this._root;for(c&&h.push(new Xl(c,o,l)),null==e?e=1/0:(o=t-e,l=t+e);a=h.pop();)if(!(!(c=a.node)||(i=a.x0)>l||(r=a.x1)<o))if(c.length){var u=(i+r)/2;h.push(new Xl(c[1],u,r),new Xl(c[0],i,u)),(s=+(t>=u))&&(a=h[h.length-1],h[h.length-1]=h[h.length-1-s],h[h.length-1-s]=a)}else{var d=Math.abs(t-+this._x.call(null,c.data));d<e&&(e=d,o=t-d,l=t+d,n=c.data)}return n},Ql.remove=function(t){if(isNaN(a=+this._x.call(null,t)))return this;var e,n,i,r,a,s,o,l,h,c=this._root,u=this._x0,d=this._x1;if(!c)return this;if(c.length)for(;;){if((o=a>=(s=(u+d)/2))?u=s:d=s,e=c,!(c=c[l=+o]))return this;if(!c.length)break;e[l+1&1]&&(n=e,h=l)}for(;c.data!==t;)if(i=c,!(c=c.next))return this;return(r=c.next)&&delete c.next,i?(r?i.next=r:delete i.next,this):e?(r?e[l]=r:delete e[l],(c=e[0]||e[1])&&c===(e[1]||e[0])&&!c.length&&(n?n[h]=c:this._root=c),this):(this._root=r,this)},Ql.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},Ql.root=function(){return this._root},Ql.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},Ql.visit=function(t){var e,n,i,r,a=[],s=this._root;for(s&&a.push(new Xl(s,this._x0,this._x1));e=a.pop();)if(!t(s=e.node,i=e.x0,r=e.x1)&&s.length){var o=(i+r)/2;(n=s[1])&&a.push(new Xl(n,o,r)),(n=s[0])&&a.push(new Xl(n,i,o))}return this},Ql.visitAfter=function(t){var e,n=[],i=[];for(this._root&&n.push(new Xl(this._root,this._x0,this._x1));e=n.pop();){var r=e.node;if(r.length){var a,s=e.x0,o=e.x1,l=(s+o)/2;(a=r[0])&&n.push(new Xl(a,s,l)),(a=r[1])&&n.push(new Xl(a,l,o))}i.push(e)}for(;e=i.pop();)t(e.node,e.x0,e.x1);return this},Ql.x=function(t){return arguments.length?(this._x=t,this):this._x};function Kl(t,e,n,i){if(isNaN(e)||isNaN(n))return t;var r,a,s,o,l,h,c,u,d,p=t._root,f={data:i},m=t._x0,g=t._y0,v=t._x1,y=t._y1;if(!p)return t._root=f,t;for(;p.length;)if((h=e>=(a=(m+v)/2))?m=a:v=a,(c=n>=(s=(g+y)/2))?g=s:y=s,r=p,!(p=p[u=c<<1|h]))return r[u]=f,t;if(o=+t._x.call(null,p.data),l=+t._y.call(null,p.data),e===o&&n===l)return f.next=p,r?r[u]=f:t._root=f,t;do{r=r?r[u]=new Array(4):t._root=new Array(4),(h=e>=(a=(m+v)/2))?m=a:v=a,(c=n>=(s=(g+y)/2))?g=s:y=s}while((u=c<<1|h)==(d=(l>=s)<<1|o>=a));return r[d]=p,r[u]=f,t}var th=function(t,e,n,i,r){this.node=t,this.x0=e,this.y0=n,this.x1=i,this.y1=r};function eh(t){return t[0]}function nh(t){return t[1]}function ih(t,e,n){var i=new rh(null==e?eh:e,null==n?nh:n,NaN,NaN,NaN,NaN);return null==t?i:i.addAll(t)}function rh(t,e,n,i,r,a){this._x=t,this._y=e,this._x0=n,this._y0=i,this._x1=r,this._y1=a,this._root=void 0}function ah(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var sh=ih.prototype=rh.prototype;sh.copy=function(){var t,e,n=new rh(this._x,this._y,this._x0,this._y0,this._x1,this._y1),i=this._root;if(!i)return n;if(!i.length)return n._root=ah(i),n;for(t=[{source:i,target:n._root=new Array(4)}];i=t.pop();)for(var r=0;r<4;++r)(e=i.source[r])&&(e.length?t.push({source:e,target:i.target[r]=new Array(4)}):i.target[r]=ah(e));return n},sh.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return Kl(this.cover(e,n),e,n,t)},sh.addAll=function(t){var e,n,i,r,a=t.length,s=new Array(a),o=new Array(a),l=1/0,h=1/0,c=-1/0,u=-1/0;for(n=0;n<a;++n)isNaN(i=+this._x.call(null,e=t[n]))||isNaN(r=+this._y.call(null,e))||(s[n]=i,o[n]=r,i<l&&(l=i),i>c&&(c=i),r<h&&(h=r),r>u&&(u=r));if(l>c||h>u)return this;for(this.cover(l,h).cover(c,u),n=0;n<a;++n)Kl(this,s[n],o[n],t[n]);return this},sh.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,i=this._y0,r=this._x1,a=this._y1;if(isNaN(n))r=(n=Math.floor(t))+1,a=(i=Math.floor(e))+1;else{for(var s,o,l=r-n||1,h=this._root;n>t||t>=r||i>e||e>=a;)switch(o=(e<i)<<1|t<n,(s=new Array(4))[o]=h,h=s,l*=2,o){case 0:r=n+l,a=i+l;break;case 1:n=r-l,a=i+l;break;case 2:r=n+l,i=a-l;break;case 3:n=r-l,i=a-l}this._root&&this._root.length&&(this._root=h)}return this._x0=n,this._y0=i,this._x1=r,this._y1=a,this},sh.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},sh.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},sh.find=function(t,e,n){var i,r,a,s,o,l,h,c=this._x0,u=this._y0,d=this._x1,p=this._y1,f=[],m=this._root;for(m&&f.push(new th(m,c,u,d,p)),null==n?n=1/0:(c=t-n,u=e-n,d=t+n,p=e+n,n*=n);l=f.pop();)if(!(!(m=l.node)||(r=l.x0)>d||(a=l.y0)>p||(s=l.x1)<c||(o=l.y1)<u))if(m.length){var g=(r+s)/2,v=(a+o)/2;f.push(new th(m[3],g,v,s,o),new th(m[2],r,v,g,o),new th(m[1],g,a,s,v),new th(m[0],r,a,g,v)),(h=(e>=v)<<1|t>=g)&&(l=f[f.length-1],f[f.length-1]=f[f.length-1-h],f[f.length-1-h]=l)}else{var y=t-+this._x.call(null,m.data),b=e-+this._y.call(null,m.data),x=y*y+b*b;if(x<n){var _=Math.sqrt(n=x);c=t-_,u=e-_,d=t+_,p=e+_,i=m.data}}return i},sh.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var e,n,i,r,a,s,o,l,h,c,u,d,p=this._root,f=this._x0,m=this._y0,g=this._x1,v=this._y1;if(!p)return this;if(p.length)for(;;){if((h=a>=(o=(f+g)/2))?f=o:g=o,(c=s>=(l=(m+v)/2))?m=l:v=l,e=p,!(p=p[u=c<<1|h]))return this;if(!p.length)break;(e[u+1&3]||e[u+2&3]||e[u+3&3])&&(n=e,d=u)}for(;p.data!==t;)if(i=p,!(p=p.next))return this;return(r=p.next)&&delete p.next,i?(r?i.next=r:delete i.next,this):e?(r?e[u]=r:delete e[u],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(n?n[d]=p:this._root=p),this):(this._root=r,this)},sh.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},sh.root=function(){return this._root},sh.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},sh.visit=function(t){var e,n,i,r,a,s,o=[],l=this._root;for(l&&o.push(new th(l,this._x0,this._y0,this._x1,this._y1));e=o.pop();)if(!t(l=e.node,i=e.x0,r=e.y0,a=e.x1,s=e.y1)&&l.length){var h=(i+a)/2,c=(r+s)/2;(n=l[3])&&o.push(new th(n,h,c,a,s)),(n=l[2])&&o.push(new th(n,i,c,h,s)),(n=l[1])&&o.push(new th(n,h,r,a,c)),(n=l[0])&&o.push(new th(n,i,r,h,c))}return this},sh.visitAfter=function(t){var e,n=[],i=[];for(this._root&&n.push(new th(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var r=e.node;if(r.length){var a,s=e.x0,o=e.y0,l=e.x1,h=e.y1,c=(s+l)/2,u=(o+h)/2;(a=r[0])&&n.push(new th(a,s,o,c,u)),(a=r[1])&&n.push(new th(a,c,o,l,u)),(a=r[2])&&n.push(new th(a,s,u,c,h)),(a=r[3])&&n.push(new th(a,c,u,l,h))}i.push(e)}for(;e=i.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},sh.x=function(t){return arguments.length?(this._x=t,this):this._x},sh.y=function(t){return arguments.length?(this._y=t,this):this._y};function oh(t,e,n,i,r){if(isNaN(e)||isNaN(n)||isNaN(i))return t;var a,s,o,l,h,c,u,d,p,f,m,g,v=t._root,y={data:r},b=t._x0,x=t._y0,_=t._z0,w=t._x1,M=t._y1,E=t._z1;if(!v)return t._root=y,t;for(;v.length;)if((d=e>=(s=(b+w)/2))?b=s:w=s,(p=n>=(o=(x+M)/2))?x=o:M=o,(f=i>=(l=(_+E)/2))?_=l:E=l,a=v,!(v=v[m=f<<2|p<<1|d]))return a[m]=y,t;if(h=+t._x.call(null,v.data),c=+t._y.call(null,v.data),u=+t._z.call(null,v.data),e===h&&n===c&&i===u)return y.next=v,a?a[m]=y:t._root=y,t;do{a=a?a[m]=new Array(8):t._root=new Array(8),(d=e>=(s=(b+w)/2))?b=s:w=s,(p=n>=(o=(x+M)/2))?x=o:M=o,(f=i>=(l=(_+E)/2))?_=l:E=l}while((m=f<<2|p<<1|d)==(g=(u>=l)<<2|(c>=o)<<1|h>=s));return a[g]=v,a[m]=y,t}var lh=function(t,e,n,i,r,a,s){this.node=t,this.x0=e,this.y0=n,this.z0=i,this.x1=r,this.y1=a,this.z1=s};function hh(t){return t[0]}function ch(t){return t[1]}function uh(t){return t[2]}function dh(t,e,n,i){var r=new ph(null==e?hh:e,null==n?ch:n,null==i?uh:i,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function ph(t,e,n,i,r,a,s,o,l){this._x=t,this._y=e,this._z=n,this._x0=i,this._y0=r,this._z0=a,this._x1=s,this._y1=o,this._z1=l,this._root=void 0}function fh(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var mh=dh.prototype=ph.prototype;mh.copy=function(){var t,e,n=new ph(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),i=this._root;if(!i)return n;if(!i.length)return n._root=fh(i),n;for(t=[{source:i,target:n._root=new Array(8)}];i=t.pop();)for(var r=0;r<8;++r)(e=i.source[r])&&(e.length?t.push({source:e,target:i.target[r]=new Array(8)}):i.target[r]=fh(e));return n},mh.add=function(t){var e=+this._x.call(null,t),n=+this._y.call(null,t),i=+this._z.call(null,t);return oh(this.cover(e,n,i),e,n,i,t)},mh.addAll=function(t){var e,n,i,r,a,s=t.length,o=new Array(s),l=new Array(s),h=new Array(s),c=1/0,u=1/0,d=1/0,p=-1/0,f=-1/0,m=-1/0;for(n=0;n<s;++n)isNaN(i=+this._x.call(null,e=t[n]))||isNaN(r=+this._y.call(null,e))||isNaN(a=+this._z.call(null,e))||(o[n]=i,l[n]=r,h[n]=a,i<c&&(c=i),i>p&&(p=i),r<u&&(u=r),r>f&&(f=r),a<d&&(d=a),a>m&&(m=a));if(c>p||u>f||d>m)return this;for(this.cover(c,u,d).cover(p,f,m),n=0;n<s;++n)oh(this,o[n],l[n],h[n],t[n]);return this},mh.cover=function(t,e,n){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(n=+n))return this;var i=this._x0,r=this._y0,a=this._z0,s=this._x1,o=this._y1,l=this._z1;if(isNaN(i))s=(i=Math.floor(t))+1,o=(r=Math.floor(e))+1,l=(a=Math.floor(n))+1;else{for(var h,c,u=s-i||1,d=this._root;i>t||t>=s||r>e||e>=o||a>n||n>=l;)switch(c=(n<a)<<2|(e<r)<<1|t<i,(h=new Array(8))[c]=d,d=h,u*=2,c){case 0:s=i+u,o=r+u,l=a+u;break;case 1:i=s-u,o=r+u,l=a+u;break;case 2:s=i+u,r=o-u,l=a+u;break;case 3:i=s-u,r=o-u,l=a+u;break;case 4:s=i+u,o=r+u,a=l-u;break;case 5:i=s-u,o=r+u,a=l-u;break;case 6:s=i+u,r=o-u,a=l-u;break;case 7:i=s-u,r=o-u,a=l-u}this._root&&this._root.length&&(this._root=d)}return this._x0=i,this._y0=r,this._z0=a,this._x1=s,this._y1=o,this._z1=l,this},mh.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},mh.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},mh.find=function(t,e,n,i){var r,a,s,o,l,h,c,u,d,p=this._x0,f=this._y0,m=this._z0,g=this._x1,v=this._y1,y=this._z1,b=[],x=this._root;for(x&&b.push(new lh(x,p,f,m,g,v,y)),null==i?i=1/0:(p=t-i,f=e-i,m=n-i,g=t+i,v=e+i,y=n+i,i*=i);u=b.pop();)if(!(!(x=u.node)||(a=u.x0)>g||(s=u.y0)>v||(o=u.z0)>y||(l=u.x1)<p||(h=u.y1)<f||(c=u.z1)<m))if(x.length){var _=(a+l)/2,w=(s+h)/2,M=(o+c)/2;b.push(new lh(x[7],_,w,M,l,h,c),new lh(x[6],a,w,M,_,h,c),new lh(x[5],_,s,M,l,w,c),new lh(x[4],a,s,M,_,w,c),new lh(x[3],_,w,o,l,h,M),new lh(x[2],a,w,o,_,h,M),new lh(x[1],_,s,o,l,w,M),new lh(x[0],a,s,o,_,w,M)),(d=(n>=M)<<2|(e>=w)<<1|t>=_)&&(u=b[b.length-1],b[b.length-1]=b[b.length-1-d],b[b.length-1-d]=u)}else{var E=t-+this._x.call(null,x.data),S=e-+this._y.call(null,x.data),A=n-+this._z.call(null,x.data),T=E*E+S*S+A*A;if(T<i){var C=Math.sqrt(i=T);p=t-C,f=e-C,m=n-C,g=t+C,v=e+C,y=n+C,r=x.data}}return r},mh.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t))||isNaN(o=+this._z.call(null,t)))return this;var e,n,i,r,a,s,o,l,h,c,u,d,p,f,m,g=this._root,v=this._x0,y=this._y0,b=this._z0,x=this._x1,_=this._y1,w=this._z1;if(!g)return this;if(g.length)for(;;){if((u=a>=(l=(v+x)/2))?v=l:x=l,(d=s>=(h=(y+_)/2))?y=h:_=h,(p=o>=(c=(b+w)/2))?b=c:w=c,e=g,!(g=g[f=p<<2|d<<1|u]))return this;if(!g.length)break;(e[f+1&7]||e[f+2&7]||e[f+3&7]||e[f+4&7]||e[f+5&7]||e[f+6&7]||e[f+7&7])&&(n=e,m=f)}for(;g.data!==t;)if(i=g,!(g=g.next))return this;return(r=g.next)&&delete g.next,i?(r?i.next=r:delete i.next,this):e?(r?e[f]=r:delete e[f],(g=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&g===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!g.length&&(n?n[m]=g:this._root=g),this):(this._root=r,this)},mh.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},mh.root=function(){return this._root},mh.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},mh.visit=function(t){var e,n,i,r,a,s,o,l,h=[],c=this._root;for(c&&h.push(new lh(c,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=h.pop();)if(!t(c=e.node,i=e.x0,r=e.y0,a=e.z0,s=e.x1,o=e.y1,l=e.z1)&&c.length){var u=(i+s)/2,d=(r+o)/2,p=(a+l)/2;(n=c[7])&&h.push(new lh(n,u,d,p,s,o,l)),(n=c[6])&&h.push(new lh(n,i,d,p,u,o,l)),(n=c[5])&&h.push(new lh(n,u,r,p,s,d,l)),(n=c[4])&&h.push(new lh(n,i,r,p,u,d,l)),(n=c[3])&&h.push(new lh(n,u,d,a,s,o,p)),(n=c[2])&&h.push(new lh(n,i,d,a,u,o,p)),(n=c[1])&&h.push(new lh(n,u,r,a,s,d,p)),(n=c[0])&&h.push(new lh(n,i,r,a,u,d,p))}return this},mh.visitAfter=function(t){var e,n=[],i=[];for(this._root&&n.push(new lh(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=n.pop();){var r=e.node;if(r.length){var a,s=e.x0,o=e.y0,l=e.z0,h=e.x1,c=e.y1,u=e.z1,d=(s+h)/2,p=(o+c)/2,f=(l+u)/2;(a=r[0])&&n.push(new lh(a,s,o,l,d,p,f)),(a=r[1])&&n.push(new lh(a,d,o,l,h,p,f)),(a=r[2])&&n.push(new lh(a,s,p,l,d,c,f)),(a=r[3])&&n.push(new lh(a,d,p,l,h,c,f)),(a=r[4])&&n.push(new lh(a,s,o,f,d,p,u)),(a=r[5])&&n.push(new lh(a,d,o,f,h,p,u)),(a=r[6])&&n.push(new lh(a,s,p,f,d,c,u)),(a=r[7])&&n.push(new lh(a,d,p,f,h,c,u))}i.push(e)}for(;e=i.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},mh.x=function(t){return arguments.length?(this._x=t,this):this._x},mh.y=function(t){return arguments.length?(this._y=t,this):this._y},mh.z=function(t){return arguments.length?(this._z=t,this):this._z};var gh=function(){var t,e,n,i,r,a,s=Hl(-30),o=1,l=1/0,h=.81;function c(i){var a,s=t.length,o=(1===e?Jl(t,Nl):2===e?ih(t,Nl,Bl):3===e?dh(t,Nl,Bl,kl):null).visitAfter(d);for(r=i,a=0;a<s;++a)n=t[a],o.visit(p)}function u(){if(t){var e,n,i=t.length;for(a=new Array(i),e=0;e<i;++e)n=t[e],a[n.index]=+s(n,e,t)}}function d(t){var n,i,r,s,o,l,h=0,c=0,u=t.length;if(u){for(r=s=o=l=0;l<u;++l)(n=t[l])&&(i=Math.abs(n.value))&&(h+=n.value,c+=i,r+=i*(n.x||0),s+=i*(n.y||0),o+=i*(n.z||0));h*=Math.sqrt(4/u),t.x=r/c,e>1&&(t.y=s/c),e>2&&(t.z=o/c)}else{(n=t).x=n.data.x,e>1&&(n.y=n.data.y),e>2&&(n.z=n.data.z);do{h+=a[n.data.index]}while(n=n.next)}t.value=h}function p(t,s,c,u,d){if(!t.value)return!0;var p=[c,u,d][e-1],f=t.x-n.x,m=e>1?t.y-n.y:0,g=e>2?t.z-n.z:0,v=p-s,y=f*f+m*m+g*g;if(v*v/h<y)return y<l&&(0===f&&(y+=(f=Vl(i))*f),e>1&&0===m&&(y+=(m=Vl(i))*m),e>2&&0===g&&(y+=(g=Vl(i))*g),y<o&&(y=Math.sqrt(o*y)),n.vx+=f*t.value*r/y,e>1&&(n.vy+=m*t.value*r/y),e>2&&(n.vz+=g*t.value*r/y)),!0;if(!(t.length||y>=l)){(t.data!==n||t.next)&&(0===f&&(y+=(f=Vl(i))*f),e>1&&0===m&&(y+=(m=Vl(i))*m),e>2&&0===g&&(y+=(g=Vl(i))*g),y<o&&(y=Math.sqrt(o*y)));do{t.data!==n&&(v=a[t.data.index]*r/y,n.vx+=f*v,e>1&&(n.vy+=m*v),e>2&&(n.vz+=g*v))}while(t=t.next)}}return c.initialize=function(n,...r){t=n,i=r.find(t=>"function"==typeof t)||Math.random,e=r.find(t=>[1,2,3].includes(t))||2,u()},c.strength=function(t){return arguments.length?(s="function"==typeof t?t:Hl(+t),u(),c):s},c.distanceMin=function(t){return arguments.length?(o=t*t,c):Math.sqrt(o)},c.distanceMax=function(t){return arguments.length?(l=t*t,c):Math.sqrt(l)},c.theta=function(t){return arguments.length?(h=t*t,c):Math.sqrt(h)},c},vh=function(t,e,n){var i,r=1;function a(){var a,s,o=i.length,l=0,h=0,c=0;for(a=0;a<o;++a)l+=(s=i[a]).x||0,h+=s.y||0,c+=s.z||0;for(l=(l/o-t)*r,h=(h/o-e)*r,c=(c/o-n)*r,a=0;a<o;++a)s=i[a],l&&(s.x-=l),h&&(s.y-=h),c&&(s.z-=c)}return null==t&&(t=0),null==e&&(e=0),null==n&&(n=0),a.initialize=function(t){i=t},a.x=function(e){return arguments.length?(t=+e,a):t},a.y=function(t){return arguments.length?(e=+t,a):e},a.z=function(t){return arguments.length?(n=+t,a):n},a.strength=function(t){return arguments.length?(r=+t,a):r},a},yh=n(8),bh=n.n(yh),xh=n(9),_h=n.n(xh),wh=n(10),Mh=n.n(wh);function Eh(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null==n)return;var i,r,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(a.push(i.value),!e||a.length!==e);s=!0);}catch(t){o=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw r}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Sh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Sh(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Sh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}var Ah=function t(e,n){var i=n.default,r=void 0===i?null:i,a=n.triggerUpdate,s=void 0===a||a,o=n.onChange,l=void 0===o?function(t,e){}:o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.name=e,this.defaultVal=r,this.triggerUpdate=s,this.onChange=l};var Th=function(t){var e=t.stateInit,n=void 0===e?function(){return{}}:e,i=t.props,r=void 0===i?{}:i,a=t.methods,s=void 0===a?{}:a,o=t.aliases,l=void 0===o?{}:o,h=t.init,c=void 0===h?function(){}:h,u=t.update,d=void 0===u?function(){}:u,p=Object.keys(r).map((function(t){return new Ah(t,r[t])}));return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object.assign({},n instanceof Function?n(t):n,{initialised:!1}),i={};function r(e){return a(e,t),o(),r}var a=function(t,n){c.call(r,t,e,n),e.initialised=!0},o=Mh()((function(){e.initialised&&(d.call(r,e,i),i={})}),1);return p.forEach((function(t){r[t.name]=function(t){var n=t.name,a=t.triggerUpdate,s=void 0!==a&&a,l=t.onChange,h=void 0===l?function(t,e){}:l,c=t.defaultVal,u=void 0===c?null:c;return function(t){var a=e[n];if(!arguments.length)return a;var l=void 0===t?u:t;return e[n]=l,h.call(r,l,e,a),!i.hasOwnProperty(n)&&(i[n]=a),s&&o(),r}}(t)})),Object.keys(s).forEach((function(t){r[t]=function(){for(var n,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return(n=s[t]).call.apply(n,[r,e].concat(a))}})),Object.entries(l).forEach((function(t){var e=Eh(t,2),n=e[0],i=e[1];return r[n]=r[i]})),r.resetProps=function(){return p.forEach((function(t){r[t.name](t.defaultVal)})),r},r.resetProps(),e._rerender=o,r}},Ch=n(1);function Lh(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let i=-1;for(let r of t)null!=(r=e(r,++i,t))&&(n>r||void 0===n&&r>=r)&&(n=r)}return n}function Rh(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n<e||void 0===n&&e>=e)&&(n=e);else{let i=-1;for(let r of t)null!=(r=e(r,++i,t))&&(n<r||void 0===n&&r>=r)&&(n=r)}return n}function Ph(t,e){if(null==t)return{};var n,i,r=function(t,e){if(null==t)return{};var n,i,r={},a=Object.keys(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)>=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Dh(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null==n)return;var i,r,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(a.push(i.value),!e||a.length!==e);s=!0);}catch(t){o=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw r}}return a}(t,e)||zh(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ih(t){return function(t){if(Array.isArray(t))return Nh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||zh(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zh(t,e){if(t){if("string"==typeof t)return Nh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Nh(t,e):void 0}}function Nh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function Bh(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var kh=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=(e instanceof Array?e.length?e:[void 0]:[e]).map((function(t){return{keyAccessor:t,isProp:!(t instanceof Function)}})),a=t.reduce((function(t,e){var i=t,a=e;return r.forEach((function(t,e){var s,o=t.keyAccessor;if(t.isProp){var l=a,h=l[o],c=Ph(l,[o].map(Bh));s=h,a=c}else s=o(a,e);e+1<r.length?(i.hasOwnProperty(s)||(i[s]={}),i=i[s]):n?(i.hasOwnProperty(s)||(i[s]=[]),i[s].push(a)):i[s]=a})),t}),{});n instanceof Function&&function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;i===r.length?Object.keys(e).forEach((function(t){return e[t]=n(e[t])})):Object.values(e).forEach((function(e){return t(e,i+1)}))}(a);var s=a;return i&&(s=[],function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];n.length===r.length?s.push({keys:n,vals:e}):Object.entries(e).forEach((function(e){var i=Dh(e,2),r=i[0],a=i[1];return t(a,[].concat(Ih(n),[r]))}))}(a),e instanceof Array&&0===e.length&&1===s.length&&(s[0].keys=[])),s};function Oh(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function Fh(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Uh(t,e){if(null==t)return{};var n,i,r=function(t,e){if(null==t)return{};var n,i,r={},a=Object.keys(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)>=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Hh(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null==n)return;var i,r,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(a.push(i.value),!e||a.length!==e);s=!0);}catch(t){o=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw r}}return a}(t,e)||Gh(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vh(t){return function(t){if(Array.isArray(t))return Wh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Gh(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Gh(t,e){if(t){if("string"==typeof t)return Wh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Wh(t,e):void 0}}function Wh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function jh(t,e,n){var i=n.objBindAttr,r=void 0===i?"__obj":i,a=n.dataBindAttr,s=void 0===a?"__data":a,o=n.idAccessor,l=n.purge,h=void 0!==l&&l,c=function(t){return t.hasOwnProperty(s)},u=e.filter((function(t){return!c(t)})),d=e.filter(c).map((function(t){return t[s]})),p=h?{enter:t,exit:d,update:[]}:function(t,e,n){var i={enter:[],update:[],exit:[]};if(n){var r=kh(t,n,!1),a=kh(e,n,!1),s=Object.assign({},r,a);Object.entries(s).forEach((function(t){var e=Hh(t,2),n=e[0],s=e[1],o=r.hasOwnProperty(n)?a.hasOwnProperty(n)?"update":"exit":"enter";i[o].push("update"===o?[r[n],a[n]]:s)}))}else{var o=new Set(t),l=new Set(e);new Set([].concat(Vh(o),Vh(l))).forEach((function(t){var e=o.has(t)?l.has(t)?"update":"exit":"enter";i[e].push("update"===e?[t,t]:t)}))}return i}(d,t,o);return p.update=p.update.map((function(t){var e=Hh(t,2),n=e[0],i=e[1];return n!==i&&(i[r]=n[r],i[r][s]=i),i})),p.exit=p.exit.concat(u.map((function(t){return Fh({},r,t)}))),p}var qh=function(t,e,n,i,r){var a=r.createObj,s=void 0===a?function(t){return{}}:a,o=r.updateObj,l=void 0===o?function(t,e){}:o,h=r.exitObj,c=void 0===h?function(t){}:h,u=r.objBindAttr,d=void 0===u?"__obj":u,p=r.dataBindAttr,f=void 0===p?"__data":p,m=Uh(r,["createObj","updateObj","exitObj","objBindAttr","dataBindAttr"]),g=jh(t,e,function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Oh(Object(n),!0).forEach((function(e){Fh(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Oh(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({objBindAttr:d,dataBindAttr:f},m)),v=g.enter,y=g.update;g.exit.forEach((function(t){var e=t[d];delete t[d],c(e),i(e)}));var b=function(t){var e=[];return t.forEach((function(t){var n=s(t);n&&(n[f]=t,t[d]=n,e.push(n))})),e}(v);!function(t){t.forEach((function(t){var e=t[d];e&&(e[f]=t,l(e,t))}))}([].concat(Vh(v),Vh(y))),b.forEach(n)};class Xh extends Map{constructor(t,e=$h){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(Yh(this,t))}has(t){return super.has(Yh(this,t))}set(t,e){return super.set(Jh(this,t),e)}delete(t){return super.delete(Zh(this,t))}}Set;function Yh({_intern:t,_key:e},n){const i=e(n);return t.has(i)?t.get(i):n}function Jh({_intern:t,_key:e},n){const i=e(n);return t.has(i)?t.get(i):(t.set(i,n),n)}function Zh({_intern:t,_key:e},n){const i=e(n);return t.has(i)&&(n=t.get(i),t.delete(i)),n}function $h(t){return null!==t&&"object"==typeof t?t.valueOf():t}function Qh(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}const Kh=Symbol("implicit");var tc=function(t){for(var e=t.length/6|0,n=new Array(e),i=0;i<e;)n[i]="#"+t.slice(6*i,6*++i);return n}("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),ec=n(5),nc=n.n(ec);function ic(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function rc(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ic(Object(n),!0).forEach((function(e){oc(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ic(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function ac(t){return(ac="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function sc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function oc(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lc(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&cc(t,e)}function hc(t){return(hc=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function cc(t,e){return(cc=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function uc(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function dc(t,e,n){return(dc=uc()?Reflect.construct:function(t,e,n){var i=[null];i.push.apply(i,e);var r=new(Function.bind.apply(t,i));return n&&cc(r,n.prototype),r}).apply(null,arguments)}function pc(t,e){if(null==t)return{};var n,i,r=function(t,e){if(null==t)return{};var n,i,r={},a=Object.keys(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)>=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(i=0;i<a.length;i++)n=a[i],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function fc(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function mc(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?fc(t):e}function gc(t){var e=uc();return function(){var n,i=hc(t);if(e){var r=hc(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return mc(this,n)}}function vc(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,r,a=[],s=!0,o=!1;try{for(n=n.call(t);!(s=(i=n.next()).done)&&(a.push(i.value),!e||a.length!==e);s=!0);}catch(t){o=!0,r=t}finally{try{s||null==n.return||n.return()}finally{if(o)throw r}}return a}(t,e)||bc(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yc(t){return function(t){if(Array.isArray(t))return xc(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||bc(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bc(t,e){if(t){if("string"==typeof t)return xc(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xc(t,e):void 0}}function xc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}var _c=function t(e){e.geometry&&e.geometry.dispose(),e.material&&function t(e){e instanceof Array?e.forEach(t):(e.map&&e.map.dispose(),e.dispose())}(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(t)},wc=function(t){for(;t.children.length;){var e=t.children[0];t.remove(e),_c(e)}},Mc=["objFilter"];function Ec(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.objFilter,r=void 0===i?function(){return!0}:i,a=pc(n,Mc);return qh(t,e.children.filter(r),(function(t){return e.add(t)}),(function(t){e.remove(t),wc(t)}),rc({objBindAttr:"__threeObj"},a))}var Sc=function(t){return isNaN(t)?parseInt(nc()(t).toHex(),16):t},Ac=function(t){return isNaN(t)?nc()(t).getAlpha():1},Tc=function t(){var e=new Xh,n=[],i=[],r=Kh;function a(t){let a=e.get(t);if(void 0===a){if(r!==Kh)return r;e.set(t,a=n.push(t)-1)}return i[a%i.length]}return a.domain=function(t){if(!arguments.length)return n.slice();n=[],e=new Xh;for(const i of t)e.has(i)||e.set(i,n.push(i)-1);return a},a.range=function(t){return arguments.length?(i=Array.from(t),a):i.slice()},a.unknown=function(t){return arguments.length?(r=t,a):r},a.copy=function(){return t(n,i).unknown(r)},Qh.apply(a,arguments),a}(tc);function Cc(t,e,n){e&&"string"==typeof n&&t.filter((function(t){return!t[n]})).forEach((function(t){t[n]=Tc(e(t))}))}var Lc=window.THREE?window.THREE:{Group:Ar,Mesh:Ae,MeshLambertMaterial:Fs,Color:qt,BufferGeometry:le,BufferAttribute:Zt,Matrix4:et,Vector3:E,SphereBufferGeometry:Ps,CylinderBufferGeometry:Ia,TubeBufferGeometry:Ds,ConeBufferGeometry:za,Line:xa,LineBasicMaterial:fa,QuadraticBezierCurve3:$a,CubicBezierCurve3:Ya,Box3:T},Rc={graph:bh.a,forcelayout:_h.a},Pc=(new Lc.BufferGeometry).setAttribute?"setAttribute":"addAttribute",Dc=(new Lc.BufferGeometry).applyMatrix4?"applyMatrix4":"applyMatrix";var Ic=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=function(e){lc(r,e);var i=gc(r);function r(){var e;sc(this,r);for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return(e=i.call.apply(i,[this].concat(s))).__kapsuleInstance=t().apply(void 0,[].concat(yc(n?[fc(e)]:[]),s)),e}return r}(e);return Object.keys(t()).forEach((function(t){return i.prototype[t]=function(){var e,n=(e=this.__kapsuleInstance)[t].apply(e,arguments);return n===this.__kapsuleInstance?this:n}})),i}(Th({props:{jsonUrl:{onChange:function(t,e){var n=this;t&&!e.fetchingJson&&(e.fetchingJson=!0,e.onLoading(),fetch(t).then((function(t){return t.json()})).then((function(t){e.fetchingJson=!1,e.onFinishLoading(t),n.graphData(t)})))},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(t,e){e.engineRunning=!1}},numDimensions:{default:3,onChange:function(t,e){var n=e.d3ForceLayout.force("charge");function i(t,e){t.forEach((function(t){delete t[e],delete t["v".concat(e)]}))}n&&n.strength(t>2?-60:-30),t<3&&i(e.graphData.nodes,"z"),t<2&&i(e.graphData.nodes,"y")}},dagMode:{onChange:function(t,e){!t&&"d3"===e.forceEngine&&(e.graphData.nodes||[]).forEach((function(t){return t.fx=t.fy=t.fz=void 0}))}},dagLevelDistance:{},dagNodeFilter:{default:function(t){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4},nodeId:{default:"id"},nodeVal:{default:"val"},nodeResolution:{default:8},nodeColor:{default:"color"},nodeAutoColorBy:{},nodeOpacity:{default:.75},nodeVisibility:{default:!0},nodeThreeObject:{},nodeThreeObjectExtend:{default:!1},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0},linkColor:{default:"color"},linkAutoColorBy:{},linkOpacity:{default:.2},linkWidth:{},linkResolution:{default:6},linkCurvature:{default:0,triggerUpdate:!1},linkCurveRotation:{default:0,triggerUpdate:!1},linkMaterial:{},linkThreeObject:{},linkThreeObjectExtend:{default:!1},linkPositionUpdate:{triggerUpdate:!1},linkDirectionalArrowLength:{default:0},linkDirectionalArrowColor:{},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1},linkDirectionalArrowResolution:{default:8},linkDirectionalParticles:{default:0},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleWidth:{default:.5},linkDirectionalParticleColor:{},linkDirectionalParticleResolution:{default:4},forceEngine:{default:"d3"},d3AlphaMin:{default:0},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(t,e){e.d3ForceLayout.alphaDecay(t)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(t,e){e.d3ForceLayout.alphaTarget(t)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(t,e){e.d3ForceLayout.velocityDecay(t)}},ngraphPhysics:{default:{timeStep:20,gravity:-1.2,theta:.8,springLength:30,springCoefficient:8e-4,dragCoefficient:.02}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onLoading:{default:function(){},triggerUpdate:!1},onFinishLoading:{default:function(){},triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1}},methods:{refresh:function(t){return t._flushObjects=!0,t._rerender(),this},d3Force:function(t,e,n){return void 0===n?t.d3ForceLayout.force(e):(t.d3ForceLayout.force(e,n),this)},d3ReheatSimulation:function(t){return t.d3ForceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(t){return t.cntTicks=0,t.startTickTime=new Date,t.engineRunning=!0,this},tickFrame:function(t){var e,n,i,r,a="ngraph"!==t.forceEngine;return t.engineRunning&&function(){++t.cntTicks>t.cooldownTicks||new Date-t.startTickTime>t.cooldownTime||a&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin?(t.engineRunning=!1,t.onEngineStop()):(t.layout[a?"tick":"step"](),t.onEngineTick());t.graphData.nodes.forEach((function(e){var n=e.__threeObj;if(n){var i=a?e:t.layout.getNodePosition(e[t.nodeId]);n.position.x=i.x,n.position.y=i.y||0,n.position.z=i.z||0}}));var e=Object(Ch.default)(t.linkWidth),n=Object(Ch.default)(t.linkCurvature),i=Object(Ch.default)(t.linkCurveRotation),r=Object(Ch.default)(t.linkThreeObjectExtend);t.graphData.links.forEach((function(s){var o=s.__lineObj;if(o){var l=a?s:t.layout.getLinkPosition(t.layout.graph.getLink(s.source,s.target).id),h=l[a?"source":"from"],c=l[a?"target":"to"];if(h&&c&&h.hasOwnProperty("x")&&c.hasOwnProperty("x")){!function(e){var r=a?e:t.layout.getLinkPosition(t.layout.graph.getLink(e.source,e.target).id),s=r[a?"source":"from"],o=r[a?"target":"to"];if(s&&o&&s.hasOwnProperty("x")&&o.hasOwnProperty("x")){var l=n(e);if(l){var h,c=new Lc.Vector3(s.x,s.y||0,s.z||0),u=new Lc.Vector3(o.x,o.y||0,o.z||0),d=c.distanceTo(u),p=i(e);if(d>0){var f=o.x-s.x,m=o.y-s.y||0,g=(new Lc.Vector3).subVectors(u,c),v=g.clone().multiplyScalar(l).cross(0!==f||0!==m?new Lc.Vector3(0,0,1):new Lc.Vector3(0,1,0)).applyAxisAngle(g.normalize(),p).add((new Lc.Vector3).addVectors(c,u).divideScalar(2));h=new Lc.QuadraticBezierCurve3(c,v,u)}else{var y=70*l,b=-p,x=b+Math.PI/2;h=new Lc.CubicBezierCurve3(c,new Lc.Vector3(y*Math.cos(x),y*Math.sin(x),0).add(c),new Lc.Vector3(y*Math.cos(b),y*Math.sin(b),0).add(c),u)}e.__curve=h}else e.__curve=null}}(s);var u=r(s);if(!t.linkPositionUpdate||!t.linkPositionUpdate(u?o.children[1]:o,{start:{x:h.x,y:h.y,z:h.z},end:{x:c.x,y:c.y,z:c.z}},s)||u){var d=s.__curve,p=o.children.length?o.children[0]:o;if("Line"===p.type){if(d)p.geometry.setFromPoints(d.getPoints(30));else{var f=p.geometry.getAttribute("position");f&&f.array&&6===f.array.length||p.geometry[Pc]("position",f=new Lc.BufferAttribute(new Float32Array(6),3)),f.array[0]=h.x,f.array[1]=h.y||0,f.array[2]=h.z||0,f.array[3]=c.x,f.array[4]=c.y||0,f.array[5]=c.z||0,f.needsUpdate=!0}p.geometry.computeBoundingSphere()}else if("Mesh"===p.type)if(d){p.geometry.type.match(/^Tube(Buffer)?Geometry$/)||(p.position.set(0,0,0),p.rotation.set(0,0,0),p.scale.set(1,1,1));var m=Math.ceil(10*e(s))/10/2,g=new Lc.TubeBufferGeometry(d,30,m,t.linkResolution,!1);p.geometry.dispose(),p.geometry=g}else{if(!p.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var v=Math.ceil(10*e(s))/10/2,y=new Lc.CylinderBufferGeometry(v,v,1,t.linkResolution,1,!1);y[Dc]((new Lc.Matrix4).makeTranslation(0,.5,0)),y[Dc]((new Lc.Matrix4).makeRotationX(Math.PI/2)),p.geometry.dispose(),p.geometry=y}var b=new Lc.Vector3(h.x,h.y||0,h.z||0),x=new Lc.Vector3(c.x,c.y||0,c.z||0),_=b.distanceTo(x);p.position.x=b.x,p.position.y=b.y,p.position.z=b.z,p.scale.z=_,p.parent.localToWorld(x),p.lookAt(x)}}}}}))}(),e=Object(Ch.default)(t.linkDirectionalArrowRelPos),n=Object(Ch.default)(t.linkDirectionalArrowLength),i=Object(Ch.default)(t.nodeVal),t.graphData.links.forEach((function(r){var s=r.__arrowObj;if(s){var o=a?r:t.layout.getLinkPosition(t.layout.graph.getLink(r.source,r.target).id),l=o[a?"source":"from"],h=o[a?"target":"to"];if(l&&h&&l.hasOwnProperty("x")&&h.hasOwnProperty("x")){var c=Math.sqrt(Math.max(0,i(l)||1))*t.nodeRelSize,u=Math.sqrt(Math.max(0,i(h)||1))*t.nodeRelSize,d=n(r),p=e(r),f=r.__curve?function(t){return r.__curve.getPoint(t)}:function(t){var e=function(t,e,n,i){return e[t]+(n[t]-e[t])*i||0};return{x:e("x",l,h,t),y:e("y",l,h,t),z:e("z",l,h,t)}},m=r.__curve?r.__curve.getLength():Math.sqrt(["x","y","z"].map((function(t){return Math.pow((h[t]||0)-(l[t]||0),2)})).reduce((function(t,e){return t+e}),0)),g=c+d+(m-c-u-d)*p,v=f(g/m),y=f((g-d)/m);["x","y","z"].forEach((function(t){return s.position[t]=y[t]}));var b=dc(Lc.Vector3,yc(["x","y","z"].map((function(t){return v[t]}))));s.parent.localToWorld(b),s.lookAt(b)}}})),r=Object(Ch.default)(t.linkDirectionalParticleSpeed),t.graphData.links.forEach((function(e){var n=e.__photonsObj&&e.__photonsObj.children,i=e.__singleHopPhotonsObj&&e.__singleHopPhotonsObj.children;if(i&&i.length||n&&n.length){var s=a?e:t.layout.getLinkPosition(t.layout.graph.getLink(e.source,e.target).id),o=s[a?"source":"from"],l=s[a?"target":"to"];if(o&&l&&o.hasOwnProperty("x")&&l.hasOwnProperty("x")){var h=r(e),c=e.__curve?function(t){return e.__curve.getPoint(t)}:function(t){var e=function(t,e,n,i){return e[t]+(n[t]-e[t])*i||0};return{x:e("x",o,l,t),y:e("y",o,l,t),z:e("z",o,l,t)}};[].concat(yc(n||[]),yc(i||[])).forEach((function(t,e){var i="singleHopPhotons"===t.parent.__linkThreeObjType;if(t.hasOwnProperty("__progressRatio")||(t.__progressRatio=i?0:e/n.length),t.__progressRatio+=h,t.__progressRatio>=1){if(i)return t.parent.remove(t),void wc(t);t.__progressRatio=t.__progressRatio%1}var r=t.__progressRatio,a=c(r);["x","y","z"].forEach((function(e){return t.position[e]=a[e]}))}))}}})),this},emitParticle:function(t,e){if(e){if(!e.__singleHopPhotonsObj){var n=new Lc.Group;n.__linkThreeObjType="singleHopPhotons",e.__singleHopPhotonsObj=n,t.graphScene.add(n)}var i=Object(Ch.default)(t.linkDirectionalParticleWidth),r=Math.ceil(10*i(e))/10/2,a=t.linkDirectionalParticleResolution,s=new Lc.SphereBufferGeometry(r,a,a),o=Object(Ch.default)(t.linkColor),l=Object(Ch.default)(t.linkDirectionalParticleColor)(e)||o(e)||"#f0f0f0",h=new Lc.Color(Sc(l)),c=3*t.linkOpacity,u=new Lc.MeshLambertMaterial({color:h,transparent:!0,opacity:c});e.__singleHopPhotonsObj.add(new Lc.Mesh(s,u))}return this},getGraphBbox:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0};if(!t.initialised)return null;var n=function t(n){var i=[];if(n.geometry){n.geometry.computeBoundingBox();var r=new Lc.Box3;r.copy(n.geometry.boundingBox).applyMatrix4(n.matrixWorld),i.push(r)}return i.concat.apply(i,yc((n.children||[]).filter((function(t){return!t.hasOwnProperty("__graphObjType")||"node"===t.__graphObjType&&e(t.__data)})).map(t)))}(t.graphScene);return n.length?Object.assign.apply(Object,yc(["x","y","z"].map((function(t){return oc({},t,[Lh(n,(function(e){return e.min[t]})),Rh(n,(function(e){return e.max[t]}))])})))):null}},stateInit:function(){return{d3ForceLayout:Ul().force("link",jl()).force("charge",gh()).force("center",vh()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(t,e){e.graphScene=t},update:function(t,e){var n=function(t){return t.some((function(t){return e.hasOwnProperty(t)}))};if(t.engineRunning=!1,t.onUpdate(),null!==t.nodeAutoColorBy&&n(["nodeAutoColorBy","graphData","nodeColor"])&&Cc(t.graphData.nodes,Object(Ch.default)(t.nodeAutoColorBy),t.nodeColor),null!==t.linkAutoColorBy&&n(["linkAutoColorBy","graphData","linkColor"])&&Cc(t.graphData.links,Object(Ch.default)(t.linkAutoColorBy),t.linkColor),t._flushObjects||n(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var i=Object(Ch.default)(t.nodeThreeObject),r=Object(Ch.default)(t.nodeThreeObjectExtend),a=Object(Ch.default)(t.nodeVal),s=Object(Ch.default)(t.nodeColor),o=Object(Ch.default)(t.nodeVisibility),l={},h={};Ec(t.graphData.nodes.filter(o),t.graphScene,{purge:t._flushObjects||n(["nodeThreeObject","nodeThreeObjectExtend"]),objFilter:function(t){return"node"===t.__graphObjType},createObj:function(e){var n,a=i(e),s=r(e);return a&&t.nodeThreeObject===a&&(a=a.clone()),a&&!s?n=a:((n=new Lc.Mesh).__graphDefaultObj=!0,a&&s&&n.add(a)),n.__graphObjType="node",n},updateObj:function(e,n){if(e.__graphDefaultObj){var i=a(n)||1,r=Math.cbrt(i)*t.nodeRelSize,o=t.nodeResolution;e.geometry.type.match(/^Sphere(Buffer)?Geometry$/)&&e.geometry.parameters.radius===r&&e.geometry.parameters.widthSegments===o||(l.hasOwnProperty(i)||(l[i]=new Lc.SphereBufferGeometry(r,o,o)),e.geometry.dispose(),e.geometry=l[i]);var c=s(n),u=new Lc.Color(Sc(c||"#ffffaa")),d=t.nodeOpacity*Ac(c);"MeshLambertMaterial"===e.material.type&&e.material.color.equals(u)&&e.material.opacity===d||(h.hasOwnProperty(c)||(h[c]=new Lc.MeshLambertMaterial({color:u,transparent:!0,opacity:d})),e.material.dispose(),e.material=h[c])}}})}if(t._flushObjects||n(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution"])){var c=Object(Ch.default)(t.linkThreeObject),u=Object(Ch.default)(t.linkThreeObjectExtend),d=Object(Ch.default)(t.linkMaterial),p=Object(Ch.default)(t.linkVisibility),f=Object(Ch.default)(t.linkColor),m=Object(Ch.default)(t.linkWidth),g={},v={},y={},b=t.graphData.links.filter(p);if(Ec(b,t.graphScene,{objBindAttr:"__lineObj",purge:t._flushObjects||n(["linkThreeObject","linkThreeObjectExtend","linkWidth"]),objFilter:function(t){return"link"===t.__graphObjType},createObj:function(e){var n,i,r=c(e),a=u(e);if(r&&t.linkThreeObject===r&&(r=r.clone()),!r||a)if(!!m(e))n=new Lc.Mesh;else{var s=new Lc.BufferGeometry;s[Pc]("position",new Lc.BufferAttribute(new Float32Array(6),3)),n=new Lc.Line(s)}return r?a?((i=new Lc.Group).__graphDefaultObj=!0,i.add(n),i.add(r)):i=r:(i=n).__graphDefaultObj=!0,i.renderOrder=10,i.__graphObjType="link",i},updateObj:function(e,n){if(e.__graphDefaultObj){var i=e.children.length?e.children[0]:e,r=Math.ceil(10*m(n))/10,a=!!r;if(a){var s=r/2,o=t.linkResolution;if(!i.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||i.geometry.parameters.radiusTop!==s||i.geometry.parameters.radialSegments!==o){if(!g.hasOwnProperty(r)){var l=new Lc.CylinderBufferGeometry(s,s,1,o,1,!1);l[Dc]((new Lc.Matrix4).makeTranslation(0,.5,0)),l[Dc]((new Lc.Matrix4).makeRotationX(Math.PI/2)),g[r]=l}i.geometry.dispose(),i.geometry=g[r]}}var h=d(n);if(h)i.material=h;else{var c=f(n),u=new Lc.Color(Sc(c||"#f0f0f0")),p=t.linkOpacity*Ac(c),b=a?"MeshLambertMaterial":"LineBasicMaterial";if(i.material.type!==b||!i.material.color.equals(u)||i.material.opacity!==p){var x=a?v:y;x.hasOwnProperty(c)||(x[c]=new Lc[b]({color:u,transparent:p<1,opacity:p,depthWrite:p>=1})),i.material.dispose(),i.material=x[c]}}}}}),t.linkDirectionalArrowLength||e.hasOwnProperty("linkDirectionalArrowLength")){var x=Object(Ch.default)(t.linkDirectionalArrowLength),_=Object(Ch.default)(t.linkDirectionalArrowColor);Ec(b.filter(x),t.graphScene,{objBindAttr:"__arrowObj",objFilter:function(t){return"arrow"===t.__linkThreeObjType},createObj:function(){var t=new Lc.Mesh(void 0,new Lc.MeshLambertMaterial({transparent:!0}));return t.__linkThreeObjType="arrow",t},updateObj:function(e,n){var i=x(n),r=t.linkDirectionalArrowResolution;if(!e.geometry.type.match(/^Cone(Buffer)?Geometry$/)||e.geometry.parameters.height!==i||e.geometry.parameters.radialSegments!==r){var a=new Lc.ConeBufferGeometry(.25*i,i,r);a.translate(0,i/2,0),a.rotateX(Math.PI/2),e.geometry.dispose(),e.geometry=a}e.material.color=new Lc.Color(_(n)||f(n)||"#f0f0f0"),e.material.opacity=3*t.linkOpacity}})}if(t.linkDirectionalParticles||e.hasOwnProperty("linkDirectionalParticles")){var w=Object(Ch.default)(t.linkDirectionalParticles),M=Object(Ch.default)(t.linkDirectionalParticleWidth),E=Object(Ch.default)(t.linkDirectionalParticleColor),S={},A={};Ec(b.filter(w),t.graphScene,{objBindAttr:"__photonsObj",objFilter:function(t){return"photons"===t.__linkThreeObjType},createObj:function(){var t=new Lc.Group;return t.__linkThreeObjType="photons",t},updateObj:function(e,n){var i,r=Math.round(Math.abs(w(n))),a=!!e.children.length&&e.children[0],s=Math.ceil(10*M(n))/10/2,o=t.linkDirectionalParticleResolution;a&&a.geometry.parameters.radius===s&&a.geometry.parameters.widthSegments===o?i=a.geometry:(A.hasOwnProperty(s)||(A[s]=new Lc.SphereBufferGeometry(s,o,o)),i=A[s],a&&a.geometry.dispose());var l,h=E(n)||f(n)||"#f0f0f0",c=new Lc.Color(Sc(h)),u=3*t.linkOpacity;a&&a.material.color.equals(c)&&a.material.opacity===u?l=a.material:(S.hasOwnProperty(h)||(S[h]=new Lc.MeshLambertMaterial({color:c,transparent:!0,opacity:u})),l=S[h],a&&a.material.dispose()),Ec(yc(new Array(r)).map((function(t,e){return{idx:e}})),e,{idAccessor:function(t){return t.idx},createObj:function(){return new Lc.Mesh(i,l)},updateObj:function(t){t.geometry=i,t.material=l}})}})}}if(t._flushObjects=!1,n(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){t.engineRunning=!1,t.graphData.links.forEach((function(e){e.source=e[t.linkSource],e.target=e[t.linkTarget]}));var T,C="ngraph"!==t.forceEngine;if(C){(T=t.d3ForceLayout).stop().alpha(1).numDimensions(t.numDimensions).nodes(t.graphData.nodes);var L=t.d3ForceLayout.force("link");L&&L.id((function(e){return e[t.nodeId]})).links(t.graphData.links);var R=t.dagMode&&function(t,e){var n=t.nodes,i=t.links,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=r.nodeFilter,s=void 0===a?function(){return!0}:a,o=r.onLoopError,l=void 0===o?function(t){throw"Invalid DAG structure! Found cycle in node path: ".concat(t.join(" -> "),".")}:o,h={};n.forEach((function(t){return h[e(t)]={data:t,out:[],depth:-1,skip:!s(t)}})),i.forEach((function(t){var n=t.source,i=t.target,r=l(n),a=l(i);if(!h.hasOwnProperty(r))throw"Missing source node with id: ".concat(r);if(!h.hasOwnProperty(a))throw"Missing target node with id: ".concat(a);var s=h[r],o=h[a];function l(t){return"object"===ac(t)?e(t):t}s.out.push(o)}));var c=[];d(Object.values(h));var u=Object.assign.apply(Object,[{}].concat(yc(Object.entries(h).filter((function(t){return!vc(t,2)[1].skip})).map((function(t){var e=vc(t,2);return oc({},e[0],e[1].depth)})))));return u;function d(t){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=0,a=t.length;r<a;r++){var s=t[r];if(-1!==n.indexOf(s)){var o=function(){var t=[].concat(yc(n.slice(n.indexOf(s))),[s]).map((function(t){return e(t.data)}));return c.some((function(e){return e.length===t.length&&e.every((function(e,n){return e===t[n]}))}))||(c.push(t),l(t)),"continue"}();if("continue"===o)continue}i>s.depth&&(s.depth=i,d(s.out,[].concat(yc(n),[s]),i+(s.skip?0:1)))}}}(t.graphData,(function(e){return e[t.nodeId]}),{nodeFilter:t.dagNodeFilter,onLoopError:t.onDagError||void 0}),P=Math.max.apply(Math,yc(Object.values(R||[]))),D=t.dagLevelDistance||t.graphData.nodes.length/(P||1)*2*(-1!==["radialin","radialout"].indexOf(t.dagMode)?.7:1);if(t.dagMode){var I=function(e,n){return function(i){return e?(R[i[t.nodeId]]-P/2)*D*(n?-1:1):void 0}},z=I(-1!==["lr","rl"].indexOf(t.dagMode),"rl"===t.dagMode),N=I(-1!==["td","bu"].indexOf(t.dagMode),"td"===t.dagMode),B=I(-1!==["zin","zout"].indexOf(t.dagMode),"zout"===t.dagMode);t.graphData.nodes.filter(t.dagNodeFilter).forEach((function(t){t.fx=z(t),t.fy=N(t),t.fz=B(t)}))}t.d3ForceLayout.force("dagRadial",-1!==["radialin","radialout"].indexOf(t.dagMode)?function(t,e,n,i){var r,a,s,o,l=Hl(.1);function h(t){for(var l=0,h=r.length;l<h;++l){var c=r[l],u=c.x-e||1e-6,d=(c.y||0)-n||1e-6,p=(c.z||0)-i||1e-6,f=Math.sqrt(u*u+d*d+p*p),m=(o[l]-f)*s[l]*t/f;c.vx+=u*m,a>1&&(c.vy+=d*m),a>2&&(c.vz+=p*m)}}function c(){if(r){var e,n=r.length;for(s=new Array(n),o=new Array(n),e=0;e<n;++e)o[e]=+t(r[e],e,r),s[e]=isNaN(o[e])?0:+l(r[e],e,r)}}return"function"!=typeof t&&(t=Hl(+t)),null==e&&(e=0),null==n&&(n=0),null==i&&(i=0),h.initialize=function(t,...e){r=t,a=e.find(t=>[1,2,3].includes(t))||2,c()},h.strength=function(t){return arguments.length?(l="function"==typeof t?t:Hl(+t),c(),h):l},h.radius=function(e){return arguments.length?(t="function"==typeof e?e:Hl(+e),c(),h):t},h.x=function(t){return arguments.length?(e=+t,h):e},h.y=function(t){return arguments.length?(n=+t,h):n},h.z=function(t){return arguments.length?(i=+t,h):i},h}((function(e){var n=R[e[t.nodeId]]||-1;return("radialin"===t.dagMode?P-n:n)*D})).strength((function(e){return t.dagNodeFilter(e)?1:0})):null)}else{var k=Rc.graph();t.graphData.nodes.forEach((function(e){k.addNode(e[t.nodeId])})),t.graphData.links.forEach((function(t){k.addLink(t.source,t.target)})),(T=Rc.forcelayout(k,rc({dimensions:t.numDimensions},t.ngraphPhysics))).graph=k}for(var O=0;O<t.warmupTicks&&!(C&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin);O++)T[C?"tick":"step"]();t.layout=T,this.resetCountdown()}t.engineRunning=!0,t.onFinishUpdate()}}),(window.THREE?window.THREE:{Group:Ar}).Group,!0);e.default=Ic}]);
1
+ !function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},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 n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},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=12)}([function(t,e){let i=(t,e,i)=>{let n;if(t.from){let i=document.getElementById(t.from);if(i.components["babia-filter"])n=i.components["babia-filter"];else if(i.components["babia-queryjson"])n=i.components["babia-queryjson"];else if(i.components["babia-querycsv"])n=i.components["babia-querycsv"];else if(i.components["babia-queryes"])n=i.components["babia-queryes"];else if(i.components["babia-querygithub"])n=i.components["babia-querygithub"];else if(i.components["babia-selector"])n=i.components["babia-selector"];else{if(!i.components["babia-treebuilder"])return void console.error("Problem registering to the querier",e);n=i.components["babia-treebuilder"]}}else{if(t.nodesFrom){let i=document.getElementById(t.nodesFrom);if(i.components["babia-filter"])prodComponentNodes=i.components["babia-filter"];else if(i.components["babia-queryjson"])prodComponentNodes=i.components["babia-queryjson"];else if(i.components["babia-querycsv"])prodComponentNodes=i.components["babia-querycsv"];else if(i.components["babia-queryes"])prodComponentNodes=i.components["babia-queryes"];else{if(!i.components["babia-querygithub"])return void console.error("Problem registering to the querier",e);prodComponentNodes=i.components["babia-querygithub"]}let n=document.getElementById(t.linksFrom);if(n.components["babia-filter"])prodComponentLinks=n.components["babia-filter"];else if(n.components["babia-queryjson"])prodComponentLinks=n.components["babia-queryjson"];else if(n.components["babia-querycsv"])prodComponentLinks=n.components["babia-querycsv"];else if(n.components["babia-queryes"])prodComponentLinks=n.components["babia-queryes"];else{if(!n.components["babia-querygithub"])return void console.error("Problem registering to the querier",e);prodComponentLinks=n.components["babia-querygithub"]}return{nodes:prodComponentNodes,links:prodComponentLinks}}if(e.components["babia-filter"]&&"babia-filter"!=i)n=e.components["babia-filter"];else if(e.components["babia-queryjson"]&&"babia-queryjson"!=i)n=e.components["babia-queryjson"];else if(e.components["babia-querycsv"]&&"babia-querycsv"!=i)n=e.components["babia-querycsv"];else if(e.components["babia-queryes"]&&"babia-queryes"!=i)n=e.components["babia-queryes"];else if(e.components["babia-querygithub"]&&"babia-querygithub"!=i)n=e.components["babia-querygithub"];else if(e.components["babia-selector"]&&"babia-selector"!=i)n=e.components["babia-selector"];else if(e.components["babia-treebuilder"])n=e.components["babia-treebuilder"];else if(document.querySelectorAll("[babia-filter]").length>0)n=document.querySelectorAll("[babia-filter]")[0].components["babia-filter"];else if(document.querySelectorAll("[babia-queryjson]").length>0)n=document.querySelectorAll("[babia-queryjson]")[0].components["babia-queryjson"];else if(document.querySelectorAll("[babia-querycsv]").length>0)n=document.querySelectorAll("[babia-querycsv]")[0].components["babia-queryjson"];else if(document.querySelectorAll("[babia-queryes]").length>0)n=document.querySelectorAll("[babia-queryes]")[0].components["babia-queryes"];else if(document.querySelectorAll("[babia-querygithub]").length>0)n=document.querySelectorAll("[babia-querygithub]")[0].components["babia-querygithub"];else if(document.querySelectorAll("[babia-selector]").length>0)n=document.querySelectorAll("[babia-selector]")[0].components["babia-selector"];else{if(!(document.querySelectorAll("[babia-treebuilder]").length>0))return void console.error("Error, querier not found",e,e.components,e.components["babia-selector"]);n=document.querySelectorAll("[babia-treebuilder]")[0].components["babia-treebuilder"]}}return n},n=t=>{let e;return e="string"==typeof t||t instanceof String?JSON.parse(t):t,e};t.exports.findProdComponent=i,t.exports.findNavComponent=(t,e)=>{let i;if(t.controller){let n=document.getElementById(t.controller);if(!n.components["babia-navigator"])return void console.error("Problem registering to the navigator",e);i=n.components["babia-navigator"]}else if(e.components["babia-navigator"])i=e.components["babia-navigator"];else{if(!(document.querySelectorAll("[babia-navigator]").length>0))return void console.error("Error, navigator not found",e,e.components,e.components["babia-navigator"]);i=document.querySelectorAll("[babia-navigator]")[0].components["babia-navigator"]}return i},t.exports.findTargetComponent=(t,e)=>{let i;if(t.target){{let e=document.getElementById(t.target);if(null==e)return void console.error("Target not exist.");if(e.components["babia-bars"])i=e.components["babia-bars"];else if(e.components["babia-barsmap"])i=e.components["babia-barsmap"];else if(e.components["babia-cyls"])i=e.components["babia-cyls"];else if(e.components["babia-cylsmap"])i=e.components["babia-cylsmap"];else if(e.components["babia-pie"])i=e.components["babia-pie"];else if(e.components["babia-doughnut"])i=e.components["babia-doughnut"];else if(e.components["babia-bubbles"])i=e.components["babia-bubbles"];else if(e.components["babia-city"])i=e.components["babia-city"];else if(e.components["babia-boats"])i=e.components["babia-boats"];else{if(!e.components["babia-network"])return void console.error("Visualizer not found.");i=e.components["babia-network"]}}return i}console.error("Error: Target not inserted. ")},t.exports.colors={palettes:{blues:["#142850","#27496d","#00909e","#dae1e7"],foxy:["#f79071","#fa744f","#16817a","#024249"],flat:["#120136","#035aa6","#40bad5","#fcbf1e"],sunset:["#202040","#543864","#ff6363","#ffbd69"],bussiness:["#de7119","#dee3e2","#116979","#18b0b0"],icecream:["#f76a8c","#f8dc88","#f8fab8","#ccf0e1"],ubuntu:["#511845","#900c3f","#c70039","#ff5733"],pearl:["#efa8e4","#f8e1f4","#fff0f5","#97e5ef"],commerce:["#222831","#30475e","#f2a365","#ececec"]},get:function(t,e){let i=this.palettes[e].length;return this.palettes[e][t%i]}},t.exports.updateTitle=(t,e)=>{let i=document.createElement("a-entity");return i.classList.add("babiaxrTitle"),i.setAttribute("text-geometry",{value:t.title}),t.titleFont&&i.setAttribute("text-geometry",{font:t.titleFont}),t.titleColor&&i.setAttribute("material",{color:t.titleColor}),i.setAttribute("position",t.titlePosition),i.setAttribute("rotation",e),i},t.exports.parseJson=n,t.exports.updateFunction=(t,e)=>{let r=t.data,a=t.el;if((a.components["babia-bars"]||a.components["babia-barsmap"]||a.components["babia-cyls"])&&(r.index||(r.index=r.x_axis),t.animation=r.animation,t.bar_array=[]),a.components["babia-boats"]&&(t.figures||(t.figures=[])),r.data&&e.data!==r.data){let e=n(r.data);t.processData(e)}else r.from!==e.from?(t.slice_array&&(t.slice_array=[]),t.prodComponent&&t.prodComponent.notiBuffer.unregister(t.notiBufferId),t.prodComponent=i(r,a),t.prodComponent.notiBuffer&&(t.notiBufferId=t.prodComponent.notiBuffer.register(t.processData.bind(t)))):r!==e&&t.newData&&(t.slice_array&&(t.slice_array=[]),t.bar_array&&(t.bar_array=[]),t.processData(t.newData))}},function(t,e,i){"use strict";i.r(e);e.default=function(t){return t instanceof Function?t:"string"==typeof t?function(e){return e[t]}:function(e){return t}}},function(t,e,i){class n{constructor(t,e){this.currentId=0,this.notifiers={},this.data,this.function1=t,this.function2=e}set(t){console.log("produced",t),this.data=t;for(const t of Object.values(this.notifiers))t(this.data)}register(t,e){void 0!==this.data&&(console.log("Data was ready"),t(this.data));let i=this.currentId;return this.notifiers[i]=t,this.currentId++,e&&this.function1&&this.function1(e),i}unregister(t,e){delete this.notifiers[t],e&&this.function2&&this.function2(e)}}t.exports.NotiBuffer=n},function(t,e,i){const n=i(8);t.exports=function(t){return function(e,i){let r=i&&i.indent||0,a=i&&void 0!==i.join?i.join:"\n",s=Array(r+1).join(" "),o=[];for(let i=0;i<t;++i){let t=n(i),r=0===i?"":s;o.push(r+e.replace(/{var}/g,t))}return o.join(a)}}},function(t,e){t.exports=function(t){!function(t){if(!t)throw new Error("Eventify cannot use falsy object as events subject");for(var e=["on","fire","off"],i=0;i<e.length;++i)if(t.hasOwnProperty(e[i]))throw new Error("Subject cannot be eventified, since it already has property '"+e[i]+"'")}(t);var e=function(t){var e=Object.create(null);return{on:function(i,n,r){if("function"!=typeof n)throw new Error("callback is expected to be a function");var a=e[i];return a||(a=e[i]=[]),a.push({callback:n,ctx:r}),t},off:function(i,n){if(void 0===i)return e=Object.create(null),t;if(e[i])if("function"!=typeof n)delete e[i];else for(var r=e[i],a=0;a<r.length;++a)r[a].callback===n&&r.splice(a,1);return t},fire:function(i){var n,r=e[i];if(!r)return t;arguments.length>1&&(n=Array.prototype.splice.call(arguments,1));for(var a=0;a<r.length;++a){var s=r[a];s.callback.apply(s.ctx,n)}return t}}}(t);return t.on=e.on,t.off=e.off,t.fire=e.fire,t}},function(t,e,i){var n;!function(r){var a=/^\s+/,s=/\s+$/,o=0,l=r.round,h=r.min,c=r.max,u=r.random;function d(t,e){if(e=e||{},(t=t||"")instanceof d)return t;if(!(this instanceof d))return new d(t,e);var i=function(t){var e={r:0,g:0,b:0},i=1,n=null,o=null,l=null,u=!1,d=!1;"string"==typeof t&&(t=function(t){t=t.replace(a,"").replace(s,"").toLowerCase();var e,i=!1;if(B[t])t=B[t],i=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};if(e=H.rgb.exec(t))return{r:e[1],g:e[2],b:e[3]};if(e=H.rgba.exec(t))return{r:e[1],g:e[2],b:e[3],a:e[4]};if(e=H.hsl.exec(t))return{h:e[1],s:e[2],l:e[3]};if(e=H.hsla.exec(t))return{h:e[1],s:e[2],l:e[3],a:e[4]};if(e=H.hsv.exec(t))return{h:e[1],s:e[2],v:e[3]};if(e=H.hsva.exec(t))return{h:e[1],s:e[2],v:e[3],a:e[4]};if(e=H.hex8.exec(t))return{r:D(e[1]),g:D(e[2]),b:D(e[3]),a:z(e[4]),format:i?"name":"hex8"};if(e=H.hex6.exec(t))return{r:D(e[1]),g:D(e[2]),b:D(e[3]),format:i?"name":"hex"};if(e=H.hex4.exec(t))return{r:D(e[1]+""+e[1]),g:D(e[2]+""+e[2]),b:D(e[3]+""+e[3]),a:z(e[4]+""+e[4]),format:i?"name":"hex8"};if(e=H.hex3.exec(t))return{r:D(e[1]+""+e[1]),g:D(e[2]+""+e[2]),b:D(e[3]+""+e[3]),format:i?"name":"hex"};return!1}(t));"object"==typeof t&&(G(t.r)&&G(t.g)&&G(t.b)?(p=t.r,f=t.g,g=t.b,e={r:255*L(p,255),g:255*L(f,255),b:255*L(g,255)},u=!0,d="%"===String(t.r).substr(-1)?"prgb":"rgb"):G(t.h)&&G(t.s)&&G(t.v)?(n=P(t.s),o=P(t.v),e=function(t,e,i){t=6*L(t,360),e=L(e,100),i=L(i,100);var n=r.floor(t),a=t-n,s=i*(1-e),o=i*(1-a*e),l=i*(1-(1-a)*e),h=n%6;return{r:255*[i,o,s,s,l,i][h],g:255*[l,i,i,o,s,s][h],b:255*[s,s,l,i,i,o][h]}}(t.h,n,o),u=!0,d="hsv"):G(t.h)&&G(t.s)&&G(t.l)&&(n=P(t.s),l=P(t.l),e=function(t,e,i){var n,r,a;function s(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}if(t=L(t,360),e=L(e,100),i=L(i,100),0===e)n=r=a=i;else{var o=i<.5?i*(1+e):i+e-i*e,l=2*i-o;n=s(l,o,t+1/3),r=s(l,o,t),a=s(l,o,t-1/3)}return{r:255*n,g:255*r,b:255*a}}(t.h,n,l),u=!0,d="hsl"),t.hasOwnProperty("a")&&(i=t.a));var p,f,g;return i=U(i),{ok:u,format:t.format||d,r:h(255,c(e.r,0)),g:h(255,c(e.g,0)),b:h(255,c(e.b,0)),a:i}}(t);this._originalInput=t,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=l(100*this._a)/100,this._format=e.format||i.format,this._gradientType=e.gradientType,this._r<1&&(this._r=l(this._r)),this._g<1&&(this._g=l(this._g)),this._b<1&&(this._b=l(this._b)),this._ok=i.ok,this._tc_id=o++}function p(t,e,i){t=L(t,255),e=L(e,255),i=L(i,255);var n,r,a=c(t,e,i),s=h(t,e,i),o=(a+s)/2;if(a==s)n=r=0;else{var l=a-s;switch(r=o>.5?l/(2-a-s):l/(a+s),a){case t:n=(e-i)/l+(e<i?6:0);break;case e:n=(i-t)/l+2;break;case i:n=(t-e)/l+4}n/=6}return{h:n,s:r,l:o}}function f(t,e,i){t=L(t,255),e=L(e,255),i=L(i,255);var n,r,a=c(t,e,i),s=h(t,e,i),o=a,l=a-s;if(r=0===a?0:l/a,a==s)n=0;else{switch(a){case t:n=(e-i)/l+(e<i?6:0);break;case e:n=(i-t)/l+2;break;case i:n=(t-e)/l+4}n/=6}return{h:n,s:r,v:o}}function g(t,e,i,n){var r=[N(l(t).toString(16)),N(l(e).toString(16)),N(l(i).toString(16))];return n&&r[0].charAt(0)==r[0].charAt(1)&&r[1].charAt(0)==r[1].charAt(1)&&r[2].charAt(0)==r[2].charAt(1)?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0):r.join("")}function m(t,e,i,n){return[N(k(n)),N(l(t).toString(16)),N(l(e).toString(16)),N(l(i).toString(16))].join("")}function y(t,e){e=0===e?0:e||10;var i=d(t).toHsl();return i.s-=e/100,i.s=R(i.s),d(i)}function b(t,e){e=0===e?0:e||10;var i=d(t).toHsl();return i.s+=e/100,i.s=R(i.s),d(i)}function v(t){return d(t).desaturate(100)}function x(t,e){e=0===e?0:e||10;var i=d(t).toHsl();return i.l+=e/100,i.l=R(i.l),d(i)}function _(t,e){e=0===e?0:e||10;var i=d(t).toRgb();return i.r=c(0,h(255,i.r-l(-e/100*255))),i.g=c(0,h(255,i.g-l(-e/100*255))),i.b=c(0,h(255,i.b-l(-e/100*255))),d(i)}function A(t,e){e=0===e?0:e||10;var i=d(t).toHsl();return i.l-=e/100,i.l=R(i.l),d(i)}function w(t,e){var i=d(t).toHsl(),n=(i.h+e)%360;return i.h=n<0?360+n:n,d(i)}function C(t){var e=d(t).toHsl();return e.h=(e.h+180)%360,d(e)}function M(t){var e=d(t).toHsl(),i=e.h;return[d(t),d({h:(i+120)%360,s:e.s,l:e.l}),d({h:(i+240)%360,s:e.s,l:e.l})]}function E(t){var e=d(t).toHsl(),i=e.h;return[d(t),d({h:(i+90)%360,s:e.s,l:e.l}),d({h:(i+180)%360,s:e.s,l:e.l}),d({h:(i+270)%360,s:e.s,l:e.l})]}function I(t){var e=d(t).toHsl(),i=e.h;return[d(t),d({h:(i+72)%360,s:e.s,l:e.l}),d({h:(i+216)%360,s:e.s,l:e.l})]}function S(t,e,i){e=e||6,i=i||30;var n=d(t).toHsl(),r=360/i,a=[d(t)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,a.push(d(n));return a}function T(t,e){e=e||6;for(var i=d(t).toHsv(),n=i.h,r=i.s,a=i.v,s=[],o=1/e;e--;)s.push(d({h:n,s:r,v:a})),a=(a+o)%1;return s}d.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,i,n=this.toRgb();return t=n.r/255,e=n.g/255,i=n.b/255,.2126*(t<=.03928?t/12.92:r.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:r.pow((e+.055)/1.055,2.4))+.0722*(i<=.03928?i/12.92:r.pow((i+.055)/1.055,2.4))},setAlpha:function(t){return this._a=U(t),this._roundA=l(100*this._a)/100,this},toHsv:function(){var t=f(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=f(this._r,this._g,this._b),e=l(360*t.h),i=l(100*t.s),n=l(100*t.v);return 1==this._a?"hsv("+e+", "+i+"%, "+n+"%)":"hsva("+e+", "+i+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=p(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=p(this._r,this._g,this._b),e=l(360*t.h),i=l(100*t.s),n=l(100*t.l);return 1==this._a?"hsl("+e+", "+i+"%, "+n+"%)":"hsla("+e+", "+i+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return g(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,i,n,r){var a=[N(l(t).toString(16)),N(l(e).toString(16)),N(l(i).toString(16)),N(k(n))];if(r&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1))return a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0);return a.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:l(this._r),g:l(this._g),b:l(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+l(this._r)+", "+l(this._g)+", "+l(this._b)+")":"rgba("+l(this._r)+", "+l(this._g)+", "+l(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:l(100*L(this._r,255))+"%",g:l(100*L(this._g,255))+"%",b:l(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+l(100*L(this._r,255))+"%, "+l(100*L(this._g,255))+"%, "+l(100*L(this._b,255))+"%)":"rgba("+l(100*L(this._r,255))+"%, "+l(100*L(this._g,255))+"%, "+l(100*L(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(F[g(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+m(this._r,this._g,this._b,this._a),i=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var r=d(t);i="#"+m(r._r,r._g,r._b,r._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+i+")"},toString:function(t){var e=!!t;t=t||this._format;var i=!1,n=this._a<1&&this._a>=0;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(i=this.toRgbString()),"prgb"===t&&(i=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(i=this.toHexString()),"hex3"===t&&(i=this.toHexString(!0)),"hex4"===t&&(i=this.toHex8String(!0)),"hex8"===t&&(i=this.toHex8String()),"name"===t&&(i=this.toName()),"hsl"===t&&(i=this.toHslString()),"hsv"===t&&(i=this.toHsvString()),i||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return d(this.toString())},_applyModification:function(t,e){var i=t.apply(null,[this].concat([].slice.call(e)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},lighten:function(){return this._applyModification(x,arguments)},brighten:function(){return this._applyModification(_,arguments)},darken:function(){return this._applyModification(A,arguments)},desaturate:function(){return this._applyModification(y,arguments)},saturate:function(){return this._applyModification(b,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(w,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(S,arguments)},complement:function(){return this._applyCombination(C,arguments)},monochromatic:function(){return this._applyCombination(T,arguments)},splitcomplement:function(){return this._applyCombination(I,arguments)},triad:function(){return this._applyCombination(M,arguments)},tetrad:function(){return this._applyCombination(E,arguments)}},d.fromRatio=function(t,e){if("object"==typeof t){var i={};for(var n in t)t.hasOwnProperty(n)&&(i[n]="a"===n?t[n]:P(t[n]));t=i}return d(t,e)},d.equals=function(t,e){return!(!t||!e)&&d(t).toRgbString()==d(e).toRgbString()},d.random=function(){return d.fromRatio({r:u(),g:u(),b:u()})},d.mix=function(t,e,i){i=0===i?0:i||50;var n=d(t).toRgb(),r=d(e).toRgb(),a=i/100;return d({r:(r.r-n.r)*a+n.r,g:(r.g-n.g)*a+n.g,b:(r.b-n.b)*a+n.b,a:(r.a-n.a)*a+n.a})},d.readability=function(t,e){var i=d(t),n=d(e);return(r.max(i.getLuminance(),n.getLuminance())+.05)/(r.min(i.getLuminance(),n.getLuminance())+.05)},d.isReadable=function(t,e,i){var n,r,a=d.readability(t,e);switch(r=!1,(n=function(t){var e,i;e=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),i=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA");"small"!==i&&"large"!==i&&(i="small");return{level:e,size:i}}(i)).level+n.size){case"AAsmall":case"AAAlarge":r=a>=4.5;break;case"AAlarge":r=a>=3;break;case"AAAsmall":r=a>=7}return r},d.mostReadable=function(t,e,i){var n,r,a,s,o=null,l=0;r=(i=i||{}).includeFallbackColors,a=i.level,s=i.size;for(var h=0;h<e.length;h++)(n=d.readability(t,e[h]))>l&&(l=n,o=d(e[h]));return d.isReadable(t,o,{level:a,size:s})||!r?o:(i.includeFallbackColors=!1,d.mostReadable(t,["#fff","#000"],i))};var B=d.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},F=d.hexNames=function(t){var e={};for(var i in t)t.hasOwnProperty(i)&&(e[t[i]]=i);return e}(B);function U(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var i=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=h(e,c(0,parseFloat(t))),i&&(t=parseInt(t*e,10)/100),r.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function R(t){return h(1,c(0,t))}function D(t){return parseInt(t,16)}function N(t){return 1==t.length?"0"+t:""+t}function P(t){return t<=1&&(t=100*t+"%"),t}function k(t){return r.round(255*parseFloat(t)).toString(16)}function z(t){return D(t)/255}var O,Q,V,H=(Q="[\\s|\\(]+("+(O="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+O+")[,|\\s]+("+O+")\\s*\\)?",V="[\\s|\\(]+("+O+")[,|\\s]+("+O+")[,|\\s]+("+O+")[,|\\s]+("+O+")\\s*\\)?",{CSS_UNIT:new RegExp(O),rgb:new RegExp("rgb"+Q),rgba:new RegExp("rgba"+V),hsl:new RegExp("hsl"+Q),hsla:new RegExp("hsla"+V),hsv:new RegExp("hsv"+Q),hsva:new RegExp("hsva"+V),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function G(t){return!!H.CSS_UNIT.exec(t)}t.exports?t.exports=d:void 0===(n=function(){return d}.call(e,i,e,t))||(t.exports=n)}(Math)},function(t,e,i){let n=i(0).updateTitle;const r=i(0).colors;let a=i(0).updateFunction;const s=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-cyls",{schema:{data:{type:"string"},height:{type:"string",default:"height"},radius:{type:"string",default:"radius"},x_axis:{type:"string",default:"x_axis"},from:{type:"string"},legend:{type:"boolean",default:!1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"vec3",default:{x:0,y:0,z:0}},chartHeight:{type:"number",default:10},radiusMax:{type:"number",default:2},keepHeight:{type:"boolean",default:!0},incremental:{type:"boolean",default:!1},index:{type:"string"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},uiLink:{type:"boolean",default:!1},uiLinkPosition:{type:"vec3",default:{x:-4.5,y:2,z:2.5}}},visProperties:["height","radius","x_axis"],multiple:!1,init:function(){this.notiBuffer=new s,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){a(this,t),this.data.uiLink&&l(el,this.data.uiLinkPosition)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,currentData:void 0,babiaMetadata:{id:0},valueMax:void 0,xLabels:[],xTicks:[],updateTitle:function(){this.titleEl=n(this.data,{x:0,y:0,z:0})},updateChart:function(){let t=this.newData;t=this.currentData?this.currentData:this.newData,console.log("Data babia-cyls:",t);const e=this.data;this.el;this.updateTitle();let i=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*maxValue/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=i;let n=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));this.radius_scale=e.radiusMax/n;let r=this.chartEl.querySelectorAll("a-entity[babia-cyl]"),a={};for(let t of r){a[t.getAttribute("babia-name")]={el:t,found:!1}}let s,l=[],h=[],c=0;for(let i=0;i<t.length;i++){let n,r,u=t[i],d=u[e.x_axis];n=0==i?.5+u[e.radius]*this.radius_scale:h[i-1]+s+.5+u[e.radius]*this.radius_scale,a[d]&&!u._not?(r=a[d].el,a[d].found=!0):(r=document.createElement("a-entity"),r.setAttribute("babia-name",d),r.id=u[e.index],r.object3D.position.x=n,this.chartEl.appendChild(r)),o(this,r,e,u,c,d,n,0),l.push(d),h.push(n),c++,s=u[e.radius]*this.radius_scale}for(let t in a)a[t].found||a[t].el.remove();if(e.axis){const i=h[h.length-1]+(t[0][e.radius]+t[t.length-1][e.radius])*this.radius_scale/2;this.updateAxis(l,h,i,this.maxValue)}},updateAxis:function(t,e,i,n){const r=this.data;r.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:r.palette}),this.xAxisEl.setAttribute("position",{x:0,y:0,z:r.radiusMax+.25}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:n,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:0,y:0,z:r.radiusMax+.25}),r.axis_name&&(r.index?this.xAxisEl.setAttribute("babia-axis-x","name",r.index):this.xAxisEl.setAttribute("babia-axis-x","name",r.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",r.height)))},processData:function(t){console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating cyls..."),this.updateChart(),this.notiBuffer.set(this.newData)}});let o=(t,e,i,n,a,s,o,l,h)=>{e.setAttribute("babia-cyl",{height:n[i.height]*t.lengthY/t.maxValue,radius:n[i.radius]*t.radius_scale,color:r.get(a,i.palette),label:"events",animation:i.animation}),i.legend&&(h?e.setAttribute("babia-cyl",{labelText:s+" | "+h+"\nHeight: "+n[i.height]+"\nRadius: "+n[i.radius]}):e.setAttribute("babia-cyl",{labelText:s+"\nHeight: "+n[i.height]+"\nRadius: "+n[i.radius]})),o!==e.object3D.position.x&&(i.animation?e.setAttribute("animation",{property:"object3D.position.x",to:o,dur:i.dur}):e.object3D.position.x=o),l!==e.object3D.position.z&&(i.animation?e.setAttribute("animation",{property:"object3D.position.z",to:l,dur:i.dur}):e.object3D.position.z=l)},l=(t,e)=>{let i=document.createElement("a-entity");if(!t.id){let e="bars"+Math.floor(1e3*Math.random());t.id=e}console.log("id:",t.id),i.setAttribute("babia-ui-link",{viz:t.id}),i.setAttribute("position",{x:e.x,y:e.y,z:e.z}),t.appendChild(i),console.log("Create Button",t)};t.exports.createCylinder=o},function(t,e,i){t.exports=function(t){var e=i(46),u=i(47),d=i(4);if(t){if(void 0!==t.springCoeff)throw new Error("springCoeff was renamed to springCoefficient");if(void 0!==t.dragCoeff)throw new Error("dragCoeff was renamed to dragCoefficient")}t=u(t,{springLength:10,springCoefficient:.8,gravity:-12,theta:.8,dragCoefficient:.9,timeStep:.5,adaptiveTimeStepWeight:0,dimensions:2,debug:!1});var p=h[t.dimensions];if(!p){var f=t.dimensions;p={Body:n(f,t.debug),createQuadTree:r(f),createBounds:a(f),createDragForce:s(f),createSpringForce:o(f),integrate:l(f)},h[f]=p}var g=p.Body,m=p.createQuadTree,y=p.createBounds,b=p.createDragForce,v=p.createSpringForce,x=p.integrate,_=i(48).random(42),A=[],w=[],C=m(t,_),M=y(A,t,_),E=v(t,_),I=b(t),S=[],T=new Map,B=0;L("nbody",(function(){if(0===A.length)return;C.insertBodies(A);var t=A.length;for(;t--;){var e=A[t];e.isPinned||(e.reset(),C.updateBodyForce(e),I.update(e))}})),L("spring",(function(){var t=w.length;for(;t--;)E.update(w[t])}));var F={bodies:A,quadTree:C,springs:w,settings:t,addForce:L,removeForce:function(t){var e=S.indexOf(T.get(t));if(e<0)return;S.splice(e,1),T.delete(t)},getForces:function(){return T},step:function(){for(var e=0;e<S.length;++e)S[e](B);var i=x(A,t.timeStep,t.adaptiveTimeStepWeight);return B+=1,i},addBody:function(t){if(!t)throw new Error("Body is required");return A.push(t),t},addBodyAt:function(t){if(!t)throw new Error("Body position is required");var e=(t=>new g(t))(t);return A.push(e),e},removeBody:function(t){if(t){var e=A.indexOf(t);if(!(e<0))return A.splice(e,1),0===A.length&&M.reset(),!0}},addSpring:function(t,i,n,r){if(!t||!i)throw new Error("Cannot add null spring to force simulator");"number"!=typeof n&&(n=-1);var a=new e(t,i,n,r>=0?r:-1);return w.push(a),a},getTotalMovement:function(){return 0},removeSpring:function(t){if(t){var e=w.indexOf(t);return e>-1?(w.splice(e,1),!0):void 0}},getBestNewBodyPosition:function(t){return M.getBestNewPosition(t)},getBBox:U,getBoundingBox:U,invalidateBBox:function(){console.warn("invalidateBBox() is deprecated, bounds always recomputed on `getBBox()` call")},gravity:function(e){return void 0!==e?(t.gravity=e,C.options({gravity:e}),this):t.gravity},theta:function(e){return void 0!==e?(t.theta=e,C.options({theta:e}),this):t.theta},random:_};return function(t,e){for(var i in t)c(t,e,i)}(t,F),d(F),F;function U(){return M.update(),M.box}function L(t,e){if(T.has(t))throw new Error("Force "+t+" is already added");T.set(t,e),S.push(e)}};var n=i(40),r=i(41),a=i(42),s=i(43),o=i(44),l=i(45),h={};function c(t,e,i){if(t.hasOwnProperty(i)&&"function"!=typeof e[i]){var n=Number.isFinite(t[i]);e[i]=n?function(n){if(void 0!==n){if(!Number.isFinite(n))throw new Error("Value of "+i+" should be a valid number.");return t[i]=n,e}return t[i]}:function(n){return void 0!==n?(t[i]=n,e):t[i]}}}},function(t,e){t.exports=function(t){return 0===t?"x":1===t?"y":2===t?"z":"c"+(t+1)}},function(t,e,i){t.exports=function(t){"uniqueLinkId"in(t=t||{})&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n","\n","Note: there is also change in default behavior: From now on each graph\nis considered to be not a multigraph by default (each edge is unique)."),t.multigraph=t.uniqueLinkId);void 0===t.multigraph&&(t.multigraph=!1);if("function"!=typeof Map)throw new Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var e=new Map,i=[],h={},c=0,u=t.multigraph?function(t,e,i){var n=l(t,e),r=h.hasOwnProperty(n);if(r||E(t,e)){r||(h[n]=0);var a="@"+ ++h[n];n=l(t+a,e+a)}return new o(t,e,i,n)}:function(t,e,i){var n=l(t,e);return new o(t,e,i,n)},d=[],p=I,f=I,g=I,m=I,y={addNode:x,addLink:function(t,e,n){g();var r=_(t)||x(t),a=_(e)||x(e),o=u(t,e,n);i.push(o),s(r,o),t!==e&&s(a,o);return p(o,"add"),m(),o},removeLink:M,removeNode:A,getNode:_,getNodeCount:w,getLinkCount:C,getLinksCount:C,getNodesCount:w,getLinks:function(t){var e=_(t);return e?e.links:null},forEachNode:B,forEachLinkedNode:function(t,i,n){var r=_(t);if(r&&r.links&&"function"==typeof i)return n?function(t,i,n){for(var r=0;r<t.length;++r){var a=t[r];if(a.fromId===i&&n(e.get(a.toId),a))return!0}}(r.links,t,i):function(t,i,n){for(var r=0;r<t.length;++r){var a=t[r],s=a.fromId===i?a.toId:a.fromId;if(n(e.get(s),a))return!0}}(r.links,t,i)},forEachLink:function(t){var e,n;if("function"==typeof t)for(e=0,n=i.length;e<n;++e)t(i[e])},beginUpdate:g,endUpdate:m,clear:function(){g(),B((function(t){A(t.id)})),m()},hasLink:E,hasNode:_,getLink:E};return n(y),function(){var t=y.on;y.on=function(){return y.beginUpdate=g=S,y.endUpdate=m=T,p=b,f=v,y.on=t,t.apply(y,arguments)}}(),y;function b(t,e){d.push({link:t,changeType:e})}function v(t,e){d.push({node:t,changeType:e})}function x(t,i){if(void 0===t)throw new Error("Invalid node identifier");g();var n=_(t);return n?(n.data=i,f(n,"update")):(n=new a(t,i),f(n,"add")),e.set(t,n),m(),n}function _(t){return e.get(t)}function A(t){var i=_(t);if(!i)return!1;g();var n=i.links;if(n){i.links=null;for(var r=0;r<n.length;++r)M(n[r])}return e.delete(t),f(i,"remove"),m(),!0}function w(){return e.size}function C(){return i.length}function M(t){if(!t)return!1;var e=r(t,i);if(e<0)return!1;g(),i.splice(e,1);var n=_(t.fromId),a=_(t.toId);return n&&(e=r(t,n.links))>=0&&n.links.splice(e,1),a&&(e=r(t,a.links))>=0&&a.links.splice(e,1),p(t,"remove"),m(),!0}function E(t,e){var i,n=_(t);if(!n||!n.links)return null;for(i=0;i<n.links.length;++i){var r=n.links[i];if(r.fromId===t&&r.toId===e)return r}return null}function I(){}function S(){c+=1}function T(){0===(c-=1)&&d.length>0&&(y.fire("changed",d),d.length=0)}function B(t){if("function"!=typeof t)throw new Error("Function is expected to iterate over graph nodes. You passed "+t);for(var i=e.values(),n=i.next();!n.done;){if(t(n.value))return!0;n=i.next()}}};var n=i(4);function r(t,e){if(!e)return-1;if(e.indexOf)return e.indexOf(t);var i,n=e.length;for(i=0;i<n;i+=1)if(e[i]===t)return i;return-1}function a(t,e){this.id=t,this.links=null,this.data=e}function s(t,e){t.links?t.links.push(e):t.links=[e]}function o(t,e,i,n){this.fromId=t,this.toId=e,this.data=i,this.id=n}function l(t,e){return t.toString()+"👉 "+e.toString()}},function(t,e,i){t.exports=function(t,e){if(!t)throw new Error("Graph structure cannot be undefined");var a=(e&&e.createSimulator||i(7))(e);if(Array.isArray(e))throw new Error("Physics settings is expected to be an object");var s=t.version>19?function(e){var i=t.getLinks(e);return i?1+i.size/3:1}:function(e){var i=t.getLinks(e);return i?1+i.length/3:1};e&&"function"==typeof e.nodeMass&&(s=e.nodeMass);var o=new Map,l={},h=0,c=a.settings.springTransform||r;h=0,t.forEachNode((function(t){m(t.id),h+=1})),t.forEachLink(b),t.on("changed",g);var u=!1,d={step:function(){if(0===h)return p(!0),!0;var t=a.step();d.lastMove=t,d.fire("step");var e=t/h<=.01;return p(e),e},getNodePosition:function(t){return _(t).pos},setNodePosition:function(t){var e=_(t);e.setPosition.apply(e,Array.prototype.slice.call(arguments,1))},getLinkPosition:function(t){var e=l[t];if(e)return{from:e.from.pos,to:e.to.pos}},getGraphRect:function(){return a.getBBox()},forEachBody:f,pinNode:function(t,e){_(t.id).isPinned=!!e},isNodePinned:function(t){return _(t.id).isPinned},dispose:function(){t.off("changed",g),d.fire("disposed")},getBody:function(t){return o.get(t)},getSpring:function(e,i){var n;if(void 0===i)n="object"!=typeof e?e:e.id;else{var r=t.hasLink(e,i);if(!r)return;n=r.id}return l[n]},getForceVectorLength:function(){var t=0,e=0;return f((function(i){t+=Math.abs(i.force.x),e+=Math.abs(i.force.y)})),Math.sqrt(t*t+e*e)},simulator:a,graph:t,lastMove:0};return n(d),d;function p(t){var e;u!==t&&(u=t,e=t,d.fire("stable",e))}function f(t){o.forEach(t)}function g(e){for(var i=0;i<e.length;++i){var n=e[i];"add"===n.changeType?(n.node&&m(n.node.id),n.link&&b(n.link)):"remove"===n.changeType&&(n.node&&y(n.node),n.link&&v(n.link))}h=t.getNodesCount()}function m(e){var i=o.get(e);if(!i){var n=t.getNode(e);if(!n)throw new Error("initBody() was called with unknown node id");var r=n.position;if(!r){var s=function(t){var e=[];if(!t.links)return e;for(var i=Math.min(t.links.length,2),n=0;n<i;++n){var r=t.links[n],a=r.fromId!==t.id?o.get(r.fromId):o.get(r.toId);a&&a.pos&&e.push(a)}return e}(n);r=a.getBestNewBodyPosition(s)}(i=a.addBodyAt(r)).id=e,o.set(e,i),x(e),function(t){return t&&(t.isPinned||t.data&&t.data.isPinned)}(n)&&(i.isPinned=!0)}}function y(t){var e=t.id,i=o.get(e);i&&(o.delete(e),a.removeBody(i))}function b(t){x(t.fromId),x(t.toId);var e=o.get(t.fromId),i=o.get(t.toId),n=a.addSpring(e,i,t.length);c(t,n),l[t.id]=n}function v(e){var i=l[e.id];if(i){var n=t.getNode(e.fromId),r=t.getNode(e.toId);n&&x(n.id),r&&x(r.id),delete l[e.id],a.removeSpring(i)}}function x(t){var e=o.get(t);if(e.mass=s(t),Number.isNaN(e.mass))throw new Error("Node mass should be a number")}function _(t){var e=o.get(t);return e||(m(t),e=o.get(t)),e}},t.exports.simulator=i(7);var n=i(4);function r(){}},function(t,e){function i(t,e,i){var n,r,a,s,o;function l(){var h=Date.now()-s;h<e&&h>=0?n=setTimeout(l,e-h):(n=null,i||(o=t.apply(a,r),a=r=null))}null==e&&(e=100);var h=function(){a=this,r=arguments,s=Date.now();var h=i&&!n;return n||(n=setTimeout(l,e)),h&&(o=t.apply(a,r),a=r=null),o};return h.clear=function(){n&&(clearTimeout(n),n=null)},h.flush=function(){n&&(o=t.apply(a,r),a=r=null,clearTimeout(n),n=null)},h}i.debounce=i,t.exports=i},function(t,e,i){i(14),i(15),i(16),i(18),i(19),i(20),i(21),i(22),i(23),i(24),i(25),i(26),i(27),i(28),i(29),i(30),i(6),i(31),i(32),i(33),i(34),i(35),i(36),i(37),i(38),i(39),i(49),i(50),i(0),i(51),i(52),i(53),i(54),i(55),i(56),i(2),i(57),i(58),pauseButton=i(59),playButton=i(60),skipButton=i(61),rewindButton=i(62),tooltip=i(63)},,function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-querygithub",{schema:{user:{type:"string"},token:{type:"string"},repos:{type:"array"},data:{type:"string"}},multiple:!1,init:function(){},update:function(t){let e=this.data,r=this.el,s=this;e.data&&t.data!==e.data?a(e.data,r,s):t.user===e.user&&t.repos===e.repos&&t.token===e.token||(e.user&&0===e.repos.length?n(e,r,s):e.repos.length>0&&i(e,r,s))},remove:function(){},pause:function(){},play:function(){},babiaData:void 0,babiaMetadata:{id:0},register:function(t){this.el;this.interestedElements.push(t),this.babiaData&&o(t,"babiaData")},unregister:function(t){const e=this.interestedElements.indexOf(t);e>-1&&this.interestedElements.splice(e,1)},interestedElements:[]});let i=(t,e,i)=>{let n=[];t.repos.forEach((i,r)=>{let a=new XMLHttpRequest,s="https://api.github.com/repos/"+t.user+"/"+i+"?_="+(new Date).getTime();a.open("get",s,!1),a.onload=function(){if(this.status>=200&&this.status<300){console.log("data OK in request.response",e.id);let t=JSON.parse(a.response);n.push(t)}else reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},a.onerror=function(){reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},a.send()}),i.babiaData=n,i.babiaMetadata={id:i.babiaMetadata.id++},s("babiaData",i)},n=(t,e,i)=>{let n=new XMLHttpRequest,a="https://api.github.com/users/"+t.user+"/repos?_="+(new Date).getTime();n.open("get",a),n.onload=function(){this.status>=200&&this.status<300?(console.log("data OK in request.response",e.id),i.babiaData=r(JSON.parse(n.response)),i.babiaMetadata={id:i.babiaMetadata.id++},s("babiaData",i)):(reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText))},n.onerror=function(){reject({status:this.status,statusText:xhr.statusText}),console.error("Error during requesting data",this.status,xhr.statusText)},n.send()},r=t=>{let e=[];return t.forEach((t,i)=>{e.push(t)}),e},a=(t,e,i)=>{let n=JSON.parse(t);i.babiaData=n,i.babiaMetadata={id:i.babiaMetadata.id++},s("babiaData",i)},s=(t,e)=>{e.interestedElements.forEach(e=>{o(e,t)})},o=(t,e)=>{t.emit("babiaQuerierDataReady",e)}},function(t,e,i){let n=i(0).parseJson;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const r=i(2).NotiBuffer;AFRAME.registerComponent("babia-queryjson",{schema:{url:{type:"string"},data:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new r},update:function(t){let e=this.data;if(e.data&&t.data!==e.data){let t=n(e.data);this.notiBuffer.set(t)}else t.url!==e.url&&this.getJSON(e.url)},remove:function(){},pause:function(){},play:function(){},getJSON:async function(t){let e=await fetch(t);if(200!=e.status)throw new Error(e.status);{let t=await e.json(),i=n(t);this.notiBuffer.set(i)}}})},function(t,e,i){let n=i(17).parse;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const r=i(2).NotiBuffer;AFRAME.registerComponent("babia-querycsv",{schema:{url:{type:"string"},data:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new r},update:function(t){let e=this.data;if(e.data&&t.data!==e.data){let t=n(e.data,{header:!0,dynamicTyping:!0,skipEmptyLines:!0});this.notiBuffer.set(t.data)}else t.url!==e.url&&this.getCSV(e.url)},remove:function(){},pause:function(){},play:function(){},getCSV:async function(t){let e=this.notiBuffer;n(t,{download:!0,header:!0,skipEmptyLines:!0,dynamicTyping:!0,complete:function(t){e.set(t.data)}})}})},function(t,e,i){var n,r,a;
2
+ /* @license
3
+ Papa Parse
4
+ v5.3.1
5
+ https://github.com/mholt/PapaParse
6
+ License: MIT
7
+ */r=[],void 0===(a="function"==typeof(n=function t(){"use strict";var e="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:{},i=!e.document&&!!e.postMessage,n=i&&/blob:/i.test((e.location||{}).protocol),r={},a=0,s={parse:function(i,n){var o=(n=n||{}).dynamicTyping||!1;if(_(o)&&(n.dynamicTypingFunction=o,o={}),n.dynamicTyping=o,n.transform=!!_(n.transform)&&n.transform,n.worker&&s.WORKERS_SUPPORTED){var l=function(){if(!s.WORKERS_SUPPORTED)return!1;var i,n,o=(i=e.URL||e.webkitURL||null,n=t.toString(),s.BLOB_URL||(s.BLOB_URL=i.createObjectURL(new Blob(["(",n,")();"],{type:"text/javascript"})))),l=new e.Worker(o);return l.onmessage=m,l.id=a++,r[l.id]=l}();return l.userStep=n.step,l.userChunk=n.chunk,l.userComplete=n.complete,l.userError=n.error,n.step=_(n.step),n.chunk=_(n.chunk),n.complete=_(n.complete),n.error=_(n.error),delete n.worker,void l.postMessage({input:i,config:n,workerId:l.id})}var p=null;return s.NODE_STREAM_INPUT,"string"==typeof i?p=n.download?new h(n):new u(n):!0===i.readable&&_(i.read)&&_(i.on)?p=new d(n):(e.File&&i instanceof File||i instanceof Object)&&(p=new c(n)),p.stream(i)},unparse:function(t,e){var i=!1,n=!0,r=",",a="\r\n",o='"',l=o+o,h=!1,c=null,u=!1;!function(){if("object"==typeof e){if("string"!=typeof e.delimiter||s.BAD_DELIMITERS.filter((function(t){return-1!==e.delimiter.indexOf(t)})).length||(r=e.delimiter),("boolean"==typeof e.quotes||"function"==typeof e.quotes||Array.isArray(e.quotes))&&(i=e.quotes),"boolean"!=typeof e.skipEmptyLines&&"string"!=typeof e.skipEmptyLines||(h=e.skipEmptyLines),"string"==typeof e.newline&&(a=e.newline),"string"==typeof e.quoteChar&&(o=e.quoteChar),"boolean"==typeof e.header&&(n=e.header),Array.isArray(e.columns)){if(0===e.columns.length)throw new Error("Option columns is empty");c=e.columns}void 0!==e.escapeChar&&(l=e.escapeChar+o),"boolean"==typeof e.escapeFormulae&&(u=e.escapeFormulae)}}();var d=new RegExp(f(o),"g");if("string"==typeof t&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return p(null,t,h);if("object"==typeof t[0])return p(c||Object.keys(t[0]),t,h)}else if("object"==typeof t)return"string"==typeof t.data&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:"object"==typeof t.data[0]?Object.keys(t.data[0]):[]),Array.isArray(t.data[0])||"object"==typeof t.data[0]||(t.data=[t.data])),p(t.fields||[],t.data||[],h);throw new Error("Unable to serialize unrecognized input");function p(t,e,i){var s="";"string"==typeof t&&(t=JSON.parse(t)),"string"==typeof e&&(e=JSON.parse(e));var o=Array.isArray(t)&&0<t.length,l=!Array.isArray(e[0]);if(o&&n){for(var h=0;h<t.length;h++)0<h&&(s+=r),s+=g(t[h],h);0<e.length&&(s+=a)}for(var c=0;c<e.length;c++){var u=o?t.length:e[c].length,d=!1,p=o?0===Object.keys(e[c]).length:0===e[c].length;if(i&&!o&&(d="greedy"===i?""===e[c].join("").trim():1===e[c].length&&0===e[c][0].length),"greedy"===i&&o){for(var f=[],m=0;m<u;m++){var y=l?t[m]:m;f.push(e[c][y])}d=""===f.join("").trim()}if(!d){for(var b=0;b<u;b++){0<b&&!p&&(s+=r);var v=o&&l?t[b]:b;s+=g(e[c][v],b)}c<e.length-1&&(!i||0<u&&!p)&&(s+=a)}}return s}function g(t,e){if(null==t)return"";if(t.constructor===Date)return JSON.stringify(t).slice(1,25);!0===u&&"string"==typeof t&&null!==t.match(/^[=+\-@].*$/)&&(t="'"+t);var n=t.toString().replace(d,l);return"boolean"==typeof i&&i||"function"==typeof i&&i(t,e)||Array.isArray(i)&&i[e]||function(t,e){for(var i=0;i<e.length;i++)if(-1<t.indexOf(e[i]))return!0;return!1}(n,s.BAD_DELIMITERS)||-1<n.indexOf(r)||" "===n.charAt(0)||" "===n.charAt(n.length-1)?o+n+o:n}}};if(s.RECORD_SEP=String.fromCharCode(30),s.UNIT_SEP=String.fromCharCode(31),s.BYTE_ORDER_MARK="\ufeff",s.BAD_DELIMITERS=["\r","\n",'"',s.BYTE_ORDER_MARK],s.WORKERS_SUPPORTED=!i&&!!e.Worker,s.NODE_STREAM_INPUT=1,s.LocalChunkSize=10485760,s.RemoteChunkSize=5242880,s.DefaultDelimiter=",",s.Parser=g,s.ParserHandle=p,s.NetworkStreamer=h,s.FileStreamer=c,s.StringStreamer=u,s.ReadableStreamStreamer=d,e.jQuery){var o=e.jQuery;o.fn.parse=function(t){var i=t.config||{},n=[];return this.each((function(t){if("INPUT"!==o(this).prop("tagName").toUpperCase()||"file"!==o(this).attr("type").toLowerCase()||!e.FileReader||!this.files||0===this.files.length)return!0;for(var r=0;r<this.files.length;r++)n.push({file:this.files[r],inputElem:this,instanceConfig:o.extend({},i)})})),r(),this;function r(){if(0!==n.length){var e,i,r,l=n[0];if(_(t.before)){var h=t.before(l.file,l.inputElem);if("object"==typeof h){if("abort"===h.action)return e=l.file,i=l.inputElem,r=h.reason,void(_(t.error)&&t.error({name:"AbortError"},e,i,r));if("skip"===h.action)return void a();"object"==typeof h.config&&(l.instanceConfig=o.extend(l.instanceConfig,h.config))}else if("skip"===h)return void a()}var c=l.instanceConfig.complete;l.instanceConfig.complete=function(t){_(c)&&c(t,l.file,l.inputElem),a()},s.parse(l.file,l.instanceConfig)}else _(t.complete)&&t.complete()}function a(){n.splice(0,1),r()}}}function l(t){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(t){var e=v(t);e.chunkSize=parseInt(e.chunkSize),t.step||t.chunk||(e.chunkSize=null),this._handle=new p(e),(this._handle.streamer=this)._config=e}.call(this,t),this.parseChunk=function(t,i){if(this.isFirstChunk&&_(this._config.beforeFirstChunk)){var r=this._config.beforeFirstChunk(t);void 0!==r&&(t=r)}this.isFirstChunk=!1,this._halted=!1;var a=this._partialLine+t;this._partialLine="";var o=this._handle.parse(a,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var l=o.meta.cursor;this._finished||(this._partialLine=a.substring(l-this._baseIndex),this._baseIndex=l),o&&o.data&&(this._rowCount+=o.data.length);var h=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(n)e.postMessage({results:o,workerId:s.WORKER_ID,finished:h});else if(_(this._config.chunk)&&!i){if(this._config.chunk(o,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);o=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(o.data),this._completeResults.errors=this._completeResults.errors.concat(o.errors),this._completeResults.meta=o.meta),this._completed||!h||!_(this._config.complete)||o&&o.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),h||o&&o.meta.paused||this._nextChunk(),o}this._halted=!0},this._sendError=function(t){_(this._config.error)?this._config.error(t):n&&this._config.error&&e.postMessage({workerId:s.WORKER_ID,error:t,finished:!1})}}function h(t){var e;(t=t||{}).chunkSize||(t.chunkSize=s.RemoteChunkSize),l.call(this,t),this._nextChunk=i?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(t){this._input=t,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),i||(e.onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!i),this._config.downloadRequestHeaders){var t=this._config.downloadRequestHeaders;for(var n in t)e.setRequestHeader(n,t[n])}if(this._config.chunkSize){var r=this._start+this._config.chunkSize-1;e.setRequestHeader("Range","bytes="+this._start+"-"+r)}try{e.send(this._config.downloadRequestBody)}catch(t){this._chunkError(t.message)}i&&0===e.status&&this._chunkError()}},this._chunkLoaded=function(){4===e.readyState&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:e.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(t){var e=t.getResponseHeader("Content-Range");return null===e?-1:parseInt(e.substring(e.lastIndexOf("/")+1))}(e),this.parseChunk(e.responseText)))},this._chunkError=function(t){var i=e.statusText||t;this._sendError(new Error(i))}}function c(t){var e,i;(t=t||{}).chunkSize||(t.chunkSize=s.LocalChunkSize),l.call(this,t);var n="undefined"!=typeof FileReader;this.stream=function(t){this._input=t,i=t.slice||t.webkitSlice||t.mozSlice,n?((e=new FileReader).onload=x(this._chunkLoaded,this),e.onerror=x(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var t=this._input;if(this._config.chunkSize){var r=Math.min(this._start+this._config.chunkSize,this._input.size);t=i.call(t,this._start,r)}var a=e.readAsText(t,this._config.encoding);n||this._chunkLoaded({target:{result:a}})},this._chunkLoaded=function(t){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(t.target.result)},this._chunkError=function(){this._sendError(e.error)}}function u(t){var e;l.call(this,t=t||{}),this.stream=function(t){return e=t,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var t,i=this._config.chunkSize;return i?(t=e.substring(0,i),e=e.substring(i)):(t=e,e=""),this._finished=!e,this.parseChunk(t)}}}function d(t){l.call(this,t=t||{});var e=[],i=!0,n=!1;this.pause=function(){l.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){l.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(t){this._input=t,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){n&&1===e.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):i=!0},this._streamData=x((function(t){try{e.push("string"==typeof t?t:t.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(t){this._streamError(t)}}),this),this._streamError=x((function(t){this._streamCleanUp(),this._sendError(t)}),this),this._streamEnd=x((function(){this._streamCleanUp(),n=!0,this._streamData("")}),this),this._streamCleanUp=x((function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)}),this)}function p(t){var e,i,n,r=Math.pow(2,53),a=-r,o=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,l=/^(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))$/,h=this,c=0,u=0,d=!1,p=!1,m=[],y={data:[],errors:[],meta:{}};if(_(t.step)){var b=t.step;t.step=function(e){if(y=e,w())A();else{if(A(),0===y.data.length)return;c+=e.data.length,t.preview&&c>t.preview?i.abort():(y.data=y.data[0],b(y,h))}}}function x(e){return"greedy"===t.skipEmptyLines?""===e.join("").trim():1===e.length&&0===e[0].length}function A(){if(y&&n&&(M("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+s.DefaultDelimiter+"'"),n=!1),t.skipEmptyLines)for(var e=0;e<y.data.length;e++)x(y.data[e])&&y.data.splice(e--,1);return w()&&function(){if(y)if(Array.isArray(y.data[0])){for(var e=0;w()&&e<y.data.length;e++)y.data[e].forEach(i);y.data.splice(0,1)}else y.data.forEach(i);function i(e,i){_(t.transformHeader)&&(e=t.transformHeader(e,i)),m.push(e)}}(),function(){if(!y||!t.header&&!t.dynamicTyping&&!t.transform)return y;function e(e,i){var n,r=t.header?{}:[];for(n=0;n<e.length;n++){var a=n,s=e[n];t.header&&(a=n>=m.length?"__parsed_extra":m[n]),t.transform&&(s=t.transform(s,a)),s=C(a,s),"__parsed_extra"===a?(r[a]=r[a]||[],r[a].push(s)):r[a]=s}return t.header&&(n>m.length?M("FieldMismatch","TooManyFields","Too many fields: expected "+m.length+" fields but parsed "+n,u+i):n<m.length&&M("FieldMismatch","TooFewFields","Too few fields: expected "+m.length+" fields but parsed "+n,u+i)),r}var i=1;return!y.data.length||Array.isArray(y.data[0])?(y.data=y.data.map(e),i=y.data.length):y.data=e(y.data,0),t.header&&y.meta&&(y.meta.fields=m),u+=i,y}()}function w(){return t.header&&0===m.length}function C(e,i){return n=e,t.dynamicTypingFunction&&void 0===t.dynamicTyping[n]&&(t.dynamicTyping[n]=t.dynamicTypingFunction(n)),!0===(t.dynamicTyping[n]||t.dynamicTyping)?"true"===i||"TRUE"===i||"false"!==i&&"FALSE"!==i&&(function(t){if(o.test(t)){var e=parseFloat(t);if(a<e&&e<r)return!0}return!1}(i)?parseFloat(i):l.test(i)?new Date(i):""===i?null:i):i;var n}function M(t,e,i,n){var r={type:t,code:e,message:i};void 0!==n&&(r.row=n),y.errors.push(r)}this.parse=function(r,a,o){var l=t.quoteChar||'"';if(t.newline||(t.newline=function(t,e){t=t.substring(0,1048576);var i=new RegExp(f(e)+"([^]*?)"+f(e),"gm"),n=(t=t.replace(i,"")).split("\r"),r=t.split("\n"),a=1<r.length&&r[0].length<n[0].length;if(1===n.length||a)return"\n";for(var s=0,o=0;o<n.length;o++)"\n"===n[o][0]&&s++;return s>=n.length/2?"\r\n":"\r"}(r,l)),n=!1,t.delimiter)_(t.delimiter)&&(t.delimiter=t.delimiter(r),y.meta.delimiter=t.delimiter);else{var h=function(e,i,n,r,a){var o,l,h,c;a=a||[",","\t","|",";",s.RECORD_SEP,s.UNIT_SEP];for(var u=0;u<a.length;u++){var d=a[u],p=0,f=0,m=0;h=void 0;for(var y=new g({comments:r,delimiter:d,newline:i,preview:10}).parse(e),b=0;b<y.data.length;b++)if(n&&x(y.data[b]))m++;else{var v=y.data[b].length;f+=v,void 0!==h?0<v&&(p+=Math.abs(v-h),h=v):h=v}0<y.data.length&&(f/=y.data.length-m),(void 0===l||p<=l)&&(void 0===c||c<f)&&1.99<f&&(l=p,o=d,c=f)}return{successful:!!(t.delimiter=o),bestDelimiter:o}}(r,t.newline,t.skipEmptyLines,t.comments,t.delimitersToGuess);h.successful?t.delimiter=h.bestDelimiter:(n=!0,t.delimiter=s.DefaultDelimiter),y.meta.delimiter=t.delimiter}var c=v(t);return t.preview&&t.header&&c.preview++,e=r,i=new g(c),y=i.parse(e,a,o),A(),d?{meta:{paused:!0}}:y||{meta:{paused:!1}}},this.paused=function(){return d},this.pause=function(){d=!0,i.abort(),e=_(t.chunk)?"":e.substring(i.getCharIndex())},this.resume=function(){h.streamer._halted?(d=!1,h.streamer.parseChunk(e,!0)):setTimeout(h.resume,3)},this.aborted=function(){return p},this.abort=function(){p=!0,i.abort(),y.meta.aborted=!0,_(t.complete)&&t.complete(y),e=""}}function f(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function g(t){var e,i=(t=t||{}).delimiter,n=t.newline,r=t.comments,a=t.step,o=t.preview,l=t.fastMode,h=e=void 0===t.quoteChar?'"':t.quoteChar;if(void 0!==t.escapeChar&&(h=t.escapeChar),("string"!=typeof i||-1<s.BAD_DELIMITERS.indexOf(i))&&(i=","),r===i)throw new Error("Comment character same as delimiter");!0===r?r="#":("string"!=typeof r||-1<s.BAD_DELIMITERS.indexOf(r))&&(r=!1),"\n"!==n&&"\r"!==n&&"\r\n"!==n&&(n="\n");var c=0,u=!1;this.parse=function(t,s,d){if("string"!=typeof t)throw new Error("Input must be a string");var p=t.length,g=i.length,m=n.length,y=r.length,b=_(a),v=[],x=[],A=[],w=c=0;if(!t)return N();if(l||!1!==l&&-1===t.indexOf(e)){for(var C=t.split(n),M=0;M<C.length;M++){if(A=C[M],c+=A.length,M!==C.length-1)c+=n.length;else if(d)return N();if(!r||A.substring(0,y)!==r){if(b){if(v=[],U(A.split(i)),P(),u)return N()}else U(A.split(i));if(o&&o<=M)return v=v.slice(0,o),N(!0)}}return N()}for(var E=t.indexOf(i,c),I=t.indexOf(n,c),S=new RegExp(f(h)+f(e),"g"),T=t.indexOf(e,c);;)if(t[c]!==e)if(r&&0===A.length&&t.substring(c,c+y)===r){if(-1===I)return N();c=I+m,I=t.indexOf(n,c),E=t.indexOf(i,c)}else if(-1!==E&&(E<I||-1===I))A.push(t.substring(c,E)),c=E+g,E=t.indexOf(i,c);else{if(-1===I)break;if(A.push(t.substring(c,I)),D(I+m),b&&(P(),u))return N();if(o&&v.length>=o)return N(!0)}else for(T=c,c++;;){if(-1===(T=t.indexOf(e,T+1)))return d||x.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:v.length,index:c}),R();if(T===p-1)return R(t.substring(c,T).replace(S,e));if(e!==h||t[T+1]!==h){if(e===h||0===T||t[T-1]!==h){-1!==E&&E<T+1&&(E=t.indexOf(i,T+1)),-1!==I&&I<T+1&&(I=t.indexOf(n,T+1));var B=L(-1===I?E:Math.min(E,I));if(t[T+1+B]===i){A.push(t.substring(c,T).replace(S,e)),t[c=T+1+B+g]!==e&&(T=t.indexOf(e,c)),E=t.indexOf(i,c),I=t.indexOf(n,c);break}var F=L(I);if(t.substring(T+1+F,T+1+F+m)===n){if(A.push(t.substring(c,T).replace(S,e)),D(T+1+F+m),E=t.indexOf(i,c),T=t.indexOf(e,c),b&&(P(),u))return N();if(o&&v.length>=o)return N(!0);break}x.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:v.length,index:c}),T++}}else T++}return R();function U(t){v.push(t),w=c}function L(e){var i=0;if(-1!==e){var n=t.substring(T+1,e);n&&""===n.trim()&&(i=n.length)}return i}function R(e){return d||(void 0===e&&(e=t.substring(c)),A.push(e),c=p,U(A),b&&P()),N()}function D(e){c=e,U(A),A=[],I=t.indexOf(n,c)}function N(t){return{data:v,errors:x,meta:{delimiter:i,linebreak:n,aborted:u,truncated:!!t,cursor:w+(s||0)}}}function P(){a(N()),v=[],x=[]}},this.abort=function(){u=!0},this.getCharIndex=function(){return c}}function m(t){var e=t.data,i=r[e.workerId],n=!1;if(e.error)i.userError(e.error,e.file);else if(e.results&&e.results.data){var a={abort:function(){n=!0,y(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:b,resume:b};if(_(i.userStep)){for(var s=0;s<e.results.data.length&&(i.userStep({data:e.results.data[s],errors:e.results.errors,meta:e.results.meta},a),!n);s++);delete e.results}else _(i.userChunk)&&(i.userChunk(e.results,a,e.file),delete e.results)}e.finished&&!n&&y(e.workerId,e.results)}function y(t,e){var i=r[t];_(i.userComplete)&&i.userComplete(e),i.terminate(),delete r[t]}function b(){throw new Error("Not implemented.")}function v(t){if("object"!=typeof t||null===t)return t;var e=Array.isArray(t)?[]:{};for(var i in t)e[i]=v(t[i]);return e}function x(t,e){return function(){t.apply(e,arguments)}}function _(t){return"function"==typeof t}return n&&(e.onmessage=function(t){var i=t.data;if(void 0===s.WORKER_ID&&i&&(s.WORKER_ID=i.workerId),"string"==typeof i.input)e.postMessage({workerId:s.WORKER_ID,results:s.parse(i.input,i.config),finished:!0});else if(e.File&&i.input instanceof File||i.input instanceof Object){var n=s.parse(i.input,i.config);n&&e.postMessage({workerId:s.WORKER_ID,results:n,finished:!0})}}),(h.prototype=Object.create(l.prototype)).constructor=h,(c.prototype=Object.create(l.prototype)).constructor=c,(u.prototype=Object.create(u.prototype)).constructor=u,(d.prototype=Object.create(l.prototype)).constructor=d,s})?n.apply(e,r):n)||(t.exports=a)},function(t,e,i){let n=i(0).parseJson;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const r=i(2).NotiBuffer;AFRAME.registerComponent("babia-queryes",{schema:{elasticsearch_url:{type:"string"},index:{type:"string"},query:{type:"string"},size:{type:"int",default:10},request:{type:"string"},user:{type:"string"},password:{type:"string"},data:{type:"string"},tableBars:{type:"boolean",default:!1},rangeSelector:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new r,this.tableBars=this.data.tableBars},update:function(t){this.oldData=t;let e="";if(this.data.rangeSelector){let t=document.getElementById(this.data.rangeSelector);t.components["babia-range-selector"]&&(this.prodComponent=t.components["babia-range-selector"]),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.updateQuerier.bind(this)),e=this.prodComponent.notiBuffer.data)}this.updateQuerier(e)},updateQuerier:function(t){let e=this.data,i=this.oldData;if(e.data&&i.data!==e.data){let t=n(e.data);this.notiBuffer.set(t)}else if(e.elasticsearch_url!==i.elasticsearch_url||e.index!==i.index||e.query!==i.query||e.size!==i.size){if(!e.elasticsearch_url||!e.index)return void console.error("elasicsearch_url and index must be defined");this.getJSON(e,t)}else t&&this.getJSON(e,t)},getJSON:async function(t,e){let i,r;if(t.size&&t.query)if(i=`${t.elasticsearch_url}/${t.index}/_search?size=${t.size}&${t.query}`,t.user&&t.password){let e=new Headers;e.append("Authorization","Basic "+btoa(t.user+":"+t.password)),r=await fetch(i,{headers:e})}else r=await fetch(i);else if(t.request){i=`${t.elasticsearch_url}/${t.index}/_search`;let a=await fetch(t.request);if(200!=a.status)throw new Error(a.status);if(this.json=await a.json(),this.json=n(this.json),e){let t;for(let e=0;e<this.json.query.bool.must.length;e++)this.json.query.bool.must[e].range&&(t=e);let i=this.json.query.bool.must[t].range[Object.keys(this.json.query.bool.must[t].range)[0]];i.gte=e.from,i.lte=e.to}r=t.user&&t.password?await fetch(i,{method:"POST",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json","Access-Control-Allow-Origin":"*",Authorization:"Basic "+btoa(t.user+":"+t.password)},body:JSON.stringify(this.json)}):await fetch(i,{method:"POST",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json","Access-Control-Allow-Origin":"*"},body:JSON.stringify(this.json)})}if(200==r.status){let t=await r.json();return t=this.parseDataES(t),void this.notiBuffer.set(t)}throw new Error(r.status)},parseDataES:function(t){let e=[];console.log("REQUEST:",this.json),console.log("REPLY:",t);let i=Object.keys(t.aggregations);if(this.json.aggs&&1==i.length&&!this.json.aggs[i[0]].aggs){t=t.aggregations[i[0]].buckets;for(let i=0;i<t.length;i++)e.push(t[i])}else if(this.json.aggs&&1==i.length&&this.json.aggs[i[0]].aggs){t=t.aggregations[i[0]].buckets;for(let n=0;n<t.length;n++)if(t[0][Object.keys(t[0])[0]].values)e.push({key_as_string:t[n].key_as_string,key:t[n].key,doc_count:t[n].doc_count,value:t[n][Object.keys(t[0])[0]].values[0].value});else if(t[0][Object.keys(t[0])[0]].value&&1==t[0][Object.keys(t[0])[0]].length)e.push({key_as_string:t[n].key_as_string,key:t[n].key,doc_count:t[n].doc_count,value:t[n][Object.keys(t[0])[0]].value});else if(t[0][Object.keys(t[0])[0]].buckets&&t[0][Object.keys(t[0])[0]].buckets.length>0)for(let i=0;i<t[n][Object.keys(t[0])[0]].buckets.length;i++)e.push({key_as_string:t[n].key_as_string,key:t[n][Object.keys(t[0])[0]].buckets[i].key,count:t[n][Object.keys(t[0])[0]].buckets[i].doc_count,doc_count:t[n].doc_count,value:t[n][Object.keys(t[0])[0]].value});else if(Object.keys(t[0]).length>1)if(1==this.tableBars){e.push({key_as_string:i[0],key:t[n].key,value:t[n].doc_count});for(let i=0;i<Object.keys(t[0]).length;i++)t[n][Object.keys(t[0])[i]].value&&e.push({key_as_string:Object.keys(t[0])[i],key:t[n].key,value:t[n][Object.keys(t[0])[i]].value})}else{let r={key:t[n].key,value:t[n].doc_count};t[n].key_as_string?r.key_as_string=t[n].key_as_string:r.key_as_string=i[0];for(let e=0;e<Object.keys(t[0]).length;e++)t[n][Object.keys(t[0])[e]].value&&(r[Object.keys(t[0])[e]]=t[n][Object.keys(t[0])[e]].value);if(t[0][Object.keys(t[0])[0]].buckets)for(let e=0;e<Object.keys(t[0][Object.keys(t[0])[0]].buckets).length;e++)t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]][Object.keys(t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]])[0]].value?r[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]]=t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]][Object.keys(t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]])[0]].value:r[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]]=t[n][Object.keys(t[n])[0]].buckets[Object.keys(t[n][Object.keys(t[n])[0]].buckets)[e]].doc_count;e.push(r)}else e.push({key_as_string:t[n].key_as_string,key:t[n].key,doc_count:t[n].doc_count})}else{t=t.hits.hits;for(let i=0;i<t.length;i++)e[i]=t[i]._source}return e}})},function(t,e,i){let n=i(0).findTargetComponent;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-ui",{schema:{target:{type:"string"}},multiple:!1,init:function(){console.log("WELCOME TO UI: Control your data.")},update:function(t){let e=this.data;this.targetComponent&&this.targetComponent.notiBuffer.unregister(this.notiBufferId),this.targetComponent=n(e,this),this.findQuerierComponents(this),this.targetComponent.visProperties&&(this.targetComponentVisProperties=this.targetComponent.visProperties),this.targetComponent.notiBuffer&&(this.notiBufferId=this.targetComponent.notiBuffer.register(this.updateInterface.bind(this)))},targetComponent:void 0,targetComponentVisProperties:void 0,dataMetrics:void 0,interface:void 0,dataQueriers:void 0,handController:void 0,nodesQueriers:void 0,linksQueriers:void 0,updateInterface:function(t){let e=this;for(t&&a(e,t,e.targetComponentVisProperties);e.el.firstChild;)e.el.firstChild.remove();if(console.log("Generating interface..."),document.querySelector("#babia-menu-hand")){let t=document.querySelector("#babia-menu-hand");t.parentNode.removeChild(t),r(e,e.handController)}else e.interface=o(e,e.dataMetrics,e.el);document.addEventListener("controllerconnected",t=>{for(;e.el.firstChild;)e.el.firstChild.remove();controller=t.detail.name,"left"!==t.target.getAttribute(controller).hand||document.querySelector("#babia-menu-hand")||(e.handController=t.target.id,r(e,e.handController))})},findQuerierComponents:function(){this.targetComponent.el.components["babia-network"]&&(this.targetComponent.el.components["babia-network"].data.nodesFrom||this.targetComponent.el.components["babia-network"].data.nodes)?(console.log("nodesFrom or nodes"),this.nodesQueriers=[],this.linksQueriers=[],document.querySelectorAll("[babia-queryjson]").forEach(t=>{(t.id!=this.data.target||t.id==this.data.target&&"babia-filter"==!this.targetComponent.prodComponent.attrName)&&(this.nodesQueriers.push(t.id),this.linksQueriers.push(t.id))}),document.querySelectorAll("[babia-queryes]").forEach(t=>{this.nodesQueriers.push(t.id),this.linksQueriers.push(t.id)}),document.querySelectorAll("[babia-querygithub]").forEach(t=>{this.nodesQueriers.push(t.id),this.linksQueriers.push(t.id)}),document.querySelectorAll("[babia-filter]").forEach(t=>{this.nodesQueriers.push(t.id),this.linksQueriers.push(t.id)})):(this.dataQueriers=[],document.querySelectorAll("[babia-queryjson]").forEach(t=>{(t.id!=this.data.target||t.id==this.data.target&&"babia-filter"==!this.targetComponent.prodComponent.attrName)&&this.dataQueriers.push(t.id)}),document.querySelectorAll("[babia-queryes]").forEach(t=>{this.dataQueriers.push(t.id)}),document.querySelectorAll("[babia-querygithub]").forEach(t=>{this.dataQueriers.push(t.id)}),document.querySelectorAll("[babia-filter]").forEach(t=>{this.dataQueriers.push(t.id)}))}});let r=(t,e)=>{let i=document.getElementById(e);t.interface=o(t,t.dataMetrics,i),t.interface.id="babia-menu-hand",t.interface.setAttribute("scale",{x:.03,y:.03,z:.03}),t.interface.setAttribute("position",{x:-.03*t.interface.width/2,y:.03*t.interface.height/2,z:-.1}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),t.interface.setAttribute("rotation",{x:-60}),d(t.handController,t.interface)},a=(t,e,i)=>{if("babia-network"==t.targetComponent.attrName)if(e.nodes){t.dataMetrics={nodes:[],links:[]};let n,r=["height","radius","width","size","farea","fheight","area","depth"],a=[];n=s(e.nodes[0]),Object.keys(n).forEach(t=>{"number"==typeof n[t]&&a.push(t)}),i.nodes.forEach(i=>{r.includes(i)?t.dataMetrics.nodes.push({property:i,metrics:a}):t.dataMetrics.nodes.push({property:i,metrics:Object.keys(e.nodes[0])})}),i.links1.forEach(i=>{r.includes(i)?t.dataMetrics.links.push({property:i,metrics:a}):t.dataMetrics.links.push({property:i,metrics:Object.keys(e.links[0])})})}else{t.dataMetrics=[];let n,r=["height","radius","width","size","farea","fheight","area","depth"],a=[];n=s(e[0]),Object.keys(n).forEach(t=>{"number"==typeof n[t]&&a.push(t)}),i.nodes.forEach(i=>{r.includes(i)?t.dataMetrics.push({property:i,metrics:a}):t.dataMetrics.push({property:i,metrics:Object.keys(e[0])})}),i.links0.forEach(i=>{r.includes(i)?t.dataMetrics.push({property:i,metrics:a}):t.dataMetrics.push({property:i,metrics:Object.keys(e[0])})})}else{t.dataMetrics=[];let n,r=["height","radius","width","size","farea","fheight","area","depth"],a=[];n="babia-city"==t.targetComponent.attrName?s(e):"babia-boats"==t.targetComponent.attrName?s(e[0]):e[0],Object.keys(n).forEach(t=>{"number"==typeof n[t]&&a.push(t)}),i.forEach(i=>{r.includes(i)?t.dataMetrics.push({property:i,metrics:a}):t.dataMetrics.push({property:i,metrics:Object.keys(e[0])})})}},s=t=>(t.children?child=s(t.children[0]):child=t,child),o=(t,e,i)=>{t.interface=document.createElement("a-entity"),t.interface.id="babia-menu";let n=0,r=0,a=0;if(t.targetComponent.el.components["babia-network"]&&(t.targetComponent.el.components["babia-network"].data.nodesFrom||t.targetComponent.el.components["babia-network"].data.nodes)){if(t.nodesQueriers.length>1){let e=c("Nodes",r,n);t.interface.appendChild(e),t.nodesQueriers.forEach(e=>{r+=3.25;let i=u(t,e,r,n,"nodes");i.classList.add("babiaxraycasterclass"),t.interface.appendChild(i)})}if(--n,a<r&&(a=r),r=0,t.linksQueriers.length>1){let e=c("Links",r,n);t.interface.appendChild(e),t.linksQueriers.forEach(e=>{r+=3.25;let i=u(t,e,r,n,"links");i.classList.add("babiaxraycasterclass"),t.interface.appendChild(i)})}--n,a<r&&(a=r),r=0,e.nodes.forEach(e=>{let i=c(e.property,r,n);t.interface.appendChild(i),e.metrics.forEach(i=>{r+=3.25;let a=l(t,e.property,i,r,n);a.classList.add("babiaxraycasterclass"),t.interface.appendChild(a)}),--n,a<r&&(a=r),r=0}),e.links.forEach(e=>{let i=c(e.property,r,n);t.interface.appendChild(i),e.metrics.forEach(i=>{r+=3.25;let a=l(t,e.property,i,r,n);a.classList.add("babiaxraycasterclass"),t.interface.appendChild(a)}),--n,a<r&&(a=r),r=0})}else{if(t.dataQueriers.length>1){let e=c("Data",r,n);t.interface.appendChild(e),t.dataQueriers.forEach(e=>{r+=3.25;let i=u(t,e,r,n);i.classList.add("babiaxraycasterclass"),t.interface.appendChild(i)})}--n,a<r&&(a=r),r=0,e.forEach(e=>{let i=c(e.property,r,n);t.interface.appendChild(i),e.metrics.forEach(i=>{r+=3.25;let a=l(t,e.property,i,r,n);a.classList.add("babiaxraycasterclass"),t.interface.appendChild(a)}),--n,a<r&&(a=r),r=0})}return t.interface.width=a+3,t.interface.height=Math.abs(n),t.interface.setAttribute("position",{x:-t.interface.width/2,y:t.interface.height,z:0}),i.appendChild(t.interface),t.interface},l=(t,e,i,n,r)=>{let a=document.createElement("a-box");a.property=e,a.metric=i,a.classList.add("babiaxraycasterclass"),a.setAttribute("position",{x:n,y:r,z:0}),a.setAttribute("rotation",{x:0,y:0,z:0}),a.setAttribute("height",.8),a.setAttribute("width",3),a.setAttribute("depth",.01);let s=document.createElement("a-entity");return s.setAttribute("text",{value:i,align:"center",width:"10",color:"black"}),s.setAttribute("position","0 0 0.01"),a.appendChild(s),t.targetComponent.data[e]==i&&a.setAttribute("color","#555555"),h(a,t.targetComponent,!1),a},h=(t,e,i)=>{t.addEventListener("mouseenter",(function(){t.children[0].setAttribute("text",{color:"#FFFFFF"}),t.setAttribute("color","#333333")})),i?t.addEventListener("mouseleave",(function(){t.children[0].setAttribute("text",{color:"black"}),e.data.from==t.from?t.setAttribute("color","#555555"):""!=e.data.from&&e.data.from==t.from||t.setAttribute("color","#FFFFFF")})):t.addEventListener("mouseleave",(function(){t.children[0].setAttribute("text",{color:"black"}),e.data[t.property]==t.metric?t.setAttribute("color","#555555"):t.setAttribute("color","#FFFFFF")})),t.addEventListener("click",(function(){t.property&&t.metric?("babia-boats"==e.attrName&&"area"==t.property?(e.el.removeAttribute(e.attrName,"width"),e.el.removeAttribute(e.attrName,"depth")):"babia-boats"!=e.attrName||"width"!=t.property&&"depth"!=t.property||!e.el.getAttribute("babia-boats").area||(e.el.removeAttribute(e.attrName,"area"),"width"==t.property?e.el.setAttribute(e.attrName,"depth",t.metric):e.el.setAttribute(e.attrName,"width",t.metric)),e.el.setAttribute(e.attrName,t.property,t.metric)):t.from?e.el.setAttribute(e.attrName,"from",t.from):t.nodes?e.el.setAttribute(e.attrName,"nodesFrom",t.nodes):t.links&&e.el.setAttribute(e.attrName,"linksFrom",t.links)}))},c=(t,e,i)=>{let n=document.createElement("a-plane");return n.setAttribute("position",{x:e,y:i,z:0}),n.setAttribute("rotation",{x:0,y:0,z:0}),n.setAttribute("height",.8),n.setAttribute("width",3),n.setAttribute("text",{value:t,align:"center",width:"10",color:"#FFFFFF"}),n.setAttribute("color","black"),n},u=(t,e,i,n,r)=>{let a=document.createElement("a-box");"nodes"==r?a.nodes=e:"links"==r?a.links=e:a.from=e,a.classList.add("babiaxraycasterclass"),a.setAttribute("position",{x:i,y:n,z:0}),a.setAttribute("rotation",{x:0,y:0,z:0}),a.setAttribute("height",.8),a.setAttribute("width",3),a.setAttribute("depth",.01);let s=document.createElement("a-entity");return s.setAttribute("text",{value:e,align:"center",width:"10",color:"black"}),s.setAttribute("position","0 0 0.01"),a.appendChild(s),t.targetComponent.prodComponent&&t.targetComponent.prodComponent.el.id==e?a.setAttribute("color","#555555"):a.setAttribute("color","#FFFFFF"),h(a,t.targetComponent,!0),a},d=(t,e)=>{let i=!0;document.getElementById(t).addEventListener("gripdown",(function(){i?(i=!1,e.setAttribute("visible",!1)):(i=!0,e.setAttribute("visible",!0))}))}},function(t,e,i){let n=i(0).findProdComponent,r=i(0).parseJson;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const a=i(2).NotiBuffer;AFRAME.registerComponent("babia-filter",{schema:{from:{type:"string"},filter:{type:"string"},data:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new a},update:function(t){let e=this.data,i=this.el;if(!e.data||t.data===e.data&&e.filter===t.filter)e.from===t.from&&e.filter===t.filter||(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i,"babia-filter"),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))));else{let t=r(e.data);this.processData(t)}},remove:function(){},pause:function(){},play:function(){},prodComponent:void 0,notiBufferId:void 0,processData:function(t){let e,i=this.data.filter.split("=");i[0]&&i[1]?(e=t.filter(t=>t[i[0]]==i[1]),this.notiBuffer.set(e)):console.error("Error on filter, please use key=value syntax")}})},function(e,i,n){let r=n(0).findProdComponent,a=n(0).parseJson;const s=n(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function o(e,i,n){for(t=0;t<e.length&&e[t][i]!==n;)t++;return t<e.length&&e[t]}AFRAME.registerComponent("babia-treebuilder",{schema:{from:{type:"string"},field:{type:"string"},split_by:{type:"string"},data:{type:"string"}},multiple:!1,prodComponent:void 0,notiBufferId:void 0,init:function(){this.notiBuffer=new s},update:function(t){let e=this.data,i=this.el;if(!e.data||t.data===e.data&&e.field===t.field&&e.split_by===t.split_by)e.from===t.from&&e.field===t.field&&e.split_by===t.split_by||(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=r(e,i,"babia-treebuilder"),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))));else{let t=a(e.data);this.processData(t)}},processData:function(t){let e=this.data,i=[];for(let n=0;n<t.length;n++){let r=t[n][e.field].split(e.split_by),a=i;for(let i=0;i<r.length;i++){if(!r[i])continue;let s=r[i],l=o(a,"name",s);if(l)a=l.children;else{let o={};i===r.length-1?o=t[n]:o.children=[],o.uid=t[n][e.field].split(s)[0]+s,o.name=s,a.push(o),a=o.children}}}this.notiBuffer.set(i)}})},function(t,e,i){let n=i(0).findProdComponent,r=i(0).findNavComponent,a=i(0).parseJson;class s{constructor(t,e,i,n,r,a,s){this.data={};for(let i of t){let t=i[e];this.data[t]?this.data[t].push(i):this.data[t]=[i]}this.selectors=Object.keys(this.data).sort(),this.length=this.selectors.length,this.step=n||1,this.speed=r||1,this.current=-2==i?0:i,this.state=a||"play",this.direction=s||"forward"}next(){let t=this.data[this.selectors[this.current]];return this.current+this.step<=this.length-1?this.current+=this.step:(this.current=this.length-1,this.current=this.length),t}prev(){let t=this.data[this.selectors[this.current]];return this.current-this.step>=0?this.current-=this.step:this.current=-1,t}setValue(t){let e=this.data[this.selectors[t]];return"rewind"!=this.direction?t>this.length?this.current=this.length:this.current=t<1?1:t+1:t>this.length-2?this.current=this.length-2:this.current=t<-1?-1:t-1,e}}if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const o=i(2).NotiBuffer;AFRAME.registerComponent("babia-selector",{schema:{from:{type:"string"},controller:{type:"string"},select:{type:"string",default:"date"},timeout:{type:"number",default:6e3},data:{type:"string"},current_value:{type:"number",default:-2},speed:{type:"number",default:0},step:{type:"number",default:0},direction:{type:"string",default:""},state:{type:"string",default:""}},multiple:!1,interval:void 0,init:function(){this.notiBuffer=new o,this.navNotiBuffer=new o},babiaMetadata:{id:0},update:function(t){let e=this.data,i=this.el;if(e.data&&t.data!==e.data){let t=a(e.data);this.processData(t)}else e.from!==t.from&&(this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i,"babia-selector"),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this))));if(e.controller!=t.controller&&(this.selectorController=document.querySelector("#"+e.controller),this.navComponent&&(this.navComponent.notiBuffer.unregister(this.navNotiBufferId,this),i.components.networked&&this.removeOldNavListener(this.navComponent.el)),this.navComponent=r(e,i),this.navComponent.notiBuffer&&(this.navNotiBufferId=this.navComponent.notiBuffer.register(this.processEvent.bind(this),this)),i.components.networked&&this.addMultiuserMode(this.navComponent.el)),e.direction&&e.direction!=t.direction&&("rewind"!=e.direction?(this.selectable.current!=this.selectable.length&&(this.selectable.current+=2),this.navNotiBuffer&&this.navNotiBuffer.set("forward")):(this.selectable.current<1?this.selectable.current=0:this.selectable.current-=2,this.navNotiBuffer&&this.navNotiBuffer.set("rewind"))),e.step&&e.step!=this.selectable.step&&(this.selectable.step=e.step,this.navNotiBuffer.set({type:"step",value:e.step}),"rewind"!=this.data.direction?this.selectable.current+e.step>this.selectable.length?this.selectable.current=this.selectable.length:this.selectable.current+=e.step-1:this.selectable.current-e.step<=0?this.selectable.current=-1:this.selectable.current-=e.step+1),e.speed&&e.speed!=this.selectable.speed){this.selectable.speed=e.speed;let t=this.data.timeout/e.speed;this.navNotiBuffer.set({type:"speed",value:e.speed});let i=this;clearInterval(this.interval),this.interval=window.setInterval((function(){i.loop()}),t)}i.components.networked&&i.components.networked.data.owner!=NAF.clientId&&"scene"!=i.components.networked.data.owner&&(-2!=e.current_value&&e.current_value!=t.current_value&&("rewind"!=e.direction?(this.navNotiBuffer.set({type:"position",value:e.current_value-1,label:this.selectable.selectors[e.current_value-1]}),this.setSelect(e.current_value-1)):(this.navNotiBuffer.set({type:"position",value:e.current_value+1,label:this.selectable.selectors[e.current_value+1]}),this.setSelect(e.current_value+1))),"pause"==e.state&&e.state!=t.state&&this.navNotiBuffer.set("pause"))},nextSelect:function(){this.selectable.current>this.selectable.length-1?(this.selectable.current=this.selectable.length,this.selectable.state="pause",this.el.setAttribute("babia-selector","state","pause"),this.navNotiBuffer.set("pause")):(this.newData=this.selectable.next(),this.el.setAttribute("babia-selector","current_value",this.selectable.current),this.notiBuffer.set(this.newData),this.navNotiBuffer.set({type:"position",value:this.selectable.current,label:this.selectable.selectors[this.selectable.current-1]}),this.babiaMetadata={id:this.selectable.current})},prevSelect:function(){this.selectable.current>=0?(this.newData=this.selectable.prev(),this.el.setAttribute("babia-selector","current_value",this.selectable.current),this.notiBuffer.set(this.newData),this.navNotiBuffer.set({type:"position",value:this.selectable.current,label:this.selectable.selectors[this.selectable.current+1]}),this.babiaMetadata={id:this.selectable.current}):(this.selectable.current=-1,this.selectable.state="pause",this.el.setAttribute("babia-selector","state","pause"),this.navNotiBuffer.set("pause"))},setSelect:function(t){if(t!=this.selectable.current-1&&"rewind"!=this.data.direction||t!=this.selectable.current+1&&"rewind"===this.data.direction){let e;this.newData=this.selectable.setValue(t),"rewind"!=this.data.direction?(this.babiaMetadata={id:t++},e=this.selectable.selectors[t-1]):(this.babiaMetadata={id:t--},this.selectable.current-=2,e=this.selectable.selectors[t+1]),this.notiBuffer.set(this.newData),this.navNotiBuffer.set({type:"position",value:t,label:e})}},loop:function(){"pause"!=this.data.state&&("rewind"!=this.data.direction?this.nextSelect():this.prevSelect())},prodComponent:void 0,navComponent:void 0,prodNotiBufferId:void 0,navNotiBufferId:void 0,newData:void 0,processData:function(t){this.selectable||(this.selectable=new s(t,this.data.select,this.data.current_value,this.data.step,this.data.speed)),this.navNotiBuffer.set({type:"position",value:this.selectable.current,label:this.selectable.selectors[this.selectable.current-1]});let e=this;this.nextSelect(),this.interval=window.setInterval((function(){e.loop()}),e.data.timeout*e.selectable.speed)},processEvent:function(t){if(t.includes("pause"))this.selectable.state="pause",this.el.setAttribute("babia-selector","state","pause");else if(t.includes("play"))this.selectable.state="play",this.el.setAttribute("babia-selector","state","play");else if(t.includes("forward"))this.selectable.direction="forward",this.el.setAttribute("babia-selector","direction","forward");else if(t.includes("rewind"))this.selectable.direction="rewind",this.el.setAttribute("babia-selector","direction","rewind");else if(t.includes("babiaSetPosition")){this.selectable.state="pause";let e=parseInt(t.substring(16),10);"rewind"!=this.data.direction?this.el.setAttribute("babia-selector",{state:"pause",current_value:e+1}):this.el.setAttribute("babia-selector",{state:"pause",current_value:e-1}),this.setSelect(e),this.navNotiBuffer.set("pause")}else t.includes("babiaSetStep")?this.el.setAttribute("babia-selector","step",parseInt(t.substring(12),10)):t.includes("babiaSetSpeed")&&this.el.setAttribute("babia-selector","speed",parseInt(t.substring(13),10))},removeOldNavListener:function(t){t.removeEventListener("click",(function(){NAF.utils.isMine(selector)||"scene"==selector.components.networked.data.owner||Object.keys(NAF.connection.connectedClients).length>0&&NAF.utils.takeOwnership(selector)}))},addMultiuserMode:function(t){let e=this.el;function i(){t.children[1].setAttribute("visible",!1),t.children[2].setAttribute("visible",!1),t.children[3].setAttribute("visible",!1)}document.body.addEventListener("clientConnected",(function(t){let n=t.detail.clientId;console.log("clientConnected event. clientId =",n),console.log("Selector owner: ",e.components.networked.data.owner);let r=!0;if("scene"==e.components.networked.data.owner){for(let t in NAF.connection.getConnectedClients()){let e=NAF.connection.getConnectedClients()[t].roomJoinTime,i=NAF.connection.adapter._myRoomJoinTime;console.log("Other: ",e),console.log("Mine: ",i),i>e&&(r=!1)}r?NAF.utils.takeOwnership(e):(console.log("I'm not first"),i())}else e.components.networked.data.owner!=NAF.clientId&&i()})),t.addEventListener("click",(function(){NAF.utils.isMine(e)||"scene"==e.components.networked.data.owner||Object.keys(NAF.connection.connectedClients).length>0&&NAF.utils.takeOwnership(e)})),e.addEventListener("ownership-gained",e=>{console.log("Selector ownership gained"),t.children[1].setAttribute("visible",!0),t.children[2].setAttribute("visible",!0),t.children[3].setAttribute("visible",!0)}),e.addEventListener("ownership-lost",t=>{console.log("Selector ownership lost"),i()})}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babiaxr-interaction-mapper",{schema:{input:{type:"string"},output:{type:"string"}},multiple:!1,init:function(){let t=this.data,e=this.el;t.input&&t.output&&i(t,e)},update:function(t){let e=this.data,n=this.el;e!==t&&(e.input===t.input&&e.output===t.output||(console.log("Change event because from has changed"),n.removeEventListener(t.input,(function(t){})),i(e,n)))},remove:function(){},pause:function(){},play:function(){}});let i=(t,e)=>{e.addEventListener(t.input,(function(i){e.emit(t.output,i,!1)}))}},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babiaxr-debug-data",{schema:{inputEvent:{type:"string"}},multiple:!1,init:function(){let t=this.data,e=this.el;t.input&&t.output&&i(t,e)},update:function(t){let e=this.data,n=this.el;e!==t&&e.inputEvent!==t.inputEvent&&(console.log("Change event because from has changed"),n.removeEventListener(e.inputEvent,(function(t){})),i(e,n))},remove:function(){},pause:function(){},play:function(){}});let i=(t,e)=>{e.addEventListener(t.inputEvent,(function(i){n(t,e)}))},n=(t,e)=>{if(!e.querySelector(".debug-data")){let t=function(t,e,i){let n=document.createElement("a-plane");n.setAttribute("color","white"),n.setAttribute("class","debug_data"),n.setAttribute("width",10),n.setAttribute("height",10);let r=e.getAttribute("position"),a=0,s=0;e.getAttribute("geometry")&&("box"===e.components.geometry.data.primitive?(a=e.getAttribute("geometry").width/2,s=e.getAttribute("geometry").height/2):"sphere"===e.components.geometry.data.primitive?a=e.getAttribute("geometry").radius:(a=0,s=0));n.setAttribute("position",{x:r.x+a+5,y:0-s+5,z:r.z});let o=document.createElement("a-text");return o.setAttribute("value",JSON.stringify(i)),o.setAttribute("width",10),o.setAttribute("height",10),o.setAttribute("color","black"),o.setAttribute("position",{x:0-n.getAttribute("width")/2,y:0-e.getAttribute("height")/2,z:0}),n.appendChild(o),n}(0,e,e.getAttribute("babiaData"));e.appendChild(t)}}},function(t,e,i){let n=i(0).updateTitle;const r=i(0).colors;let a=i(0).updateFunction;const s=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function o(t,e,i,n,a){let s=r.get(n,a);console.log("Generating slice...");let o=document.createElement("a-cylinder");return o.setAttribute("color",s),o.setAttribute("theta-start",t),o.setAttribute("theta-length",e),o.setAttribute("side","double"),o.setAttribute("radius",i),o}function l(t,e,i,n){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e){let i=e[t.key]+": "+e[t.size],n=2;i.length>16&&(n=i.length/8);let r=document.createElement("a-plane");return r.setAttribute("position",{x:0,y:0,z:-2}),r.setAttribute("rotation",{x:-90,y:0,z:0}),r.setAttribute("height","1"),r.setAttribute("width",n),r.setAttribute("color","white"),r.setAttribute("text",{value:e[t.key]+": "+e[t.size],align:"center",width:6,color:"black"}),r.classList.add("babiaxrLegend"),r}(t,i),n.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),n.removeChild(legend)}))}AFRAME.registerComponent("babia-pie",{schema:{data:{type:"string"},size:{type:"string",default:"size"},key:{type:"string",default:"key"},from:{type:"string"},legend:{type:"boolean"},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},animation:{type:"boolean",default:!1}},visProperties:["size","key"],multiple:!1,init:function(){this.notiBuffer=new s},update:function(t){a(this,t)},tick:function(t,e){if(this.data.animation&&this.loaded){let i=document.getElementsByClassName("babiaxrChart")[0].children;for(let n in this.slice_array){let r=this.slice_array[n].delay,a=this.slice_array[n].degreeLenght,s=parseFloat(i[n].getAttribute("theta-length"));t>=r&&s<a&&(s+=360*e/this.total_duration,s>a&&(s=a),i[n].setAttribute("theta-length",s))}}},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},loaded:!1,slice_array:[],total_duration:4e3,updateTitle:function(){const t=n(this.data,{x:-90,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-pie:",t);const e=this.data,i=this.el,n=e.animation,r=e.palette;let a=0,s=0,h=0,c=0;for(let i of t)c+=i[e.size];this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),i.appendChild(this.chartEl);let u=0;for(let d of t){let t;if(s=360*d[e.size]/c,n){let e=this.total_duration*s/360;this.slice_array.push({degreeLenght:s,duration:e,delay:u}),u+=e,t=o(a,.01,1,h,r)}else t=o(a,s,1,h,r);t.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(t),a+=s,e.legend&&l(e,t,d,i),h++}this.updateTitle()},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating pie..."),this.updateChart(),this.loaded=!0,this.notiBuffer.set(this.newData)}})},function(t,e,i){let n=i(0).updateTitle;const r=i(0).colors;let a=i(0).updateFunction;const s=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-bars",{schema:{data:{type:"string"},height:{type:"string",default:"height"},x_axis:{type:"string",default:"x_axis"},from:{type:"string"},legend:{type:"boolean",default:!1},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"vec3",default:{x:0,y:0,z:0}},chartHeight:{type:"number",default:10},keepHeight:{type:"boolean",default:!0},incremental:{type:"boolean",default:!1},index:{type:"string"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},uiLink:{type:"boolean",default:!1},uiLinkPosition:{type:"vec3",default:{x:-4.5,y:2,z:2.5}}},visProperties:["height","x_axis"],multiple:!1,init:function(){this.notiBuffer=new s,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){a(this,t),this.data.uiLink&&l(el,this.data.uiLinkPosition)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,currentData:void 0,babiaMetadata:{id:0},widthBars:1,total_duration:3e3,proportion:void 0,valueMax:void 0,xLabels:[],xTicks:[],updateTitle:function(){this.titleEl=n(this.data,{x:0,y:0,z:0})},updateAxis:function(t,e,i,n){const r=this.data;r.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:r.palette}),this.xAxisEl.setAttribute("position",{x:0,y:0,z:this.widthBars/2}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:n,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:-this.widthBars/2,y:0,z:this.widthBars/2}),r.axis_name&&(r.index?this.xAxisEl.setAttribute("babia-axis-x","name",r.index):this.xAxisEl.setAttribute("babia-axis-x","name",r.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",r.height)))},updateChart:function(){let t;t=this.currentData?this.currentData:this.newData,console.log("Data babia-bars:",t);const e=this.data,i=e.palette;this.updateTitle();let n=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*n/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=n;let a=this.chartEl,s=a.querySelectorAll("a-entity[babia-bar]"),o={};for(let t of s){o[t.getAttribute("babia-name")]={el:t,found:!1}}let l=[],h=[],c=0;for(let n=0;n<t.length;n++){let s,u=t[n],d=u[e.x_axis],p=n*this.widthBars*1.25;o[d]&&!u._not?(s=o[d].el,o[d].found=!0):(s=document.createElement("a-entity"),s.setAttribute("babia-name",d),s.id=u[e.index],s.object3D.position.x=p,a.appendChild(s)),s.setAttribute("babia-bar",{height:u[e.height]*this.lengthY/this.maxValue,width:this.widthBars,depth:this.widthBars,color:r.get(c,i),label:"events",animation:e.animation}),e.legend&&s.setAttribute("babia-bar",{labelText:d+": "+u[e.height]}),p!==s.object3D.position.x&&(e.animation?s.setAttribute("animation",{property:"object3D.position.x",to:p,dur:e.dur}):s.object3D.position.x=p),l.push(u[e.x_axis]),h.push(p),c++}for(let t in o)o[t].found||o[t].el.remove();const u=this.widthBars*(1.25*t.length);this.updateAxis(l,h,u,this.maxValue)},processData:function(t){console.log("processData",this);let e=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},this.notiBuffer.set(this.newData),e.incremental)if(this.newData.forEach(t=>{let i=!1;for(let n in this.currentData)this.currentData[n][e.index]==t[e.index]&&(this.currentData[n]=t,i=!0);i||this.currentData.push(t)}),e.keepHeight)this.maxValue=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]}))),console.log("Re-draw the chart"),this.updateChart();else{this.newData.forEach(t=>{if(t._not)this.chartEl.querySelector("#"+t[e.index]).setAttribute("babia-bar","height",-.1);else if(this.chartEl.querySelector("#"+t[e.index]))this.chartEl.querySelector("#"+t[e.index]).setAttribute("babia-bar",{height:t[e.height]*e.chartHeight/this.maxValue,labelText:t[e.index]+": "+t[e.height]});else{let i=this.chartEl.querySelectorAll("[babia-bar]").length,n=this.chartEl.querySelectorAll("[babia-bar]")[i-1].getAttribute("position").x+this.widthBars+this.widthBars/4,r=o(this,e,t,i,e.palette,n);this.chartEl.appendChild(r),this.xLabels.push(r.id),this.xTicks.push(n)}});let t=this.xTicks[this.xTicks.length-1]+3*this.widthBars/4;if(!e.chartHeight||!e.keepHeight){let t=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]})));this.lengthY=t*e.chartHeight/this.maxValue,this.maxValue=t}this.updateAxis(this.xLabels,this.xTicks,t,this.maxValue)}else this.currentData=JSON.parse(JSON.stringify(this.newData)),this.updateChart()}});let o=(t,e,i,n,a,s)=>{let o=document.createElement("a-entity");return o.setAttribute("babia-bar",{height:i[t.data.height]*e.chartHeight/t.maxValue,width:t.widthBars,depth:t.widthBars,color:r.get(n,a),label:"events",animation:e.animation}),e.legend&&o.setAttribute("babia-bar",{labelText:i[t.data.x_axis]+": "+i[t.data.height]}),o.setAttribute("position",{x:s,y:0,z:0}),o.id=i[t.data.index],o},l=(t,e)=>{let i=document.createElement("a-entity");if(!t.id){let e="bars"+Math.floor(1e3*Math.random());t.id=e}console.log("id:",t.id),i.setAttribute("babia-ui-link",{viz:t.id}),i.setAttribute("position",{x:e.x,y:e.y,z:e.z}),t.appendChild(i),console.log("Create Button",t)}},function(t,e,i){var n=this;i(0).findProdComponent;let r=i(0).updateTitle;i(0).parseJson;const a=i(0).colors;let s=i(0).updateFunction;const o=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-barsmap",{schema:{data:{type:"string"},height:{type:"string",default:"height"},x_axis:{type:"string",default:"x_axis"},z_axis:{type:"string",default:"z_axis"},from:{type:"string"},legend:{type:"boolean"},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},chartHeight:{type:"number",default:10},keepHeight:{type:"boolean",default:!0},incremental:{type:"boolean",default:!1},index:{type:"string",default:"x_axis"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3}},visProperties:["height","x_axis","z_axis"],multiple:!1,init:function(){this.notiBuffer=new o,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){s(this,t)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,currentData:void 0,babiaMetadata:{id:0},widthBars:1,proportion:void 0,valueMax:void 0,xLabels:[],zLabels:[],xTicks:[],zTicks:[],total_duration:3e3,updateTitle:function(){this.titleEl=r(this.data,{x:0,y:0,z:0})},updateAxis:function(t,e,i,n,r,a,s){const o=this.data;o.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:o.palette,align:"behind"}),this.xAxisEl.setAttribute("position",{x:-this.widthBars/2,y:0,z:-this.widthBars/2}),this.zAxisEl||(this.zAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.zAxisEl)),this.zAxisEl.setAttribute("babia-axis-z",{labels:r,ticks:a,length:s,palette:o.palette,align:"left"}),this.zAxisEl.setAttribute("position",{x:0-this.widthBars/2,y:0,z:-this.widthBars/2}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:n,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:-this.widthBars/2,y:0,z:-this.widthBars/2}),o.axis_name&&((o.index=!1)?this.xAxisEl.setAttribute("babia-axis-x","name",o.index):this.xAxisEl.setAttribute("babia-axis-x","name",o.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",o.height),this.zAxisEl.setAttribute("babia-axis-z","name",o.z_axis)))},updateChart:function(){let t;t=this.currentData?this.currentData:this.newData,console.log("Data babia-barsmap:",t);const e=this.data,i=e.palette;this.updateTitle();let n=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*n/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=n;let r=[],s=[],o=[],l=[],h=this.chartEl;console.log(t);for(let c=0;c<t.length;c++){let u,d,p=t[c],f=p[e.x_axis],g=p[e.z_axis];r.includes(f)||(r.push(f),u=(r.length-1)*this.widthBars*1.25,s.push(u+this.widthBars/2)),u||(u=r.indexOf(f)*this.widthBars*1.25),o.includes(g)||(o.push(g),d=(o.length-1)*this.widthBars*1.25,l.push(d+this.widthBars/2)),d||(d=o.indexOf(g)*this.widthBars*1.25),console.log(f+" "+g+" "+u+" "+d);let m,y=r.indexOf(f);m||(m=document.createElement("a-entity"),m.id=f+g,m.classList.add("babiaxraycasterclass"),m.object3D.position.x=u,m.object3D.position.z=d,h.appendChild(m)),p._not?m.setAttribute("babia-bar",{height:-.1,color:a.get(y,i)}):m.setAttribute("babia-bar",{height:p[e.height]*this.lengthY/n,width:this.widthBars,depth:this.widthBars,color:a.get(y,i),label:"events",animation:e.animation}),e.legend&&m.setAttribute("babia-bar",{labelText:f+", "+g+": "+p[e.height]})}const c=this.widthBars*(1.25*r.length+.75),u=this.widthBars*(1.25*o.length+.75);this.updateAxis(r,s,c,n,o,l,u),this.xLabels=r,this.xTicks=s,this.zLabels=o,this.zTicks=l},processData:function(t){console.log("processData",this);let e=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},this.notiBuffer.set(this.newData),e.incremental)if(this.newData.forEach(t=>{let i=!1;for(let n in this.currentData)this.currentData[n][e.x_axis]==t[e.x_axis]&&this.currentData[n][e.z_axis]==t[e.z_axis]&&(this.currentData[n]=t,i=!0);i||this.currentData.push(t)}),e.keepHeight)this.maxValue=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]}))),console.log("Re-draw the chart"),this.updateChart();else{console.log("Keep ---\x3e Update"),this.newData.forEach(t=>{t._not?this.chartEl.querySelector("#"+t[e.x_axis]+t[e.z_axis]).setAttribute("babia-bar","height",-.1):this.chartEl.querySelector("#"+t[e.x_axis]+t[e.z_axis])?this.chartEl.querySelector("#"+t[e.x_axis]+t[e.z_axis]).setAttribute("babia-bar",{height:t[e.height]*e.chartHeight/this.maxValue,labelText:t[e.x_axis]+","+t[e.z_axis]+": "+t[e.height]}):l(this,e,t,this.maxValue,a,this.xLabels,this.zLabels,this.xTicks,this.zTicks)});let t=this.xTicks[this.xTicks.length-1]+3*this.widthBars/4,i=this.zTicks[this.zTicks.length-1]+3*this.widthBars/4;if(!e.chartHeight||!e.keepHeight){let t=Math.max.apply(Math,this.currentData.map((function(t){return t[e.height]})));this.lengthY=t*e.chartHeight/this.maxValue,this.maxValue=t}this.updateAxis(this.xLabels,this.xTicks,t,this.maxValue,this.zLabels,this.zTicks,i)}else this.currentData=JSON.parse(JSON.stringify(this.newData)),this.updateChart()}});let l=(t,e,i,r,s,o,l,h,c)=>{let u,d,p=i[e.x_axis],f=i[e.z_axis];o.includes(p)||(o.push(p),u=(o.length-1)*n.widthBars*1.25,h.push(u+n.widthBars/2)),u||(u=o.indexOf(p)*n.widthBars*1.25),l.includes(f)||(l.push(f),d=(l.length-1)*n.widthBars*1.25,c.push(d+n.widthBars/2)),d||(d=l.indexOf(f)*n.widthBars*1.25);let g=o.indexOf(p),m=document.createElement("a-entity");return m.id=p+f,m.classList.add("babiaxraycasterclass"),m.setAttribute("babia-bar",{height:i[e.height]*n.lengthY/r,width:n.widthBars,depth:n.widthBars,color:a.get(g,s),label:"events",animation:e.animation}),m.object3D.position.x=u,m.object3D.position.z=d,chartEl.appendChild(m),e.legend&&m.setAttribute("babia-bar",{labelText:i[t.data.x_axis]+": "+i[t.data.height]}),n.xLabels=o,n.xTicks=h,n.zLabels=l,n.zTicks=c,bar}},function(t,e,i){let n=i(0).updateTitle;const r=i(0).colors;let a=i(0).updateFunction;const s=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function o(t,e,i,n,a,s,o,l,h,c){let u=r.get(i,n);console.log("Generating bubble..."),l?(t/=l,e/=l):(h||c)&&(h&&(t*=h),c&&(e*=c));let d=document.createElement("a-sphere");if(d.setAttribute("color",u),d.setAttribute("radius",e),o){let i=a.toString()+" "+e.toString()+" "+s.toString(),n=a.toString()+" "+(e+t).toString()+" "+s.toString();d.setAttribute("animation__position",{property:"position",from:i,to:n,dur:"3000",easing:"linear"})}else d.setAttribute("position",{x:a,y:e+t,z:s});return d}function l(t,e,i,n){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e,i){let n=e[t.x_axis]+": \n Radius:"+e[t.radius]+"\nHeight:"+e[t.height],r=2;n.length>16&&(r=n.length/8);let a=i.getAttribute("position"),s=parseFloat(i.getAttribute("radius")),o=document.createElement("a-plane");return o.setAttribute("position",{x:a.x,y:a.y+s+1,z:a.z+.1}),o.setAttribute("rotation",{x:0,y:0,z:0}),o.setAttribute("height","1"),o.setAttribute("width",r),o.setAttribute("color","white"),o.setAttribute("text",{value:n,align:"center",width:6,color:"black"}),o.classList.add("babiaxrLegend"),o}(t,i,e),n.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),n.removeChild(legend)}))}AFRAME.registerComponent("babia-bubbles",{schema:{data:{type:"string"},height:{type:"string",default:"height"},radius:{type:"string",default:"radius"},x_axis:{type:"string",default:"x_axis"},z_axis:{type:"string",default:"z_axis"},from:{type:"string"},legend:{type:"boolean"},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},animation:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},scale:{type:"number"},heightMax:{type:"number"},radiusMax:{type:"number"}},visProperties:["height","radius","x_axis","z_axis"],multiple:!1,init:function(){this.notiBuffer=new s},update:function(t){a(this,t)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},updateTitle:function(){const t=n(this.data,{x:0,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-bubbles:",t);const e=this.data,i=this.el,n=e.animation,r=e.palette,a=e.scale;let s=e.heightMax,h=e.radiusMax,c=[],u=[],d=[],p=[],f=0,g=0,m=0,y=0,b=0,v=0,x={},_={},A=Math.max.apply(Math,t.map((function(t){return t[e.height]}))),w=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));a&&(A/=a,w/=a),s||(s=A),proportion=s/A,h||(h=w),radius_scale=h/w,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),i.appendChild(this.chartEl),a?(b=w/a,v=w/a):(b=w*radius_scale,v=w*radius_scale);for(let s of t){let t=s[e.x_axis],h=s[e.z_axis],A=s[e.height],C=s[e.radius];x[t]?(m=x[t].posX,f=x[t].colorId):(m+=a?2*w/a+.5:2*w*radius_scale+.5,f=g,x[t]={posX:m,colorId:f},c.push(t),u.push(m),g++),_[h]?y=_[h].posZ:(y=a?v+2*w/a+.5:v+2*w*radius_scale+.5,_[h]={posZ:y},d.push(h),p.push(y)),m>b&&(b=m),y>v&&(v=y);let M=o(A,C,f,r,m,y,n,a,proportion,radius_scale);M.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(M),e.legend&&l(e,M,s,i)}if(e.axis){const t=b,e=v,i=s;this.updateAxis(c,u,t,d,p,e,A,i)}this.updateTitle()},updateAxis:function(t,e,i,n,r,a,s,o){let l=document.createElement("a-entity");this.chartEl.appendChild(l),l.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:this.data.palette}),l.setAttribute("position",{x:0,y:0,z:0});let h=document.createElement("a-entity");this.chartEl.appendChild(h),h.setAttribute("babia-axis-y",{maxValue:s,length:o}),h.setAttribute("position",{x:0,y:0,z:0});let c=document.createElement("a-entity");this.chartEl.appendChild(c),c.setAttribute("babia-axis-z",{labels:n,ticks:r,length:a}),c.setAttribute("position",{x:0,y:0,z:0}),this.data.axis_name&&(l.setAttribute("babia-axis-x","name",this.data.x_axis),h.setAttribute("babia-axis-y","name",this.data.height),c.setAttribute("babia-axis-z","name",this.data.z_axis))},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating bubbles..."),this.updateChart(),this.notiBuffer.set(this.newData)}})},function(t,e,i){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let n;AFRAME.registerComponent("babiaxr-codecity",{schema:{absolute:{type:"boolean",default:!1},width:{type:"number",default:20},depth:{type:"number",default:20},split:{type:"string",default:"naive"},data:{type:"string",default:JSON.stringify({id:"CodeCity",area:1,height:1})},farea:{type:"string",default:"area"},fmaxarea:{type:"string",default:"max_area"},fheight:{type:"string",default:"height"},titles:{type:"boolean",default:!0},building_color:{type:"color",default:"#E6B9A1"},building_model:{type:"string",default:null},base:{type:"boolean",default:!0},base_thick:{type:"number",default:.2},base_color:{type:"color",default:"#98e690"},border:{type:"number",default:1},extra:{type:"number",default:1.4},zone_elevation:{type:"number",default:1},unicolor:{type:"color",default:!1},wireframe:{type:"boolean",default:!1},colormap:{type:"array",default:["blue","green","yellow","brown","orange","magenta","grey","cyan","azure","beige","blueviolet","coral","crimson","darkblue","darkgrey","orchid","olive","navy","palegreen"]},time_evolution_delta:{type:"number",default:8e3},time_evolution_init:{type:"string",default:"data_0"},time_evolution_past_present:{type:"boolean",default:!1},time_evolution_animation:{type:"boolean",default:!0},time_evolution_color:{type:"boolean",default:!1},ui_navbar:{type:"string",default:""}},multiple:!1,init:function(){},update:function(t){this.loader=new THREE.FileLoader;let e=this.data,i=this.el;C=e.building_color,n=i,"string"==typeof e.data?e.data.endsWith("json")?raw_items=l(e):raw_items=JSON.parse(e.data):raw_items=e.data,i.emit("babiaxr-dataLoaded",{data:raw_items,codecity:!0}),m=e.time_evolution_delta,this.zone_data=raw_items;let a,o,d=new r({data:this.zone_data,extra:function(t){return t*e.extra},farea:e.farea,fheight:e.fheight,fmaxarea:e.fmaxarea});1==e.absolute?(a=Math.sqrt(d.areas.canvas)*e.width/e.depth,o=d.areas.canvas/a):(a=e.width,o=e.depth);let y=new s({width:a,depth:o,x:0,z:0});d.add_rects({rect:y,split:e.split,relative:!1});let b=document.createElement("a-entity");this.base=b;d.draw_rects({ground:y,el:b,base:e.base,level:0,elevation:0,relative:!1,base_thick:e.base_thick,wireframe:e.wireframe,building_color:e.building_color,base_color:e.base_color,model:e.building_model,visible:!0,titles:e.titles}),i.appendChild(b),h&&(time_evolution_past_present=e.time_evolution_past_present,c=e.time_evolution_animation,u=e.time_evolution_color,A(e),function(){const t=Object.keys(g).length;let e=0;p&&(document.addEventListener("babiaxrToPast",(function(){time_evolution_past_present=!1})),document.addEventListener("babiaxrToPresent",(function(){time_evolution_past_present=!0})),document.addEventListener("babiaxrStop",(function(){clearInterval(_)})),document.addEventListener("babiaxrContinue",(function(){_=setTimeout((function(){M(t,e),e<t-1&&i()}),m)})),document.addEventListener("babiaxrSkipNext",(function(){time_evolution_past_present=!1,clearInterval(_),R(t-x-1),f=t-x-1,e--,x--,E()})),document.addEventListener("babiaxrSkipPrev",(function(){time_evolution_past_present=!0,clearInterval(_),R(t-x-3),f=t-x-3,e++,x++,E()})),document.addEventListener("babiaxrShow",(function(i){clearInterval(_),eventData=i.detail.data,e=eventData.data,R(t-e-1),f=t-e-1,x=e-1,E(!0)})));let i=()=>{_=setTimeout((function(){p&&R(t-x-2),f=t-x-2,M(t,e),e<t-1&&i()}),m)};i()}())},remove:function(){},play:function(){}});let r=class{constructor({data:t,extra:e=function(t){return t},farea:i="area",fmaxarea:n="max_area",fheight:r="height"}){this.data=t,this.id=this.data.id,this.extra=e,this.farea=i,this.fmaxarea=n,this.fheight=r,this.areas=this.areas_tree(),this.el=null,this.pending_rects=0}areas_tree({data:t=this.data,level:e=0}={}){let i=t,n={data:i};if("children"in i){n.inner=0,n.area=0,n.children=[];for(const t of i.children){let i=this.areas_tree({data:t,level:e+1});n.inner+=i.canvas,n.area+=i.area,n.children.push(i)}}else n.area=i[this.farea],n.max_area=i[this.fmaxarea],n.inner=n.max_area,n.inner_real=n.area;return n.canvas=this.extra(n.inner,e),n}add_rects({rect:t,area:e=this.areas,relative:i=!0,split:n="naive"}={}){if(e.rect=t,e.rect.inner(e.canvas,e.inner,e.inner_real),"children"in e){let t,r=new a(e.children.map(t=>t.canvas),e.inner);if("naive"===n)t=e.rect.split(r,i);else{if("pivot"!==n)throw new Error("CodeCity: Unknwon split method");t=e.rect.split_pivot(r,i)}for(const r in e.children)this.add_rects({rect:t[r],area:e.children[r],relative:i,split:n})}}draw_rects({ground:t,el:e,area:i=this.areas,level:r=0,elevation:a=0,relative:s=!0,base_thick:o=.2,wireframe:l=!1,building_color:h="red",base_color:c="green",model:u=null,visible:d=!0,titles:p=!0}){0===r&&(this.el=e);this.pending_rects;if("children"in i){let t=i.rect.box({elevation:a,height:o,color:c,inner:!1,wireframe:l,visible:d,id:i.data.id,rawarea:0});if(p){let e,i;t.addEventListener("click",(function(){if(e)n.removeChild(i),n.removeChild(e),e=void 0,i=void 0;else{i=document.createElement("a-entity");let r=t.getAttribute("geometry"),a=t.getAttribute("position");i.setAttribute("geometry",{height:r.height+10,depth:r.depth,width:r.width}),i.setAttribute("position",a),i.setAttribute("material",{visible:!0,opacity:.4}),e=w(this.getAttribute("id"),r.height+10,a,null,n),n.appendChild(e),n.appendChild(i)}}))}t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t);let f=t;s||(f=e);for(const t of i.children){let e=o/2;s||(e=a+o),this.draw_rects({ground:i.rect,el:f,area:t,level:r+1,elevation:e,relative:s,building_color:h,base_color:c,model:u,base_thick:o,wireframe:l,visible:d,titles:p})}}else{i.data[this.fheight];let t=i.rect.box({height:i.data[this.fheight],elevation:a,wireframe:l,color:h,model:u,visible:d,id:i.data.id,rawarea:i.data[this.farea],inner_real:!0});if(t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t),p){let e,i,r=!1;t.addEventListener("click",(function(){r?(n.removeChild(e),n.removeChild(i),e=void 0,i=void 0,r=!1):r=!0})),t.addEventListener("mouseenter",(function(){if(!r){i=document.createElement("a-entity");let r=t.getAttribute("geometry"),a=t.getAttribute("position");i.setAttribute("position",a),i.setAttribute("material",{visible:!0}),i.setAttribute("geometry",{height:r.height+.1,depth:r.depth+.1,width:r.width+.1}),e=w(this.getAttribute("id"),r.height+.1,a,null,n),n.appendChild(e),n.appendChild(i)}})),t.addEventListener("mouseleave",(function(){!r&&e&&(n.removeChild(e),n.removeChild(i),e=void 0,i=void 0)}))}}}},a=class{constructor(t,e){this.items=t,this.total=void 0!==e?e:t.reduce((t,e)=>t+e,0)}imax(){let t=this.items[0],e=0;for(let i=0;i<this.items.length;i++)t<this.items[i]&&(t=this.items[i],e=i);return e}static range(t,e){var i=[];for(let n=t;n<t+e;n++)i.push(n);return i}scaled_area(t,e){return this.items[e]*t/this.total}values_i(t){let e=[];for(const i of t)e.push(this.items[i]);return new a(e)}pivot_regions(t,e){if(this.items.length<3)throw new Error("CodeCity - Values.pivot_regions: less than three items");if(t<e)throw new Error("Codecity - Values.pivot_regions: rectangle should be laying");let i,n,r=this.imax();if(this.items.lenght==r+1)return{pivot:r,a1:a.range(0,r),a2:[],a3:[]};if(this.items.length==r+2)return{pivot:r,a1:a.range(0,r),a2:[r+1],a3:[]};let s=t*e,o=this.scaled_area(s,r),l=Math.sqrt(o)*e-o,h=0,c=h,u=r+1;for(;h<l&&u<this.items.length;)c=h,h+=this.scaled_area(s,u),u++;let d=u;return u-1>r&&Math.abs(h-l)>Math.abs(c-l)&&(d=u-1),i=d-r-1,n=this.items.length-d,{pivot:r,a1:a.range(0,r),a2:a.range(r+1,i),a3:a.range(r+1+i,n)}}pivot_region_width(t,e){let i=0;for(const e of t)i+=this.items[e];return i/this.total*e}},s=class{constructor({width:t,depth:e,x:i=0,z:n=0}){this.width=t,this.depth=e,this.x=i,this.z=n}is_ilaying(){return Math.max(this.width,this.depth)==this.width}inner(t,e,i){if(t<e)throw"Rectangle.inner: Area for inner rectangle larger than my area";if(void 0!==t){let n=Math.sqrt(e/t);if(this.iwidth=n*this.width,this.idepth=n*this.depth,i){let e=Math.sqrt(i/t);this.iwidth_real=e*this.width,this.idepth_real=e*this.depth}}else this.iwidth=this.width,this.idepth=this.depth}reflect(){[this.width,this.depth]=[this.depth,this.width],[this.x,this.z]=[this.z,this.x]}idims_as_laying(){return this.is_ilaying()?[this.iwidth,this.idepth,this.x,this.z,!1]:[this.idepth,this.iwidth,this.z,this.x,!0]}split(t,e=!0){let[i,n,r,a,o]=this.idims_as_laying(),l=i/t.total,h=-i/2,c=0;e||(h+=r,c=a);let u=[];for(const e of t.items){let t=e*l,i=new s({width:t,depth:n,x:h+t/2,z:c});o&&i.reflect(),u.push(i),h+=t}return u}split_pivot(t,e=!0){if(t.items.length<=2)return this.split(t,e);let[i,n,r,a,o]=this.idims_as_laying();e&&(r=0,a=0);let{pivot:l,a1:h,a2:c,a3:u}=t.pivot_regions(i,n),d=t.pivot_region_width(h,i),p=t.pivot_region_width(c.concat(l),i),f=t.pivot_region_width(u,i),g=r-i/2+d/2,m=r-i/2+d+p/2,y=r-i/2+d+p+f/2,b=[],v=t.scaled_area(i*n,l)/p;b[l]=new s({width:p,depth:v,x:m,z:a+n/2-v/2});let x=[[h,d,n,g,a],[c,p,n-v,m,a-v/2],[u,f,n,y,a]];for(const[e,i,n,r,a]of x)if(e.length>0){let o=new s({width:i,depth:n,x:r,z:a});o.inner();let l=t.values_i(e),h=o.split_pivot(l,!1),c=0;for(const t of e)b[t]=h[c],c++}if(o)for(const t of b)t.reflect();return b}box({height:t,elevation:e=0,color:i="red",model:n=null,inner:r=!0,wireframe:a=!1,visible:s=!0,id:o="",rawarea:l=0,inner_real:h=!1}){let c,u;[c,u]=h?[this.idepth_real,this.iwidth_real]:r?[this.idepth,this.iwidth]:[this.depth,this.width];let d=document.createElement("a-entity");return d.setAttribute("geometry",{primitive:"box",skipCache:!0,depth:c,width:u,height:t}),d.setAttribute("material",{color:i}),d.setAttribute("position",{x:this.x,y:e+t/2,z:this.z}),d.setAttribute("id",o),d.setAttribute("babiaxr-rawarea",l),d}};t.exports={Values:a,Rectangle:s,Zone:r};let o,l=t=>{let e,i=t.data,n=new XMLHttpRequest;if(n.open("get",i,!1),n.onload=function(){this.status>=200&&this.status<300?e="string"==typeof n.response||n.response instanceof String?JSON.parse(n.response):n.response:reject({status:this.status,statusText:xhr.statusText})},n.onerror=function(){reject({status:this.status,statusText:xhr.statusText})},n.send(),e.time_evolution){y=e,h=!0,d=e.time_evolution_commit_by_commit;let i=e.data_files.find(t=>"data_0_tree"===t.key_tree);e=i.data_0_tree,b=i.data_0;let n=[];for(let t=0;t<y.data_files.length;t++){g["data_"+t]=y.data_files[t],n.push({date:new Date(1e3*y.data_files[t].date).toLocaleDateString(),commit:y.data_files[t].commit_sha,data:t})}if(t.ui_navbar&&(f=t.time_evolution_past_present?parseInt(t.time_evolution_init.split("_")[1]):y.data_files.length-1,p=t.ui_navbar,document.getElementById(p).setAttribute("babiaxr-navigation-bar","commits",JSON.stringify(n.reverse()))),"data_0"!==t.time_evolution_init){let i;i=g[t.time_evolution_init][t.time_evolution_init+"_allfiles"]?t.time_evolution_init+"_allfiles":t.time_evolution_init;let n=L(e.children,{});g[t.time_evolution_init][i].forEach(t=>{n[t.id]&&(n[t.id].height=t.height,n[t.id].area=t.area,n[t.id].max_area=t.max_area)}),x=parseInt(t.time_evolution_init.split("_")[1])}}return e},h=!1,c=!0,u=!1,d=!1,p=void 0,f=void 0,g={},m=8e3,y={},b=void 0,v=[],x=0,_=void 0,A=t=>{let e;if(document.getElementById("scene"))e=document.getElementById("scene");else{e=document.getElementsByTagName("a-scene");document.getElementsByTagName("a-entity")}let i=document.createElement("a-entity");i.classList.add("babiaxrDateBar"),i.setAttribute("position",{x:-13,y:10,z:-3}),i.setAttribute("rotation",{x:0,y:0,z:0}),i.setAttribute("material",{color:"black"}),i.setAttribute("height",.5),i.setAttribute("width",2),i.setAttribute("scale",{x:1,y:1,z:1});let n="Date: "+new Date(1e3*g[t.time_evolution_init].date).toLocaleDateString();g[t.time_evolution_init].commit_sha&&(n+="\n\nCommit: "+g[t.time_evolution_init].commit_sha),i.setAttribute("text-geometry",{value:n}),o=i,e.appendChild(i)},w=(t,e,i,n,r)=>{let a=2;t.length>16&&(a=t.length/8);let s=e,o=document.createElement("a-plane");o.setAttribute("babia-lookat","[camera]"),o.setAttribute("position",{x:i.x,y:i.y+s/2+1,z:i.z}),o.setAttribute("rotation",{x:0,y:0,z:0}),o.setAttribute("height","1"),o.setAttribute("width",a),o.setAttribute("color","white"),o.setAttribute("material",{side:"double"}),o.setAttribute("text",{value:t,align:"center",width:6,color:"black"});let l=r.getAttribute("scale");return!l||l.x===l.y&&l.x===l.z||o.setAttribute("scale",{x:1/l.x,y:1/l.y,z:1/l.z}),o};let C,M=(t,e)=>{console.log("Loop number",e),E(),time_evolution_past_present?(x--,0==x&&console.log("finished"),e--):(x++,e++,x>t-1&&(x=0))},E=t=>{let e,i="data_"+(x+1);e=t?"data_"+(x+1)+"_allfiles":time_evolution_past_present?"data_reverse_"+(x+1):"data_"+(x+1);let n="Date: "+new Date(1e3*g[i].date).toLocaleDateString();g[i].commit_sha&&(n+="\n\nCommit: "+g[i].commit_sha),o.setAttribute("text-geometry","value",n),v=[],u&&(I+=5,80!==I?C=function(t,e){let i,n=parseInt(t.slice(1,3),16),r=parseInt(t.slice(3,5),16),a=parseInt(t.slice(5,7),16),s=function(t,e,i){t/=255,e/=255,i/=255;let n,r,a=Math.max(t,e,i),s=Math.min(t,e,i),o=(a+s)/2;if(a==s)n=r=0;else{let l=a-s;switch(r=o>.5?l/(2-a-s):l/(a+s),a){case t:n=(e-i)/l+(e<i?6:0);break;case e:n=(i-t)/l+2;break;case i:n=(t-e)/l+4}n/=6}return[n,r,o]}(n,r,a);return i=function(t,e,i){let n,r,a;if(0==e)n=r=a=i;else{function s(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}let o=i<.5?i*(1+e):i+e-i*e,l=2*i-o;n=s(l,o,t+1/3),r=s(l,o,t),a=s(l,o,t-1/3)}return[255*n,255*r,255*a]}(s[0],s[1],e/100),t="#"+D(i[0])+D(i[1])+D(i[2])}(C,I):(T++,T>S.length-1&&(T=0),C=S[T],I=20)),g[i][e]?g[i][e].forEach(t=>{B(t)}):g[i][i].forEach(t=>{B(t)}),d||b.forEach(t=>{v.includes(t.id)||F(t.id)}),U()},I=20,S=["#000066","#006600","#666600","#660000"],T=0,B=t=>{if(null!=document.getElementById(t.id)&&0!=t.area){v.push(t.id);let e=document.getElementById(t.id).getAttribute("position"),i=document.getElementById(t.id).getAttribute("position").x,n=document.getElementById(t.id).getAttribute("position").y,r=document.getElementById(t.id).getAttribute("position").z,a=document.getElementById(t.id).getAttribute("geometry").width,s=document.getElementById(t.id).getAttribute("geometry").depth,o=document.getElementById(t.id).getAttribute("geometry").height,l=parseFloat(document.getElementById(t.id).getAttribute("babiaxr-rawarea"));if(o.toFixed(6)!==t.height.toFixed(6)||l.toFixed(6)!==t.area.toFixed(6)){u&&document.getElementById(t.id).setAttribute("material",{color:C});let h=!1,d=a/s;d<1&&(h=!0,d=s/a);let p=t.area*(s*a)/l,f=Math.sqrt(p*d),g=Math.sqrt(p/d);if(h&&(g=Math.sqrt(p*d),f=Math.sqrt(p/d)),document.getElementById(t.id).setAttribute("babiaxr-rawarea",t.area),c){let e=500;if(f>a||g>s){let i=20*(f-a)/e,n=20*(g-s)/e,r=a,o=s,l=setInterval((function(){r>=f||o>=g?(document.getElementById(t.id).setAttribute("geometry","width",f),document.getElementById(t.id).setAttribute("geometry","depth",g),clearInterval(l)):(r+=i,o+=n,document.getElementById(t.id).setAttribute("geometry","width",r),document.getElementById(t.id).setAttribute("geometry","depth",o))}),1)}else if(f<a||g<s){let i=20*(a-f)/e,n=20*(s-g)/e,r=a,o=s,l=setInterval((function(){r<=f||o<=g?(document.getElementById(t.id).setAttribute("geometry","width",f),document.getElementById(t.id).setAttribute("geometry","depth",g),clearInterval(l)):(r-=i,o-=n,document.getElementById(t.id).setAttribute("geometry","width",r),document.getElementById(t.id).setAttribute("geometry","depth",o))}),1)}if(t.height<0)F(t.id);else if(t.height>o){let a=20*(t.height-o)/e,s=o,l=setInterval((function(){s>=t.height?(document.getElementById(t.id).setAttribute("position",{x:i,y:n-o/2+t.height/2,z:r}),clearInterval(l)):(s+=a,document.getElementById(t.id).setAttribute("geometry","height",s),document.getElementById(t.id).setAttribute("position",{x:i,y:n-o/2+s/2,z:r}))}),1)}else if(t.height<o){let a=20*(o-t.height)/e,s=o,l=setInterval((function(){s<=t.height?(document.getElementById(t.id).setAttribute("position",{x:i,y:n-o/2+t.height/2,z:r}),clearInterval(l)):(s-=a,document.getElementById(t.id).setAttribute("geometry","height",s),document.getElementById(t.id).setAttribute("position",{x:i,y:n-o/2+s/2,z:r}))}),1)}}else document.getElementById(t.id).setAttribute("geometry","width",f),document.getElementById(t.id).setAttribute("geometry","depth",g),document.getElementById(t.id).setAttribute("geometry","height",t.height),document.getElementById(t.id).setAttribute("position",{x:e.x,y:e.y-o/2+t.height/2,z:e.z})}}},F=t=>{let e=document.getElementById(t).getAttribute("material").color;document.getElementById(t).setAttribute("material",{color:"black"}),document.getElementById(t).setAttribute("material",{opacity:"0.3"});let i=setInterval((function(){!function(){let n=document.getElementById(t).getAttribute("position"),r=document.getElementById(t).getAttribute("geometry").height;document.getElementById(t).setAttribute("geometry","height",-.1),document.getElementById(t).setAttribute("position",{x:n.x,y:n.y-r/2-.05,z:n.z}),document.getElementById(t).setAttribute("material",{color:e}),document.getElementById(t).setAttribute("material",{opacity:"1.0"}),clearInterval(i)}()}),1e3)},U=()=>{console.log("Changing city")},L=(t,e)=>(t.forEach(t=>{t.children?L(t.children,e):e[t.id]=t}),e),R=t=>{let e=document.getElementsByClassName("babiaxrTimeBar")[0].children;if(f||0==f){e[f].emit("removeinfo")}e[t].emit("showinfo")};function D(t){let e=Math.round(t).toString(16);return e.length>1||(e="0"+e),e}},function(t,e,i){let n=i(0).findProdComponent;const r=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-city",{schema:{from:{type:"string"},absolute:{type:"boolean",default:!1},width:{type:"number",default:20},depth:{type:"number",default:20},split:{type:"string",default:"naive"},data:{type:"string"},farea:{type:"string",default:"area"},fmaxarea:{type:"string",default:"max_area"},fheight:{type:"string",default:"height"},titles:{type:"boolean",default:!0},building_color:{type:"color",default:"#E6B9A1"},building_model:{type:"string",default:null},base:{type:"boolean",default:!0},base_thick:{type:"number",default:.2},base_color:{type:"color",default:"#98e690"},border:{type:"number",default:1},extra:{type:"number",default:1.4},zone_elevation:{type:"number",default:1},unicolor:{type:"color",default:!1},wireframe:{type:"boolean",default:!1},colormap:{type:"array",default:["blue","green","yellow","brown","orange","magenta","grey","cyan","azure","beige","blueviolet","coral","crimson","darkblue","darkgrey","orchid","olive","navy","palegreen"]},time_evolution_delta:{type:"number",default:8e3},time_evolution_init:{type:"string",default:"data_0"},time_evolution_past_present:{type:"boolean",default:!1},time_evolution_animation:{type:"boolean",default:!0},time_evolution_color:{type:"boolean",default:!1},ui_navbar:{type:"string",default:""}},multiple:!1,init:function(){this.notiBuffer=new r},update:function(t){let e=this.data,i=this.el;if(e.data&&t.data!==e.data){let t=JSON.parse(e.data);this.processData(t)}else if(e.from!==t.from)this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(e,i),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)));else if(e!==t&&this.newData){for(console.log("Generating city...");this.el.firstChild;)this.el.firstChild.remove();this.processData(this.newData)}},dataComponent:void 0,dataComponentDataPropertyName:"babiaData",dataComponentEventName:void 0,babiaData:void 0,babiaMetadata:{id:0},visProperties:["fheight","farea"],processData:function(t){let e;console.log("processData",t),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},e=this.newData.length>0?{id:"init",children:this.newData}:this.newData.length<=0?this.newData[0]:this.newData,console.log("toSave",e),this.notiBuffer.set(e),a(this,e)}});let a=(t,e)=>{t.loader=new THREE.FileLoader;let i=t.data,n=t.el;u=i.building_color;let r=n;n.emit("babiaxr-dataLoaded",{data:e,codecity:!0}),h=i.time_evolution_delta,t.zone_data=e;let a,o,c=new s({data:t.zone_data,extra:function(t){return t*i.extra},farea:i.farea,fheight:i.fheight,fmaxarea:i.fmaxarea});1==i.absolute?(a=Math.sqrt(c.areas.canvas)*i.width/i.depth,o=c.areas.canvas/a):(a=i.width,o=i.depth);let d=new l({width:a,depth:o,x:0,z:0});c.add_rects({rect:d,split:i.split,relative:!1});let p=document.createElement("a-entity");t.base=p;c.draw_rects({ground:d,el:p,base:i.base,level:0,elevation:0,relative:!1,base_thick:i.base_thick,wireframe:i.wireframe,building_color:i.building_color,base_color:i.base_color,model:i.building_model,visible:!0,titles:i.titles,rootCodecityEntity:r}),n.appendChild(p)},s=class{constructor({data:t,extra:e=function(t){return t},farea:i="area",fmaxarea:n="max_area",fheight:r="height"}){this.data=t,this.id=this.data.id,this.extra=e,this.farea=i,this.fmaxarea=n,this.fheight=r,this.areas=this.areas_tree(),this.el=null,this.pending_rects=0}areas_tree({data:t=this.data,level:e=0}={}){let i=t,n={data:i};if("children"in i){n.inner=0,n.area=0,n.children=[];for(const t of i.children){let i=this.areas_tree({data:t,level:e+1});n.inner+=i.canvas,n.area+=i.area,n.children.push(i)}}else n.area=i[this.farea]||.5,n.max_area=i[this.fmaxarea]||.5,n.inner=n.max_area,n.inner_real=n.area;return n.canvas=this.extra(n.inner,e),n}add_rects({rect:t,area:e=this.areas,relative:i=!0,split:n="naive"}={}){if(e.rect=t,e.rect.inner(e.canvas,e.inner,e.inner_real),"children"in e){let t,r=new o(e.children.map(t=>t.canvas),e.inner);if("naive"===n)t=e.rect.split(r,i);else{if("pivot"!==n)throw new Error("CodeCity: Unknwon split method");t=e.rect.split_pivot(r,i)}for(const r in e.children)this.add_rects({rect:t[r],area:e.children[r],relative:i,split:n})}}draw_rects({ground:t,el:e,area:i=this.areas,level:n=0,elevation:r=0,relative:a=!0,base_thick:s=.2,wireframe:o=!1,building_color:l="red",base_color:h="green",model:u=null,visible:d=!0,titles:p=!0,rootCodecityEntity:f}){let g=this;0===n&&(this.el=e);this.pending_rects;if("children"in i){let t=i.rect.box({elevation:r,height:s,color:h,inner:!1,wireframe:o,visible:d,id:i.data.id,rawarea:0});if(p){let e,i;t.addEventListener("click",(function(){if(e)f.removeChild(i),f.parentElement.removeChild(e),e=void 0,i=void 0;else{i=document.createElement("a-entity");let n=t.getAttribute("geometry"),r=t.getAttribute("position"),a=f.getAttribute("scale"),s=n.height+11;a&&(s=(n.height+11)/a.y),i.setAttribute("geometry",{height:s,depth:n.depth,width:n.width}),i.setAttribute("position",r),i.setAttribute("material",{visible:!0,opacity:.4}),f.appendChild(i),e=c(this.getAttribute("id"),"black","white");let o=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),l={x:o.x,y:12,z:o.z};e.setAttribute("position",l),e.setAttribute("visible",!0),f.parentElement.appendChild(e)}}))}t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t);let g=t;a||(g=e);for(const t of i.children){let e=s/2;a||(e=r+s),this.draw_rects({ground:i.rect,el:g,area:t,level:n+1,elevation:e,relative:a,building_color:l,base_color:h,model:u,base_thick:s,wireframe:o,visible:d,titles:p,rootCodecityEntity:f})}}else{let t=i.rect.box({height:i.data[this.fheight],elevation:r,wireframe:o,color:l,model:u,visible:d,id:i.data.id,rawarea:i.data[this.farea],inner_real:!0});if(t.setAttribute("class","babiaxraycasterclass"),e.appendChild(t),p){let e,n,r=!1;t.addEventListener("click",(function(){r?(e.setAttribute("visible",!1),n.setAttribute("visible",!1),f.parentElement.removeChild(e),f.removeChild(n),e=void 0,n=void 0,r=!1):r=!0})),t.addEventListener("mouseenter",(function(){if(!r){n=document.createElement("a-entity");let r=t.getAttribute("geometry"),a=t.getAttribute("position");n.setAttribute("position",a),n.setAttribute("material",{visible:!0}),n.setAttribute("geometry",{height:r.height+.1,depth:r.depth+.1,width:r.width+.1}),e=c(this.getAttribute("id"),"white","black",i.data,g.fheight,g.farea);let s=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),o=(new THREE.Box3).setFromObject(t.object3D),l={x:s.x,y:o.max.y+1,z:s.z};e.setAttribute("position",l),e.setAttribute("visible",!0),f.parentElement.appendChild(e),f.appendChild(n)}})),t.addEventListener("mouseleave",(function(){!r&&e&&(e.setAttribute("visible",!1),n.setAttribute("visible",!1),f.parentElement.removeChild(e),f.removeChild(n),e=void 0,n=void 0)}))}}}},o=class{constructor(t,e){this.items=t,this.total=void 0!==e?e:t.reduce((t,e)=>t+e,0)}imax(){let t=this.items[0],e=0;for(let i=0;i<this.items.length;i++)t<this.items[i]&&(t=this.items[i],e=i);return e}static range(t,e){var i=[];for(let n=t;n<t+e;n++)i.push(n);return i}scaled_area(t,e){return this.items[e]*t/this.total}values_i(t){let e=[];for(const i of t)e.push(this.items[i]);return new o(e)}pivot_regions(t,e){if(this.items.length<3)throw new Error("CodeCity - Values.pivot_regions: less than three items");if(t<e)throw new Error("Codecity - Values.pivot_regions: rectangle should be laying");let i,n,r=this.imax();if(this.items.lenght==r+1)return{pivot:r,a1:o.range(0,r),a2:[],a3:[]};if(this.items.length==r+2)return{pivot:r,a1:o.range(0,r),a2:[r+1],a3:[]};let a=t*e,s=this.scaled_area(a,r),l=Math.sqrt(s)*e-s,h=0,c=h,u=r+1;for(;h<l&&u<this.items.length;)c=h,h+=this.scaled_area(a,u),u++;let d=u;return u-1>r&&Math.abs(h-l)>Math.abs(c-l)&&(d=u-1),i=d-r-1,n=this.items.length-d,{pivot:r,a1:o.range(0,r),a2:o.range(r+1,i),a3:o.range(r+1+i,n)}}pivot_region_width(t,e){let i=0;for(const e of t)i+=this.items[e];return i/this.total*e}},l=class{constructor({width:t,depth:e,x:i=0,z:n=0}){this.width=t,this.depth=e,this.x=i,this.z=n}is_ilaying(){return Math.max(this.width,this.depth)==this.width}inner(t,e,i){if(t<e)throw"Rectangle.inner: Area for inner rectangle larger than my area";if(void 0!==t){let n=Math.sqrt(e/t);if(this.iwidth=n*this.width,this.idepth=n*this.depth,i){let e=Math.sqrt(i/t);this.iwidth_real=e*this.width,this.idepth_real=e*this.depth}}else this.iwidth=this.width,this.idepth=this.depth}reflect(){[this.width,this.depth]=[this.depth,this.width],[this.x,this.z]=[this.z,this.x]}idims_as_laying(){return this.is_ilaying()?[this.iwidth,this.idepth,this.x,this.z,!1]:[this.idepth,this.iwidth,this.z,this.x,!0]}split(t,e=!0){let[i,n,r,a,s]=this.idims_as_laying(),o=i/t.total,h=-i/2,c=0;e||(h+=r,c=a);let u=[];for(const e of t.items){let t=e*o,i=new l({width:t,depth:n,x:h+t/2,z:c});s&&i.reflect(),u.push(i),h+=t}return u}split_pivot(t,e=!0){if(t.items.length<=2)return this.split(t,e);let[i,n,r,a,s]=this.idims_as_laying();e&&(r=0,a=0);let{pivot:o,a1:h,a2:c,a3:u}=t.pivot_regions(i,n),d=t.pivot_region_width(h,i),p=t.pivot_region_width(c.concat(o),i),f=t.pivot_region_width(u,i),g=r-i/2+d/2,m=r-i/2+d+p/2,y=r-i/2+d+p+f/2,b=[],v=t.scaled_area(i*n,o)/p;b[o]=new l({width:p,depth:v,x:m,z:a+n/2-v/2});let x=[[h,d,n,g,a],[c,p,n-v,m,a-v/2],[u,f,n,y,a]];for(const[e,i,n,r,a]of x)if(e.length>0){let s=new l({width:i,depth:n,x:r,z:a});s.inner();let o=t.values_i(e),h=s.split_pivot(o,!1),c=0;for(const t of e)b[t]=h[c],c++}if(s)for(const t of b)t.reflect();return b}box({height:t,elevation:e=0,color:i="red",model:n=null,inner:r=!0,wireframe:a=!1,visible:s=!0,id:o="",rawarea:l=0,inner_real:h=!1}){let c,u;[c,u]=h?[this.idepth_real,this.iwidth_real]:r?[this.idepth,this.iwidth]:[this.depth,this.width];let d=document.createElement("a-entity");return d.setAttribute("geometry",{primitive:"box",skipCache:!0,depth:c,width:u,height:t}),d.setAttribute("material",{color:i}),d.setAttribute("position",{x:this.x,y:e+t/2,z:this.z}),d.setAttribute("id",o),d.setAttribute("babiaxr-rawarea",l),d}};t.exports={Values:o,Rectangle:l,Zone:s};let h=8e3,c=(t,e,i,n,r,a)=>{let s=2;if(t.length>16&&(s=t.length/8),n){let e="\n "+r+" (height): "+n[r];e.length>16&&(s=e.length/8),t+=e;let i="\n "+a+" (area): "+n[a];i.length>16&&i>e&&(s=i.length/8),t+=i}let o=document.createElement("a-plane");return o.setAttribute("babia-lookat","[camera]"),o.setAttribute("rotation",{x:0,y:0,z:0}),o.setAttribute("height","1"),o.setAttribute("width",s),o.setAttribute("color",e),o.setAttribute("material",{side:"double"}),o.setAttribute("text",{value:t,align:"center",width:6,color:i}),o.setAttribute("visible",!1),o};let u},function(t,e,n){let r=n(0).updateTitle;n(0).colors;let a=n(0).updateFunction,s=n(6).createCylinder;const o=n(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-cylsmap",{schema:{data:{type:"string"},height:{type:"string",default:"height"},radius:{type:"string",default:"radius"},x_axis:{type:"string",default:"x_axis"},z_axis:{type:"string",default:"z_axis"},from:{type:"string"},legend:{type:"boolean"},axis:{type:"boolean",default:!0},axis_name:{type:"boolean",default:!1},animation:{type:"boolean",default:!1},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},scale:{type:"number"},heightMax:{type:"number"},radiusMax:{type:"number",default:2},chartHeight:{type:"number",default:10},keepHeight:{type:"boolean",default:!0}},visProperties:["height","radius","x_axis","z_axis"],multiple:!1,init:function(){this.notiBuffer=new o,this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.el.appendChild(this.chartEl),this.updateTitle(),this.el.appendChild(this.titleEl)},update:function(t){a(this,t)},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},updateTitle:function(){this.titleEl=r(this.data,{x:0,y:0,z:0})},updateChart:function(){const t=this.newData,e=this.data;let n=[],r=[],a=new Array,o=0,h=[],c=[];for(i=0;i<t.length;i++){let s=t[i][e.x_axis],o=t[i][e.z_axis];n.includes(s)||n.push(s),r.includes(o)||r.push(o);let l=n.indexOf(s),h=r.indexOf(o);if(a[l])a[l][h]=t[i][e.radius];else{let n=new Array;n[h]=t[i][e.radius],a[l]=n}}let u=Math.max.apply(Math,t.map((function(t){return t[e.height]})));this.lengthY?e.keepHeight||(this.lengthY=this.lengthY*this.maxValue/this.maxValue):this.lengthY=e.chartHeight,this.maxValue=u;let d=Math.max.apply(Math,t.map((function(t){return t[e.radius]})));for(this.radius_scale=e.radiusMax/d,i=0;i<n.length;i++){let t=Math.max.apply(Math,a[i].filter((function(t){if(""!=t)return t})));if(0==i)h.push(t*this.radius_scale);else{let e=Math.max.apply(Math,a[i-1].filter((function(t){if(""!=t)return t})));h.push(h[i-1]+t*this.radius_scale+.5+e*this.radius_scale)}}for(j=0;j<r.length;j++)rad_0=l(a,n.length,j),0==j?c.push(rad_0*this.radius_scale):(rad_1=l(a,n.length,j-1),c.push(c[j-1]+rad_1*this.radius_scale+.5+rad_0*this.radius_scale));let p=this.chartEl.querySelectorAll("a-entity[babia-cyl]"),f={};for(let t of p){f[t.getAttribute("babia-name")]={el:t,found:!1}}for(let i=0;i<t.length;i++){let a,l=t[i],u=l[e.x_axis],d=l[e.z_axis],p=u+"-"+d,g=h[n.indexOf(u)],m=c[r.indexOf(d)];f[p]&&!l._not?(a=f[p].el,f[p].found=!0):(a=document.createElement("a-entity"),a.setAttribute("babia-name",p),a.id=p,a.object3D.position.x=g,a.object3D.position.z=m,this.chartEl.appendChild(a)),o=n.indexOf(u),s(this,a,e,l,o,u,g,m,d)}for(let t in f)f[t].found||f[t].el.remove();if(e.axis){let t=Math.max.apply(Math,a[n.length-1].filter((function(t){if(""!=t)return t})));const e=h[h.length-1]+t*this.radius_scale+.5,i=c[c.length-1]+l(a,n.length,r.length-1)*this.radius_scale+.5;h+=.25,c+=.25,this.updateAxis(n,h,e,u,r,c,i)}this.updateTitle()},updateAxis:function(t,e,i,n,r,a,s){const o=this.data;o.axis&&(this.xAxisEl||(this.xAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.xAxisEl)),this.xAxisEl.setAttribute("babia-axis-x",{labels:t,ticks:e,length:i,palette:o.palette,align:"behind"}),this.xAxisEl.setAttribute("position",{x:-.25,y:0,z:-.25}),this.zAxisEl||(this.zAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.zAxisEl)),this.zAxisEl.setAttribute("babia-axis-z",{labels:r,ticks:a,length:s,palette:o.palette,align:"left"}),this.zAxisEl.setAttribute("position",{x:-.25,y:0,z:-.25}),this.yAxisEl||(this.yAxisEl=document.createElement("a-entity"),this.chartEl.appendChild(this.yAxisEl)),this.yAxisEl.setAttribute("babia-axis-y",{maxValue:n,length:this.lengthY}),this.yAxisEl.setAttribute("position",{x:-.25,y:0,z:-.25}),o.axis_name&&((o.index=!1)?this.xAxisEl.setAttribute("babia-axis-x","name",o.index):this.xAxisEl.setAttribute("babia-axis-x","name",o.x_axis),this.yAxisEl.setAttribute("babia-axis-y","name",o.height),this.zAxisEl.setAttribute("babia-axis-z","name",o.z_axis)))},processData:function(t){console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating cylsmap..."),this.updateChart(),this.notiBuffer.set(this.newData)}});let l=(t,e,n)=>{let r=0;for(i=0;i<e;i++)t[i][n]&&r<t[i][n]&&(r=t[i][n]);return r}},function(t,e,i){let n=i(0).updateTitle;const r=i(0).colors;let a=i(0).updateFunction;const s=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function o(t,e,i,n,a){let s=r.get(n,a);console.log("Generating slice...");let o=document.createElement("a-torus");return o.setAttribute("color",s),o.setAttribute("rotation",{x:90,y:0,z:t}),o.setAttribute("arc",e),o.setAttribute("side","double"),o.setAttribute("radius",i),o.setAttribute("radius-tubular",i/4),o}function l(t,e,i,n){e.addEventListener("mouseenter",(function(){this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),legend=function(t,e){let i=e[t.key]+": "+e[t.size],n=2;i.length>16&&(n=i.length/8);let r=document.createElement("a-plane");return r.setAttribute("position",{x:0,y:1,z:-2}),r.setAttribute("rotation",{x:-90,y:0,z:0}),r.setAttribute("height","1"),r.setAttribute("width",n),r.setAttribute("color","white"),r.setAttribute("text",{value:e[t.key]+": "+e[t.size],align:"center",width:6,color:"black"}),r.classList.add("babiaxrLegend"),r}(t,i),n.appendChild(legend)})),e.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),n.removeChild(legend)}))}AFRAME.registerComponent("babia-doughnut",{schema:{data:{type:"string"},size:{type:"string",default:"size"},key:{type:"string",default:"key"},from:{type:"string"},legend:{type:"boolean"},palette:{type:"string",default:"ubuntu"},title:{type:"string"},titleFont:{type:"string"},titleColor:{type:"string"},titlePosition:{type:"string",default:"0 0 0"},animation:{type:"boolean",default:!1}},visProperties:["size","key"],multiple:!1,init:function(){this.notiBuffer=new s},update:function(t){a(this,t)},tick:function(t,e){if(this.data.animation&&this.loaded){let i=document.getElementsByClassName("babiaxrChart")[0].children;for(let n in this.slice_array){let r=this.slice_array[n].delay,a=this.slice_array[n].arc,s=parseFloat(i[n].getAttribute("arc"));t>=r&&s<a&&(s+=360*e/this.total_duration,s>a&&(s=a),i[n].setAttribute("arc",s))}}},prodComponent:void 0,notiBufferId:void 0,newData:void 0,babiaMetadata:{id:0},loaded:!1,slice_array:[],total_duration:4e3,updateTitle:function(){const t=n(this.data,{x:-90,y:0,z:0});this.el.appendChild(t)},updateChart:function(){const t=this.newData;console.log("Data babia-doughnut",t);const e=this.data,i=this.el,n=e.animation,r=e.palette;let a=0,s=0,h=0,c=0;for(let i of t)c+=i[e.size];this.chartEl=document.createElement("a-entity"),this.chartEl.classList.add("babiaxrChart"),this.chartEl.setAttribute("rotation",{y:90}),i.appendChild(this.chartEl);let u=0;for(let d of t){let t;if(s=360*d[e.size]/c,n){let e=this.total_duration*s/360;this.slice_array.push({arc:s,duration:e,delay:u}),u+=e,t=o(a,.01,1,h,r)}else t=o(a,s,1,h,r);t.classList.add("babiaxraycasterclass"),this.chartEl.appendChild(t),a+=s,e.legend&&l(e,t,d,i),h++}this.updateTitle()},processData:function(t){for(console.log("processData",this),this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++};this.el.firstChild;)this.el.firstChild.remove();console.log("Generating doughnut..."),this.updateChart(),this.loaded=!0,this.notiBuffer.set(this.newData)}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babiaxr-totem",{schema:{charts_id:{type:"string"},data_list:{type:"string"}},multiple:!1,init:function(){let t=this.data,e=this.el;i=e.id,t&&(s.push({id:e.id,charts_id:JSON.parse(t.charts_id)}),t.data_list&&(n=JSON.parse(t.data_list),function(t){let e=new THREE.FileLoader;for(let i of t)if(i.from_querier){let t=document.getElementById(i.from_querier);if(t.getAttribute("babiaData")){let e=JSON.parse(t.getAttribute("babiaData"));a.push({file:e,path:i.from_querier})}else t.addEventListener("dataReady"+i.from_querier,(function(t){a.push({file:t.detail,path:i.from_querier})}))}else if(i.path){let t=i.path;e.load(t,(function(e){a.push({file:e,path:t})}),(function(e){console.log(t.toString()+": "+e.loaded/e.total*100+"% loaded")}),(function(t){console.error("An error happened")}))}}(n)))},update:function(t){let e=this.data;if(r=this.el,e!==t){for(;this.el.firstChild;)this.el.firstChild.remove();console.log("Generating totemchart..."),o(r)}},remove:function(){},pause:function(){},play:function(){}});let i,n,r,a=[],s=[],o=t=>{a&&function(t,e){console.log("Generating Totem...");let i=7.5;if(e.length%2==1){let t=Math.trunc(e.length/2);i+=t}let n=function(t){let e=5;for(let i of t)i.data&&(i=i.data),i.length>10&&e<i.length/4&&(e=i.length/4);return e}(e);document.createElement;(function(t,e,i,n,r,a,s){let o=document.createElement("a-plane");o.setAttribute("class","title"),o.setAttribute("position",{x:e,y:i,z:n}),o.setAttribute("rotation",{x:0,y:r,z:0}),o.setAttribute("height",1),o.setAttribute("width",a),o.setAttribute("color","blue"),o.setAttribute("text",{value:s,align:"center",width:"10",color:"white"}),t.appendChild(o)})(t,-3,i,6,0,n,"Select Data"),i-=1,function(t,e,i,n,r,a,s,o){for(let h of s){h.data&&(h=h.data);let c=document.createElement("a-plane");c.setAttribute("position",{x:e,y:i,z:n}),c.setAttribute("rotation",{x:0,y:r,z:0}),c.setAttribute("height",1),c.setAttribute("width",a),c.setAttribute("text",{value:h,align:"center",width:"10"}),c.setAttribute("color","white"),c.setAttribute("text",{color:"black"}),t.appendChild(c),i-=1,c.classList.add("babiaxraycasterclass"),c.addEventListener("click",(function(){let t=c.parentElement.id,e=c.parentElement.children;o=h;for(let e of s)(e.path||e.from_querier)&&o==e.data&&l(e.path||e.from_querier,t);for(let t in e)e[t]===c?(c.setAttribute("color","black"),c.setAttribute("text",{color:"white"})):e[t].id||"title"!==e[t].className&&(e[t].setAttribute("color","white"),e[t].setAttribute("text",{color:"black"}))}))}}(t,-3,i,6,0,n,e)}(t,n)};function l(t,e){!function(t){document.getElementById(t)}(e);for(let i in s)if(e==s[i].id){let e=s[i].charts_id;for(obj in e){let i,n=e[obj].type,r=e[obj].id;for(let e in a)a[e].path==t&&(i=a[e].file,"babiaxr-vismapper"===n?document.getElementById(r).setAttribute(n,"dataToShow",JSON.stringify(i)):document.getElementById(r).setAttribute(n,"data",i))}}}},function(t,e){AFRAME.registerComponent("babia-terrain",{schema:{width:{type:"number",default:1},height:{type:"number",default:1},segmentsHeight:{type:"number",default:1},segmentsWidth:{type:"number",default:1},data:{type:"array"},color:{type:"string",default:"0xdddddd"},filled:{type:"boolean",default:!1}},init:function(){var t=this.data,e=this.el,i=t.data;console.log("Vertices:"),console.log(i),this.geometry=new THREE.PlaneGeometry(t.width,t.height,t.segmentsHeight,t.segmentsWidth);for(var n=0,r=this.geometry.vertices.length;n<r;n++)this.geometry.vertices[n].z=i[n];var a=t.color;t.filled?this.material=new THREE.MeshPhongMaterial({color:a,wireframe:!1}):this.material=new THREE.MeshPhongMaterial({color:a,wireframe:!0}),this.mesh=new THREE.Mesh(this.geometry,this.material),e.setObject3D("mesh",this.mesh)}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let n,r,a,s,o,l,h,c,u,d,p;function f(t){let e=document.createElement("a-sphere");var i;return e.setAttribute("radius",.05),e.setAttribute("material",{color:"#FF0000"}),function(t,e){let i,n;t.addEventListener("mouseenter",(function(){c=this.getAttribute("material").color,this.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),this.setAttribute("material",{color:"#AAAA00"}),n=g(e),this.appendChild(n)})),t.addEventListener("showinfo",(function(){i=g(e),this.setAttribute("material",{color:"#00AA00"}),this.appendChild(i)})),t.addEventListener("mouseleave",(function(){this.setAttribute("scale",{x:1,y:1,z:1}),this.setAttribute("material",{color:c}),this.removeChild(n)})),t.addEventListener("removeinfo",(function(){i&&(this.removeChild(i),this.setAttribute("material",{color:"#FF0000"}))}))}(e,t),i=t,e.addEventListener("click",(function(){this.setAttribute("material",{color:"#00AA00"}),c=this.getAttribute("material").color,l.emit("babiaxrShow",{data:i}),document.getElementsByClassName("babiaxrPause")[0]&&(o.removeChild(s),o.appendChild(a))})),e}function g(t){let e="",i=[];i.push("Date: "+t.date+"\n"),i.push("commit: "+t.commit+"\n");let n=1;for(let t of i)t.length>10&&n<t.length/2&&(n=t.length/7),e+=t;let r=document.createElement("a-plane");return r.setAttribute("position",{x:0,y:.4,z:.1}),r.setAttribute("scale",{x:.5,y:.5,z:1}),r.setAttribute("height","1"),r.setAttribute("width",n),r.setAttribute("color","white"),r.setAttribute("text",{value:e,align:"center",width:6,color:"black"}),r.setAttribute("material",{opacity:.6}),r}function m(t){let e=t.length,n=[];for(i=0;i<e;i++){let e=.11*t[i][0],r=.11*t[i][1],a=.11*t[i][2],s=new THREE.Vector3(e,r,a);n.push(s)}let r=new THREE.Shape(n),a=new THREE.MeshBasicMaterial({color:16777215,side:THREE.DoubleSide,wireframe:!1}),s=new THREE.ExtrudeGeometry(r,{depth:.05,bevelEnabled:!1,bevelSegments:1,steps:1,bevelThickness:1});return new THREE.Mesh(s,a)}function y(t){t.addEventListener("mouseenter",(function(){h=Object.assign({},this.object3DMap.mesh.material.color),this.object3DMap.mesh.material.color={r:170/255,g:170/255,b:170/255}})),t.addEventListener("mouseleave",(function(){this.object3DMap.mesh.material.color=h}))}function b(t,e){t.addEventListener("click",(function(){if(t.classList.contains("babiaxrPlay"))o.removeChild(t),o.appendChild(s);else if(t.classList.contains("babiaxrPause"))o.removeChild(s),o.appendChild(a);else if(t.classList.contains("babiaxrSkipNext")||t.classList.contains("babiaxrSkipPrev"))document.getElementsByClassName("babiaxrPause")[0]&&(o.removeChild(s),o.appendChild(a));else if(t.classList.contains("babiaxrForward")){h={r:85/255,g:85/255,b:85/255},document.getElementsByClassName("babiaxrRewind")[0].object3DMap.mesh.material.color={r:1,g:1,b:1}}else if(t.classList.contains("babiaxrRewind")){h={r:85/255,g:85/255,b:85/255},document.getElementsByClassName("babiaxrForward")[0].object3DMap.mesh.material.color={r:1,g:1,b:1}}console.log("Emit..... "+e),l.emit(e)}))}AFRAME.registerComponent("babiaxr-navigation-bar",{schema:{commits:{type:"string"},size:{type:"number",default:"5"},points_by_line:{type:"number",default:"5"},to:{type:"string",default:"left"},start_point:{type:"number",default:"0"}},multiple:!1,init:function(){let t=this.data;l=this.el,n=JSON.parse(t.commits),r=t.size,u=t.to,d=t.start_point,p=t.points_by_line;let e=function(t,e,i){let n=document.createElement("a-entity");n.classList.add("babiaxrTimeBar");let r=0,a=Math.ceil(t.length/i)/5-.2,s=e/(i-1),o=0,l=1;for(let e in t){let h=f(t[e]);h.classList.add("babiaxraycasterclass"),h.setAttribute("position",{x:r,y:a,z:0}),n.appendChild(h),e%i==i-1&&e!=t.length-1?(l++,a-=.2,r=0):e!=t.length-1&&(r+=s),o=r}for(let t=0;t<l;t++){let i=document.createElement("a-entity");0!=o&&0==t||1==p||0==o&&0==t?i.setAttribute("line",{start:"0 "+a+" 0",end:o+" "+a+" 0",color:"#FF0000"}):i.setAttribute("line",{start:"0 "+a+" 0",end:e+" "+a+" 0",color:"#FF0000"}),a+=.2,n.appendChild(i)}return n}(n,r,p);this.el.appendChild(e),o=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrPlayer"),t.setAttribute("position",{x:(r-5)/2,y:0,z:0}),t.classList.add("babiaxraycasterclass"),a=function(t){let e=document.createElement("a-entity");e.classList.add("babiaxrPlay");let i=m([[0,0,0],[0,3,0],[2.5,1.5,0],[0,0,0]]);return e.setObject3D("mesh",i),b(e,"babiaxrContinue"),y(e),e}(),a.setAttribute("position",{x:2.35,y:-.65,z:0}),a.classList.add("babiaxraycasterclass"),s=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrPause");let e=function(t,e){let n=t.length,r=e.length,a=[],s=[];for(i=0;i<n;i++){let e=.11*t[i][0],n=.11*t[i][1],r=.11*t[i][2],s=new THREE.Vector3(e,n,r);a.push(s)}for(i=0;i<r;i++){let t=.11*e[i][0],n=.11*e[i][1],r=.11*e[i][2],a=new THREE.Vector3(t,n,r);s.push(a)}let o=new THREE.Shape(a),l=new THREE.Shape(s),h={depth:.05,bevelEnabled:!1,bevelSegments:1,steps:1,bevelThickness:1},c=new THREE.MeshBasicMaterial({color:16777215,side:THREE.DoubleSide,wireframe:!1}),u=new THREE.ExtrudeGeometry(o,h),d=new THREE.ExtrudeGeometry(l,h),p=new THREE.Mesh(u,c);return p.updateMatrix(),d.merge(p.geometry,p.matrix),new THREE.Mesh(d,c)}([[0,0,0],[0,3,0],[1,3,0],[1,0,0],[0,0,0]],[[1.5,0,0],[1.5,3,0],[2.5,3,0],[2.5,0,0],[1.5,0,0]]);return t.setObject3D("mesh",e),b(t,"babiaxrStop"),y(t),t}(),s.setAttribute("position",{x:2.35,y:-.65,z:0}),s.classList.add("babiaxraycasterclass"),t.appendChild(s);let e=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrRewind");let e=m([[0,0,0],[0,3,0],[1.25,1.5,0],[1.25,3,0],[2.5,1.5,0],[1.25,0,0],[1.25,1.5,0],[0,0,0]]);t.setObject3D("mesh",e),t.setAttribute("rotation",{x:0,y:180,z:0}),"left"==u&&(t.object3DMap.mesh.material.color={r:85/255,g:85/255,b:85/255});return b(t,"babiaxrToPast"),y(t),t}();e.setAttribute("position",{x:1.25,y:-.65,z:0}),e.classList.add("babiaxraycasterclass"),t.appendChild(e);let n=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrForward");let e=m([[0,0,0],[0,3,0],[1.25,1.5,0],[1.25,3,0],[2.5,1.5,0],[1.25,0,0],[1.25,1.5,0],[0,0,0]]);t.setObject3D("mesh",e),"right"==u&&(t.object3DMap.mesh.material.color={r:85/255,g:85/255,b:85/255});return b(t,"babiaxrToPresent"),y(t),t}();n.setAttribute("position",{x:3.7,y:-.65,z:0}),n.classList.add("babiaxraycasterclass"),t.appendChild(n);let o=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrSkipPrev");let e=m([[0,0,0],[0,3,0],[1,1.5,0],[1,3,0],[2,1.5,0],[2,3,0],[2.5,3,0],[2.5,0,0],[2,0,0],[2,1.5,0],[1,0,0],[1,1.5,0],[0,0,0]]);return t.setObject3D("mesh",e),t.setAttribute("rotation",{x:0,y:180,z:0}),b(t,"babiaxrSkipPrev"),y(t),t}();o.setAttribute("position",{x:1.95,y:-.65,z:0}),o.classList.add("babiaxraycasterclass"),t.appendChild(o);let l=function(){let t=document.createElement("a-entity");t.classList.add("babiaxrSkipNext");let e=m([[0,0,0],[0,3,0],[1,1.5,0],[1,3,0],[2,1.5,0],[2,3,0],[2.5,3,0],[2.5,0,0],[2,0,0],[2,1.5,0],[1,0,0],[1,1.5,0],[0,0,0]]);return t.setObject3D("mesh",e),b(t,"babiaxrSkipNext"),y(t),t}();return l.setAttribute("position",{x:3,y:-.65,z:0}),l.classList.add("babiaxraycasterclass"),t.appendChild(l),t}(),this.el.appendChild(o),function(){let t=document.getElementsByClassName("babiaxrTimeBar")[0].children;for(let e in t)e==d&&t[e].emit("showinfo")}()},update:function(t){},remove:function(){},pause:function(){},play:function(){}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let i,n,r;var a;AFRAME.registerComponent("babiaxr-event-controller",{schema:{navigation:{type:"string"},targets:{type:"string"}},multiple:!1,init:function(){},update:function(t){i=this.el;let e=this.data;n=e.navigation,r=JSON.parse(e.targets),function(t){let e=document.getElementById(t).getAttribute("babiaxr-navigation-bar").commits;if(e&&c){a=JSON.parse(e);for(let t in a)s.push(a[t]);if(s.reverse(),h){let t=a.length-1-0;o=s[0],l=t}else o=a[0],l=0;c=!1,function(){u(h?s:a);document.addEventListener("babiaxrShow",(function(t){!function(t){for(let e in a)if(a[e].commit==t.commit){o=a[e],f(e),l=e;break}p()}(t.detail.data),i.emit("babiaxrStop")})),document.addEventListener("babiaxrContinue",(function(){console.log("PLAY"),u(h?s:a)})),document.addEventListener("babiaxrToPresent",(function(){console.log("TO PRESENT"),h=!1,i.emit("babiaxrStop"),u(a)})),document.addEventListener("babiaxrToPast",(function(){console.log("TO PAST"),h=!0,i.emit("babiaxrStop"),u(s)})),document.addEventListener("babiaxrSkipNext",(function(){console.log("SKIP NEXT"),i.emit("babiaxrStop"),d("next")})),document.addEventListener("babiaxrSkipPrev",(function(){console.log("SKIP PREV"),i.emit("babiaxrStop"),d("prev")}))}()}}(n)},remove:function(){},pause:function(){},play:function(){}});var s=[];let o,l,h=!1,c=!0;function u(t){let e=0;for(let i in t)t[i]==o&&(e=parseInt(i)+1);let n=setInterval((function(){if(e<t.length){if(o=t[e],h){let i=t.length-1-e;f(i),l=i}else f(e),l=e;if(p(),e++,document.addEventListener("babiaxrStop",(function(){clearInterval(n)})),e==t.length){document.getElementsByClassName("babiaxrPause")[0].emit("click")}}else i.emit("babiaxrStop")}),3e3)}function d(t){for(let e in a)if(a[e]==o){"next"==t&&e<a.length-1?e++:"prev"==t&&e>=1&&e--,o=a[e],f(e),l=e;break}p()}function p(){let t=document.getElementById(o.commit).getAttribute("babiadata");for(let e in r){let i=document.getElementById(r[e].id);i&&i.setAttribute("babiaxr-vismapper","dataToShow",t)}}function f(t){let e=document.getElementsByClassName("babiaxrTimeBar")[0].children;if(l||0==l){e[l].emit("removeinfo")}e[t].emit("showinfo")}},function(t,e,n){n(0).findProdComponent;let r=n(0).updateFunction;const a=n(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-boats",{schema:{data:{type:"asset"},from:{type:"string"},border:{type:"number",default:.5},width:{type:"string",default:"width"},depth:{type:"string",default:"depth"},area:{type:"string"},color:{type:"string"},height:{type:"string",default:"height"},zone_elevation:{type:"number",default:.3},building_separation:{type:"number",default:.25},extra:{type:"number",default:1},levels:{type:"number"},building_color:{type:"string",default:"#E6B9A1"},base_color:{type:"color",default:"#98e690"},min_building_height:{type:"number",default:1},height_quarter_legend_box:{type:"number",default:11},height_quarter_legend_title:{type:"number",default:12},height_building_legend:{type:"number",default:0},legend_scale:{type:"number",default:1},legend_lookat:{type:"string",default:"[camera]"},field:{type:"string",default:"uid"}},entitiesWithLegend:[],dataComponent:void 0,newData:void 0,babiaMetadata:{id:0},visProperties:["height","area","width","depth"],multiple:!1,duration:2e3,figures_del:[],figures_in:[],animation:!1,init:function(){this.notiBuffer=new a},update:function(t){r(this,t)},tick:function(t,e){if(this.animation){let t={x:0,y:0,z:0};Date.now()-this.start_time>this.duration?(this.animation=!1,this.setFigures(this.figures,t)):this.Animation(this.el,this.figures,this.figures_old,e,t,t)}},updateChart:function(t){console.log("Data Loaded.");let e={x:0,y:0,z:0};this.animation&&(this.figures_del.forEach(t=>{let e=document.getElementById(t.id);e&&e.remove()}),this.figures_in.forEach(t=>{let e=document.getElementById(t.id);e&&o(e,1)}),this.setFigures(this.figures,e),this.animation=!1,this.figures_del=[],this.figures_in=[]),this.figures_old=this.figures,this.figures=[];let i,n=this.el,r=t;if(this.data.levels)i=this.data.border*this.data.extra*this.data.levels;else{let t=l(r,0);i=this.data.border*this.data.extra*(t+1)}if([x,y,e,this.figures]=this.generateElements(r,this.figures,e,i),e.x=0,e.z=0,0==this.figures_old.length){for(;this.el.firstChild;)this.el.firstChild.remove();this.drawElements(n,this.figures,e)}else this.figures_old!==this.figures&&(this.animation=!0,this.start_time=Date.now())},generateElements:function(t,e,i,n){var r=n,a=0,s=0,o=0,l=0,h=0,c=0,u=0,d=0,p=0,f=0,g=0,m=0,y=!1,b=!1,v=!1,x=!0;for(let i=0;i<t.length;i++){let w,C={};if(this.data.width&&(C.width=t[i][this.data.width]||.5),this.data.height&&(C.height=t[i][this.data.height]||this.data.min_building_height),this.data.depth&&(C.depth=t[i][this.data.depth]||.5),this.data.area&&(C.area=t[i][this.data.area]||.5),t[i].children){C.children=t[i].children,this.quarter=!0;var _,A=[];C.height=this.data.zone_elevation,r-=this.data.border*this.data.extra,[C.width,C.depth,_,A]=this.generateElements(C.children,A,_,r),_.y=C.height,r=n}0==i?(this.data.area&&!t[i].children?(a+=Math.sqrt(C.area)/2,s-=Math.sqrt(C.area)/2,o+=Math.sqrt(C.area)/2,l-=Math.sqrt(C.area)/2):(a+=C.depth/2,s-=C.depth/2,o+=C.width/2,l-=C.width/2),m=a+this.data.building_separation/2):C.height>0&&(y?([g,h,c,f]=this.UpSide(C,a,g,f),g>o&&(u=g+=this.data.building_separation/2,y=!1,x=!0,d<l&&(l=d),m=a+this.data.building_separation/2)):x?([m,h,c,u]=this.RightSide(C,o,m,u),m<s&&(p=m+=this.data.building_separation/2,x=!1,b=!0,f>a&&(a=f),g=o+this.data.building_separation/2)):b?([g,h,c,p]=this.DownSide(C,s,g,p),g<l&&(d=g-=this.data.building_separation/2,b=!1,v=!0,u>o&&(o=u),m=s-this.data.building_separation/2)):v&&([m,h,c,d]=this.LeftSide(C,l,m,d),m>a&&(f=m-=this.data.building_separation/2,v=!1,y=!0,p<s&&(s=p),g=l-this.data.building_separation/2))),w=t[i].children?{id:id="boat-"+t[i][this.data.field],name:t[i][this.data.field],posX:h,posY:c,width:C.width,height:C.height,depth:C.depth,children:A,translate_matrix:_}:this.data.area?{id:"boat-"+t[i][this.data.field],name:t[i].name?t[i].name:t[i][this.data.field],posX:h,posY:c,width:Math.sqrt(C.area),height:C.height,depth:Math.sqrt(C.area)}:{id:"boat-"+t[i][this.data.field],name:t[i].name?t[i].name:t[i][this.data.field],posX:h,posY:c,width:C.width,height:C.height,depth:C.depth},w.rawData=t[i],e.push(w)}p<s&&(s=p),d<l&&(l=d),f>a&&(a=f),u>o&&(o=u),g<l&&(l=g+this.data.building_separation/2),g>o&&(o=g-this.data.building_separation/2),m>a&&(a=m-this.data.building_separation/2),m<s&&(s=m+this.data.building_separation/2);var w=Math.abs(l)+Math.abs(o),C=Math.abs(s)+Math.abs(a);return[w+=2*r,C+=2*r,{x:l+w/2-r,y:0,z:s+C/2-r},e]},drawElements:function(t,e,i){for(let n in e){let r=e[n].height,a=e[n].posX,s=e[n].posY,o={x:a-i.x,y:r/2+i.y/2,z:-s+i.z},l=this.createElement(e[n],o);this.addEvents(l,e[n]),t.appendChild(l)}},RightSide:function(t,e,i,n){let r,a,s=parseFloat(this.data.building_separation);this.data.area&&!t.children?(r=Math.sqrt(t.area),a=Math.sqrt(t.area)+s):(r=parseFloat(t.width),a=parseFloat(t.depth)+s);let o=i-a/2,l=e+r+s;return l>n&&(n=l),[i-=a,e+r/2+s,o,n]},DownSide:function(t,e,i,n){let r,a,s=parseFloat(this.data.building_separation);this.data.area&&!t.children?(r=Math.sqrt(t.area)+s,a=Math.sqrt(t.area)):(r=parseFloat(t.width)+s,a=parseFloat(t.depth));let o=i-r/2,l=e-a-s;return l<n&&(n=l),[i-=r,o,e-a/2-s,n]},LeftSide:function(t,e,i,n){let r,a,s=parseFloat(this.data.building_separation);this.data.area&&!t.children?(r=Math.sqrt(t.area),a=Math.sqrt(t.area)+s):(r=parseFloat(t.width),a=parseFloat(t.depth)+s);let o=i+a/2,l=e-r-s;return l<n&&(n=l),[i+=a,e-r/2-s,o,n]},UpSide:function(t,e,i,n){let r,a,s=parseFloat(this.data.building_separation);this.data.area&&!t.children?(r=Math.sqrt(t.area)+s,a=Math.sqrt(t.area)):(r=parseFloat(t.width)+s,a=parseFloat(t.depth));let o=i+r/2,l=e+a+s;return l>n&&(n=l),[i+=r,o,e+a/2+s,n]},Animation:function(t,e,i,n,r,a){let s,l=this,h=Date.now();for(let u in e)if(document.getElementById(e[u].id))if(s=document.getElementById(e[u].id),e[u].inserted){let t="id="+e[u].id;c(l.figures_in,t)<0&&l.figures_in.push(e[u])}else{let t="id="+e[u].id,o=c(i,t);o<0?(e[u].inserted=!0,s.getAttribute("width")!=e[u].width&&s.setAttribute("width",e[u].width),s.getAttribute("height")!=e[u].height&&s.setAttribute("height",e[u].height),s.getAttribute("depth")!=e[u].depth&&s.setAttribute("depth",e[u].depth)):(this.resize(s,h,n,e[u],i[o]),this.traslate(s,h,n,e[u],i[o],r,a),e[u].children&&this.Animation(s,e[u].children,i[o].children,n,e[u].translate_matrix,i[o].translate_matrix))}else{position={x:e[u].posX-r.x,y:e[u].height/2+r.y/2,z:-e[u].posY+r.z};let i=this.createElement(e[u],position);this.addEvents(i,e[u]),o(i,.5),t.appendChild(i),e[u].inserted=!0}this.duration;for(let t in i){let n="id="+i[t].id;if(c(e,n)<0){c(l.figures_del,n)<0&&l.figures_del.push(i[t]);let e=document.getElementById(i[t].id);e&&(e.object3D.visible=!1,e.remove())}}},setFigures:function(t,e){t.forEach(t=>{let i=document.getElementById(t.id);i&&(i.getAttribute("width")!=t.width&&i.setAttribute("width",t.width),i.getAttribute("height")!=t.height&&i.setAttribute("height",t.height),i.getAttribute("depth")!=t.depth&&i.setAttribute("depth",t.depth),i.components.material.data.opacity<1&&o(i,1),i.object3D.position.set(t.posX-e.x,(parseFloat(t.height)+e.y)/2,-t.posY+e.z),t.children&&this.setFigures(t.children,t.translate_matrix))})},resize:function(t,e,i,n,r){if(e-this.start_time<this.duration&&(n.width!=r.width||n.height!=r.height||n.depth!=r.depth)){let e,a,s,o=Math.abs(n.width-r.width),l=Math.abs(n.height-r.height),h=Math.abs(n.depth-r.depth),c=i*o/this.duration,u=i*l/this.duration,d=i*h/this.duration,p=parseFloat(t.getAttribute("width")),f=parseFloat(t.getAttribute("height")),g=parseFloat(t.getAttribute("depth"));e=n.width-r.width<0?p-c:p+c,a=n.height-r.height<0?f-u:f+u,s=n.depth-r.depth<0?g-d:g+d,t.setAttribute("width",e),t.setAttribute("height",a),t.setAttribute("depth",s),t.babiaRawData=n.rawData}else e-this.start_time>this.duration&&(n.width!=r.width||n.height!=r.height||n.depth!=r.depth)&&(t.setAttribute("width",n.width),t.setAttribute("height",n.height),t.setAttribute("depth",n.depth),t.babiaRawData=n.rawData)},traslate:function(t,e,i,n,r,a,s){let o=r.posX-s.x-(n.posX-a.x),l=n.height-r.height,h=r.posY-s.z-(n.posY-a.z);if(0!=o||0!=l||0!=h)if(e-this.start_time<this.duration){let e=i*o/this.duration,n=i*l/(2*this.duration),r=i*h/this.duration,a=parseFloat(t.object3D.position.x)-e,s=parseFloat(t.object3D.position.y)+n,c=parseFloat(t.object3D.position.z)+r;t.object3D.position.set(a,s,c)}else e-this.start_time>this.duration&&t.object3D.position.set(n.posX-a.x,(parseFloat(n.height)+a.y)/2,-n.posY+a.z)},createElement:function(t,e){let i=this,n=document.createElement("a-box");n.id=t.id,n.setAttribute("class","babiaxraycasterclass");let r=t.width,a=t.height,s=t.depth;return t.children?color=i.data.base_color:i.data.color?color=function(t,e,i){let n=[19,82,138],r=[255,94,83];var a=((((t||0)-i)/(e-i)*2-1)/1+1)/2,s=1-a,o=[Math.round(r[0]*a+n[0]*s),Math.round(r[1]*a+n[1]*s),Math.round(r[2]*a+n[2]*s)];return"rgb("+o[0]+","+o[1]+","+o[2]+")"}(t.rawData[i.data.color],i.babiaMetadata.color_max,i.babiaMetadata.color_min):color=i.data.building_color,n.setAttribute("color",color),n.setAttribute("width",r),n.setAttribute("height",a),n.setAttribute("depth",s),t.rawData&&(n.babiaRawData=t.rawData),n.setAttribute("position",{x:e.x,y:e.y,z:e.z}),n},processData:function(t){console.log("processData",t);let e=this.data;if(this.newData=t,this.babiaMetadata={id:this.babiaMetadata.id++},e.color){let[t,i]=h(this.newData,e.color);this.babiaMetadata.color_max=t,this.babiaMetadata.color_min=i}this.notiBuffer.set(this.newData),this.updateChart(this.newData)},addEvents:function(t,e){let i=this;if(e.children){let n,r;t.addEventListener("click",(function(a){if(a.target===this)if(n){t.removeChild(r),i.el.parentElement.removeChild(n),n=void 0,r=void 0;const e=i.entitiesWithLegend.indexOf(t);e>-1&&i.entitiesWithLegend.splice(e,1)}else{r=document.createElement("a-entity"),r.setAttribute("class","babialegend");let a=t.getAttribute("geometry"),o=i.el.getAttribute("scale"),l=a.height+i.data.height_quarter_legend_box;o&&(l=(a.height+i.data.height_quarter_legend_box)/o.y),r.setAttribute("geometry",{height:l,depth:a.depth,width:a.width}),r.setAttribute("material",{visible:!0,opacity:.4}),t.appendChild(r),n=s(e.name,i.data.legend_scale,i.data.legend_lookat,"black","white");let h=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),c={x:h.x,y:i.data.height_quarter_legend_title,z:h.z};n.setAttribute("position",c),n.setAttribute("visible",!0),i.el.parentElement.appendChild(n),i.entitiesWithLegend.push(t)}})),this.drawElements(t,e.children,e.translate_matrix)}else{let n,r,a=!1;t.addEventListener("click",(function(o){if(o.target===this)if(a){n.setAttribute("visible",!1),t.setAttribute("geometry",{height:r.height-.1,depth:r.depth-.1,width:r.width-.1}),t.setAttribute("material",{color:t.getAttribute("babiaxrFirstColor")}),i.el.parentElement.removeChild(n),n=void 0,a=!1;const e=i.entitiesWithLegend.indexOf(t);e>-1&&i.entitiesWithLegend.splice(e,1)}else{if(a=!0,!n){r=t.getAttribute("geometry");let a=t.getAttribute("position");t.setAttribute("position",a),t.setAttribute("babiaxrFirstColor",t.getAttribute("material").color),t.setAttribute("material",{color:"white"}),t.setAttribute("geometry",{height:r.height+.1,depth:r.depth+.1,width:r.width+.1}),n=s(e.name,i.data.legend_scale,i.data.legend_lookat,"white","black",t.babiaRawData,i.data.height,i.data.area,i.data.depth,i.data.width,i.data.color);let o=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),l=(new THREE.Box3).setFromObject(t.object3D),h={x:o.x,y:l.max.y+1+i.data.height_building_legend,z:o.z};n.setAttribute("position",h),n.setAttribute("visible",!0),i.el.parentElement.appendChild(n)}i.entitiesWithLegend.push(t)}})),t.addEventListener("mouseenter",(function(){if(!a){r=t.getAttribute("geometry");let a=t.getAttribute("position");t.setAttribute("position",a),t.setAttribute("babiaxrFirstColor",t.getAttribute("material").color),t.setAttribute("material",{color:"white"}),t.setAttribute("geometry",{height:r.height+.1,depth:r.depth+.1,width:r.width+.1}),n=s(e.name,i.data.legend_scale,i.data.legend_lookat,"white","black",t.babiaRawData,i.data.height,i.data.area,i.data.depth,i.data.width,i.data.color);let o=(new THREE.Vector3).setFromMatrixPosition(t.object3D.matrixWorld),l=(new THREE.Box3).setFromObject(t.object3D),h={x:o.x,y:l.max.y+1+i.data.height_building_legend,z:o.z};n.setAttribute("position",h),n.setAttribute("visible",!0),i.el.parentElement.appendChild(n)}})),t.addEventListener("mouseleave",(function(){!a&&n&&(n.setAttribute("visible",!1),t.setAttribute("geometry",{height:r.height-.1,depth:r.depth-.1,width:r.width-.1}),t.setAttribute("material",{color:t.getAttribute("babiaxrFirstColor")}),i.el.parentElement.removeChild(n),n=void 0)}))}}});let s=(t,e,i,n,r,a,s,o,l,h,c)=>{let u=2,d=1;if(t.length>16&&(u=t.length/5),a){let e="\n "+s+" (height): "+Math.round(100*a[s])/100;if(e.length>16&&(u=e.length/5),t+=e,o){let i="\n "+o+" (area): "+Math.round(100*a[o])/100;i.length>16&&i>e&&(u=i.length/5),t+=i}else{let i="\n "+l+" (depth): "+Math.round(100*a[l])/100;i.length>16&&i>e&&(u=i.length/5),t+=i;let n="\n "+h+" (width): "+Math.round(100*a[h])/100;n.length>16&&n>e&&n>i&&(u=n.length/5),t+=n,d=1.5}if(c){let i="\n "+c+" (color): "+Math.round(100*a[c])/100;i.length>16&&i>e&&(u=i.length/5),t+=i,d+=.2}}let p=document.createElement("a-plane");return p.setAttribute("babia-lookat",i),p.setAttribute("rotation",{x:0,y:0,z:0}),p.setAttribute("height",d),p.setAttribute("width",u),p.setAttribute("color",n),p.setAttribute("material",{side:"double"}),p.setAttribute("text",{value:t,align:"center",width:6,color:r,alphaTest:6,opacity:6,transparent:!1}),p.setAttribute("visible",!1),p.setAttribute("class","babialegend"),p.setAttribute("scale",{x:e,y:e,z:e}),p};function o(t,e){if(t.setAttribute("material","opacity",e),t.childNodes)for(let i=0;i<t.childNodes.length;i++)o(t.childNodes[i],e)}let l=(t,e)=>{let i=e,n=e;for(let r in t)t[r].children&&(i++,n<(e=l(t[r].children,i))&&(n=e),i--);return n},h=(t,e,i,n)=>{for(let r=0;r<t.length;r++)t[r].children?[i,n]=h(t[r].children,e,i,n):(("null"!==t[r][e]&&!i||t[r][e]>i)&&(i=t[r][e]),("null"!==t[r][e]&&!n||t[r][e]<n)&&(n=t[r][e]));return[i,n]};let c=(t,e)=>{for(e=e.split("="),i=0;i<t.length;i++)if(t[i][e[0]]===e[1])return i;return-1}},function(t,e){var i,n=AFRAME.utils.debug,r=AFRAME.utils.coordinates,a=n("components:babia-lookat:warn"),s=r.isCoordinates||r.isCoordinate;delete AFRAME.components["babia-lookat"],AFRAME.registerComponent("babia-lookat",{schema:{default:"0 0 0",parse:function(t){return s(t)||"object"==typeof t?r.parse(t):t},stringify:function(t){return"object"==typeof t?r.stringify(t):t}},init:function(){this.target3D=null,this.vector=new THREE.Vector3,this.cameraListener=AFRAME.utils.bind(this.cameraListener,this),this.el.addEventListener("componentinitialized",this.cameraListener),this.el.addEventListener("componentremoved",this.cameraListener)},update:function(){var t,e=this,i=e.data;return!i||"object"==typeof i&&!Object.keys(i).length?e.remove():"object"==typeof i?this.lookAt(new THREE.Vector3(i.x,i.y,i.z)):(t=e.el.sceneEl.querySelector(i))?t.hasLoaded?e.beginTracking(t):t.addEventListener("loaded",(function(){e.beginTracking(t)})):void a('"'+i+'" does not point to a valid entity to babia-lookat')},tick:(i=new THREE.Vector3,function(t){var e=this.target3D;e&&(e.getWorldPosition(i),this.lookAt(i))}),remove:function(){this.el.removeEventListener("componentinitialized",this.cameraListener),this.el.removeEventListener("componentremoved",this.cameraListener)},beginTracking:function(t){this.target3D=t.object3D},cameraListener:function(t){t.detail&&"camera"===t.detail.name&&this.update()},lookAt:function(t){var e=this.vector,i=this.el.object3D;this.el.getObject3D("camera")?e.subVectors(i.position,t).add(i.position):e.copy(t),i.lookAt(e)}})},function(t,e,i){let n=i(0).findProdComponent,r=i(0).parseJson;const a=i(2).NotiBuffer;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");let s=i(1);"default"in s&&(s=s.default);let o=i(64);"default"in o&&(o=o.default);let l=function(t){if("function"==typeof t)return t;let e=eval;try{return e("("+t+")")}catch(t){}return null},h=function(t){return isNaN(parseFloat(t))?l(t)?l(t):t:parseFloat(t)},c="";AFRAME.registerComponent("babia-network",{schema:{nodeLegend:{type:"boolean",default:!1},linkLegend:{type:"boolean",default:!1},from:{type:"string"},nodesFrom:{type:"string"},linksFrom:{type:"string"},data:{type:"string",default:""},nodes:{type:"string",default:""},links:{type:"string",default:""},nodeId:{type:"string",default:"id"},nodeLabel:{parse:h,default:"id"},linkId:{type:"string",default:""},linkSource:{type:"string",default:"source"},linkTarget:{type:"string",default:"target"},nodeVal:{type:"string",default:""},nodeRelSize:{type:"number",default:4},nodeColor:{parse:h,default:"color"},nodeAutoColorBy:{parse:h,default:""},nodeResolution:{type:"number",default:8},linkColor:{parse:h,default:"color"},linkAutoColorBy:{parse:h,default:""},linkWidth:{parse:h,default:0},linkResolution:{type:"number",default:6},linkLabel:{parse:h,default:""},nodeDesc:{parse:h,default:"desc"},linkDesc:{parse:h,default:"desc"},nodeVisibility:{parse:h,default:!0},nodeOpacity:{type:"number",default:1},linkVisibility:{parse:h,default:!0},linkOpacity:{type:"number",default:1},nodeThreeObject:{parse:h,default:null},nodeThreeObjectExtend:{parse:h,default:!1},linkCurvature:{parse:h,default:0},linkCurveRotation:{parse:h,default:0},linkMaterial:{parse:h,default:null},linkThreeObject:{parse:h,default:null},linkThreeObjectExtend:{parse:h,default:!1},linkPositionUpdate:{parse:l,default:null},linkDirectionalArrowLength:{parse:h,default:0},linkDirectionalArrowColor:{parse:h,default:null},linkDirectionalArrowRelPos:{parse:h,default:.5},linkDirectionalArrowResolution:{type:"number",default:8},linkDirectionalParticles:{parse:h,default:0},linkDirectionalParticleSpeed:{parse:h,default:.01},linkDirectionalParticleWidth:{parse:h,default:.5},linkDirectionalParticleColor:{parse:h,default:null},linkDirectionalParticleResolution:{type:"number",default:4},linkHoverPrecision:{type:"number",default:2},onNodeCenterHover:{parse:l,default:function(){}},onLinkCenterHover:{parse:l,default:function(){}},numDimensions:{type:"number",default:3},dagMode:{type:"string",default:""},dagLevelDistance:{type:"number",default:0},dagNodeFilter:{parse:l,function:()=>!0},onDagError:{parse:l,default:void 0},forceEngine:{type:"string",default:"d3"},d3AlphaMin:{type:"number",default:0},d3AlphaDecay:{type:"number",default:.0228},d3VelocityDecay:{type:"number",default:.4},ngraphPhysics:{parse:r,default:null},warmupTicks:{type:"int",default:0},cooldownTicks:{type:"int",default:1e18},cooldownTime:{type:"int",default:15e3},onEngineTick:{parse:l,default:function(){}},onEngineStop:{parse:l,default:function(){}}},getGraphBbox:function(){return this.forceGraph||(this.forceGraph=new o),this.forceGraph.getGraphBbox()},emitParticle:function(){this.forceGraph||(this.forceGraph=new o);const t=this.forceGraph,e=t.emitParticle.apply(t,arguments);return e===t?this:e},d3Force:function(){this.forceGraph||(this.forceGraph=new o);const t=this.forceGraph,e=t.d3Force.apply(t,arguments);return e===t?this:e},d3ReheatSimulation:function(){return this.forceGraph&&this.forceGraph.d3ReheatSimulation(),this},refresh:function(){return this.forceGraph&&this.forceGraph.refresh(),this},visProperties:{nodes:["nodeId"],links0:["linkId"],links1:["linkSource","linkTarget"]},init:function(){this.isFirstTimeNodes=!0,this.isFirstTimeLinks=!0,this.notiBuffer=new a;let t=this.state={},e=document.querySelector("a-entity[camera], a-camera");t.cameraObj=e.object3D.children.filter((function(t){return"PerspectiveCamera"===t.type}))[0],this.el.sceneEl.addEventListener("camera-set-active",(function(e){t.cameraObj=e.detail.cameraEl.components.camera.camera})),this.forceGraph||(this.forceGraph=new o),this.el.object3D.add(this.forceGraph),c=document.querySelector("[cursor]"),document.addEventListener("controllerconnected",t=>{c=document.querySelector("[laser-controls]")})},update:function(t){let e=this.el,i=this.data;if(this.currentData=t,i.data&&t.data!==i.data){let t=r(i.data);this.processData(t)}else if(i.nodes){if(t.nodes!==i.nodes){let t=r(i.nodes);this.processNodes(t)}if(t.links!==i.links){let t=r(i.links);this.processLinks(t)}}else if(i.from===t.from||i.nodesFrom){if(i.nodesFrom!==t.nodesFrom||i.linksFrom!==t.linksFrom){this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.nodesProdComponent&&this.nodesProdComponent.notiBuffer.unregister(this.notiBufferId),this.linksProdComponent&&this.linksProdComponent.notiBuffer.unregister(this.notiBufferId);let t=n(i,e);this.nodesProdComponent=t.nodes,this.nodesProdComponent.notiBuffer&&(this.notiBufferId=this.nodesProdComponent.notiBuffer.register(this.processNodes.bind(this))),this.linksProdComponent=t.links,this.linksProdComponent.notiBuffer&&(this.notiBufferId=this.linksProdComponent.notiBuffer.register(this.processLinks.bind(this)))}else if(i!==t)if(this.newData){let t=r(this.newData);this.processData(t,!0)}else if(this.newNodes)if(i.linkSource!=t.linkSource||i.linkTarget!=t.linkTarget){let t=r(this.newLinks);this.processLinks(t,!0)}else{let t=r(this.newNodes);this.processNodes(t,!0)}}else this.prodComponent&&this.prodComponent.notiBuffer.unregister(this.notiBufferId),this.nodesProdComponent&&this.nodesProdComponent.notiBuffer.unregister(this.notiBufferId),this.linksProdComponent&&this.linksProdComponent.notiBuffer.unregister(this.notiBufferId),this.prodComponent=n(i,e),this.prodComponent.notiBuffer&&(this.notiBufferId=this.prodComponent.notiBuffer.register(this.processData.bind(this)))},tick:function(t,e){let i=c.components.raycaster.raycaster.intersectObjects(this.forceGraph.children).filter((function(t){return-1!==["node","link"].indexOf(t.object.__graphObjType)})).sort((function(t,e){return i(e)-i(t);function i(t){return"node"===t.object.__graphObjType}})),n=i.length?i[0].object:null;if(n!==this.state.hoverObj){const t=this.state.hoverObj?this.state.hoverObj.__graphObjType:null,e=this.state.hoverObj?this.state.hoverObj.__data:null,i=n?n.__graphObjType:null,r=n?n.__data:null;t&&t!==i&&this.data["on"+("node"===t?"Node":"Link")+"CenterHover"](null,e),(this.data.nodeLegend&&"node"===t||this.data.linkLegend&&""!=this.data.linkLabel&&"link"===t)&&this.removeLegend(this),i&&this.data["on"+("node"===i?"Node":"Link")+"CenterHover"](r,t===i?e:null),this.state.hoverObj=n,n&&(this.data.nodeLegend&&"node"===n.__graphObjType?this.showLegend(n,n.__data,this.data.nodeLabel,this.el.getAttribute("scale")):this.data.linkLegend&&"link"===n.__graphObjType&&""!=this.data.linkLabel&&this.showLinkLegend(n,n.__data,this.data.linkLabel,this.el.getAttribute("scale")))}this.forceGraph.tickFrame()},prodComponent:void 0,nodesProdComponent:void 0,linksProdComponent:void 0,notiBufferId:void 0,newData:void 0,newNodes:void 0,newLinks:void 0,isFirstTimeNodes:void 0,isFirstTimeLinks:void 0,nodeFields:void 0,linkFields:void 0,currentData:void 0,babiaMetadata:{id:0},legend:"",updateChart:function(t,e){if(e.currentData){let i=[];for(let t in this.data)i[t]=this.data[t];i.nodes=t.nodes,i.links=t.links;let n=AFRAME.utils.diff(i,e.currentData);["jsonUrl","numDimensions","dagMode","dagLevelDistance","dagNodeFilter","onDagError","nodeRelSize","nodeId","nodeVal","nodeResolution","nodeVisibility","nodeColor","nodeAutoColorBy","nodeOpacity","nodeThreeObject","nodeThreeObjectExtend","linkSource","linkTarget","linkVisibility","linkColor","linkAutoColorBy","linkOpacity","linkWidth","linkResolution","linkCurvature","linkCurveRotation","linkMaterial","linkThreeObject","linkThreeObjectExtend","linkPositionUpdate","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","forceEngine","d3AlphaMin","d3AphaDecay","d3VelocityDecay","ngraphPhysics","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"].filter((function(t){return t in n})).forEach((function(t){e.forceGraph[t](""!==i[t]?i[t]:null)})),("nodes"in n||"links"in n)&&e.forceGraph.graphData({nodes:i.nodes,links:i.links})}},processData:function(t,e){if(console.log("processData",this),this.newData!=t||e){this.newData=t;let e=this.elDataFromData(t);this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."),this.updateChart(e,this),this.notiBuffer.set(t)}},processNodes:function(t,e){if(console.log("processNodes",this),this.newNodes!=t||e){this.newNodes=t;let e=this.elDataFromNodesAndLinks(t,this.newLinks);if(e)this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."),this.updateChart(e,this),this.notiBuffer.set({nodes:e.nodes,links:e.links});else if(this.data.links){let t=r(this.data.links);this.processLinks(t)}else this.data.linksFrom&&(this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."))}},processLinks:function(t,e){console.log("processLinks",this);let i=r(t);if(this.newLinks!=i||e){this.newLinks=i;let t=this.elDataFromNodesAndLinks(this.newNodes,i);if(t)this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."),this.updateChart(t,this),this.notiBuffer.set({nodes:t.nodes,links:t.links});else if(this.data.nodes){let t=r(this.data.nodes);this.processNodes(t)}else this.data.nodesFrom&&(this.babiaMetadata={id:this.babiaMetadata.id++},console.log("Generating network..."))}},elDataFromData:function(t){let e=[],i=[];const n=this.data.nodeId,r=this.data.linkId,a=this.data.nodeVal,s=this.data.linkSource,o=this.data.linkTarget,l=this.data.linkLabel;return t.forEach(t=>{let i={};Object.keys(t).forEach((function(e){e===n&&(i[n]=t[e]),e===r&&(i.linkId=t[e]),e===a&&(i[a]=t[e])})),e.push(i)}),e.forEach(t=>{e.forEach(e=>{if(t[n]!==e[n]&&t.linkId===e.linkId)if(i.length>0){let r=!1;if(i.forEach(i=>{(i[s]===t[n]&&i[o]===e[n]||i[s]===e[n]&&i[o]===t[n])&&(r=!0)}),!r){let r={};r[l]=t[l],r[s]=t[n],r[o]=e[n],i.push(r)}}else{let r={};r[l]=t[l],r[s]=t[n],r[o]=e[n],i.push(r)}})}),{nodes:e,links:i}},elDataFromNodesAndLinks:function(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;this.isFirstTimeNodes&&(this.nodeFields=[],Object.keys(t[0]).forEach(t=>{this.nodeFields.push(t)}),this.isFirstTimeNodes=!1),this.isFirstTimeLinks&&(this.linkFields=[],Object.keys(e[0]).forEach(t=>{this.linkFields.push(t)}),this.isFirstTimeLinks=!1),"object"==typeof e[0].source&&e.forEach(t=>{t.source=t.source[this.data.nodeId],t.target=t.target[this.data.nodeId]});let i=[];t.forEach(t=>{let e={};Object.keys(t).forEach(i=>{for(let n in this.nodeFields)i==this.nodeFields[n]&&(e[i]=t[i])}),i.push(e)});let n=[];return e.forEach(t=>{let e={};Object.keys(t).forEach(i=>{for(let n in this.linkFields)i==this.linkFields[n]&&i!=this.data.linkId&&(e[i]=t[i])}),n.push(e)}),{nodes:i,links:n}},showLegend:function(t,e,i,n){let r=new THREE.Vector3;t.getWorldPosition(r);let a=t.geometry.boundingSphere.radius,s=document.querySelector("a-scene");this.legend=function(t,e,i,n,r){let a=t[e];if(a){let s=2,o=3,l=3,h=3;a.length>16&&(s=a.length/8),r&&(o*=r.x,l*=r.y,h*=r.z,n=(n+3)*r.y);let c=document.createElement("a-plane");return c.setAttribute("position",{x:i.x,y:i.y+n,z:i.z}),c.setAttribute("babia-lookat","[camera]"),c.setAttribute("width",s),c.setAttribute("height","1"),c.setAttribute("color","white"),c.setAttribute("scale",{x:o,y:l,z:h}),c.setAttribute("text",{value:t[e],align:"center",width:6,color:"black"}),c.classList.add("babiaxrLegend"),c}}(e,i,r,a,n),this.legend&&s.appendChild(this.legend)},showLinkLegend:function(t,e,i,n){let r=new THREE.Vector3,a=t.geometry.boundingSphere.radius,s=new THREE.Vector3,o=new THREE.Vector3;this.forceGraph.children.filter(t=>"node"==t.__graphObjType).forEach(t=>{t.__data[this.data.nodeId]==e.source[this.data.nodeId]&&t.getWorldPosition(s),t.__data[this.data.nodeId]==e.target[this.data.nodeId]&&t.getWorldPosition(o)}),r.x=(s.x+o.x)/2,r.y=(s.y+o.y)/2,r.z=(s.z+o.z)/2;let l=document.querySelector("a-scene");this.legend=function(t,e,i,n,r){let a=t[e];if(a){let s=2,o=3,l=3,h=3;a.length>16&&(s=a.length/8),r&&(o*=r.x,l*=r.y,h*=r.z,n=(n+3)*r.y);let c=document.createElement("a-plane");return c.setAttribute("position",{x:i.x,y:i.y+n,z:i.z}),c.setAttribute("babia-lookat","[camera]"),c.setAttribute("width",s),c.setAttribute("height","1"),c.setAttribute("color","white"),c.setAttribute("scale",{x:o,y:l,z:h}),c.setAttribute("text",{value:t[e],align:"center",width:6,color:"black"}),c.classList.add("babiaxrLegend"),c}}(e,i,r,a,n),this.legend&&l.appendChild(this.legend)},removeLegend:function(){if(this.legend){document.querySelector("a-scene").removeChild(this.legend)}}})},function(t,e,i){const n=i(3);function r(t,e){return`\n${s(t,e)}\n${a(t)}\nreturn {Body: Body, Vector: Vector};\n`}function a(t){let e=n(t),i=e("{var}",{join:", "});return`\nfunction Body(${i}) {\n this.isPinned = false;\n this.pos = new Vector(${i});\n this.force = new Vector();\n this.velocity = new Vector();\n this.mass = 1;\n\n this.springCount = 0;\n this.springLength = 0;\n}\n\nBody.prototype.reset = function() {\n this.force.reset();\n this.springCount = 0;\n this.springLength = 0;\n}\n\nBody.prototype.setPosition = function (${i}) {\n ${e("this.pos.{var} = {var} || 0;",{indent:2})}\n};`}function s(t,e){let i=n(t),r="";return e&&(r=""+i("\n var v{var};\nObject.defineProperty(this, '{var}', {\n set: function(v) { \n if (!Number.isFinite(v)) throw new Error('Cannot set non-numbers to {var}');\n v{var} = v; \n },\n get: function() { return v{var}; }\n});")),`function Vector(${i("{var}",{join:", "})}) {\n ${r}\n if (typeof arguments[0] === 'object') {\n // could be another vector\n let v = arguments[0];\n ${i('if (!Number.isFinite(v.{var})) throw new Error("Expected value is not a finite number at Vector constructor ({var})");',{indent:4})}\n ${i("this.{var} = v.{var};",{indent:4})}\n } else {\n ${i('this.{var} = typeof {var} === "number" ? {var} : 0;',{indent:4})}\n }\n }\n \n Vector.prototype.reset = function () {\n ${i("this.{var} = ",{join:""})}0;\n };`}t.exports=function(t,e){let i=r(t,e),{Body:n}=new Function(i)();return n},t.exports.generateCreateBodyFunctionBody=r,t.exports.getVectorCode=s,t.exports.getBodyCode=a},function(t,e,i){const n=i(3),r=i(8);function a(t){let e=n(t),i=Math.pow(2,t);return`\n${c()}\n${h(t)}\n${s(t)}\n${l(t)}\n${o(t)}\n\nfunction createQuadTree(options, random) {\n options = options || {};\n options.gravity = typeof options.gravity === 'number' ? options.gravity : -1;\n options.theta = typeof options.theta === 'number' ? options.theta : 0.8;\n\n var gravity = options.gravity;\n var updateQueue = [];\n var insertStack = new InsertStack();\n var theta = options.theta;\n\n var nodesCache = [];\n var currentInCache = 0;\n var root = newNode();\n\n return {\n insertBodies: insertBodies,\n\n /**\n * Gets root node if it is present\n */\n getRoot: function() {\n return root;\n },\n\n updateBodyForce: update,\n\n options: function(newOptions) {\n if (newOptions) {\n if (typeof newOptions.gravity === 'number') {\n gravity = newOptions.gravity;\n }\n if (typeof newOptions.theta === 'number') {\n theta = newOptions.theta;\n }\n\n return this;\n }\n\n return {\n gravity: gravity,\n theta: theta\n };\n }\n };\n\n function newNode() {\n // To avoid pressure on GC we reuse nodes.\n var node = nodesCache[currentInCache];\n if (node) {\n${function(t){let e=[];for(let n=0;n<i;++n)e.push(`${t}quad${n} = null;`);return e.join("\n")}(" node.")}\n node.body = null;\n node.mass = ${e("node.mass_{var} = ",{join:""})}0;\n ${e("node.min_{var} = node.max_{var} = ",{join:""})}0;\n } else {\n node = new QuadNode();\n nodesCache[currentInCache] = node;\n }\n\n ++currentInCache;\n return node;\n }\n\n function update(sourceBody) {\n var queue = updateQueue;\n var v;\n ${e("var d{var};",{indent:4})}\n var r; \n ${e("var f{var} = 0;",{indent:4})}\n var queueLength = 1;\n var shiftIdx = 0;\n var pushIdx = 1;\n\n queue[0] = root;\n\n while (queueLength) {\n var node = queue[shiftIdx];\n var body = node.body;\n\n queueLength -= 1;\n shiftIdx += 1;\n var differentBody = (body !== sourceBody);\n if (body && differentBody) {\n // If the current node is a leaf node (and it is not source body),\n // calculate the force exerted by the current node on body, and add this\n // amount to body's net force.\n ${e("d{var} = body.pos.{var} - sourceBody.pos.{var};",{indent:8})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n // Poor man's protection against zero distance.\n ${e("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:10})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n }\n\n // This is standard gravitation force calculation but we divide\n // by r^3 to save two operations when normalizing force vector.\n v = gravity * body.mass * sourceBody.mass / (r * r * r);\n ${e("f{var} += v * d{var};",{indent:8})}\n } else if (differentBody) {\n // Otherwise, calculate the ratio s / r, where s is the width of the region\n // represented by the internal node, and r is the distance between the body\n // and the node's center-of-mass\n ${e("d{var} = node.mass_{var} / node.mass - sourceBody.pos.{var};",{indent:8})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n // Sorry about code duplication. I don't want to create many functions\n // right away. Just want to see performance first.\n ${e("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:10})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n }\n // If s / r < θ, treat this internal node as a single body, and calculate the\n // force it exerts on sourceBody, and add this amount to sourceBody's net force.\n if ((node.max_${r(0)} - node.min_${r(0)}) / r < theta) {\n // in the if statement above we consider node's width only\n // because the region was made into square during tree creation.\n // Thus there is no difference between using width or height.\n v = gravity * node.mass * sourceBody.mass / (r * r * r);\n ${e("f{var} += v * d{var};",{indent:10})}\n } else {\n // Otherwise, run the procedure recursively on each of the current node's children.\n\n // I intentionally unfolded this loop, to save several CPU cycles.\n${function(){let t=Array(11).join(" "),e=[];for(let n=0;n<i;++n)e.push(t+`if (node.quad${n}) {`),e.push(t+` queue[pushIdx] = node.quad${n};`),e.push(t+" queueLength += 1;"),e.push(t+" pushIdx += 1;"),e.push(t+"}");return e.join("\n")}()}\n }\n }\n }\n\n ${e("sourceBody.force.{var} += f{var};",{indent:4})}\n }\n\n function insertBodies(bodies) {\n ${e("var {var}min = Number.MAX_VALUE;",{indent:4})}\n ${e("var {var}max = Number.MIN_VALUE;",{indent:4})}\n var i = bodies.length;\n\n // To reduce quad tree depth we are looking for exact bounding box of all particles.\n while (i--) {\n var pos = bodies[i].pos;\n ${e("if (pos.{var} < {var}min) {var}min = pos.{var};",{indent:6})}\n ${e("if (pos.{var} > {var}max) {var}max = pos.{var};",{indent:6})}\n }\n\n // Makes the bounds square.\n var maxSideLength = -Infinity;\n ${e("if ({var}max - {var}min > maxSideLength) maxSideLength = {var}max - {var}min ;",{indent:4})}\n\n currentInCache = 0;\n root = newNode();\n ${e("root.min_{var} = {var}min;",{indent:4})}\n ${e("root.max_{var} = {var}min + maxSideLength;",{indent:4})}\n\n i = bodies.length - 1;\n if (i >= 0) {\n root.body = bodies[i];\n }\n while (i--) {\n insert(bodies[i], root);\n }\n }\n\n function insert(newBody) {\n insertStack.reset();\n insertStack.push(root, newBody);\n\n while (!insertStack.isEmpty()) {\n var stackItem = insertStack.pop();\n var node = stackItem.node;\n var body = stackItem.body;\n\n if (!node.body) {\n // This is internal node. Update the total mass of the node and center-of-mass.\n ${e("var {var} = body.pos.{var};",{indent:8})}\n node.mass += body.mass;\n ${e("node.mass_{var} += body.mass * {var};",{indent:8})}\n\n // Recursively insert the body in the appropriate quadrant.\n // But first find the appropriate quadrant.\n var quadIdx = 0; // Assume we are in the 0's quad.\n ${e("var min_{var} = node.min_{var};",{indent:8})}\n ${e("var max_{var} = (min_{var} + node.max_{var}) / 2;",{indent:8})}\n\n${function(e){let i=[],n=Array(e+1).join(" ");for(let e=0;e<t;++e)i.push(n+`if (${r(e)} > max_${r(e)}) {`),i.push(n+` quadIdx = quadIdx + ${Math.pow(2,e)};`),i.push(n+` min_${r(e)} = max_${r(e)};`),i.push(n+` max_${r(e)} = node.max_${r(e)};`),i.push(n+"}");return i.join("\n")}(8)}\n\n var child = getChild(node, quadIdx);\n\n if (!child) {\n // The node is internal but this quadrant is not taken. Add\n // subnode to it.\n child = newNode();\n ${e("child.min_{var} = min_{var};",{indent:10})}\n ${e("child.max_{var} = max_{var};",{indent:10})}\n child.body = body;\n\n setChild(node, quadIdx, child);\n } else {\n // continue searching in this quadrant.\n insertStack.push(child, body);\n }\n } else {\n // We are trying to add to the leaf node.\n // We have to convert current leaf into internal node\n // and continue adding two nodes.\n var oldBody = node.body;\n node.body = null; // internal nodes do not cary bodies\n\n if (isSamePosition(oldBody.pos, body.pos)) {\n // Prevent infinite subdivision by bumping one node\n // anywhere in this quadrant\n var retriesCount = 3;\n do {\n var offset = random.nextDouble();\n ${e("var d{var} = (node.max_{var} - node.min_{var}) * offset;",{indent:12})}\n\n ${e("oldBody.pos.{var} = node.min_{var} + d{var};",{indent:12})}\n retriesCount -= 1;\n // Make sure we don't bump it out of the box. If we do, next iteration should fix it\n } while (retriesCount > 0 && isSamePosition(oldBody.pos, body.pos));\n\n if (retriesCount === 0 && isSamePosition(oldBody.pos, body.pos)) {\n // This is very bad, we ran out of precision.\n // if we do not return from the method we'll get into\n // infinite loop here. So we sacrifice correctness of layout, and keep the app running\n // Next layout iteration should get larger bounding box in the first step and fix this\n return;\n }\n }\n // Next iteration should subdivide node further.\n insertStack.push(node, oldBody);\n insertStack.push(node, body);\n }\n }\n }\n}\nreturn createQuadTree;\n\n`}function s(t){let e=n(t);return`\n function isSamePosition(point1, point2) {\n ${e("var d{var} = Math.abs(point1.{var} - point2.{var});",{indent:2})}\n \n return ${e("d{var} < 1e-8",{join:" && "})};\n } \n`}function o(t){var e=Math.pow(2,t);return`\nfunction setChild(node, idx, child) {\n ${function(){let t=[];for(let i=0;i<e;++i){let e=0===i?" ":" else ";t.push(`${e}if (idx === ${i}) node.quad${i} = child;`)}return t.join("\n")}()}\n}`}function l(t){return`function getChild(node, idx) {\n${function(){let e=[],i=Math.pow(2,t);for(let t=0;t<i;++t)e.push(` if (idx === ${t}) return node.quad${t};`);return e.join("\n")}()}\n return null;\n}`}function h(t){let e=n(t),i=Math.pow(2,t);return`\nfunction QuadNode() {\n // body stored inside this node. In quad tree only leaf nodes (by construction)\n // contain bodies:\n this.body = null;\n\n // Child nodes are stored in quads. Each quad is presented by number:\n // 0 | 1\n // -----\n // 2 | 3\n${function(t){let e=[];for(let n=0;n<i;++n)e.push(`${t}quad${n} = null;`);return e.join("\n")}(" this.")}\n\n // Total mass of current node\n this.mass = 0;\n\n // Center of mass coordinates\n ${e("this.mass_{var} = 0;",{indent:2})}\n\n // bounding box coordinates\n ${e("this.min_{var} = 0;",{indent:2})}\n ${e("this.max_{var} = 0;",{indent:2})}\n}\n`}function c(){return"\n/**\n * Our implementation of QuadTree is non-recursive to avoid GC hit\n * This data structure represent stack of elements\n * which we are trying to insert into quad tree.\n */\nfunction InsertStack () {\n this.stack = [];\n this.popIdx = 0;\n}\n\nInsertStack.prototype = {\n isEmpty: function() {\n return this.popIdx === 0;\n },\n push: function (node, body) {\n var item = this.stack[this.popIdx];\n if (!item) {\n // we are trying to avoid memory pressure: create new element\n // only when absolutely necessary\n this.stack[this.popIdx] = new InsertStackElement(node, body);\n } else {\n item.node = node;\n item.body = body;\n }\n ++this.popIdx;\n },\n pop: function () {\n if (this.popIdx > 0) {\n return this.stack[--this.popIdx];\n }\n },\n reset: function () {\n this.popIdx = 0;\n }\n};\n\nfunction InsertStackElement(node, body) {\n this.node = node; // QuadTree node\n this.body = body; // physical body which needs to be inserted to node\n}\n"}t.exports=function(t){let e=a(t);return new Function(e)()},t.exports.generateQuadTreeFunctionBody=a,t.exports.getInsertStackCode=c,t.exports.getQuadNodeCode=h,t.exports.isSamePosition=s,t.exports.getChildBodyCode=l,t.exports.setChildBodyCode=o},function(t,e,i){t.exports=function(t){let e=r(t);return new Function("bodies","settings","random",e)},t.exports.generateFunctionBody=r;const n=i(3);function r(t){let e=n(t);return`\n var boundingBox = {\n ${e("min_{var}: 0, max_{var}: 0,",{indent:4})}\n };\n\n return {\n box: boundingBox,\n\n update: updateBoundingBox,\n\n reset: resetBoundingBox,\n\n getBestNewPosition: function (neighbors) {\n var ${e("base_{var} = 0",{join:", "})};\n\n if (neighbors.length) {\n for (var i = 0; i < neighbors.length; ++i) {\n let neighborPos = neighbors[i].pos;\n ${e("base_{var} += neighborPos.{var};",{indent:10})}\n }\n\n ${e("base_{var} /= neighbors.length;",{indent:8})}\n } else {\n ${e("base_{var} = (boundingBox.min_{var} + boundingBox.max_{var}) / 2;",{indent:8})}\n }\n\n var springLength = settings.springLength;\n return {\n ${e("{var}: base_{var} + (random.nextDouble() - 0.5) * springLength,",{indent:8})}\n };\n }\n };\n\n function updateBoundingBox() {\n var i = bodies.length;\n if (i === 0) return; // No bodies - no borders.\n\n ${e("var max_{var} = -Infinity;",{indent:4})}\n ${e("var min_{var} = Infinity;",{indent:4})}\n\n while(i--) {\n // this is O(n), it could be done faster with quadtree, if we check the root node bounds\n var bodyPos = bodies[i].pos;\n ${e("if (bodyPos.{var} < min_{var}) min_{var} = bodyPos.{var};",{indent:6})}\n ${e("if (bodyPos.{var} > max_{var}) max_{var} = bodyPos.{var};",{indent:6})}\n }\n\n ${e("boundingBox.min_{var} = min_{var};",{indent:4})}\n ${e("boundingBox.max_{var} = max_{var};",{indent:4})}\n }\n\n function resetBoundingBox() {\n ${e("boundingBox.min_{var} = boundingBox.max_{var} = 0;",{indent:4})}\n }\n`}},function(t,e,i){const n=i(3);function r(t){return`\n if (!Number.isFinite(options.dragCoefficient)) throw new Error('dragCoefficient is not a finite number');\n\n return {\n update: function(body) {\n ${n(t)("body.force.{var} -= options.dragCoefficient * body.velocity.{var};",{indent:6})}\n }\n };\n`}t.exports=function(t){let e=r(t);return new Function("options",e)},t.exports.generateCreateDragForceFunctionBody=r},function(t,e,i){const n=i(3);function r(t){let e=n(t);return`\n if (!Number.isFinite(options.springCoefficient)) throw new Error('Spring coefficient is not a number');\n if (!Number.isFinite(options.springLength)) throw new Error('Spring length is not a number');\n\n return {\n /**\n * Updates forces acting on a spring\n */\n update: function (spring) {\n var body1 = spring.from;\n var body2 = spring.to;\n var length = spring.length < 0 ? options.springLength : spring.length;\n ${e("var d{var} = body2.pos.{var} - body1.pos.{var};",{indent:6})}\n var r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n\n if (r === 0) {\n ${e("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:8})}\n r = Math.sqrt(${e("d{var} * d{var}",{join:" + "})});\n }\n\n var d = r - length;\n var coefficient = ((spring.coefficient > 0) ? spring.coefficient : options.springCoefficient) * d / r;\n\n ${e("body1.force.{var} += coefficient * d{var}",{indent:6})};\n body1.springCount += 1;\n body1.springLength += r;\n\n ${e("body2.force.{var} -= coefficient * d{var}",{indent:6})};\n body2.springCount += 1;\n body2.springLength += r;\n }\n };\n`}t.exports=function(t){let e=r(t);return new Function("options","random",e)},t.exports.generateCreateSpringForceFunctionBody=r},function(t,e,i){const n=i(3);function r(t){let e=n(t);return`\n var length = bodies.length;\n if (length === 0) return 0;\n\n ${e("var d{var} = 0, t{var} = 0;",{indent:2})}\n\n for (var i = 0; i < length; ++i) {\n var body = bodies[i];\n if (body.isPinned) continue;\n\n if (adaptiveTimeStepWeight && body.springCount) {\n timeStep = (adaptiveTimeStepWeight * body.springLength/body.springCount);\n }\n\n var coeff = timeStep / body.mass;\n\n ${e("body.velocity.{var} += coeff * body.force.{var};",{indent:4})}\n ${e("var v{var} = body.velocity.{var};",{indent:4})}\n var v = Math.sqrt(${e("v{var} * v{var}",{join:" + "})});\n\n if (v > 1) {\n // We normalize it so that we move within timeStep range. \n // for the case when v <= 1 - we let velocity to fade out.\n ${e("body.velocity.{var} = v{var} / v;",{indent:6})}\n }\n\n ${e("d{var} = timeStep * body.velocity.{var};",{indent:4})}\n\n ${e("body.pos.{var} += d{var};",{indent:4})}\n\n ${e("t{var} += Math.abs(d{var});",{indent:4})}\n }\n\n return (${e("t{var} * t{var}",{join:" + "})})/length;\n`}t.exports=function(t){let e=r(t);return new Function("bodies","timeStep","adaptiveTimeStepWeight",e)},t.exports.generateIntegratorFunctionBody=r},function(t,e){t.exports=function(t,e,i,n){this.from=t,this.to=e,this.length=i,this.coefficient=n}},function(t,e){t.exports=function t(e,i){var n;e||(e={});if(i)for(n in i)if(i.hasOwnProperty(n)){var r=e.hasOwnProperty(n),a=typeof i[n];!r||typeof e[n]!==a?e[n]=i[n]:"object"===a&&(e[n]=t(e[n],i[n]))}return e}},function(t,e){function i(t){return new n("number"==typeof t?t:+new Date)}function n(t){this.seed=t}function r(t){return Math.sqrt(2*Math.PI/t)*Math.pow(1/Math.E*(t+1/(12*t-1/(10*t))),t)}function a(){var t=this.seed;return t=4294967295&(3042594569^(t=(t=4294967295&((t=(t=4294967295&(3345072700^(t=t+2127912214+(t<<12)&4294967295)^t>>>19))+374761393+(t<<5)&4294967295)+3550635116^t<<9))+4251993797+(t<<3)&4294967295)^t>>>16),this.seed=t,(268435455&t)/268435456}t.exports=i,t.exports.random=i,t.exports.randomIterator=function(t,e){var n=e||i();if("function"!=typeof n.next)throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:function(e){var i,r,a;for(i=t.length-1;i>0;--i)r=n.next(i+1),a=t[r],t[r]=t[i],t[i]=a,e(a);t.length&&e(t[0])},shuffle:function(){var e,i,r;for(e=t.length-1;e>0;--e)i=n.next(e+1),r=t[i],t[i]=t[e],t[e]=r;return t}}},n.prototype.next=function(t){return Math.floor(this.nextDouble()*t)},n.prototype.nextDouble=a,n.prototype.uniform=a,n.prototype.gaussian=function(){var t,e,i;do{e=2*this.nextDouble()-1,i=2*this.nextDouble()-1,t=e*e+i*i}while(t>=1||0===t);return e*Math.sqrt(-2*Math.log(t)/t)},n.prototype.levy=function(){var t=Math.pow(r(2.5)*Math.sin(1.5*Math.PI/2)/(1.5*r(1.25)*Math.pow(2,.25)),1/1.5);return this.gaussian()*t/Math.pow(Math.abs(this.gaussian()),1/1.5)}},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-label",{schema:{text:{type:"string"},height:{type:"number",default:1},width:{type:"number",default:3},textWidth:{type:"number",default:6},color:{type:"color",default:"white"},font:{type:"string",default:"default"},background:{type:"color",default:"black"},align:{type:"string",default:"center"}},update:function(t){console.log("Starting label..."),this.el.setAttribute("geometry",{primitive:"plane",height:this.data.height,width:this.data.width}),this.el.setAttribute("material",{color:this.data.color}),this.el.setAttribute("text",{value:this.data.text,align:this.data.align,width:this.data.textWidth,color:this.data.background}),this.el.classList.add("babiaxrLegend")}})},function(t,e,i){const n=i(0).colors;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");class r{constructor(t,e,i,n){this.el=t,this.axis=e,this.anim=i,this.dur=n}updateLine(t,e){const i=this.axis,n=this.el,r=this.anim,a=this.dur,s=`line__${i}axis`;let o=n.components[s],l={x:0,y:0,z:0};l[i]=t,r&&o?(n.setAttribute(`animation__${i}axis`,{property:s+".end",to:l,dur:a}),n.setAttribute(s,{color:e})):n.setAttribute(s,{start:{x:0,y:0,z:0},end:l,color:e})}removeLabels(){const t=this.el,e=this.anim,i=this.dur;let n=t.querySelectorAll("[text]");for(const t of n)e?(t.addEventListener("animationcomplete",(function(t){t.target.remove()})),t.setAttribute("animation",{property:"text.opacity",to:0,dur:i})):t.remove()}updateLabels(t,e,i,r,a){const s=this.axis;let o=this.el;const l=this.anim,h=this.dur;for(let c=0;c<t.length;++c){let u,d=document.createElement("a-entity"),p=i;r&&(p=n.get(c,r)),d.setAttribute("text",{value:e[c],align:"right",width:10,color:p,opacity:0}),"behind"!=a&&"right"!=a||d.setAttribute("text",{align:"left"}),"x"===s?u="behind"==a?{x:t[c],y:0,z:-5.15}:{x:t[c],y:0,z:5.25}:"y"===s?u="right"==a?{x:5.2,y:t[c],z:0}:{x:-5.2,y:t[c],z:0}:"z"===s&&(u="right"==a?{x:5.2,y:0,z:t[c]}:{x:-5.2,y:0,z:t[c]}),d.setAttribute("position",u),"x"===s?d.setAttribute("rotation",{x:-90,y:90,z:0}):"z"===s&&d.setAttribute("rotation",{x:-90,y:0,z:0}),l?d.setAttribute("animation",{property:"text.opacity",to:1,dur:h}):d.setAttribute("text",{opacity:1}),o.appendChild(d)}}updateName(t,e,i){const n=this.axis;let r=this.el;const a=this.anim,s=this.dur;let o,l=document.createElement("a-entity");l.setAttribute("text",{value:t,align:"right",width:10,color:"#000",opacity:0}),"behind"!=e&&"right"!=e||l.setAttribute("text",{align:"left"}),"x"===n?o="behind"==e?{x:i+.5,y:0,z:-5.15}:{x:i+.5,y:0,z:5.25}:"y"===n?o="right"==e?{x:5.2,y:i+.5,z:0}:{x:-5.2,y:i+.5,z:0}:"z"===n&&(o="right"==e?{x:5.2,y:0,z:i+.5}:{x:-5.2,y:0,z:i+.5}),l.setAttribute("position",o),"x"===n?l.setAttribute("rotation",{x:-90,y:90,z:0}):"z"===n&&l.setAttribute("rotation",{x:-90,y:0,z:0}),a?l.setAttribute("animation",{property:"text.opacity",to:1,dur:s}):l.setAttribute("text",{opacity:1}),r.appendChild(l)}}AFRAME.registerComponent("babia-axis-y",{schema:{maxValue:{type:"number"},length:{type:"number"},minSteps:{type:"number",default:6},color:{type:"color",default:"#000"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},align:{type:"string",default:"left"},name:{type:"string",default:""}},init:function(){this.axis=new r(this.el,"y",this.data.animation,this.data.dur)},update:function(t){const e=this.data;let i=this.data.maxValue,n=this.data.length,r=this.data.minSteps;this.data.animation,this.data.dur;let a=0;if(console.log("Starting babia-axis-y:",i,n,this.data.color),i!=t.maxValue||n!=t.maxValue||r!=t.minSteps){let t=Math.floor(Math.log10(i));t<=0&&(a=1-t);let s=n/i,o=Math.pow(10,t),l=i/o;for(;l<=r;)o/=2,l=i/o;this.axis.updateLine(n,e.color),this.axis.removeLabels();let h=[],c=[];for(let t=1;o*t<i;t++)vtick=o*t,h.push(vtick*s),c.push(vtick.toFixed(a));this.axis.updateLabels(h,c,e.color,e.palette,e.align)}e.name&&this.axis.updateName(e.name,e.align,e.length)}}),AFRAME.registerComponent("babia-axis-x",{schema:{labels:{type:"array"},ticks:{type:"array"},length:{type:"number"},color:{type:"color",default:"#000"},palette:{type:"string",default:""},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},align:{type:"string",default:"front"},name:{type:"string",default:""}},init:function(){this.axis=new r(this.el,"x",this.data.animation,this.data.dur)},update:function(t){const e=this.data;console.log("Starting babia-axis-x:",e.ticks.length,e.length,this.data.color),this.axis.updateLine(e.length,e.color),this.axis.removeLabels(),this.axis.updateLabels(e.ticks,e.labels,e.color,e.palette,e.align),e.name&&this.axis.updateName(e.name,e.align,e.length)}}),AFRAME.registerComponent("babia-axis-z",{schema:{labels:{type:"array"},ticks:{type:"array"},length:{type:"number"},color:{type:"color",default:"#000"},palette:{type:"string",default:""},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},align:{type:"string",default:"left"},name:{type:"string",default:""}},init:function(){this.axis=new r(this.el,"z",this.data.animation,this.data.dur)},update:function(t){const e=this.data;console.log("Starting babia-axis-z:",e.ticks.length,e.length,this.data.color),this.axis.updateLine(e.length,e.color),this.axis.removeLabels(),this.axis.updateLabels(e.ticks,e.labels,e.color,e.palette,e.align),e.name&&this.axis.updateName(e.name,e.align,e.length)}})},function(t,e,i){i(0).colors;AFRAME.registerComponent("babia-bar",{schema:{height:{type:"number"},width:{type:"number"},depth:{type:"number"},color:{type:"color",default:"#000"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},label:{type:"string",default:""},labelText:{type:"string",default:""}},init:function(){console.log("Starting bar:",this.data.height,this.data.color);let t=this.data;this.box=document.createElement("a-entity"),this.box.classList.add("babiaxraycasterclass"),this.el.appendChild(this.box);let e={};e=t.animation?{height:0,width:t.width,depth:t.depth}:{height:t.height,width:t.width,depth:t.depth},this.box.setAttribute("geometry",{primitive:"box",height:e.height,width:e.width,depth:e.depth}),this.box.setAttribute("material",{color:t.color})},update:function(t){let e=this.data,i=this.box;this.updateProperty(i,"geometry","height",e.animation,e.height,t.height),e.height!=t.height&&(e.animation?(i.setAttribute("animation__pos",{property:"position",to:{x:0,y:e.height/2,z:0},dur:e.dur}),e.height<=0&&t.height>0?i.setAttribute("animation__opacity",{property:"material.opacity",to:0,dur:e.dur}):t.height<=0&&e.height>0&&i.setAttribute("animation__opacity",{property:"material.opacity",to:100,dur:e.dur})):(i.setAttribute("position",{x:0,y:e.height/2,z:0}),e.height<=0&&t.height>0?i.setAttribute("material","opacity",0):t.height<=0&&e.height>0&&i.setAttribute("material","opacity",100))),this.updateProperty(i,"geometry","width",e.animation,e.width,t.width),this.updateProperty(i,"geometry","depth",e.animation,e.depth,t.depth),this.updateProperty(i,"material","color",e.animation,e.color,t.color),"events"===this.data.label?(i.addEventListener("mouseenter",this.showLabel.bind(this)),i.addEventListener("mouseleave",this.hideLabel.bind(this))):"fixed"===this.data.label&&this.showLabel(t)},updateProperty:function(t,e,i,n,r,a){let s=this.data;if(r!==a)if(n){let n=e;i&&(n=n+"."+i),t.setAttribute("animation__"+e+"_"+i,{property:n,to:r,dur:s.dur})}else i?t.setAttribute(e,{[i]:r}):t.setAttribute(e,r)},showLabel:function(t){let e=this.data;"events"===e.label&&this.el.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),text=e.labelText;let i=2;text.length>16&&(i=text.length/8);oldHeight=t.height||0,oldDepth=t.depth||0;let n={x:0,y:oldHeight+.6,z:0};this.labelEl||(this.labelEl=document.createElement("a-entity"),this.labelEl.setAttribute("babia-label",{width:i,textWidth:6}),e.animation&&"fixed"===e.label&&this.labelEl.setAttribute("position",n),this.el.appendChild(this.labelEl));let r={x:0,y:e.height+.6,z:.7*e.depth},a=e.animation&&"fixed"===e.label;this.updateProperty(this.labelEl,"position","",a,r,n),this.labelEl.setAttribute("rotation",{x:0,y:0,z:0}),text!=t.labelText&&this.labelEl.setAttribute("babia-label",{text:e.labelText})},hideLabel:function(){"events"===this.data.label&&this.el.setAttribute("scale",{x:1,y:1,z:1}),this.labelEl&&(this.el.removeChild(this.labelEl),this.labelEl=null)}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");function i(t,e){t.getObject3D("mesh")?n(t,e):t.addEventListener("model-loaded",(function(){t.color=e,n(t,e)}))}function n(t,e){t.object3D.traverse((function(t){last_material=t.material,last_material&&(t.material=new THREE.MeshBasicMaterial({color:e}))}))}AFRAME.registerComponent("babia-controls",{schema:{direction:{type:"string",default:""},state:{type:"string",default:""}},multiple:!1,init:function(){this.createPlayer()},update:function(t){let e=this.data;if(e.state&&e.state!=t.state){let t=document.getElementsByClassName("babiaPause")[0],i=document.getElementsByClassName("babiaPlay")[0];"pause"===e.state?(t&&this.el.children[0].removeChild(t),i||this.createButton("play","white")):(i&&this.el.children[0].removeChild(i),t||this.createButton("pause","white")),this.el.parentEl.setAttribute("babia-navigator","state",e.state)}if(e.direction&&e.direction!=t.direction){let t=document.getElementsByClassName("babiaRewind")[0],n=document.getElementsByClassName("babiaForward")[0];"rewind"===e.direction?(n.color="white",t.color="grey",i(n,"white"),i(t,"grey")):(n.color="grey",t.color="white",i(n,"grey"),i(t,"white")),this.el.parentEl.setAttribute("babia-navigator","direction",e.direction)}},player:void 0,createPlayer:function(){this.player=document.createElement("a-entity"),this.player.classList.add("babiaxrPlayer"),this.player.classList.add("babiaxraycasterclass"),this.el.appendChild(this.player),this.createButton("rewind","white"),this.createButton("skipPrev","white"),this.createButton("pause","white"),this.createButton("skipNext","white"),this.createButton("forward","grey")},createButton:function(t,e){let n,r,a,s=!1;if("play"===t)n=playButton.default,r=.2,a="babiaPlay";else if("pause"===t)n=pauseButton.default,r=0,a="babiaPause";else if("skipNext"===t)n=skipButton.default,r=3,a="babiaSkipNext",s=!0;else if("skipPrev"===t)n=skipButton.default,r=-3,a="babiaSkipPrev";else if("rewind"===t)n=rewindButton.default,r=-6,a="babiaRewind";else{if("forward"!==t)throw new Error("That button type doesn't exist.");n=rewindButton.default,r=6,a="babiaForward",s=!0}let o=document.createElement("a-entity");o.setAttribute("gltf-model","url("+n+")"),o.classList.add("babiaxraycasterclass"),o.classList.add(a),o.setAttribute("position",{x:r,y:0,z:0}),i(o,e),s&&o.setAttribute("rotation",{x:0,y:180,z:0}),this.player.appendChild(o),this.mouseOver(o),this.processEvents(o)},mouseOver:function(t){t.addEventListener("mouseenter",(function(){i(t,"grey")})),t.addEventListener("mouseleave",(function(){i(t,t.color)}))},processEvents:function(t){let e=this;t.addEventListener("click",(function(){if(t.classList.contains("babiaPlay"))this.parentEl.parentEl.setAttribute("babia-controls","state","play");else if(t.classList.contains("babiaPause"))this.parentEl.parentEl.setAttribute("babia-controls","state","pause");else if(t.classList.contains("babiaSkipNext")||t.classList.contains("babiaSkipPrev")){"pause"!=e.data.state&&this.parentEl.parentEl.setAttribute("babia-controls","state","pause");let i="skipPrev";t.classList.contains("babiaSkipNext")&&(i="skipNext"),e.el.parentEl.components["babia-navigator"].controlNavigator(i)}else t.classList.contains("babiaForward")?this.parentEl.parentEl.setAttribute("babia-controls","direction","forward"):t.classList.contains("babiaRewind")&&this.parentEl.parentEl.setAttribute("babia-controls","direction","rewind")}))}})},function(t,e,i){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const n=i(2).NotiBuffer;AFRAME.registerComponent("babia-navigator",{schema:{direction:{type:"string",default:""},state:{type:"string",default:""}},multiple:!1,sliderEl:void 0,init:function(){this.notiBuffer=new n(this.registerBack.bind(this),this.unregisterBack.bind(this))},update:function(t){let e=this.data;e.state&&e.state!=t.state&&this.controlNavigator(e.state),e.direction&&e.direction!=t.direction&&this.controlNavigator(e.direction)},initializeControls:function(){this.sliderEl=document.createElement("a-entity"),this.sliderEl.min=0,this.sliderEl.max=this.selector.selectable.length-1,this.current=this.selector.selectable.current,this.sliderEl.setAttribute("babia-slider",{size:1.5,min:this.sliderEl.min,max:this.sliderEl.max,value:this.current}),this.sliderEl.classList.add("babiaxraycasterclass"),this.sliderEl.id="timeline",this.sliderEl.setAttribute("scale",{x:2.3,y:2.3,z:2.3}),this.el.appendChild(this.sliderEl),this.controlsEl=document.createElement("a-entity"),this.controlsEl.setAttribute("babia-controls",""),this.controlsEl.classList.add("babiaxraycasterclass"),this.controlsEl.setAttribute("scale",{x:.15,y:.15,z:.3}),this.controlsEl.object3D.position.y=-.5,this.el.appendChild(this.controlsEl),this.stepControllerEl=document.createElement("a-entity"),this.stepControllerEl.setAttribute("babia-step-controller",""),this.stepControllerEl.classList.add("babiaxraycasterclass"),this.stepControllerEl.object3D.position.x=2.5,this.el.appendChild(this.stepControllerEl),this.speedControllerEl=document.createElement("a-entity"),this.speedControllerEl.setAttribute("babia-speed-controller",""),this.speedControllerEl.classList.add("babiaxraycasterclass"),this.speedControllerEl.object3D.position.x=3,this.el.appendChild(this.speedControllerEl)},updateSlider:function(t){let e=this.sliderEl.getAttribute("babia-slider").value;"skipNext"===t?e++:"skipPrev"===t&&e--,"skipPrev"===t&&e>=0||"skipNext"===t&&e<=this.sliderEl.max?(this.current=e,this.notiBuffer.set("babiaSetPosition"+this.current)):this.controlsEl.querySelector(".babiaPause")&&(this.current=e,processData("pause"))},registerBack:function(t){this.selector=t,this.prodComponent=t,this.prodComponent.navNotiBuffer&&(this.navNotiBufferId=this.prodComponent.navNotiBuffer.register(this.processData.bind(this)))},unregisterBack:function(t){t.navNotiBuffer.unregister(this.navNotiBufferId)},processData:function(t){"pause"==t?this.controlsEl.setAttribute("babia-controls","state","pause"):"rewind"==t?this.el.setAttribute("babia-navigator","direction","rewind"):"forward"==t?this.el.setAttribute("babia-navigator","direction","forward"):t.type&&("position"===t.type?(this.sliderEl||this.initializeControls(),"rewind"!=this.data.direction?this.current=t.value-1:this.current=t.value+1,this.current>=this.sliderEl.min&&this.current<=this.sliderEl.max&&(t.label?this.sliderEl.setAttribute("babia-slider",{label:t.label,value:this.current}):this.sliderEl.setAttribute("babia-slider","value",this.current))):"step"===t.type?this.stepControllerEl.setAttribute("babia-step-controller","value",t.value):"speed"===t.type&&this.speedControllerEl.setAttribute("babia-speed-controller","value",t.value))},prodComponent:void 0,navNotiBufferId:void 0,sliderComp:void 0,controlsComp:void 0,stepComp:void 0,speedComp:void 0,controlNavigator:function(t,e){"skipNext"==t||"skipPrev"==t?this.updateSlider(t):this.notiBuffer.set(t+e)}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-slider",{schema:{color:{type:"color",default:"#fff"},size:{type:"number",default:.5},min:{type:"number",default:-6},max:{type:"number",default:-4},value:{type:"number",default:-5},innerSize:{type:"number",default:.8},precision:{type:"number",default:2},vertical:{type:"boolean",default:!1},label:{type:"string"}},multiple:!0,init:function(){this.loader=new THREE.FontLoader;let t=new THREE.MeshBasicMaterial({color:this.data.color});this.material=t;let e=new THREE.Mesh(new THREE.BoxGeometry(.05,.15,.05),t),i=new THREE.Mesh(new THREE.CylinderGeometry(.015,.015,this.data.size,12),t);i.rotateZ(Math.PI/2);let n=new THREE.Group;this.lever=e,n.add(i),n.add(e),this.data.vertical&&n.rotateZ(Math.PI/2),this.el.setObject3D("mesh",n),this.el.classList.add("babiaxraycasterclass"),this.controllers=Array.prototype.slice.call(document.querySelectorAll("a-entity[hand-controls]")),this.fontURL="https://threejsfundamentals.org/threejs/resources/threejs/fonts/helvetiker_regular.typeface.json",this.loader.load(this.fontURL,t=>{this.font=t;let e=this.createTextGeometry(this.data.min,-this.data.size/2-.15,-.025),i=this.createTextGeometry(this.data.max,this.data.size/2+.08,-.025);n.add(e),n.add(i)})},createTextGeometry:function(t,e,i){let n=new THREE.TextGeometry(t.toString(),{font:this.font,size:.07,height:.01,curveSegments:12,bevelEnabled:!1}),r=new THREE.Mesh(n,this.material);return r.position.x=e,r.position.y=i,this.data.vertical&&(r.rotation.z=-Math.PI/2,r.position.y+=.05),r},setTextGeometry:function(t){this.textmesh&&(this.lever.children=[]),this.loader.load(this.fontURL,e=>{this.font=e,this.data.vertical?this.textmesh=this.createTextGeometry(t,-.025,-.2):this.textmesh=this.createTextGeometry(t,-.025,.15),this.lever.add(this.textmesh)})},play:function(){this.grabbed=!1,this.el.addEventListener("rangeout",this.onTriggerUp.bind(this)),this.controllers.forEach(function(t){t.addEventListener("triggerdown",this.onTriggerDown.bind(this)),t.addEventListener("triggerup",this.onTriggerUp.bind(this))}.bind(this))},pause:function(){this.el.removeEventListener("rangeout",this.onTriggerUp.bind(this)),this.controllers.forEach(function(t){t.removeEventListener("triggerdown",this.onTriggerDown.bind(this)),t.removeEventListener("triggerup",this.onTriggerUp.bind(this))}.bind(this))},onTriggerDown:function(t){var e=t.target.object3D,i=this.lever,n=(new THREE.Box3).setFromObject(e),r=(new THREE.Box3).setFromObject(i);if(n.intersectsBox(r)){let t=new THREE.Vector3;e.getWorldPosition(t);let n=new THREE.Vector3;i.getWorldPosition(n),t.distanceTo(n)<.1&&(this.grabbed=e,this.grabbed.visible=!1,this.knob.material=this.knobGrabbedMaterial)}},onTriggerUp:function(){this.grabbed&&(this.grabbed.visible=!0,this.grabbed=!1,this.knob.material=this.knobMaterial)},setValue:function(t){var e=this.lever;t<this.data.min?t=this.data.min:t>this.data.max&&(t=this.data.max),this.value=t,e.position.x=this.valueToLeverPosition(t),this.data.label?this.setTextGeometry(this.data.label):this.setTextGeometry(t)},valueToLeverPosition:function(t){var e=this.data.size*this.data.innerSize,i=Math.abs(this.data.max-this.data.min);let n=-1*e/2;return(t-this.data.min)*e/i+n},leverPositionToValue:function(t){var e=this.data.size*this.data.innerSize;return(t- -1*e/2)*Math.abs(this.data.max-this.data.min)/e+this.data.min},tick:function(){if(this.grabbed){var t=this.grabbed,e=this.lever,i=this.data.size*this.data.innerSize,n=(new THREE.Vector3).setFromMatrixPosition(t.matrixWorld);e.parent.worldToLocal(n),Math.abs(n.x)>i/2?e.position.x=i/2*Math.sign(e.position.x):e.position.x=n.x;var r=this.leverPositionToValue(e.position.x);Math.abs(this.value-r)>=Math.pow(10,-this.data.precision)&&(r=Math.round(r),this.value=r,this.setTextGeometry(r),this.el.parentEl.components["babia-navigator"]?this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetPosition",Math.round(r)):this.el.parentEl.components["babia-step-controller"]?this.el.parentEl.components["babia-step-controller"].controlStep(Math.round(r)):this.el.parentEl.components["babia-speed-controller"]&&this.el.parentEl.components["babia-speed-controller"].controlSpeed(Math.round(r)))}},mousexPositionToValue:function(t){let e=this.el.object3D.getWorldPosition().x,i=this.data.size*this.data.innerSize*this.el.object3D.getWorldScale().x,n=(t-(e-i/2))*Math.abs(this.data.max-this.data.min)/i+this.data.min;return n<this.data.min?this.data.min:n>this.data.max?this.data.max:n},mouseyPositionToValue:function(t){let e=this.el.object3D.getWorldPosition().y,i=this.data.size*this.data.innerSize*this.el.object3D.getWorldScale().y,n=(t-(e-i/2))*Math.abs(this.data.max-this.data.min)/i+this.data.min;return n<this.data.min?this.data.min:n>this.data.max?this.data.max:n},update:function(t){this.data.value!==t.value&&this.setValue(this.data.value),this.el.addEventListener("click",_listener=t=>{let e,i=t.detail.intersection.point;e=this.data.vertical?this.mouseyPositionToValue(i.y):this.mousexPositionToValue(i.x),this.el.parentEl.components["babia-navigator"]?this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetPosition",Math.round(e)):this.el.parentEl.components["babia-step-controller"]?this.el.parentEl.components["babia-step-controller"].controlStep(Math.round(e)):this.el.parentEl.components["babia-speed-controller"]&&this.el.parentEl.components["babia-speed-controller"].controlSpeed(Math.round(e))})}}),AFRAME.registerComponent("babia-step-controller",{schema:{value:{type:"number",default:-5}},multiple:!0,sliderEl:void 0,step:void 0,init:function(){this.createSlider()},update:function(t){this.data.value!==t.value&&this.sliderEl.setAttribute("babia-slider","value",this.data.value)},createSlider:function(){this.sliderEl=document.createElement("a-entity"),this.sliderEl.setAttribute("babia-slider",{size:1,min:1,max:10,value:1,vertical:!0}),this.sliderEl.classList.add("babiaxraycasterclass"),this.sliderEl.id="step-controller",this.el.appendChild(this.sliderEl)},controlStep:function(t){this.step=t,this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetStep",this.step)}}),AFRAME.registerComponent("babia-speed-controller",{schema:{value:{type:"number",default:-5}},multiple:!0,sliderEl:void 0,speed:void 0,init:function(){this.createSlider()},update:function(t){this.data.value!==t.value&&this.sliderEl.setAttribute("babia-slider","value",this.data.value)},createSlider:function(){this.sliderEl=document.createElement("a-entity"),this.sliderEl.setAttribute("babia-slider",{size:1,min:1,max:3,value:1,vertical:!0}),this.sliderEl.classList.add("babiaxraycasterclass"),this.sliderEl.id="speed-controller",this.el.appendChild(this.sliderEl)},controlSpeed:function(t){this.speed=t,this.el.parentEl.components["babia-navigator"].controlNavigator("babiaSetSpeed",this.speed)}})},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-ui-link",{schema:{viz:{type:"string"},ui:{type:"string"}},linked_viz:void 0,ui_target:void 0,init:function(){this.createButton()},update:function(t){let e=this.data;n(e,this.el,this),i(e,this.el,this),console.log("VIZ",this.linked_viz)},createButton:function(){this.button=document.createElement("a-entity"),this.button.classList.add("babiaxraycasterclass"),this.button.setAttribute("geometry",{primitive:"plane",height:1,width:3}),this.button.setAttribute("material",{color:"#FFF"}),this.button.setAttribute("text",{value:"Manage me",align:"center",width:8,color:"#000"}),this.button.setAttribute("position",{x:0,y:-1,z:0}),this.addListeners(this.button,this),this.el.appendChild(this.button)},addListeners:function(t,e){t.addEventListener("mouseenter",(function(){t.setAttribute("text",{color:"#FFF"}),t.setAttribute("material",{color:"#333"})})),t.addEventListener("mouseleave",(function(){t.setAttribute("text",{color:"#000"}),t.setAttribute("material",{color:"#FFF"})})),t.addEventListener("click",(function(){let t=document.querySelector("#"+e.ui_target);console.log(e.linked_viz),t.setAttribute("babia-ui","target",e.linked_viz)}))}});let i=(t,e,i)=>t.ui?void(i.ui_target=t.ui):e.components["babia-ui"]?void(i.ui_target=e.components["babia-ui"]):document.querySelectorAll("[babia-ui]").length>0?void(i.ui_target=document.querySelectorAll("[babia-ui]")[0].id):void console.error("UI Component not found."),n=(t,e,i)=>{if(!t.viz)return e.components["babia-bars"]||e.components["babia-barsmap"]||e.components["babia-boats"]||e.components["babia-bubbles"]||e.components["babia-city"]||e.components["babia-cyls"]||e.components["babia-cylsmap"]||e.components["babia-doughnut"]||e.components["babia-network"]||e.components["babia-pie"]?void(i.linked_viz=e.id):void console.error("Visuzlizer not found.");i.linked_viz=t.viz}},function(t,e){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("babia-camera",{schema:{raycasterMouse:{type:"string",default:".babiaxraycasterclass"},raycasterHand:{type:"string",default:".babiaxraycasterclass"},tipsOpened:{type:"boolean",default:!0},gripRLabel:{type:"string",default:"Open/Close \nTips"},gripLLabel:{type:"string",default:"Stop Audio"},triggerRLabel:{type:"string",default:"Click"},triggerLLabel:{type:"string",default:"Teleport"},teleportCollisions:{type:"string",default:".environmentGround"}},multiple:!1,init:function(){},update:function(t){this.data!=this.oldData&&(this.el.setAttribute("camera",""),this.addCursor(),this.setOculusConnected())},addCursor:function(){this.cursor=document.createElement("a-entity"),this.cursor.id="cursor",this.cursor.setAttribute("cursor",{rayOrigin:"mouse"}),this.cursor.setAttribute("raycaster",{objects:this.data.raycasterMouse}),this.el.parentElement.append(this.cursor)},createTip:function(t,e,i){let n=document.createElement("a-entity");return n.id=t,n.classList.add("tips"),n.setAttribute("tooltip",e),n.setAttribute("position",i),n},setOculusConnected:function(){let t=this;t.tooltips=[],t.leftHand=document.createElement("a-entity"),t.leftHand.id="babia-leftHand",t.leftHand.setAttribute("oculus-touch-controls",{hand:"left"}),t.el.parentElement.append(t.leftHand),t.rightHand=document.createElement("a-entity"),t.rightHand.id="babia-rightHand",t.rightHand.setAttribute("oculus-touch-controls",{hand:"right"}),t.el.parentElement.append(t.rightHand),document.addEventListener("controllerconnected",e=>{let i=t.el.parentElement.object3D.position;t.el.parentElement.setAttribute("position",{x:i.x,y:0,z:i.z}),"babia-leftHand"===e.target.id&&(t.leftHand.setAttribute("teleport-controls",{cameraRig:"#"+t.el.parentElement.id,teleportOrigin:"#"+t.el.id,collisionEntities:t.data.teleportCollisions,hitCylinderColor:"#ff3468",curveHitColor:"#ff3468",curveMissColor:"#333333",curveLineWidth:.01,button:"trigger"}),tipTriggerLconfig={text:t.data.triggerLLabel,width:.07,height:.03,targetPosition:"0.002 -0.02 -0.014",lineHorizontalAlign:"right",rotation:"-90 0 0",src:tooltip.default},tipTriggerLpos={x:-.09,y:-.04,z:-.08},t.tipTriggerL=this.createTip("babia-tooltip_trigger_L",tipTriggerLconfig,tipTriggerLpos),t.leftHand.append(t.tipTriggerL),t.tooltips.push(t.tipTriggerL),tipGripLconfig={text:t.data.gripLLabel,width:.08,height:.04,targetPosition:"0.006 -0.008 0.033",rotation:"-90 0 0",src:tooltip.default},tipGripLpos={x:.085,y:-.01,z:.07},t.tipGripL=this.createTip("babia-tooltip_grip_L",tipGripLconfig,tipGripLpos),t.leftHand.append(t.tipGripL),t.tooltips.push(t.tipGripL)),"babia-rightHand"===e.target.id&&(t.rightHand.setAttribute("laser-controls",{hand:"right"}),t.rightHand.setAttribute("raycaster",{objects:this.data.raycasterHand}),tipTriggerRconfig={text:t.data.triggerRLabel,width:.07,height:.03,targetPosition:"0.005 -0.02 -0.014",lineHorizontalAlign:"left",rotation:"-90 0 0",src:tooltip.default},tipTriggerRpos={x:-.09,y:-.04,z:-.08},t.tipTriggerR=this.createTip("babia-tooltip_trigger_R",tipTriggerRconfig,tipTriggerRpos),t.rightHand.append(t.tipTriggerR),t.tooltips.push(t.tipTriggerR),tipGripRconfig={text:t.data.gripRLabel,width:.08,height:.04,targetPosition:"0.006 -0.008 0.033",lineHorizontalAlign:"right",rotation:"-90 0 0",src:tooltip.default},tipGripRpos={x:-.085,y:-.01,z:.07},t.tipGripR=this.createTip("babia-tooltip_grip_R",tipGripRconfig,tipGripRpos),t.rightHand.append(t.tipGripR),t.tooltips.push(t.tipGripR)),this.tipsController(),this.data.networkedAudio&&this.setAudioController()})},tipsController:function(){let t=this;this.tipsOpened=t.data.tipsOpened,t.tipsOpened||t.tooltips.forEach(t=>{t.setAttribute("visible",!1)}),t.rightHand.addEventListener("gripdown",()=>{t.tipsOpened?(t.tipsOpened=!1,t.tooltips.forEach(t=>{t.setAttribute("visible",!1)})):(t.tipsOpened=!0,t.tooltips.forEach(t=>{t.setAttribute("visible",!0)}))})}})},function(t,e,i){i(0).colors;AFRAME.registerComponent("babia-cyl",{schema:{height:{type:"number"},radius:{type:"number"},color:{type:"color",default:"#000"},animation:{type:"boolean",default:!0},dur:{type:"number",default:2e3},label:{type:"string",default:""},labelText:{type:"string",default:""}},init:function(){console.log("Starting cyl:",this.data.height,this.data.color);let t=this.data;this.cylinder=document.createElement("a-entity"),this.cylinder.classList.add("babiaxraycasterclass"),this.el.appendChild(this.cylinder);let e={};e=t.animation?{height:0,radius:t.radius}:{height:t.height,radius:t.radius},this.cylinder.setAttribute("geometry",{primitive:"cylinder",height:e.height,radius:e.radius}),this.cylinder.setAttribute("material",{color:t.color})},update:function(t){let e=this.data,i=this.cylinder;this.updateProperty(i,"geometry","height",e.animation,e.height,t.height),e.height!=t.height&&(e.animation?(i.setAttribute("animation__pos",{property:"position",to:{x:0,y:e.height/2,z:0},dur:e.dur}),e.height<=0&&t.height>0?i.setAttribute("animation__opacity",{property:"material.opacity",to:0,dur:e.dur}):t.height<=0&&e.height>0&&i.setAttribute("animation__opacity",{property:"material.opacity",to:100,dur:e.dur})):(i.setAttribute("position",{x:0,y:e.height/2,z:0}),e.height<=0&&t.height>0?i.setAttribute("material","opacity",0):t.height<=0&&e.height>0&&i.setAttribute("material","opacity",100))),this.updateProperty(i,"geometry","radius",e.animation,e.radius,t.radius),this.updateProperty(i,"material","color",e.animation,e.color,t.color),"events"===this.data.label?(i.addEventListener("mouseenter",this.showLabel.bind(this)),i.addEventListener("mouseleave",this.hideLabel.bind(this))):"fixed"===this.data.label&&this.showLabel(t)},updateProperty:function(t,e,i,n,r,a){let s=this.data;if(r!==a)if(n){let n=e;i&&(n=n+"."+i),t.setAttribute("animation__"+e+"_"+i,{property:n,to:r,dur:s.dur})}else i?t.setAttribute(e,{[i]:r}):t.setAttribute(e,r)},showLabel:function(t){let e=this.data;"events"===e.label&&this.el.setAttribute("scale",{x:1.1,y:1.1,z:1.1}),text=e.labelText;let i=2;text.length>16&&(i=text.length/8);oldHeight=t.height||0;let n={x:0,y:oldHeight+.6,z:0};this.labelEl||(this.labelEl=document.createElement("a-entity"),this.labelEl.setAttribute("babia-label",{width:i,textWidth:6}),e.animation&&"fixed"===e.label&&this.labelEl.setAttribute("position",n),this.el.appendChild(this.labelEl));let r={x:0,y:e.height+.7,z:.7*e.radius},a=e.animation&&"fixed"===e.label;this.updateProperty(this.labelEl,"position","",a,r,n),this.labelEl.setAttribute("rotation",{x:0,y:0,z:0}),text!=t.labelText&&this.labelEl.setAttribute("babia-label",{text:e.labelText})},hideLabel:function(){"events"===this.data.label&&this.el.setAttribute("scale",{x:1,y:1,z:1}),this.labelEl&&(this.el.removeChild(this.labelEl),this.labelEl=null)}})},function(t,e,i){i(0).findTargetComponent;if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");const n=i(2).NotiBuffer;AFRAME.registerComponent("babia-range-selector",{schema:{from:{type:"string"},to:{type:"string"}},multiple:!1,init:function(){this.notiBuffer=new n,this.options=[{label:"Last 15 minutes",time:9e5},{label:"Last 30 minutes",time:9e5},{label:"Last 1 hour",time:36e5},{label:"Last 4 hours",time:144e5},{label:"Last 12 hours",time:432e5},{label:"Last 24 hours",time:864e5},{label:"Last 7 days",time:6048e5},{label:"Last 30 days",time:2592e6},{label:"Last 60 days",time:5184e6},{label:"Last 90 days",time:7776e6},{label:"Last 6 months",time:15552e6},{label:"Last 1 year",time:31536e6},{label:"Last 2 years",time:63072e6},{label:"Last 5 years",time:15768e7}],this.label_select="babia-button-"+this.options[0].label.replaceAll(" ","-")},update:function(t){let e=this.data;this.updateInterface(e)},interface:void 0,options:void 0,handController:void 0,label_select:void 0,updateInterface:function(t){let e=this;for(;e.el.firstChild;)e.el.firstChild.remove();if(console.log("Generating interface..."),document.querySelector("#babia-menu-hand")){let t=document.querySelector("#babia-menu-hand");t.parentNode.removeChild(t),r(e,e.handController)}else e.interface=a(e),e.el.appendChild(e.interface);document.addEventListener("controllerconnected",t=>{for(;e.el.firstChild;)e.el.firstChild.remove();let i=t.detail.name;"left"!==t.target.getAttribute(i).hand||document.querySelector("#babia-menu-hand")||(e.handController=t.target.id,e.interface=a(e),r(e,e.handController))})}});let r=(t,e)=>{let i=document.getElementById(e);t.interface.id="babia-menu-hand",t.interface.setAttribute("scale",{x:.03,y:.03,z:.03}),t.interface.setAttribute("position",{x:-.05,y:-.05,z:-.1}),t.interface.setAttribute("rotation",{x:-60,y:0,z:0}),t.interface.setAttribute("visible",!1),i.appendChild(t.interface),l(e,t.interface)},a=t=>{t.interface=document.createElement("a-entity"),t.interface.id="babia-menu";let e=7,i=0;return t.options.forEach(n=>{let r=s(t,n.label,i,e);t.interface.appendChild(r),e>1?--e:(i+=3.75,e=7)}),t.interface},s=(t,e,i,n)=>{let r=document.createElement("a-box");r.id="babia-button-"+e.replaceAll(" ","-"),r.classList.add("babiaxraycasterclass"),r.setAttribute("position",{x:i,y:n,z:0}),r.setAttribute("rotation",{x:0,y:0,z:0}),r.setAttribute("height",.8),r.setAttribute("width",3.5),r.setAttribute("depth",.01);let a=document.createElement("a-entity");return a.setAttribute("text",{value:e,align:"center",width:"10",color:"black"}),a.setAttribute("position","0 0 0.01"),r.appendChild(a),o(t,r),t.label_select==r.id&&r.emit("click"),r},o=(t,e)=>{e.addEventListener("mouseenter",(function(){e.children[0].setAttribute("text",{color:"#FFFFFF"}),e.setAttribute("color","#333333")})),e.addEventListener("mouseleave",(function(){e.children[0].setAttribute("text",{color:"black"}),t.label_select==e.id?e.setAttribute("color","#555555"):e.setAttribute("color","#FFFFFF")})),e.addEventListener("click",(function(){let i=document.getElementById(t.label_select);null!=i&&(i.children[0].setAttribute("text",{color:"black"}),i.setAttribute("color","#FFFFFF")),t.label_select=e.id,e.children[0].setAttribute("text",{color:"black"}),e.setAttribute("color","#555555");let n=t.label_select.slice(13).replaceAll("-"," ");t.options.forEach(e=>{if(e.label==n){let i=Date.now(),n={from:i-e.time,to:i};t.notiBuffer.set(n)}})}))},l=(t,e)=>{let i=!1;document.getElementById(t).addEventListener("gripdown",(function(){i?(i=!1,e.setAttribute("visible",!1)):(i=!0,e.setAttribute("visible",!0))}))}},function(t,e,i){"use strict";i.r(e),e.default="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogInBhdXNlIiwKICAgICAgICAgICAgInJvdGF0aW9uIiA6IFsKICAgICAgICAgICAgICAgIDAuNzA3MTA2NzY5MDg0OTMwNCwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgMC43MDcxMDY3NjkwODQ5MzA0CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgIm1lc2hlcyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAibmFtZSIgOiAiUGxhbmUiLAogICAgICAgICAgICAicHJpbWl0aXZlcyIgOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgImF0dHJpYnV0ZXMiIDogewogICAgICAgICAgICAgICAgICAgICAgICAiUE9TSVRJT04iIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgIk5PUk1BTCIgOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAiVEVYQ09PUkRfMCIgOiAyCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAiaW5kaWNlcyIgOiAzCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgImFjY2Vzc29ycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAwLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNTYsCiAgICAgICAgICAgICJtYXgiIDogWwogICAgICAgICAgICAgICAgMC44MDk2NzM1NDc3NDQ3NTEsCiAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgMQogICAgICAgICAgICBdLAogICAgICAgICAgICAibWluIiA6IFsKICAgICAgICAgICAgICAgIC0wLjc5NjU0NzUzMjA4MTYwNCwKICAgICAgICAgICAgICAgIC0wLjE5Njg4OTQ2MDA4NjgyMjUsCiAgICAgICAgICAgICAgICAtMQogICAgICAgICAgICBdLAogICAgICAgICAgICAidHlwZSIgOiAiVkVDMyIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlclZpZXciIDogMSwKICAgICAgICAgICAgImNvbXBvbmVudFR5cGUiIDogNTEyNiwKICAgICAgICAgICAgImNvdW50IiA6IDU2LAogICAgICAgICAgICAidHlwZSIgOiAiVkVDMyIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlclZpZXciIDogMiwKICAgICAgICAgICAgImNvbXBvbmVudFR5cGUiIDogNTEyNiwKICAgICAgICAgICAgImNvdW50IiA6IDU2LAogICAgICAgICAgICAidHlwZSIgOiAiVkVDMiIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlclZpZXciIDogMywKICAgICAgICAgICAgImNvbXBvbmVudFR5cGUiIDogNTEyMywKICAgICAgICAgICAgImNvdW50IiA6IDcyLAogICAgICAgICAgICAidHlwZSIgOiAiU0NBTEFSIgogICAgICAgIH0KICAgIF0sCiAgICAiYnVmZmVyVmlld3MiIDogWwogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiA2NzIsCiAgICAgICAgICAgICJieXRlT2Zmc2V0IiA6IDAKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiA2NzIsCiAgICAgICAgICAgICJieXRlT2Zmc2V0IiA6IDY3MgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDQ0OCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMTM0NAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDE0NCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMTc5MgogICAgICAgIH0KICAgIF0sCiAgICAiYnVmZmVycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiAxOTM2LAogICAgICAgICAgICAidXJpIiA6ICJkYXRhOmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTtiYXNlNjQsaXVwTHZ3QUFBQUFBQUlBL2l1cEx2d0FBQUFBQUFJQy82RlZRdmdBQUFBQUFBSUMvNkZWUXZnQUFBQUFBQUlBL3hFWlBQMlNkU2I0QUFJQS94RVpQUDJTZFNiNEFBSUMvYkoxSlBtU2RTYjRBQUlDL2NKMUpQbVNkU2I0QUFJQS82RlZRdm1TZFNiNEFBSUEvNkZWUXZtU2RTYjRBQUlDL2l1cEx2MlNkU2I0QUFJQy9pdXBMdjJTZFNiNEFBSUEvY0oxSlBnQUFBQUFBQUlBL2JKMUpQZ0FBQUFBQUFJQy94RVpQUHdBQUFBQUFBSUMveEVaUFB3QUFBQUFBQUlBLzZGVlF2Z0FBQUFBQUFJQy82RlZRdm1TZFNiNEFBSUMvNkZWUXZtU2RTYjRBQUlBLzZGVlF2Z0FBQUFBQUFJQS94RVpQUHdBQUFBQUFBSUMveEVaUFAyU2RTYjRBQUlDL3hFWlBQMlNkU2I0QUFJQS94RVpQUHdBQUFBQUFBSUEvaXVwTHZ3QUFBQUFBQUlBL2l1cEx2MlNkU2I0QUFJQS9pdXBMdjJTZFNiNEFBSUMvaXVwTHZ3QUFBQUFBQUlDL2NKMUpQZ0FBQUFBQUFJQS9jSjFKUG1TZFNiNEFBSUEvYkoxSlBtU2RTYjRBQUlDL2NKMUpQZ0FBQUFBQUFJQS9iSjFKUG1TZFNiNEFBSUMvYkoxSlBnQUFBQUFBQUlDLzZGVlF2Z0FBQUFBQUFJQS82RlZRdm1TZFNiNEFBSUEvaXVwTHYyU2RTYjRBQUlBLzZGVlF2Z0FBQUFBQUFJQS9pdXBMdjJTZFNiNEFBSUEvaXVwTHZ3QUFBQUFBQUlBL2l1cEx2d0FBQUFBQUFJQy9pdXBMdjJTZFNiNEFBSUMvNkZWUXZtU2RTYjRBQUlDL2l1cEx2d0FBQUFBQUFJQy82RlZRdm1TZFNiNEFBSUMvNkZWUXZnQUFBQUFBQUlDL3hFWlBQd0FBQUFBQUFJQS94RVpQUDJTZFNiNEFBSUEvY0oxSlBtU2RTYjRBQUlBL3hFWlBQd0FBQUFBQUFJQS9jSjFKUG1TZFNiNEFBSUEvY0oxSlBnQUFBQUFBQUlBL2JKMUpQZ0FBQUFBQUFJQy9iSjFKUG1TZFNiNEFBSUMveEVaUFAyU2RTYjRBQUlDL3hFWlBQd0FBQUFBQUFJQy9BQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBUHdBQUFBQUFBQUNBQUFDQVB3QUFBQUFBQUFDQUFBQ0FQd0FBQUFBQUFBQ0FBQUNBUHdBQUFBQUFBQUNBQUFDQVB3QUFBQUFhaDZLeUFBQ0FQd0FBQUFBYWg2S3lBQUNBUHdBQUFBQWFoNkt5QUFDQVB3QUFBQUFhaHlLekFBQ0FQd0FBQUFBYWh5S3pBQUNBUHdBQUFBQWFoeUt6QUFBQUFBQUFBQUFBQUlDL0FBQUFBQUFBQUFBQUFJQy9BQUFBQUFBQUFBQUFBSUMvQUFBQUFBQUFBQUQvLzMrL0FBQUFBQUFBQUFELy8zKy9BQUFBQUFBQUFBRC8vMysvQUFBQUFBQUFBQUQvLzM4L0FBQUFBQUFBQUFELy8zOC9BQUFBQUFBQUFBRC8vMzgvQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBQUFBQUFJQS9BQUFBQUFBQUFBQUFBSUEvQUFBQUFBQUFBQUFBQUlDL0FBQUFBQUFBQUFBQUFJQy9BQUFBQUFBQUFBQUFBSUMvQUFBQUFBQUFBQUQvLzMrL0FBQUFBQUFBQUFELy8zKy9BQUFBQUFBQUFBRC8vMysvQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBQUFBQUFJQS9BQUFBQUFBQUFBQUFBSUEvQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBZ0Q4QUFBQUFBQUFBQUJEVmx6NEFBQUFBRU5XWFBnQUFnRDhBQUlBL0FBQ0FQd0FBZ0Q4QUFBQUFUSkF4UHdBQUFBQk1rREUvQUFDQVB4RFZsejRBQUlBL0VOV1hQZ0FBQUFBQUFBQUFBQUFBQUFBQUFBQUFBSUEvVEpBeFB3QUFnRDlNa0RFL0FBQUFBQUFBZ0Q4QUFBQUFBQUNBUHdBQWdEOFExWmMrQUFBQUFCRFZsejRBQUFBQUVOV1hQZ0FBZ0Q4UTFaYytBQUNBUHdBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUlBL0FBQ0FQd0FBZ0Q4QUFJQS9BQUFBQUFBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUFBQUFBQUFBQUFBQUFCTWtERS9BQUNBUDB5UU1UOEFBSUEvVEpBeFB3QUFBQUJNa0RFL0FBQ0FQMHlRTVQ4QUFBQUFUSkF4UHdBQUFBQVExWmMrQUFDQVB4RFZsejRBQUlBL0FBQUFBQUFBZ0Q4UTFaYytBQUNBUHdBQUFBQUFBSUEvQUFBQUFBQUFnRDhBQUFBQUFBQUFBQUFBQUFBQUFBQUFFTldYUGdBQUFBQUFBQUFBQUFBQUFCRFZsejRBQUFBQUVOV1hQZ0FBQUFBQUFJQS9BQUNBUHdBQWdEOEFBSUEvVEpBeFB3QUFnRDhBQUlBL0FBQ0FQMHlRTVQ4QUFJQS9USkF4UHdBQWdEOU1rREUvQUFBQUFFeVFNVDhBQUFBQUFBQ0FQd0FBQUFBQUFJQS9BQUFBQUFBQUFRQUNBQUFBQWdBREFBUUFCUUFHQUFRQUJnQUhBQWdBQ1FBS0FBZ0FDZ0FMQUF3QURRQU9BQXdBRGdBUEFCQUFFUUFTQUJBQUVnQVRBQlFBRlFBV0FCUUFGZ0FYQUJnQUdRQWFBQmdBR2dBYkFCd0FIUUFlQUI4QUlBQWhBQ0lBSXdBa0FDVUFKZ0FuQUNnQUtRQXFBQ3NBTEFBdEFDNEFMd0F3QURFQU1nQXpBRFFBTlFBMkFEUUFOZ0EzQUE9PSIKICAgICAgICB9CiAgICBdCn0K"},function(t,e,i){"use strict";i.r(e),e.default="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogIlBsYXkiLAogICAgICAgICAgICAicm90YXRpb24iIDogWwogICAgICAgICAgICAgICAgMC43MDcxMDY3NjkwODQ5MzA0LAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAwLjcwNzEwNjc2OTA4NDkzMDQKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibWVzaGVzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJuYW1lIiA6ICJQbGFuZS4wMDEiLAogICAgICAgICAgICAicHJpbWl0aXZlcyIgOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgImF0dHJpYnV0ZXMiIDogewogICAgICAgICAgICAgICAgICAgICAgICAiUE9TSVRJT04iIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgIk5PUk1BTCIgOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAiVEVYQ09PUkRfMCIgOiAyCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAiaW5kaWNlcyIgOiAzCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgImFjY2Vzc29ycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAwLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogMTgsCiAgICAgICAgICAgICJtYXgiIDogWwogICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJtaW4iIDogWwogICAgICAgICAgICAgICAgLTEsCiAgICAgICAgICAgICAgICAtMC4xOTY4ODk0NzQ5ODc5ODM3LAogICAgICAgICAgICAgICAgLTAuOTk0OTY1NjcyNDkyOTgxCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAxLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogMTgsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAyLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogMTgsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMyIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAzLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTIzLAogICAgICAgICAgICAiY291bnQiIDogMjQsCiAgICAgICAgICAgICJ0eXBlIiA6ICJTQ0FMQVIiCiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJWaWV3cyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDIxNiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDIxNiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMjE2CiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogMTQ0LAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiA0MzIKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiA0OCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogNTc2CiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDYyNCwKICAgICAgICAgICAgInVyaSIgOiAiZGF0YTphcHBsaWNhdGlvbi9vY3RldC1zdHJlYW07YmFzZTY0LEFBQ0F2MldkU2I0U3RuNi9BQUNBdjJXZFNiNEFBSUEvQUFDQVAyV2RTYjRBR2txOEFBQ0FQd0FBQUFBQUdrcThBQUNBUDJXZFNiNEFHa3E4QUFDQXYyV2RTYjRBQUlBL0FBQ0F2d0FBQUFBQUFJQS9BQUNBdndBQUFBQVN0bjYvQUFDQVB3QUFBQUFBR2txOEFBQ0F2d0FBQUFBQUFJQS9BQUNBdndBQUFBQVN0bjYvQUFDQXYyV2RTYjRTdG42L0FBQ0FQMldkU2I0QUdrcThBQUNBUHdBQUFBQUFHa3E4QUFDQXZ3QUFBQUFBQUlBL0FBQ0F2MldkU2I0QUFJQS9BQUNBdjJXZFNiNFN0bjYvQUFDQXZ3QUFBQUFTdG42L0FBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQWZqbm52Z0FBQUFBNGFHUy9mam5udmdBQUFBQTRhR1MvZmpubnZnQUFBQUE0YUdTL2Zqbm52Z0FBQUFBNGFHUy9BQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FhY2JodmdBQUFBQVh4R1UvYWNiaHZnQUFBQUFYeEdVL2FjYmh2Z0FBQUFBWHhHVS9hY2JodmdBQUFBQVh4R1UvQUFDQVB3QUFBQUFBQUFDQUFBQ0FQd0FBQUFBQUFBQ0FBQUNBUHdBQUFBQUFBQUNBQUFDQVB3QUFBQUFBQUFDQUFBQUFBQUQzSkRzQUFBQUFBQUNBUHdBQWdEK1kxL3crQUFDQVA1algvRDRBQUlBL21OZjhQZ0FBQUFBQUFJQS9BQUFBQUFBQWdEOEFBQUFBQVBja093QUFnRCtZMS93K0FBQUFBQUFBZ0Q4QUFBQUFBUGNrT3dBQUFBQUE5eVE3QUFDQVA1algvRDRBQUlBL21OZjhQZ0FBQUFBQUFJQS9BQUFBQUFBQWdEOEFBQUFBQVBja093QUFBQUFBOXlRN0FBQUJBQUlBQXdBRUFBVUFBd0FGQUFZQUJ3QUlBQWtBQ2dBTEFBd0FDZ0FNQUEwQURnQVBBQkFBRGdBUUFCRUEiCiAgICAgICAgfQogICAgXQp9Cg=="},function(t,e,i){"use strict";i.r(e),e.default="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogInNraXAiLAogICAgICAgICAgICAicm90YXRpb24iIDogWwogICAgICAgICAgICAgICAgMC43MDcxMDY3NjkwODQ5MzA0LAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAwLjcwNzEwNjc2OTA4NDkzMDQKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibWVzaGVzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJuYW1lIiA6ICJQbGFuZS4wMDIiLAogICAgICAgICAgICAicHJpbWl0aXZlcyIgOiBbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgImF0dHJpYnV0ZXMiIDogewogICAgICAgICAgICAgICAgICAgICAgICAiUE9TSVRJT04iIDogMCwKICAgICAgICAgICAgICAgICAgICAgICAgIk5PUk1BTCIgOiAxLAogICAgICAgICAgICAgICAgICAgICAgICAiVEVYQ09PUkRfMCIgOiAyCiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICAiaW5kaWNlcyIgOiAzCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIF0KICAgICAgICB9CiAgICBdLAogICAgImFjY2Vzc29ycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAwLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNDYsCiAgICAgICAgICAgICJtYXgiIDogWwogICAgICAgICAgICAgICAgMSwKICAgICAgICAgICAgICAgIDAsCiAgICAgICAgICAgICAgICAxCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJtaW4iIDogWwogICAgICAgICAgICAgICAgLTEsCiAgICAgICAgICAgICAgICAtMC4yMDIzNTg2MDM0Nzc0NzgwMywKICAgICAgICAgICAgICAgIC0xCiAgICAgICAgICAgIF0sCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAxLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNDYsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMzIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAyLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTI2LAogICAgICAgICAgICAiY291bnQiIDogNDYsCiAgICAgICAgICAgICJ0eXBlIiA6ICJWRUMyIgogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyVmlldyIgOiAzLAogICAgICAgICAgICAiY29tcG9uZW50VHlwZSIgOiA1MTIzLAogICAgICAgICAgICAiY291bnQiIDogNzIsCiAgICAgICAgICAgICJ0eXBlIiA6ICJTQ0FMQVIiCiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJWaWV3cyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDU1MiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDU1MiwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogNTUyCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogMzY4LAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiAxMTA0CiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogMTQ0LAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiAxNDcyCiAgICAgICAgfQogICAgXSwKICAgICJidWZmZXJzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDE2MTYsCiAgICAgICAgICAgICJ1cmkiIDogImRhdGE6YXBwbGljYXRpb24vb2N0ZXQtc3RyZWFtO2Jhc2U2NCxBQUNBdndBQUFBQUFBSUEvQUFDQXZ3QUFBQUFBQUlDLzVBSWF2d0FBQUFBQUFJQy81QUlhdndBQUFBQUFOck83NUFJYXZ3QUFBQUFBQUlBL0FBQ0FQd0FBQUFBQUFJQS9BQUNBUHhnM1Q3NEFBSUEvNUFJYXZ4ZzNUNzRBTnJPNzVBSWF2d0FBQUFBQU5yTzdBQUNBUHhnM1Q3NEFBSUMvNUFJYXZ4ZzNUNzRBTnJPN0FBQ0FQeGczVDc0QUFJQS9BQUNBUHdBQUFBQUFBSUMvQUFDQVB3QUFBQUFBQUlBLzVBSWF2d0FBQUFBQU5yTzc1QUlhdnhnM1Q3NEFOck83NUFJYXZ4ZzNUNzRBQUlDL0FBQ0F2eGczVDc0QUFJQy9BQUNBdnhnM1Q3NEFBSUEvNUFJYXZ4ZzNUNzRBQUlBLzVBSWF2d0FBQUFBQUFJQy81QUlhdnhnM1Q3NEFBSUMvNUFJYXZ4ZzNUNzRBTnJPNzVBSWF2d0FBQUFBQU5yTzdBQUNBdndBQUFBQUFBSUMvQUFDQXZ4ZzNUNzRBQUlDLzVBSWF2eGczVDc0QUFJQy81QUlhdndBQUFBQUFBSUMvNUFJYXZ3QUFBQUFBTnJPNzVBSWF2eGczVDc0QU5yTzdBQUNBUHhnM1Q3NEFBSUMvQUFDQVB3QUFBQUFBQUlDLzVBSWF2eGczVDc0QUFJQS81QUlhdndBQUFBQUFBSUEvNUFJYXZ3QUFBQUFBQUlBLzVBSWF2eGczVDc0QUFJQS9BQUNBdnhnM1Q3NEFBSUEvQUFDQXZ3QUFBQUFBQUlBL0FBQ0FQd0FBQUFBQUFJQy9BQUNBUHhnM1Q3NEFBSUMvQUFDQVB4ZzNUNzRBQUlBL0FBQ0FQd0FBQUFBQUFJQS9BQUNBdndBQUFBQUFBSUEvQUFDQXZ4ZzNUNzRBQUlBL0FBQ0F2eGczVDc0QUFJQy9BQUNBdndBQUFBQUFBSUMvQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FOUjBJUHdBQUFBREQwRmkvTlIwSVB3QUFBQUREMEZpL05SMElQd0FBQUFERDBGaS9OUjBJUHdBQUFBREQwRmkvQUFBQUFQLy9mejhBQUFBQUFBQUFBUC8vZno4QUFBQUFBQUFBQVAvL2Z6OEFBQUFBQUFBQUFQLy9mNzhBQUFDQUFBQUFBUC8vZjc4QUFBQ0FBQUFBQVAvL2Y3OEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFBQUFBQUFBQUFBQUlBL0FBQUFBQUFBQUFBQUFJQS9BQUFBQUFBQUFBQUFBSUEvQUFBQUFBQUFBQUFBQUlBL0RRd0hQd0FBQUFCUmUxay9EUXdIUHdBQUFBQlJlMWsvRFF3SFB3QUFBQUJSZTFrL0RRd0hQd0FBQUFCUmUxay9BQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQUFBQUFBQUlBQUFJQy9BQUFBQUFBQUFJQUFBSUMvQUFBQUFBQUFBSUFBQUlDL0FBQUFBQUFBQUlBQUFJQy9BQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBQUFDQVB3QUFBSUFBQUFDQUFBQ0FQd0FBQUlBQUFBQ0FBQUNBUHdBQUFJQUFBQUNBQUFDQVB3QUFBSUFBQUFDQUFBQUFBQUFBZ0Q4QUFBQUFBQUFBQURqNlN6NEFBQUFBT1BwTFBwU1ovajQ0K2tzK0FBQ0FQd0FBZ0Q4QUFJQS9BQUNBUHdBQWdEODQra3MrbEpuK1BqajZTejZVbWY0K0FBQ0FQd0FBQUFBNCtrcytsSm4rUGdBQWdEOEFBSUEvQUFDQVB3QUFBQUFBQUlBL0FBQ0FQemo2U3o2VW1mNCtPUHBMUHBTWi9qNDQra3MrQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBZ0Q4NCtrcytBQUNBUHpqNlN6NEFBQUFBT1BwTFBnQUFBQUE0K2tzK2xKbitQamo2U3o2VW1mNCtBQUFBQUFBQUFBQUFBQUFBQUFBQUFEajZTejRBQUFBQU9QcExQZ0FBQUFBNCtrcytsSm4rUGpqNlN6NlVtZjQrQUFDQVB3QUFBQUFBQUlBL0FBQUFBRGo2U3o0QUFJQS9PUHBMUGdBQWdEODQra3MrQUFDQVB6ajZTejRBQUlBL0FBQUFBQUFBZ0Q4QUFBQUFBQUNBUHdBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUlBL0FBQ0FQd0FBZ0Q4QUFJQS9BQUFBQUFBQWdEOEFBQUFBQUFDQVB3QUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBRUFBZ0FBQUFJQUF3QUFBQU1BQkFBRkFBWUFCd0FGQUFjQUNBQUpBQW9BQ3dBTUFBMEFEZ0FQQUJBQUVRQVBBQkVBRWdBVEFBOEFFZ0FVQUJVQUZnQVVBQllBRndBWUFCa0FHZ0FZQUJvQUd3QWNBQjBBSGdBY0FCNEFId0FYQUJZQUlBQVhBQ0FBSVFBaUFDTUFKQUFpQUNRQUpRQW1BQ2NBS0FBbUFDZ0FLUUFxQUNzQUxBQXFBQ3dBTFFBPSIKICAgICAgICB9CiAgICBdCn0K"},function(t,e,i){"use strict";i.r(e),e.default="data:model/gltf+json;base64,ewogICAgImFzc2V0IiA6IHsKICAgICAgICAiZ2VuZXJhdG9yIiA6ICJLaHJvbm9zIGdsVEYgQmxlbmRlciBJL08gdjEuMi43NSIsCiAgICAgICAgInZlcnNpb24iIDogIjIuMCIKICAgIH0sCiAgICAic2NlbmUiIDogMCwKICAgICJzY2VuZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlNjZW5lIiwKICAgICAgICAgICAgIm5vZGVzIiA6IFsKICAgICAgICAgICAgICAgIDAKICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAibm9kZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm1lc2giIDogMCwKICAgICAgICAgICAgIm5hbWUiIDogInJld2luZCIsCiAgICAgICAgICAgICJyb3RhdGlvbiIgOiBbCiAgICAgICAgICAgICAgICAwLjcwNzEwNjc2OTA4NDkzMDQsCiAgICAgICAgICAgICAgICAwLAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDAuNzA3MTA2NzY5MDg0OTMwNAogICAgICAgICAgICBdCiAgICAgICAgfQogICAgXSwKICAgICJtZXNoZXMiIDogWwogICAgICAgIHsKICAgICAgICAgICAgIm5hbWUiIDogIlBsYW5lLjAwMyIsCiAgICAgICAgICAgICJwcmltaXRpdmVzIiA6IFsKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAiYXR0cmlidXRlcyIgOiB7CiAgICAgICAgICAgICAgICAgICAgICAgICJQT1NJVElPTiIgOiAwLAogICAgICAgICAgICAgICAgICAgICAgICAiTk9STUFMIiA6IDEsCiAgICAgICAgICAgICAgICAgICAgICAgICJURVhDT09SRF8wIiA6IDIKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgICJpbmRpY2VzIiA6IDMKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0sCiAgICAiYWNjZXNzb3JzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDAsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjYsCiAgICAgICAgICAgICJjb3VudCIgOiA0MCwKICAgICAgICAgICAgIm1heCIgOiBbCiAgICAgICAgICAgICAgICAxLAogICAgICAgICAgICAgICAgMCwKICAgICAgICAgICAgICAgIDEKICAgICAgICAgICAgXSwKICAgICAgICAgICAgIm1pbiIgOiBbCiAgICAgICAgICAgICAgICAtMSwKICAgICAgICAgICAgICAgIC0wLjE5NzQ5NzA4NDczNjgyNDA0LAogICAgICAgICAgICAgICAgLTEKICAgICAgICAgICAgXSwKICAgICAgICAgICAgInR5cGUiIDogIlZFQzMiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDEsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjYsCiAgICAgICAgICAgICJjb3VudCIgOiA0MCwKICAgICAgICAgICAgInR5cGUiIDogIlZFQzMiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDIsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjYsCiAgICAgICAgICAgICJjb3VudCIgOiA0MCwKICAgICAgICAgICAgInR5cGUiIDogIlZFQzIiCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXJWaWV3IiA6IDMsCiAgICAgICAgICAgICJjb21wb25lbnRUeXBlIiA6IDUxMjMsCiAgICAgICAgICAgICJjb3VudCIgOiA2MCwKICAgICAgICAgICAgInR5cGUiIDogIlNDQUxBUiIKICAgICAgICB9CiAgICBdLAogICAgImJ1ZmZlclZpZXdzIiA6IFsKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogNDgwLAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiAwCiAgICAgICAgfSwKICAgICAgICB7CiAgICAgICAgICAgICJidWZmZXIiIDogMCwKICAgICAgICAgICAgImJ5dGVMZW5ndGgiIDogNDgwLAogICAgICAgICAgICAiYnl0ZU9mZnNldCIgOiA0ODAKICAgICAgICB9LAogICAgICAgIHsKICAgICAgICAgICAgImJ1ZmZlciIgOiAwLAogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiAzMjAsCiAgICAgICAgICAgICJieXRlT2Zmc2V0IiA6IDk2MAogICAgICAgIH0sCiAgICAgICAgewogICAgICAgICAgICAiYnVmZmVyIiA6IDAsCiAgICAgICAgICAgICJieXRlTGVuZ3RoIiA6IDEyMCwKICAgICAgICAgICAgImJ5dGVPZmZzZXQiIDogMTI4MAogICAgICAgIH0KICAgIF0sCiAgICAiYnVmZmVycyIgOiBbCiAgICAgICAgewogICAgICAgICAgICAiYnl0ZUxlbmd0aCIgOiAxNDAwLAogICAgICAgICAgICAidXJpIiA6ICJkYXRhOmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTtiYXNlNjQsQUFDQVB3QUFBQUFBQUlBL0FBQ0FQNjA4U3I0QUFJQS9KeFk3dTYwOFNyNEFLbmc3SnhZN3V3QUFBQUFBS25nN0FBQ0FQNjA4U3I0QUFJQy9KeFk3dTYwOFNyNEFLbmc3QUFDQVA2MDhTcjRBQUlBL0FBQ0F2d0FBQUFBQTZQaTdBQUNBdjYwOFNyNEE2UGk3QUNDcnU2MDhTcjRBQUlDL0FDQ3J1d0FBQUFBQUFJQy9BQUNBdndBQUFBQUE2UGk3QUNDcnV3QUFBQUFBQUlDL0p4WTd1d0FBQUFBQUtuZzdBR0FFdWdBQUFBQUFBSUEvQUNDcnV3QUFBQUFBQUlDL0FDQ3J1NjA4U3I0QUFJQy9KeFk3dTYwOFNyNEFLbmc3SnhZN3V3QUFBQUFBS25nN0FBQ0FQd0FBQUFBQUFJQy9BQUNBUHdBQUFBQUFBSUEvQUNDcnU2MDhTcjRBQUlDL0FBQ0F2NjA4U3I0QTZQaTdBR0FFdXEwOFNyNEFBSUEvSnhZN3V3QUFBQUFBS25nN0p4WTd1NjA4U3I0QUtuZzdBR0FFdXEwOFNyNEFBSUEvQUdBRXVnQUFBQUFBQUlBL0FBQ0FQd0FBQUFBQUFJQy9BQUNBUDYwOFNyNEFBSUMvQUFDQVA2MDhTcjRBQUlBL0FBQ0FQd0FBQUFBQUFJQS9KeFk3dXdBQUFBQUFLbmc3SnhZN3U2MDhTcjRBS25nN0FBQ0FQNjA4U3I0QUFJQy9BQUNBUHdBQUFBQUFBSUMvQUdBRXVnQUFBQUFBQUlBL0FHQUV1cTA4U3I0QUFJQS9BQUNBdjYwOFNyNEE2UGk3QUFDQXZ3QUFBQUFBNlBpN3ZXbzBQd0FBQUFDbm5qVy92V28wUHdBQUFBQ25ualcvdldvMFB3QUFBQUNubmpXL3ZXbzBQd0FBQUFDbm5qVy9BQUFBQUFBQWdEOEFBQUFBQUFBQUFBQUFnRDhBQUFBQUFBQUFBQUFBZ0Q4QUFBQUFrTTAwUHdBQUFBQkZQRFUva00wMFB3QUFBQUJGUERVL2tNMDBQd0FBQUFCRlBEVS9rTTAwUHdBQUFBQkZQRFUvQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0w4QUFBQ0FBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQTB2OS92d0FBQUFEbGt4bzcwdjkvdndBQUFBRGxreG83MHY5L3Z3QUFBQURsa3hvNzB2OS92d0FBQUFEbGt4bzdBQUFBQUFBQWdMOEFBQUNBQUFBQUFBQUFnTDhBQUFDQUFBQUFBQUFBZ0Q4QUFBQ0FBQUFBQUFBQWdEOEFBQUNBQUFBQUFBQUFnRDhBQUFDQTBQOS92d0FBQUFEamt4bzcwUDkvdndBQUFBRGpreG83MFA5L3Z3QUFBQURqa3hvNzBQOS92d0FBQUFEamt4bzdBQUNBdndBQUFBQUFBQUNBQUFDQXZ3QUFBQUFBQUFDQUFBQ0F2d0FBQUFBQUFBQ0FBQUNBdndBQUFBQUFBQUNBZHhvMVB3QUFBQUJyN3pRL2R4bzFQd0FBQUFCcjd6US9keG8xUHdBQUFBQnI3elEvZHhvMVB3QUFBQUJyN3pRL25iODFQd0FBQUFDSlNUUy9uYjgxUHdBQUFBQ0pTVFMvbmI4MVB3QUFBQUNKU1RTL25iODFQd0FBQUFDSlNUUy9BQUNBUHdBQWdEOEFBSUEvQUFDQVArcEUvejRWZkFBLzZrVC9QaFY4QUQ4QUFJQS9BQUFBQU9wRS96NFZmQUEvQUFDQVB3QUFnRDhBQUFBQU1BNytQZ0FBQUFBd0R2NCt3S24rUGdBQUFBREFxZjQrQUFBQUFBQUFBQUF3RHY0K3dLbitQZ0FBQUFEcVJQOCtGWHdBUCtqZS96NEFBSUEvd0tuK1BnQUFBQURBcWY0K0FBQUFBT3BFL3o0VmZBQS82a1QvUGhWOEFEOEFBSUEvQUFBQUFBQUFnRDhBQUlBL3dLbitQZ0FBQUFBQUFBQUFNQTcrUHVqZS96NEFBSUEvNmtUL1BoVjhBRC9xUlA4K0ZYd0FQK2plL3o0QUFJQS82TjcvUGdBQWdEOEFBSUEvQUFBQUFBQUFnRDhBQUFBQUFBQ0FQd0FBZ0Q4QUFJQS9BQUNBUCtwRS96NFZmQUEvNmtUL1BoVjhBRDhBQUlBL0FBQUFBQUFBZ0Q4QUFBQUE2TjcvUGdBQWdEL28zdjgrQUFDQVB3QUFBQUF3RHY0K0FBQUFBREFPL2o0QUFBRUFBZ0FBQUFJQUF3QUVBQVVBQmdBSEFBZ0FDUUFIQUFrQUNnQUxBQXdBRFFBT0FBc0FEUUFQQUJBQUVRQVBBQkVBRWdBVEFCUUFEUUFGQUJVQUZnQUZBQllBRndBWUFCa0FHZ0FZQUJvQUd3QWNBQjBBSGdBY0FCNEFId0FnQUNFQUlnQWdBQ0lBSXdBa0FDVUFKZ0FrQUNZQUp3QT0iCiAgICAgICAgfQogICAgXQp9Cg=="},function(t,e,i){"use strict";i.r(e),e.default="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAC70lEQVR42u3by04TURzH8W+nFx0kMUBbE6eNiSCXjQlxZQKU2qUbSERfwUQQ0ATfwATYGCPxHSwoLtzZ9ObWGIMRSDDRlFlIW1xIUuxtXHQ0gC1MTRM6nfNPupmeaef3OTNnziRzbJqmcUy5gDH9cx24qG9r5toDtoEPwCvgNZCv1dh2DMA4sAD0YO7aAh4BL6t9KVXZZgfm9R3MHh49w4qeyX4SgB14DMzRejWnZ7PXAmjl8DURDo4B8y0e/mAt6OPCX4BbQBhr1QSwbNM0zQV8AXwWA1CBy5IuYbXwAApwW9InOVatMZumaV+BS0b3KBSK5XgyqcYSSXXt01o2k87k8sVi+TSOvk2WHV6vV+7r7e0IBoaVkaFhxel0SHX8xDebpmn7wBkjrWPxhPp06fnHlLq914zd6Vd87VP37l4NBgJGL+m8TTvhYeBgz49P3HnzPb2Ta+Zz2uv2yKvLL24aPRMMny6RaDTV7OEBdjLp3NtIJGW0vWGAWDyhmmVkiyXfqQ0H+LyxvmsWgPU6jtUwQDa7u28WgGwmu99wgHyhUDYLQD23ZQmLlwAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAByqc22ywyyhXA7jL0oZbtjV6ZbNAtDl7jrbcIArPd3nzQIw0D/Q2XCA0cCIYhaA0eEhpeEAoWDQf8HjbfrLwOv2yKHQDX89AD+NNHQ6HdLs9NSgX/G1N2t4v+Jrfzhzf9DldBrt2LxN07RNoNfonxQKxXIkGk1F4wl1Y3PjR3onkyuUTudVWafdIXm8brm/r78jGBhRQsGg/39elQ1TWS9gxVqRgFULz4NWrb5goluisqjwgQV7fxb49WfACAOLFgq/qGc+tGrMDjwBJls8/BIwDZSOToRKwAzwzCrhq80EWxnhn/C1psIlYEqfG2y1QPAtKivjJo+GPzoGVH201nceB65RWWrmbPLABf0W957K8vkwxyyf/w0kIOOe2pS1LAAAAABJRU5ErkJggg=="},function(t,e,i){"use strict";i.r(e);class n{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const i=this._listeners[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const i=e.slice(0);for(let e=0,n=i.length;e<n;e++)i[e].call(this,t);t.target=null}}}const r=Math.PI/180,a=180/Math.PI,s=[];for(let t=0;t<256;t++)s[t]=(t<16?"0":"")+t.toString(16);const o="undefined"!=typeof crypto&&"randomUUID"in crypto;function l(){if(o)return crypto.randomUUID().toUpperCase();const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(s[255&t]+s[t>>8&255]+s[t>>16&255]+s[t>>24&255]+"-"+s[255&e]+s[e>>8&255]+"-"+s[e>>16&15|64]+s[e>>24&255]+"-"+s[63&i|128]+s[i>>8&255]+"-"+s[i>>16&255]+s[i>>24&255]+s[255&n]+s[n>>8&255]+s[n>>16&255]+s[n>>24&255]).toUpperCase()}function h(t,e,i){return Math.max(e,Math.min(i,t))}function c(t,e){return(t%e+e)%e}function u(t,e,i){return(1-i)*t+i*e}function d(t){return 0==(t&t-1)&&0!==t}function p(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}class f{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(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}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){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}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*i-a*n+t.x,this.y=r*n+a*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}f.prototype.isVector2=!0;class g{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,i,n,r,a,s,o,l){const h=this.elements;return h[0]=t,h[1]=n,h[2]=s,h[3]=e,h[4]=r,h[5]=o,h[6]=i,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const 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],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,a=i[0],s=i[3],o=i[6],l=i[1],h=i[4],c=i[7],u=i[2],d=i[5],p=i[8],f=n[0],g=n[3],m=n[6],y=n[1],b=n[4],v=n[7],x=n[2],_=n[5],A=n[8];return r[0]=a*f+s*y+o*x,r[3]=a*g+s*b+o*_,r[6]=a*m+s*v+o*A,r[1]=l*f+h*y+c*x,r[4]=l*g+h*b+c*_,r[7]=l*m+h*v+c*A,r[2]=u*f+d*y+p*x,r[5]=u*g+d*b+p*_,r[8]=u*m+d*v+p*A,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],h=t[8];return e*a*h-e*s*l-i*r*h+i*s*o+n*r*l-n*a*o}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],h=t[8],c=h*a-s*l,u=s*o-h*r,d=l*r-a*o,p=e*c+i*u+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=c*f,t[1]=(n*l-h*i)*f,t[2]=(s*i-n*a)*f,t[3]=u*f,t[4]=(h*e-n*o)*f,t[5]=(n*r-s*e)*f,t[6]=d*f,t[7]=(i*o-l*e)*f,t[8]=(a*e-i*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,r,a,s){const o=Math.cos(r),l=Math.sin(r);return this.set(i*o,i*l,-i*(o*a+l*s)+a+t,-n*l,n*o,-n*(-l*a+o*s)+s+e,0,0,1),this}scale(t,e){const i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),n=this.elements,r=n[0],a=n[3],s=n[6],o=n[1],l=n[4],h=n[7];return n[0]=e*r+i*o,n[3]=e*a+i*l,n[6]=e*s+i*h,n[1]=-i*r+e*o,n[4]=-i*a+e*l,n[7]=-i*s+e*h,this}translate(t,e){const i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const 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}clone(){return(new this.constructor).fromArray(this.elements)}}function m(t){if(0===t.length)return-1/0;let e=t[0];for(let i=1,n=t.length;i<n;++i)t[i]>e&&(e=t[i]);return e}g.prototype.isMatrix3=!0;Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;function y(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}let b;class v{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===b&&(b=y("canvas")),b.width=t.width,b.height=t.height;const i=b.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=b}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}}let x=0;class _ extends n{constructor(t=_.DEFAULT_IMAGE,e=_.DEFAULT_MAPPING,i=1001,n=1001,r=1006,a=1008,s=1023,o=1009,h=1,c=3e3){super(),Object.defineProperty(this,"id",{value:x++}),this.uuid=l(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=a,this.anisotropy=h,this.format=s,this.internalFormat=null,this.type=o,this.offset=new f(0,0),this.repeat=new f(1,1),this.center=new f(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new g,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const n=this.image;if(void 0===n.uuid&&(n.uuid=l()),!e&&void 0===t.images[n.uuid]){let e;if(Array.isArray(n)){e=[];for(let t=0,i=n.length;t<i;t++)n[t].isDataTexture?e.push(A(n[t].image)):e.push(A(n[t]))}else e=A(n);t.images[n.uuid]={uuid:n.uuid,url:e}}i.image=n.uuid}return e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&this.version++}}function A(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?v.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}_.DEFAULT_IMAGE=void 0,_.DEFAULT_MAPPING=300,_.prototype.isTexture=!0;class w{constructor(t=0,e=0,i=0,n=1){this.x=t,this.y=e,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .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.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .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.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*e+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*e+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*e+a[7]*i+a[11]*n+a[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,n,r;const a=t.elements,s=a[0],o=a[4],l=a[8],h=a[1],c=a[5],u=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(o-h)<.01&&Math.abs(l-d)<.01&&Math.abs(u-p)<.01){if(Math.abs(o+h)<.1&&Math.abs(l+d)<.1&&Math.abs(u+p)<.1&&Math.abs(s+c+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const t=(s+1)/2,a=(c+1)/2,g=(f+1)/2,m=(o+h)/4,y=(l+d)/4,b=(u+p)/4;return t>a&&t>g?t<.01?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(t),n=m/i,r=y/i):a>g?a<.01?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(a),i=m/n,r=b/n):g<.01?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(g),i=y/r,n=b/r),this.set(i,n,r,e),this}let g=Math.sqrt((p-u)*(p-u)+(l-d)*(l-d)+(h-o)*(h-o));return Math.abs(g)<.001&&(g=1),this.x=(p-u)/g,this.y=(l-d)/g,this.z=(h-o)/g,this.w=Math.acos((s+c+f-1)/2),this}min(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.w=Math.min(this.w,t.w),this}max(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.w=Math.max(this.w,t.w),this}clamp(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.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(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.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){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.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(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.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}w.prototype.isVector4=!0;class C extends n{constructor(t,e,i={}){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new w(0,0,t,e),this.scissorTest=!1,this.viewport=new w(0,0,t,e),this.texture=new _(void 0,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.isRenderTargetTexture=!0,this.texture.image={width:t,height:e,depth:1},this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.internalFormat=void 0!==i.internalFormat?i.internalFormat:null,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:1006,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0!==i.stencilBuffer&&i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null}setTexture(t){t.image={width:this.width,height:this.height,depth:this.depth},this.texture=t}setSize(t,e,i=1){this.width===t&&this.height===e&&this.depth===i||(this.width=t,this.height=e,this.depth=i,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.image={...this.texture.image},this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}C.prototype.isWebGLRenderTarget=!0;(class extends C{constructor(t,e,i){super(t,e);const n=this.texture;this.texture=[];for(let t=0;t<i;t++)this.texture[t]=n.clone()}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let n=0,r=this.texture.length;n<r;n++)this.texture[n].image.width=t,this.texture[n].image.height=e,this.texture[n].image.depth=i;this.dispose()}return this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e),this}copy(t){this.dispose(),this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this.texture.length=0;for(let e=0,i=t.texture.length;e<i;e++)this.texture[e]=t.texture[e].clone();return this}}).prototype.isWebGLMultipleRenderTargets=!0;class M extends C{constructor(t,e,i){super(t,e,i),this.samples=4}copy(t){return super.copy.call(this,t),this.samples=t.samples,this}}M.prototype.isWebGLMultisampleRenderTarget=!0;class E{constructor(t=0,e=0,i=0,n=1){this._x=t,this._y=e,this._z=i,this._w=n}static slerp(t,e,i,n){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),i.slerpQuaternions(t,e,n)}static slerpFlat(t,e,i,n,r,a,s){let o=i[n+0],l=i[n+1],h=i[n+2],c=i[n+3];const u=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(0===s)return t[e+0]=o,t[e+1]=l,t[e+2]=h,void(t[e+3]=c);if(1===s)return t[e+0]=u,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(c!==f||o!==u||l!==d||h!==p){let t=1-s;const e=o*u+l*d+h*p+c*f,i=e>=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const r=Math.sqrt(n),a=Math.atan2(r,e*i);t=Math.sin(t*a)/r,s=Math.sin(s*a)/r}const r=s*i;if(o=o*t+u*r,l=l*t+d*r,h=h*t+p*r,c=c*t+f*r,t===1-s){const t=1/Math.sqrt(o*o+l*l+h*h+c*c);o*=t,l*=t,h*=t,c*=t}}t[e]=o,t[e+1]=l,t[e+2]=h,t[e+3]=c}static multiplyQuaternionsFlat(t,e,i,n,r,a){const s=i[n],o=i[n+1],l=i[n+2],h=i[n+3],c=r[a],u=r[a+1],d=r[a+2],p=r[a+3];return t[e]=s*p+h*c+o*d-l*u,t[e+1]=o*p+h*u+l*c-s*d,t[e+2]=l*p+h*d+s*u-o*c,t[e+3]=h*p-s*c-o*u-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const i=t._x,n=t._y,r=t._z,a=t._order,s=Math.cos,o=Math.sin,l=s(i/2),h=s(n/2),c=s(r/2),u=o(i/2),d=o(n/2),p=o(r/2);switch(a){case"XYZ":this._x=u*h*c+l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c-u*d*p;break;case"YXZ":this._x=u*h*c+l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c+u*d*p;break;case"ZXY":this._x=u*h*c-l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c-u*d*p;break;case"ZYX":this._x=u*h*c-l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c+u*d*p;break;case"YZX":this._x=u*h*c+l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c-u*d*p;break;case"XZY":this._x=u*h*c-l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],r=e[8],a=e[1],s=e[5],o=e[9],l=e[2],h=e[6],c=e[10],u=i+s+c;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(h-o)*t,this._y=(r-l)*t,this._z=(a-n)*t}else if(i>s&&i>c){const t=2*Math.sqrt(1+i-s-c);this._w=(h-o)/t,this._x=.25*t,this._y=(n+a)/t,this._z=(r+l)/t}else if(s>c){const t=2*Math.sqrt(1+s-i-c);this._w=(r-l)/t,this._x=(n+a)/t,this._y=.25*t,this._z=(o+h)/t}else{const t=2*Math.sqrt(1+c-i-s);this._w=(a-n)/t,this._x=(r+l)/t,this._y=(o+h)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(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(t){return 2*Math.acos(Math.abs(h(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let 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(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(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,r=t._z,a=t._w,s=e._x,o=e._y,l=e._z,h=e._w;return this._x=i*h+a*s+n*l-r*o,this._y=n*h+a*o+r*s-i*l,this._z=r*h+a*l+i*o-n*s,this._w=a*h-i*s-n*o-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,r=this._z,a=this._w;let s=a*t._w+i*t._x+n*t._y+r*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=a,this._x=i,this._y=n,this._z=r,this;const o=1-s*s;if(o<=Number.EPSILON){const t=1-e;return this._w=t*a+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(o),h=Math.atan2(l,s),c=Math.sin((1-e)*h)/l,u=Math.sin(e*h)/l;return this._w=a*c+this._w*u,this._x=i*c+this._x*u,this._y=n*c+this._y*u,this._z=r*c+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,i){this.copy(t).slerp(e,i)}random(){const t=Math.random(),e=Math.sqrt(1-t),i=Math.sqrt(t),n=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(n),i*Math.sin(r),i*Math.cos(r),e*Math.sin(n))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}E.prototype.isQuaternion=!0;class I{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(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(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(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(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(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(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(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(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(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(T.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(T.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=t.elements,a=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*a,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*a,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,r=t.x,a=t.y,s=t.z,o=t.w,l=o*e+a*n-s*i,h=o*i+s*e-r*n,c=o*n+r*i-a*e,u=-r*e-a*i-s*n;return this.x=l*o+u*-r+h*-s-c*-a,this.y=h*o+u*-a+c*-r-l*-s,this.z=c*o+u*-s+l*-a-h*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(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(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(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(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(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){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(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(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(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(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(t,e){const i=t.x,n=t.y,r=t.z,a=e.x,s=e.y,o=e.z;return this.x=n*o-r*s,this.y=r*a-i*o,this.z=i*s-n*a,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return S.copy(this).projectOnVector(t),this.sub(S)}reflect(t){return this.sub(S.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(h(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(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}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,i=Math.sqrt(1-t**2);return this.x=i*Math.cos(e),this.y=i*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}I.prototype.isVector3=!0;const S=new I,T=new E;class B{constructor(t=new I(1/0,1/0,1/0),e=new I(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,s=-1/0;for(let o=0,l=t.length;o<l;o+=3){const l=t[o],h=t[o+1],c=t[o+2];l<e&&(e=l),h<i&&(i=h),c<n&&(n=c),l>r&&(r=l),h>a&&(a=h),c>s&&(s=c)}return this.min.set(e,i,n),this.max.set(r,a,s),this}setFromBufferAttribute(t){let e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,s=-1/0;for(let o=0,l=t.count;o<l;o++){const l=t.getX(o),h=t.getY(o),c=t.getZ(o);l<e&&(e=l),h<i&&(i=h),c<n&&(n=c),l>r&&(r=l),h>a&&(a=h),c>s&&(s=c)}return this.min.set(e,i,n),this.max.set(r,a,s),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=U.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t){return this.makeEmpty(),this.expandByObject(t)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t){t.updateWorldMatrix(!1,!1);const e=t.geometry;void 0!==e&&(null===e.boundingBox&&e.computeBoundingBox(),L.copy(e.boundingBox),L.applyMatrix4(t.matrixWorld),this.union(L));const i=t.children;for(let t=0,e=i.length;t<e;t++)this.expandByObject(i[t]);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,U),U.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(O),Q.subVectors(this.max,O),R.subVectors(t.a,O),D.subVectors(t.b,O),N.subVectors(t.c,O),P.subVectors(D,R),k.subVectors(N,D),z.subVectors(R,N);let e=[0,-P.z,P.y,0,-k.z,k.y,0,-z.z,z.y,P.z,0,-P.x,k.z,0,-k.x,z.z,0,-z.x,-P.y,P.x,0,-k.y,k.x,0,-z.y,z.x,0];return!!G(e,R,D,N,Q)&&(e=[1,0,0,0,1,0,0,0,1],!!G(e,R,D,N,Q)&&(V.crossVectors(P,k),e=[V.x,V.y,V.z],G(e,R,D,N,Q)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return U.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(U).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(F[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),F[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),F[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),F[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),F[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),F[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),F[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),F[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(F)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}B.prototype.isBox3=!0;const F=[new I,new I,new I,new I,new I,new I,new I,new I],U=new I,L=new B,R=new I,D=new I,N=new I,P=new I,k=new I,z=new I,O=new I,Q=new I,V=new I,H=new I;function G(t,e,i,n,r){for(let a=0,s=t.length-3;a<=s;a+=3){H.fromArray(t,a);const s=r.x*Math.abs(H.x)+r.y*Math.abs(H.y)+r.z*Math.abs(H.z),o=e.dot(H),l=i.dot(H),h=n.dot(H);if(Math.max(-Math.max(o,l,h),Math.min(o,l,h))>s)return!1}return!0}const j=new B,W=new I,q=new I,Z=new I;class J{constructor(t=new I,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):j.setFromPoints(t).getCenter(i);let n=0;for(let e=0,r=t.length;e<r;e++)n=Math.max(n,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(n),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){Z.subVectors(t,this.center);const e=Z.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.add(Z.multiplyScalar(i/t)),this.radius+=i}return this}union(t){return q.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(W.copy(t.center).add(q)),this.expandByPoint(W.copy(t.center).sub(q)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const X=new I,Y=new I,K=new I,$=new I,tt=new I,et=new I,it=new I;class nt{constructor(t=new I,e=new I(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,X)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=X.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(X.copy(this.direction).multiplyScalar(e).add(this.origin),X.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){Y.copy(t).add(e).multiplyScalar(.5),K.copy(e).sub(t).normalize(),$.copy(this.origin).sub(Y);const r=.5*t.distanceTo(e),a=-this.direction.dot(K),s=$.dot(this.direction),o=-$.dot(K),l=$.lengthSq(),h=Math.abs(1-a*a);let c,u,d,p;if(h>0)if(c=a*o-s,u=a*s-o,p=r*h,c>=0)if(u>=-p)if(u<=p){const t=1/h;c*=t,u*=t,d=c*(c+a*u+2*s)+u*(a*c+u+2*o)+l}else u=r,c=Math.max(0,-(a*u+s)),d=-c*c+u*(u+2*o)+l;else u=-r,c=Math.max(0,-(a*u+s)),d=-c*c+u*(u+2*o)+l;else u<=-p?(c=Math.max(0,-(-a*r+s)),u=c>0?-r:Math.min(Math.max(-r,-o),r),d=-c*c+u*(u+2*o)+l):u<=p?(c=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+l):(c=Math.max(0,-(a*r+s)),u=c>0?r:Math.min(Math.max(-r,-o),r),d=-c*c+u*(u+2*o)+l);else u=a>0?-r:r,c=Math.max(0,-(a*u+s)),d=-c*c+u*(u+2*o)+l;return i&&i.copy(this.direction).multiplyScalar(c).add(this.origin),n&&n.copy(K).multiplyScalar(u).add(Y),d}intersectSphere(t,e){X.subVectors(t.center,this.origin);const i=X.dot(this.direction),n=X.dot(X)-i*i,r=t.radius*t.radius;if(n>r)return null;const a=Math.sqrt(r-n),s=i-a,o=i+a;return s<0&&o<0?null:s<0?this.at(o,e):this.at(s,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,n,r,a,s,o;const l=1/this.direction.x,h=1/this.direction.y,c=1/this.direction.z,u=this.origin;return l>=0?(i=(t.min.x-u.x)*l,n=(t.max.x-u.x)*l):(i=(t.max.x-u.x)*l,n=(t.min.x-u.x)*l),h>=0?(r=(t.min.y-u.y)*h,a=(t.max.y-u.y)*h):(r=(t.max.y-u.y)*h,a=(t.min.y-u.y)*h),i>a||r>n?null:((r>i||i!=i)&&(i=r),(a<n||n!=n)&&(n=a),c>=0?(s=(t.min.z-u.z)*c,o=(t.max.z-u.z)*c):(s=(t.max.z-u.z)*c,o=(t.min.z-u.z)*c),i>o||s>n?null:((s>i||i!=i)&&(i=s),(o<n||n!=n)&&(n=o),n<0?null:this.at(i>=0?i:n,e)))}intersectsBox(t){return null!==this.intersectBox(t,X)}intersectTriangle(t,e,i,n,r){tt.subVectors(e,t),et.subVectors(i,t),it.crossVectors(tt,et);let a,s=this.direction.dot(it);if(s>0){if(n)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}$.subVectors(this.origin,t);const o=a*this.direction.dot(et.crossVectors($,et));if(o<0)return null;const l=a*this.direction.dot(tt.cross($));if(l<0)return null;if(o+l>s)return null;const h=-a*$.dot(it);return h<0?null:this.at(h/s,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class rt{constructor(){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.")}set(t,e,i,n,r,a,s,o,l,h,c,u,d,p,f,g){const m=this.elements;return m[0]=t,m[4]=e,m[8]=i,m[12]=n,m[1]=r,m[5]=a,m[9]=s,m[13]=o,m[2]=l,m[6]=h,m[10]=c,m[14]=u,m[3]=d,m[7]=p,m[11]=f,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new rt).fromArray(this.elements)}copy(t){const 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(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(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(t){const e=this.elements,i=t.elements,n=1/at.setFromMatrixColumn(t,0).length(),r=1/at.setFromMatrixColumn(t,1).length(),a=1/at.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*a,e[9]=i[9]*a,e[10]=i[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,i=t.x,n=t.y,r=t.z,a=Math.cos(i),s=Math.sin(i),o=Math.cos(n),l=Math.sin(n),h=Math.cos(r),c=Math.sin(r);if("XYZ"===t.order){const t=a*h,i=a*c,n=s*h,r=s*c;e[0]=o*h,e[4]=-o*c,e[8]=l,e[1]=i+n*l,e[5]=t-r*l,e[9]=-s*o,e[2]=r-t*l,e[6]=n+i*l,e[10]=a*o}else if("YXZ"===t.order){const t=o*h,i=o*c,n=l*h,r=l*c;e[0]=t+r*s,e[4]=n*s-i,e[8]=a*l,e[1]=a*c,e[5]=a*h,e[9]=-s,e[2]=i*s-n,e[6]=r+t*s,e[10]=a*o}else if("ZXY"===t.order){const t=o*h,i=o*c,n=l*h,r=l*c;e[0]=t-r*s,e[4]=-a*c,e[8]=n+i*s,e[1]=i+n*s,e[5]=a*h,e[9]=r-t*s,e[2]=-a*l,e[6]=s,e[10]=a*o}else if("ZYX"===t.order){const t=a*h,i=a*c,n=s*h,r=s*c;e[0]=o*h,e[4]=n*l-i,e[8]=t*l+r,e[1]=o*c,e[5]=r*l+t,e[9]=i*l-n,e[2]=-l,e[6]=s*o,e[10]=a*o}else if("YZX"===t.order){const t=a*o,i=a*l,n=s*o,r=s*l;e[0]=o*h,e[4]=r-t*c,e[8]=n*c+i,e[1]=c,e[5]=a*h,e[9]=-s*h,e[2]=-l*h,e[6]=i*c+n,e[10]=t-r*c}else if("XZY"===t.order){const t=a*o,i=a*l,n=s*o,r=s*l;e[0]=o*h,e[4]=-c,e[8]=l*h,e[1]=t*c+r,e[5]=a*h,e[9]=i*c-n,e[2]=n*c-i,e[6]=s*h,e[10]=r*c+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(ot,t,lt)}lookAt(t,e,i){const n=this.elements;return ut.subVectors(t,e),0===ut.lengthSq()&&(ut.z=1),ut.normalize(),ht.crossVectors(i,ut),0===ht.lengthSq()&&(1===Math.abs(i.z)?ut.x+=1e-4:ut.z+=1e-4,ut.normalize(),ht.crossVectors(i,ut)),ht.normalize(),ct.crossVectors(ut,ht),n[0]=ht.x,n[4]=ct.x,n[8]=ut.x,n[1]=ht.y,n[5]=ct.y,n[9]=ut.y,n[2]=ht.z,n[6]=ct.z,n[10]=ut.z,this}multiply(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(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,a=i[0],s=i[4],o=i[8],l=i[12],h=i[1],c=i[5],u=i[9],d=i[13],p=i[2],f=i[6],g=i[10],m=i[14],y=i[3],b=i[7],v=i[11],x=i[15],_=n[0],A=n[4],w=n[8],C=n[12],M=n[1],E=n[5],I=n[9],S=n[13],T=n[2],B=n[6],F=n[10],U=n[14],L=n[3],R=n[7],D=n[11],N=n[15];return r[0]=a*_+s*M+o*T+l*L,r[4]=a*A+s*E+o*B+l*R,r[8]=a*w+s*I+o*F+l*D,r[12]=a*C+s*S+o*U+l*N,r[1]=h*_+c*M+u*T+d*L,r[5]=h*A+c*E+u*B+d*R,r[9]=h*w+c*I+u*F+d*D,r[13]=h*C+c*S+u*U+d*N,r[2]=p*_+f*M+g*T+m*L,r[6]=p*A+f*E+g*B+m*R,r[10]=p*w+f*I+g*F+m*D,r[14]=p*C+f*S+g*U+m*N,r[3]=y*_+b*M+v*T+x*L,r[7]=y*A+b*E+v*B+x*R,r[11]=y*w+b*I+v*F+x*D,r[15]=y*C+b*S+v*U+x*N,this}multiplyScalar(t){const 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}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],a=t[1],s=t[5],o=t[9],l=t[13],h=t[2],c=t[6],u=t[10],d=t[14];return t[3]*(+r*o*c-n*l*c-r*s*u+i*l*u+n*s*d-i*o*d)+t[7]*(+e*o*d-e*l*u+r*a*u-n*a*d+n*l*h-r*o*h)+t[11]*(+e*l*c-e*s*d-r*a*c+i*a*d+r*s*h-i*l*h)+t[15]*(-n*s*h-e*o*c+e*s*u+n*a*c-i*a*u+i*o*h)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],h=t[8],c=t[9],u=t[10],d=t[11],p=t[12],f=t[13],g=t[14],m=t[15],y=c*g*l-f*u*l+f*o*d-s*g*d-c*o*m+s*u*m,b=p*u*l-h*g*l-p*o*d+a*g*d+h*o*m-a*u*m,v=h*f*l-p*c*l+p*s*d-a*f*d-h*s*m+a*c*m,x=p*c*o-h*f*o-p*s*u+a*f*u+h*s*g-a*c*g,_=e*y+i*b+n*v+r*x;if(0===_)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const A=1/_;return t[0]=y*A,t[1]=(f*u*r-c*g*r-f*n*d+i*g*d+c*n*m-i*u*m)*A,t[2]=(s*g*r-f*o*r+f*n*l-i*g*l-s*n*m+i*o*m)*A,t[3]=(c*o*r-s*u*r-c*n*l+i*u*l+s*n*d-i*o*d)*A,t[4]=b*A,t[5]=(h*g*r-p*u*r+p*n*d-e*g*d-h*n*m+e*u*m)*A,t[6]=(p*o*r-a*g*r-p*n*l+e*g*l+a*n*m-e*o*m)*A,t[7]=(a*u*r-h*o*r+h*n*l-e*u*l-a*n*d+e*o*d)*A,t[8]=v*A,t[9]=(p*c*r-h*f*r-p*i*d+e*f*d+h*i*m-e*c*m)*A,t[10]=(a*f*r-p*s*r+p*i*l-e*f*l-a*i*m+e*s*m)*A,t[11]=(h*s*r-a*c*r-h*i*l+e*c*l+a*i*d-e*s*d)*A,t[12]=x*A,t[13]=(h*f*n-p*c*n+p*i*u-e*f*u-h*i*g+e*c*g)*A,t[14]=(p*s*n-a*f*n-p*i*o+e*f*o+a*i*g-e*s*g)*A,t[15]=(a*c*n-h*s*n+h*i*o-e*c*o-a*i*u+e*s*u)*A,this}scale(t){const e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){const 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],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const 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(t){const 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(t){const 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(t,e){const i=Math.cos(e),n=Math.sin(e),r=1-i,a=t.x,s=t.y,o=t.z,l=r*a,h=r*s;return this.set(l*a+i,l*s-n*o,l*o+n*s,0,l*s+n*o,h*s+i,h*o-n*a,0,l*o-n*s,h*o+n*a,r*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,r,a){return this.set(1,i,r,0,t,1,a,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,r=e._x,a=e._y,s=e._z,o=e._w,l=r+r,h=a+a,c=s+s,u=r*l,d=r*h,p=r*c,f=a*h,g=a*c,m=s*c,y=o*l,b=o*h,v=o*c,x=i.x,_=i.y,A=i.z;return n[0]=(1-(f+m))*x,n[1]=(d+v)*x,n[2]=(p-b)*x,n[3]=0,n[4]=(d-v)*_,n[5]=(1-(u+m))*_,n[6]=(g+y)*_,n[7]=0,n[8]=(p+b)*A,n[9]=(g-y)*A,n[10]=(1-(u+f))*A,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let r=at.set(n[0],n[1],n[2]).length();const a=at.set(n[4],n[5],n[6]).length(),s=at.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],st.copy(this);const o=1/r,l=1/a,h=1/s;return st.elements[0]*=o,st.elements[1]*=o,st.elements[2]*=o,st.elements[4]*=l,st.elements[5]*=l,st.elements[6]*=l,st.elements[8]*=h,st.elements[9]*=h,st.elements[10]*=h,e.setFromRotationMatrix(st),i.x=r,i.y=a,i.z=s,this}makePerspective(t,e,i,n,r,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const s=this.elements,o=2*r/(e-t),l=2*r/(i-n),h=(e+t)/(e-t),c=(i+n)/(i-n),u=-(a+r)/(a-r),d=-2*a*r/(a-r);return s[0]=o,s[4]=0,s[8]=h,s[12]=0,s[1]=0,s[5]=l,s[9]=c,s[13]=0,s[2]=0,s[6]=0,s[10]=u,s[14]=d,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(t,e,i,n,r,a){const s=this.elements,o=1/(e-t),l=1/(i-n),h=1/(a-r),c=(e+t)*o,u=(i+n)*l,d=(a+r)*h;return s[0]=2*o,s[4]=0,s[8]=0,s[12]=-c,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-u,s[2]=0,s[6]=0,s[10]=-2*h,s[14]=-d,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const 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}}rt.prototype.isMatrix4=!0;const at=new I,st=new rt,ot=new I(0,0,0),lt=new I(1,1,1),ht=new I,ct=new I,ut=new I,dt=new rt,pt=new E;class ft{constructor(t=0,e=0,i=0,n=ft.DefaultOrder){this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const n=t.elements,r=n[0],a=n[4],s=n[8],o=n[1],l=n[5],c=n[9],u=n[2],d=n[6],p=n[10];switch(e){case"XYZ":this._y=Math.asin(h(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,p),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-h(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(h(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-h(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(h(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-h(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-c,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return dt.makeRotationFromQuaternion(t),this.setFromRotationMatrix(dt,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return pt.setFromEuler(this),this.setFromQuaternion(pt,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(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(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}toVector3(t){return t?t.set(this._x,this._y,this._z):new I(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}ft.prototype.isEuler=!0,ft.DefaultOrder="XYZ",ft.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class gt{constructor(){this.mask=1}set(t){this.mask=1<<t|0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}}let mt=0;const yt=new I,bt=new E,vt=new rt,xt=new I,_t=new I,At=new I,wt=new E,Ct=new I(1,0,0),Mt=new I(0,1,0),Et=new I(0,0,1),It={type:"added"},St={type:"removed"};class Tt extends n{constructor(){super(),Object.defineProperty(this,"id",{value:mt++}),this.uuid=l(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Tt.DefaultUp.clone();const t=new I,e=new ft,i=new E,n=new I(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new rt},normalMatrix:{value:new g}}),this.matrix=new rt,this.matrixWorld=new rt,this.matrixAutoUpdate=Tt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new gt,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return bt.setFromAxisAngle(t,e),this.quaternion.multiply(bt),this}rotateOnWorldAxis(t,e){return bt.setFromAxisAngle(t,e),this.quaternion.premultiply(bt),this}rotateX(t){return this.rotateOnAxis(Ct,t)}rotateY(t){return this.rotateOnAxis(Mt,t)}rotateZ(t){return this.rotateOnAxis(Et,t)}translateOnAxis(t,e){return yt.copy(t).applyQuaternion(this.quaternion),this.position.add(yt.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(Ct,t)}translateY(t){return this.translateOnAxis(Mt,t)}translateZ(t){return this.translateOnAxis(Et,t)}localToWorld(t){return t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return t.applyMatrix4(vt.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?xt.copy(t):xt.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),_t.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?vt.lookAt(_t,xt,this.up):vt.lookAt(xt,_t,this.up),this.quaternion.setFromRotationMatrix(vt),n&&(vt.extractRotation(n.matrixWorld),bt.setFromRotationMatrix(vt),this.quaternion.premultiply(bt.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(It)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(St)),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(St)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),vt.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),vt.multiply(t.parent.matrixWorld)),t.applyMatrix4(vt),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_t,t,At),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_t,wt,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].updateMatrixWorld(t)}updateWorldMatrix(t,e){const i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const n={};function r(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++){const n=i[e];r(t.shapes,n)}else r(t.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,n=this.material.length;i<n;i++)e.push(r(t.materials,this.material[i]));n.material=e}else n.material=r(t.materials,this.material);if(this.children.length>0){n.children=[];for(let e=0;e<this.children.length;e++)n.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];n.animations.push(r(t.animations,i))}}if(e){const e=a(t.geometries),n=a(t.materials),r=a(t.textures),s=a(t.images),o=a(t.shapes),l=a(t.skeletons),h=a(t.animations);e.length>0&&(i.geometries=e),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),s.length>0&&(i.images=s),o.length>0&&(i.shapes=o),l.length>0&&(i.skeletons=l),h.length>0&&(i.animations=h)}return i.object=n,i;function a(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const i=t.children[e];this.add(i.clone())}return this}}Tt.DefaultUp=new I(0,1,0),Tt.DefaultMatrixAutoUpdate=!0,Tt.prototype.isObject3D=!0;const Bt=new I,Ft=new I,Ut=new I,Lt=new I,Rt=new I,Dt=new I,Nt=new I,Pt=new I,kt=new I,zt=new I;class Ot{constructor(t=new I,e=new I,i=new I){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,n){n.subVectors(i,e),Bt.subVectors(t,e),n.cross(Bt);const r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(t,e,i,n,r){Bt.subVectors(n,e),Ft.subVectors(i,e),Ut.subVectors(t,e);const a=Bt.dot(Bt),s=Bt.dot(Ft),o=Bt.dot(Ut),l=Ft.dot(Ft),h=Ft.dot(Ut),c=a*l-s*s;if(0===c)return r.set(-2,-1,-1);const u=1/c,d=(l*o-s*h)*u,p=(a*h-s*o)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,i,n){return this.getBarycoord(t,e,i,n,Lt),Lt.x>=0&&Lt.y>=0&&Lt.x+Lt.y<=1}static getUV(t,e,i,n,r,a,s,o){return this.getBarycoord(t,e,i,n,Lt),o.set(0,0),o.addScaledVector(r,Lt.x),o.addScaledVector(a,Lt.y),o.addScaledVector(s,Lt.z),o}static isFrontFacing(t,e,i,n){return Bt.subVectors(i,e),Ft.subVectors(t,e),Bt.cross(Ft).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}setFromAttributeAndIndices(t,e,i,n){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Bt.subVectors(this.c,this.b),Ft.subVectors(this.a,this.b),.5*Bt.cross(Ft).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Ot.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Ot.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,i,n,r){return Ot.getUV(t,this.a,this.b,this.c,e,i,n,r)}containsPoint(t){return Ot.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Ot.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,n=this.b,r=this.c;let a,s;Rt.subVectors(n,i),Dt.subVectors(r,i),Pt.subVectors(t,i);const o=Rt.dot(Pt),l=Dt.dot(Pt);if(o<=0&&l<=0)return e.copy(i);kt.subVectors(t,n);const h=Rt.dot(kt),c=Dt.dot(kt);if(h>=0&&c<=h)return e.copy(n);const u=o*c-h*l;if(u<=0&&o>=0&&h<=0)return a=o/(o-h),e.copy(i).addScaledVector(Rt,a);zt.subVectors(t,r);const d=Rt.dot(zt),p=Dt.dot(zt);if(p>=0&&d<=p)return e.copy(r);const f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),e.copy(i).addScaledVector(Dt,s);const g=h*p-d*c;if(g<=0&&c-h>=0&&d-p>=0)return Nt.subVectors(r,n),s=(c-h)/(c-h+(d-p)),e.copy(n).addScaledVector(Nt,s);const m=1/(g+f+u);return a=f*m,s=u*m,e.copy(i).addScaledVector(Rt,a).addScaledVector(Dt,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let Qt=0;class Vt extends n{constructor(){super(),Object.defineProperty(this,"id",{value:Qt++}),this.uuid=l(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.format=1023,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===i;continue}const n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenTint&&this.sheenTint.isColor&&(i.sheenTint=this.sheenTint.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularTint&&this.specularTint.isColor&&(i.specularTint=this.specularTint.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularTintMap&&this.specularTintMap.isTexture&&(i.specularTintMap=this.specularTintMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationTint&&(i.attenuationTint=this.attenuationTint.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),1023!==this.format&&(i.format=this.format),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(i.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=this.flatShading),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),e){const e=n(t.textures),r=n(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.format=t.format,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let n=0;n!==t;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}Vt.prototype.isMaterial=!0;const Ht={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Gt={h:0,s:0,l:0},jt={h:0,s:0,l:0};function Wt(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}function qt(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Zt(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class Jt{constructor(t,e,i){return void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this}setRGB(t,e,i){return this.r=t,this.g=e,this.b=i,this}setHSL(t,e,i){if(t=c(t,1),e=h(e,0,1),i=h(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=Wt(r,n,t+1/3),this.g=Wt(r,n,t),this.b=Wt(r,n,t-1/3)}return this}setStyle(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const n=i[1],r=i[2];switch(n){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,e(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,e(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)){const i=parseFloat(t[1])/360,n=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(i,n,r)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=i[1],e=t.length;if(3===e)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this}setColorName(t){const e=Ht[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const i=e>0?1/e:1;return this.r=Math.pow(t.r,i),this.g=Math.pow(t.g,i),this.b=Math.pow(t.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=qt(t.r),this.g=qt(t.g),this.b=qt(t.b),this}copyLinearToSRGB(t){return this.r=Zt(t.r),this.g=Zt(t.g),this.b=Zt(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){const e=this.r,i=this.g,n=this.b,r=Math.max(e,i,n),a=Math.min(e,i,n);let s,o;const l=(a+r)/2;if(a===r)s=0,o=0;else{const t=r-a;switch(o=l<=.5?t/(r+a):t/(2-r-a),r){case e:s=(i-n)/t+(i<n?6:0);break;case i:s=(n-e)/t+2;break;case n:s=(e-i)/t+4}s/=6}return t.h=s,t.s=o,t.l=l,t}getStyle(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"}offsetHSL(t,e,i){return this.getHSL(Gt),Gt.h+=t,Gt.s+=e,Gt.l+=i,this.setHSL(Gt.h,Gt.s,Gt.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Gt),t.getHSL(jt);const i=u(Gt.h,jt.h,e),n=u(Gt.s,jt.s,e),r=u(Gt.l,jt.l,e);return this.setHSL(i,n,r),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}Jt.NAMES=Ht,Jt.prototype.isColor=!0,Jt.prototype.r=1,Jt.prototype.g=1,Jt.prototype.b=1;class Xt extends Vt{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new Jt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Xt.prototype.isMeshBasicMaterial=!0;const Yt=new I,Kt=new f;class $t{constructor(t,e,i){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===i,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this}copyArray(t){return this.array.set(t),this}copyColorsArray(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),r=new Jt),e[i++]=r.r,e[i++]=r.g,e[i++]=r.b}return this}copyVector2sArray(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),r=new f),e[i++]=r.x,e[i++]=r.y}return this}copyVector3sArray(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),r=new I),e[i++]=r.x,e[i++]=r.y,e[i++]=r.z}return this}copyVector4sArray(t){const e=this.array;let i=0;for(let n=0,r=t.length;n<r;n++){let r=t[n];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),r=new w),e[i++]=r.x,e[i++]=r.y,e[i++]=r.z,e[i++]=r.w}return this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)Kt.fromBufferAttribute(this,e),Kt.applyMatrix3(t),this.setXY(e,Kt.x,Kt.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)Yt.fromBufferAttribute(this,e),Yt.applyMatrix3(t),this.setXYZ(e,Yt.x,Yt.y,Yt.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)Yt.x=this.getX(e),Yt.y=this.getY(e),Yt.z=this.getZ(e),Yt.applyMatrix4(t),this.setXYZ(e,Yt.x,Yt.y,Yt.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Yt.x=this.getX(e),Yt.y=this.getY(e),Yt.z=this.getZ(e),Yt.applyNormalMatrix(t),this.setXYZ(e,Yt.x,Yt.y,Yt.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Yt.x=this.getX(e),Yt.y=this.getY(e),Yt.z=this.getZ(e),Yt.transformDirection(t),this.setXYZ(e,Yt.x,Yt.y,Yt.z);return this}set(t,e=0){return this.array.set(t,e),this}getX(t){return this.array[t*this.itemSize]}setX(t,e){return this.array[t*this.itemSize]=e,this}getY(t){return this.array[t*this.itemSize+1]}setY(t,e){return this.array[t*this.itemSize+1]=e,this}getZ(t){return this.array[t*this.itemSize+2]}setZ(t,e){return this.array[t*this.itemSize+2]=e,this}getW(t){return this.array[t*this.itemSize+3]}setW(t,e){return this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),35044!==this.usage&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}}$t.prototype.isBufferAttribute=!0;class te extends $t{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class ee extends $t{constructor(t,e,i){super(new Uint32Array(t),e,i)}}(class extends $t{constructor(t,e,i){super(new Uint16Array(t),e,i)}}).prototype.isFloat16BufferAttribute=!0;class ie extends $t{constructor(t,e,i){super(new Float32Array(t),e,i)}}let ne=0;const re=new rt,ae=new Tt,se=new I,oe=new B,le=new B,he=new I;class ce extends n{constructor(){super(),Object.defineProperty(this,"id",{value:ne++}),this.uuid=l(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(m(t)>65535?ee:te)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new g).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return re.makeRotationFromQuaternion(t),this.applyMatrix4(re),this}rotateX(t){return re.makeRotationX(t),this.applyMatrix4(re),this}rotateY(t){return re.makeRotationY(t),this.applyMatrix4(re),this}rotateZ(t){return re.makeRotationZ(t),this.applyMatrix4(re),this}translate(t,e,i){return re.makeTranslation(t,e,i),this.applyMatrix4(re),this}scale(t,e,i){return re.makeScale(t,e,i),this.applyMatrix4(re),this}lookAt(t){return ae.lookAt(t),ae.updateMatrix(),this.applyMatrix4(ae.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(se).negate(),this.translate(se.x,se.y,se.z),this}setFromPoints(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new ie(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new B);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new I(-1/0,-1/0,-1/0),new I(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];oe.setFromBufferAttribute(i),this.morphTargetsRelative?(he.addVectors(this.boundingBox.min,oe.min),this.boundingBox.expandByPoint(he),he.addVectors(this.boundingBox.max,oe.max),this.boundingBox.expandByPoint(he)):(this.boundingBox.expandByPoint(oe.min),this.boundingBox.expandByPoint(oe.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new J);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new I,1/0);if(t){const i=this.boundingSphere.center;if(oe.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];le.setFromBufferAttribute(i),this.morphTargetsRelative?(he.addVectors(oe.min,le.min),oe.expandByPoint(he),he.addVectors(oe.max,le.max),oe.expandByPoint(he)):(oe.expandByPoint(le.min),oe.expandByPoint(le.max))}oe.getCenter(i);let n=0;for(let e=0,r=t.count;e<r;e++)he.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(he));if(e)for(let r=0,a=e.length;r<a;r++){const a=e[r],s=this.morphTargetsRelative;for(let e=0,r=a.count;e<r;e++)he.fromBufferAttribute(a,e),s&&(se.fromBufferAttribute(t,e),he.add(se)),n=Math.max(n,i.distanceToSquared(he))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const i=t.array,n=e.position.array,r=e.normal.array,a=e.uv.array,s=n.length/3;void 0===e.tangent&&this.setAttribute("tangent",new $t(new Float32Array(4*s),4));const o=e.tangent.array,l=[],h=[];for(let t=0;t<s;t++)l[t]=new I,h[t]=new I;const c=new I,u=new I,d=new I,p=new f,g=new f,m=new f,y=new I,b=new I;function v(t,e,i){c.fromArray(n,3*t),u.fromArray(n,3*e),d.fromArray(n,3*i),p.fromArray(a,2*t),g.fromArray(a,2*e),m.fromArray(a,2*i),u.sub(c),d.sub(c),g.sub(p),m.sub(p);const r=1/(g.x*m.y-m.x*g.y);isFinite(r)&&(y.copy(u).multiplyScalar(m.y).addScaledVector(d,-g.y).multiplyScalar(r),b.copy(d).multiplyScalar(g.x).addScaledVector(u,-m.x).multiplyScalar(r),l[t].add(y),l[e].add(y),l[i].add(y),h[t].add(b),h[e].add(b),h[i].add(b))}let x=this.groups;0===x.length&&(x=[{start:0,count:i.length}]);for(let t=0,e=x.length;t<e;++t){const e=x[t],n=e.start;for(let t=n,r=n+e.count;t<r;t+=3)v(i[t+0],i[t+1],i[t+2])}const _=new I,A=new I,w=new I,C=new I;function M(t){w.fromArray(r,3*t),C.copy(w);const e=l[t];_.copy(e),_.sub(w.multiplyScalar(w.dot(e))).normalize(),A.crossVectors(C,e);const i=A.dot(h[t])<0?-1:1;o[4*t]=_.x,o[4*t+1]=_.y,o[4*t+2]=_.z,o[4*t+3]=i}for(let t=0,e=x.length;t<e;++t){const e=x[t],n=e.start;for(let t=n,r=n+e.count;t<r;t+=3)M(i[t+0]),M(i[t+1]),M(i[t+2])}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new $t(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const n=new I,r=new I,a=new I,s=new I,o=new I,l=new I,h=new I,c=new I;if(t)for(let u=0,d=t.count;u<d;u+=3){const d=t.getX(u+0),p=t.getX(u+1),f=t.getX(u+2);n.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),a.fromBufferAttribute(e,f),h.subVectors(a,r),c.subVectors(n,r),h.cross(c),s.fromBufferAttribute(i,d),o.fromBufferAttribute(i,p),l.fromBufferAttribute(i,f),s.add(h),o.add(h),l.add(h),i.setXYZ(d,s.x,s.y,s.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(f,l.x,l.y,l.z)}else for(let t=0,s=e.count;t<s;t+=3)n.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),a.fromBufferAttribute(e,t+2),h.subVectors(a,r),c.subVectors(n,r),h.cross(c),i.setXYZ(t+0,h.x,h.y,h.z),i.setXYZ(t+1,h.x,h.y,h.z),i.setXYZ(t+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}merge(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const i=this.attributes;for(const n in i){if(void 0===t.attributes[n])continue;const r=i[n].array,a=t.attributes[n],s=a.array,o=a.itemSize*e,l=Math.min(s.length,r.length-o);for(let t=0,e=o;t<l;t++,e++)r[e]=s[t]}return this}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)he.fromBufferAttribute(t,e),he.normalize(),t.setXYZ(e,he.x,he.y,he.z)}toNonIndexed(){function t(t,e){const i=t.array,n=t.itemSize,r=t.normalized,a=new i.constructor(e.length*n);let s=0,o=0;for(let r=0,l=e.length;r<l;r++){s=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*n;for(let t=0;t<n;t++)a[o++]=i[s++]}return new $t(a,n,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new ce,i=this.index.array,n=this.attributes;for(const r in n){const a=t(n[r],i);e.setAttribute(r,a)}const r=this.morphAttributes;for(const n in r){const a=[],s=r[n];for(let e=0,n=s.length;e<n;e++){const n=t(s[e],i);a.push(n)}e.morphAttributes[n]=a}e.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let t=0,i=a.length;t<i;t++){const i=a[t];e.addGroup(i.start,i.count,i.materialIndex)}return e}toJSON(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const n=i[e];t.data.attributes[e]=n.toJSON(t.data)}const n={};let r=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],a=[];for(let e=0,n=i.length;e<n;e++){const n=i[e];a.push(n.toJSON(t.data))}a.length>0&&(n[e]=a,r=!0)}r&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const s=this.boundingSphere;return null!==s&&(t.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone(e));const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const r=t.morphAttributes;for(const t in r){const i=[],n=r[t];for(let t=0,r=n.length;t<r;t++)i.push(n[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;const a=t.groups;for(let t=0,e=a.length;t<e;t++){const e=a[t];this.addGroup(e.start,e.count,e.materialIndex)}const s=t.boundingBox;null!==s&&(this.boundingBox=s.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,void 0!==t.parameters&&(this.parameters=Object.assign({},t.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}ce.prototype.isBufferGeometry=!0;const ue=new rt,de=new nt,pe=new J,fe=new I,ge=new I,me=new I,ye=new I,be=new I,ve=new I,xe=new I,_e=new I,Ae=new I,we=new f,Ce=new f,Me=new f,Ee=new I,Ie=new I;class Se extends Tt{constructor(t=new ce,e=new Xt){super(),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(t,e){const i=this.geometry,n=this.material,r=this.matrixWorld;if(void 0===n)return;if(null===i.boundingSphere&&i.computeBoundingSphere(),pe.copy(i.boundingSphere),pe.applyMatrix4(r),!1===t.ray.intersectsSphere(pe))return;if(ue.copy(r).invert(),de.copy(t.ray).applyMatrix4(ue),null!==i.boundingBox&&!1===de.intersectsBox(i.boundingBox))return;let a;if(i.isBufferGeometry){const r=i.index,s=i.attributes.position,o=i.morphAttributes.position,l=i.morphTargetsRelative,h=i.attributes.uv,c=i.attributes.uv2,u=i.groups,d=i.drawRange;if(null!==r)if(Array.isArray(n))for(let i=0,p=u.length;i<p;i++){const p=u[i],f=n[p.materialIndex];for(let i=Math.max(p.start,d.start),n=Math.min(r.count,Math.min(p.start+p.count,d.start+d.count));i<n;i+=3){const n=r.getX(i),u=r.getX(i+1),d=r.getX(i+2);a=Te(this,f,t,de,s,o,l,h,c,n,u,d),a&&(a.faceIndex=Math.floor(i/3),a.face.materialIndex=p.materialIndex,e.push(a))}}else{for(let i=Math.max(0,d.start),u=Math.min(r.count,d.start+d.count);i<u;i+=3){const u=r.getX(i),d=r.getX(i+1),p=r.getX(i+2);a=Te(this,n,t,de,s,o,l,h,c,u,d,p),a&&(a.faceIndex=Math.floor(i/3),e.push(a))}}else if(void 0!==s)if(Array.isArray(n))for(let i=0,r=u.length;i<r;i++){const r=u[i],p=n[r.materialIndex];for(let i=Math.max(r.start,d.start),n=Math.min(s.count,Math.min(r.start+r.count,d.start+d.count));i<n;i+=3){a=Te(this,p,t,de,s,o,l,h,c,i,i+1,i+2),a&&(a.faceIndex=Math.floor(i/3),a.face.materialIndex=r.materialIndex,e.push(a))}}else{for(let i=Math.max(0,d.start),r=Math.min(s.count,d.start+d.count);i<r;i+=3){a=Te(this,n,t,de,s,o,l,h,c,i,i+1,i+2),a&&(a.faceIndex=Math.floor(i/3),e.push(a))}}}else i.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}function Te(t,e,i,n,r,a,s,o,l,h,c,u){fe.fromBufferAttribute(r,h),ge.fromBufferAttribute(r,c),me.fromBufferAttribute(r,u);const d=t.morphTargetInfluences;if(a&&d){xe.set(0,0,0),_e.set(0,0,0),Ae.set(0,0,0);for(let t=0,e=a.length;t<e;t++){const e=d[t],i=a[t];0!==e&&(ye.fromBufferAttribute(i,h),be.fromBufferAttribute(i,c),ve.fromBufferAttribute(i,u),s?(xe.addScaledVector(ye,e),_e.addScaledVector(be,e),Ae.addScaledVector(ve,e)):(xe.addScaledVector(ye.sub(fe),e),_e.addScaledVector(be.sub(ge),e),Ae.addScaledVector(ve.sub(me),e)))}fe.add(xe),ge.add(_e),me.add(Ae)}t.isSkinnedMesh&&(t.boneTransform(h,fe),t.boneTransform(c,ge),t.boneTransform(u,me));const p=function(t,e,i,n,r,a,s,o){let l;if(l=1===e.side?n.intersectTriangle(s,a,r,!0,o):n.intersectTriangle(r,a,s,2!==e.side,o),null===l)return null;Ie.copy(o),Ie.applyMatrix4(t.matrixWorld);const h=i.ray.origin.distanceTo(Ie);return h<i.near||h>i.far?null:{distance:h,point:Ie.clone(),object:t}}(t,e,i,n,fe,ge,me,Ee);if(p){o&&(we.fromBufferAttribute(o,h),Ce.fromBufferAttribute(o,c),Me.fromBufferAttribute(o,u),p.uv=Ot.getUV(Ee,fe,ge,me,we,Ce,Me,new f)),l&&(we.fromBufferAttribute(l,h),Ce.fromBufferAttribute(l,c),Me.fromBufferAttribute(l,u),p.uv2=Ot.getUV(Ee,fe,ge,me,we,Ce,Me,new f));const t={a:h,b:c,c:u,normal:new I,materialIndex:0};Ot.getNormal(fe,ge,me,t.normal),p.face=t}return p}Se.prototype.isMesh=!0;class Be extends ce{constructor(t=1,e=1,i=1,n=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:a};const s=this;n=Math.floor(n),r=Math.floor(r),a=Math.floor(a);const o=[],l=[],h=[],c=[];let u=0,d=0;function p(t,e,i,n,r,a,p,f,g,m,y){const b=a/g,v=p/m,x=a/2,_=p/2,A=f/2,w=g+1,C=m+1;let M=0,E=0;const S=new I;for(let a=0;a<C;a++){const s=a*v-_;for(let o=0;o<w;o++){const u=o*b-x;S[t]=u*n,S[e]=s*r,S[i]=A,l.push(S.x,S.y,S.z),S[t]=0,S[e]=0,S[i]=f>0?1:-1,h.push(S.x,S.y,S.z),c.push(o/g),c.push(1-a/m),M+=1}}for(let t=0;t<m;t++)for(let e=0;e<g;e++){const i=u+e+w*t,n=u+e+w*(t+1),r=u+(e+1)+w*(t+1),a=u+(e+1)+w*t;o.push(i,n,a),o.push(n,r,a),E+=6}s.addGroup(d,E,y),d+=E,u+=M}p("z","y","x",-1,-1,i,e,t,a,r,0),p("z","y","x",1,-1,i,e,-t,a,r,1),p("x","z","y",1,1,t,i,e,n,a,2),p("x","z","y",1,-1,t,i,-e,n,a,3),p("x","y","z",1,-1,t,e,i,n,r,4),p("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(o),this.setAttribute("position",new ie(l,3)),this.setAttribute("normal",new ie(h,3)),this.setAttribute("uv",new ie(c,2))}static fromJSON(t){return new Be(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Fe(t){const e={};for(const i in t){e[i]={};for(const n in t[i]){const r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}}return e}function Ue(t){const e={};for(let i=0;i<t.length;i++){const n=Fe(t[i]);for(const t in n)e[t]=n[t]}return e}const Le={clone:Fe,merge:Ue};class Re extends Vt{constructor(t){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Fe(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const n=this.uniforms[i].value;n&&n.isTexture?e.uniforms[i]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?e.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[i]={type:"m4",value:n.toArray()}:e.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const i={};for(const t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}Re.prototype.isShaderMaterial=!0;class De extends Tt{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new rt,this.projectionMatrix=new rt,this.projectionMatrixInverse=new rt}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}De.prototype.isCamera=!0;class Ne extends De{constructor(t=50,e=1,i=.1,n=2e3){super(),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*a*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*r*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*a*Math.atan(Math.tan(.5*r*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,i,n,r,a){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*r*this.fov)/this.zoom,i=2*e,n=this.aspect*i,a=-.5*n;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,r=s.fullHeight;a+=s.offsetX*n/t,e-=s.offsetY*i/r,n*=s.width/t,i*=s.height/r}const o=this.filmOffset;0!==o&&(a+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(a,a+n,e,e-i,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}Ne.prototype.isPerspectiveCamera=!0;class Pe extends Tt{constructor(t,e,i){if(super(),this.type="CubeCamera",!0!==i.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=i;const n=new Ne(90,1,t,e);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new I(1,0,0)),this.add(n);const r=new Ne(90,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new I(-1,0,0)),this.add(r);const a=new Ne(90,1,t,e);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new I(0,1,0)),this.add(a);const s=new Ne(90,1,t,e);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new I(0,-1,0)),this.add(s);const o=new Ne(90,1,t,e);o.layers=this.layers,o.up.set(0,-1,0),o.lookAt(new I(0,0,1)),this.add(o);const l=new Ne(90,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new I(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const i=this.renderTarget,[n,r,a,s,o,l]=this.children,h=t.xr.enabled,c=t.getRenderTarget();t.xr.enabled=!1;const u=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0),t.render(e,n),t.setRenderTarget(i,1),t.render(e,r),t.setRenderTarget(i,2),t.render(e,a),t.setRenderTarget(i,3),t.render(e,s),t.setRenderTarget(i,4),t.render(e,o),i.texture.generateMipmaps=u,t.setRenderTarget(i,5),t.render(e,l),t.setRenderTarget(c),t.xr.enabled=h}}class ke extends _{constructor(t,e,i,n,r,a,s,o,l,h){super(t=void 0!==t?t:[],e=void 0!==e?e:301,i,n,r,a,s,o,l,h),this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}ke.prototype.isCubeTexture=!0;class ze extends C{constructor(t,e,i){Number.isInteger(e)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),e=i),super(t,t,e),e=e||{},this.texture=new ke(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:1006,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=1023,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},n=new Be(5,5,5),r=new Re({name:"CubemapFromEquirect",uniforms:Fe(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const a=new Se(n,r),s=e.minFilter;1008===e.minFilter&&(e.minFilter=1006);return new Pe(1,10,this).update(t,a),e.minFilter=s,a.geometry.dispose(),a.material.dispose(),this}clear(t,e,i,n){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,n);t.setRenderTarget(r)}}ze.prototype.isWebGLCubeRenderTarget=!0;const Oe=new I,Qe=new I,Ve=new g;class He{constructor(t=new I(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const n=Oe.subVectors(i,e).cross(Qe.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){const i=t.delta(Oe),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/n;return r<0||r>1?null:e.copy(i).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||Ve.getNormalMatrix(t),n=this.coplanarPoint(Oe).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}He.prototype.isPlane=!0;const Ge=new J,je=new I;class We{constructor(t=new He,e=new He,i=new He,n=new He,r=new He,a=new He){this.planes=[t,e,i,n,r,a]}set(t,e,i,n,r,a){const s=this.planes;return s[0].copy(t),s[1].copy(e),s[2].copy(i),s[3].copy(n),s[4].copy(r),s[5].copy(a),this}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t){const e=this.planes,i=t.elements,n=i[0],r=i[1],a=i[2],s=i[3],o=i[4],l=i[5],h=i[6],c=i[7],u=i[8],d=i[9],p=i[10],f=i[11],g=i[12],m=i[13],y=i[14],b=i[15];return e[0].setComponents(s-n,c-o,f-u,b-g).normalize(),e[1].setComponents(s+n,c+o,f+u,b+g).normalize(),e[2].setComponents(s+r,c+l,f+d,b+m).normalize(),e[3].setComponents(s-r,c-l,f-d,b-m).normalize(),e[4].setComponents(s-a,c-h,f-p,b-y).normalize(),e[5].setComponents(s+a,c+h,f+p,b+y).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Ge.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Ge)}intersectsSprite(t){return Ge.center.set(0,0,0),Ge.radius=.7071067811865476,Ge.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ge)}intersectsSphere(t){const e=this.planes,i=t.center,n=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(i)<n)return!1}return!0}intersectsBox(t){const e=this.planes;for(let i=0;i<6;i++){const n=e[i];if(je.x=n.normal.x>0?t.max.x:t.min.x,je.y=n.normal.y>0?t.max.y:t.min.y,je.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(je)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function qe(){let t=null,e=!1,i=null,n=null;function r(e,a){i(e,a),n=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==i&&(n=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function Ze(t,e){const i=e.isWebGL2,n=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),n.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const i=n.get(e);i&&(t.deleteBuffer(i.buffer),n.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=n.get(e);return void((!t||t.version<e.version)&&n.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const a=n.get(e);void 0===a?n.set(e,function(e,n){const r=e.array,a=e.usage,s=t.createBuffer();t.bindBuffer(n,s),t.bufferData(n,r,a),e.onUploadCallback();let o=5126;return r instanceof Float32Array?o=5126:r instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):r instanceof Uint16Array?e.isFloat16BufferAttribute?i?o=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):o=5123:r instanceof Int16Array?o=5122:r instanceof Uint32Array?o=5125:r instanceof Int32Array?o=5124:r instanceof Int8Array?o=5120:(r instanceof Uint8Array||r instanceof Uint8ClampedArray)&&(o=5121),{buffer:s,type:o,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}(e,r)):a.version<e.version&&(!function(e,n,r){const a=n.array,s=n.updateRange;t.bindBuffer(r,e),-1===s.count?t.bufferSubData(r,0,a):(i?t.bufferSubData(r,s.offset*a.BYTES_PER_ELEMENT,a,s.offset,s.count):t.bufferSubData(r,s.offset*a.BYTES_PER_ELEMENT,a.subarray(s.offset,s.offset+s.count)),s.count=-1)}(a.buffer,e,r),a.version=e.version)}}}class Je extends ce{constructor(t=1,e=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};const r=t/2,a=e/2,s=Math.floor(i),o=Math.floor(n),l=s+1,h=o+1,c=t/s,u=e/o,d=[],p=[],f=[],g=[];for(let t=0;t<h;t++){const e=t*u-a;for(let i=0;i<l;i++){const n=i*c-r;p.push(n,-e,0),f.push(0,0,1),g.push(i/s),g.push(1-t/o)}}for(let t=0;t<o;t++)for(let e=0;e<s;e++){const i=e+l*t,n=e+l*(t+1),r=e+1+l*(t+1),a=e+1+l*t;d.push(i,n,a),d.push(n,r,a)}this.setIndex(d),this.setAttribute("position",new ie(p,3)),this.setAttribute("normal",new ie(f,3)),this.setAttribute("uv",new ie(g,2))}static fromJSON(t){return new Je(t.width,t.height,t.widthSegments,t.heightSegments)}}const Xe={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenTint, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenTint * ( D * V );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec;\n\t\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\t\treflectVec = reflect( - viewDir, normal );\n\t\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\t#else\n\t\t\t\treflectVec = refract( - viewDir, normal, refractionRatio );\n\t\t\t#endif\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tlightMapIrradiance *= PI;\n\t#endif\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularTintFactor = specularTint;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARTINTMAP\n\t\t\tspecularTintFactor *= specularTintMapTexelToLinear( texture2D( specularTintMap, vUv ) ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularTintFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularTintFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenTint = sheenTint;\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenTint;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenTint, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] > 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1, 2 ) * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform vec2 morphTargetsTextureSize;\n\t\tvec3 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset, const in int stride ) {\n\t\t\tfloat texelIndex = float( vertexIndex * stride + offset );\n\t\t\tfloat y = floor( texelIndex / morphTargetsTextureSize.x );\n\t\t\tfloat x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tvec3 morphUV = vec3( ( x + 0.5 ) / morphTargetsTextureSize.x, y / morphTargetsTextureSize.y, morphTargetIndex );\n\t\t\treturn texture( morphTargetsTexture, morphUV ).xyz;\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\t#ifndef USE_MORPHNORMALS\n\t\t\t\tif ( morphTargetInfluences[ i ] > 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 1 ) * morphTargetInfluences[ i ];\n\t\t\t#else\n\t\t\t\tif ( morphTargetInfluences[ i ] > 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 2 ) * morphTargetInfluences[ i ];\n\t\t\t#endif\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationTint, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationTint;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( float roughness, float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( vec2 fragCoord, float roughness, float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 diffuseColor, vec3 specularColor, float specularF90,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularTint;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARTINTMAP\n\t\tuniform sampler2D specularTintMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenTint;\n\tuniform float sheenRoughness;\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - clearcoat * Fcc ) + clearcoatSpecular * clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}"},Ye={common:{diffuse:{value:new Jt(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new g},uv2Transform:{value:new g},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new f(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Jt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Jt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new g}},sprite:{diffuse:{value:new Jt(16777215)},opacity:{value:1},center:{value:new f(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new g}}},Ke={basic:{uniforms:Ue([Ye.common,Ye.specularmap,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.fog]),vertexShader:Xe.meshbasic_vert,fragmentShader:Xe.meshbasic_frag},lambert:{uniforms:Ue([Ye.common,Ye.specularmap,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.fog,Ye.lights,{emissive:{value:new Jt(0)}}]),vertexShader:Xe.meshlambert_vert,fragmentShader:Xe.meshlambert_frag},phong:{uniforms:Ue([Ye.common,Ye.specularmap,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.fog,Ye.lights,{emissive:{value:new Jt(0)},specular:{value:new Jt(1118481)},shininess:{value:30}}]),vertexShader:Xe.meshphong_vert,fragmentShader:Xe.meshphong_frag},standard:{uniforms:Ue([Ye.common,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.roughnessmap,Ye.metalnessmap,Ye.fog,Ye.lights,{emissive:{value:new Jt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Xe.meshphysical_vert,fragmentShader:Xe.meshphysical_frag},toon:{uniforms:Ue([Ye.common,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.gradientmap,Ye.fog,Ye.lights,{emissive:{value:new Jt(0)}}]),vertexShader:Xe.meshtoon_vert,fragmentShader:Xe.meshtoon_frag},matcap:{uniforms:Ue([Ye.common,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.fog,{matcap:{value:null}}]),vertexShader:Xe.meshmatcap_vert,fragmentShader:Xe.meshmatcap_frag},points:{uniforms:Ue([Ye.points,Ye.fog]),vertexShader:Xe.points_vert,fragmentShader:Xe.points_frag},dashed:{uniforms:Ue([Ye.common,Ye.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Xe.linedashed_vert,fragmentShader:Xe.linedashed_frag},depth:{uniforms:Ue([Ye.common,Ye.displacementmap]),vertexShader:Xe.depth_vert,fragmentShader:Xe.depth_frag},normal:{uniforms:Ue([Ye.common,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,{opacity:{value:1}}]),vertexShader:Xe.meshnormal_vert,fragmentShader:Xe.meshnormal_frag},sprite:{uniforms:Ue([Ye.sprite,Ye.fog]),vertexShader:Xe.sprite_vert,fragmentShader:Xe.sprite_frag},background:{uniforms:{uvTransform:{value:new g},t2D:{value:null}},vertexShader:Xe.background_vert,fragmentShader:Xe.background_frag},cube:{uniforms:Ue([Ye.envmap,{opacity:{value:1}}]),vertexShader:Xe.cube_vert,fragmentShader:Xe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Xe.equirect_vert,fragmentShader:Xe.equirect_frag},distanceRGBA:{uniforms:Ue([Ye.common,Ye.displacementmap,{referencePosition:{value:new I},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Xe.distanceRGBA_vert,fragmentShader:Xe.distanceRGBA_frag},shadow:{uniforms:Ue([Ye.lights,Ye.fog,{color:{value:new Jt(0)},opacity:{value:1}}]),vertexShader:Xe.shadow_vert,fragmentShader:Xe.shadow_frag}};function $e(t,e,i,n,r){const a=new Jt(0);let s,o,l=0,h=null,c=0,u=null;function d(t,e){i.buffers.color.setClear(t.r,t.g,t.b,e,r)}return{getClearColor:function(){return a},setClearColor:function(t,e=1){a.set(t),l=e,d(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(t){l=t,d(a,l)},render:function(i,r){let p=!1,f=!0===r.isScene?r.background:null;f&&f.isTexture&&(f=e.get(f));const g=t.xr,m=g.getSession&&g.getSession();m&&"additive"===m.environmentBlendMode&&(f=null),null===f?d(a,l):f&&f.isColor&&(d(f,1),p=!0),(t.autoClear||p)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),f&&(f.isCubeTexture||306===f.mapping)?(void 0===o&&(o=new Se(new Be(1,1,1),new Re({name:"BackgroundCubeMaterial",uniforms:Fe(Ke.cube.uniforms),vertexShader:Ke.cube.vertexShader,fragmentShader:Ke.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(o.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(o)),o.material.uniforms.envMap.value=f,o.material.uniforms.flipEnvMap.value=f.isCubeTexture&&!1===f.isRenderTargetTexture?-1:1,h===f&&c===f.version&&u===t.toneMapping||(o.material.needsUpdate=!0,h=f,c=f.version,u=t.toneMapping),i.unshift(o,o.geometry,o.material,0,0,null)):f&&f.isTexture&&(void 0===s&&(s=new Se(new Je(2,2),new Re({name:"BackgroundMaterial",uniforms:Fe(Ke.background.uniforms),vertexShader:Ke.background.vertexShader,fragmentShader:Ke.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(s)),s.material.uniforms.t2D.value=f,!0===f.matrixAutoUpdate&&f.updateMatrix(),s.material.uniforms.uvTransform.value.copy(f.matrix),h===f&&c===f.version&&u===t.toneMapping||(s.material.needsUpdate=!0,h=f,c=f.version,u=t.toneMapping),i.unshift(s,s.geometry,s.material,0,0,null))}}}function ti(t,e,i,n){const r=t.getParameter(34921),a=n.isWebGL2?null:e.get("OES_vertex_array_object"),s=n.isWebGL2||null!==a,o={},l=d(null);let h=l;function c(e){return n.isWebGL2?t.bindVertexArray(e):a.bindVertexArrayOES(e)}function u(e){return n.isWebGL2?t.deleteVertexArray(e):a.deleteVertexArrayOES(e)}function d(t){const e=[],i=[],n=[];for(let t=0;t<r;t++)e[t]=0,i[t]=0,n[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:n,object:t,attributes:{},index:null}}function p(){const t=h.newAttributes;for(let e=0,i=t.length;e<i;e++)t[e]=0}function f(t){g(t,0)}function g(i,r){const a=h.newAttributes,s=h.enabledAttributes,o=h.attributeDivisors;if(a[i]=1,0===s[i]&&(t.enableVertexAttribArray(i),s[i]=1),o[i]!==r){(n.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](i,r),o[i]=r}}function m(){const e=h.newAttributes,i=h.enabledAttributes;for(let n=0,r=i.length;n<r;n++)i[n]!==e[n]&&(t.disableVertexAttribArray(n),i[n]=0)}function y(e,i,r,a,s,o){!0!==n.isWebGL2||5124!==r&&5125!==r?t.vertexAttribPointer(e,i,r,a,s,o):t.vertexAttribIPointer(e,i,r,s,o)}function b(){v(),h!==l&&(h=l,c(h.object))}function v(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,u,b,v){let x=!1;if(s){const e=function(e,i,r){const s=!0===r.wireframe;let l=o[e.id];void 0===l&&(l={},o[e.id]=l);let h=l[i.id];void 0===h&&(h={},l[i.id]=h);let c=h[s];void 0===c&&(c=d(n.isWebGL2?t.createVertexArray():a.createVertexArrayOES()),h[s]=c);return c}(b,u,l);h!==e&&(h=e,c(h.object)),x=function(t,e){const i=h.attributes,n=t.attributes;let r=0;for(const t in n){const e=i[t],a=n[t];if(void 0===e)return!0;if(e.attribute!==a)return!0;if(e.data!==a.data)return!0;r++}return h.attributesNum!==r||h.index!==e}(b,v),x&&function(t,e){const i={},n=t.attributes;let r=0;for(const t in n){const e=n[t],a={};a.attribute=e,e.data&&(a.data=e.data),i[t]=a,r++}h.attributes=i,h.attributesNum=r,h.index=e}(b,v)}else{const t=!0===l.wireframe;h.geometry===b.id&&h.program===u.id&&h.wireframe===t||(h.geometry=b.id,h.program=u.id,h.wireframe=t,x=!0)}!0===r.isInstancedMesh&&(x=!0),null!==v&&i.update(v,34963),x&&(!function(r,a,s,o){if(!1===n.isWebGL2&&(r.isInstancedMesh||o.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;p();const l=o.attributes,h=s.getAttributes(),c=a.defaultAttributeValues;for(const e in h){const n=h[e];if(n.location>=0){let a=l[e];if(void 0===a&&("instanceMatrix"===e&&r.instanceMatrix&&(a=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(a=r.instanceColor)),void 0!==a){const e=a.normalized,s=a.itemSize,l=i.get(a);if(void 0===l)continue;const h=l.buffer,c=l.type,u=l.bytesPerElement;if(a.isInterleavedBufferAttribute){const i=a.data,l=i.stride,d=a.offset;if(i&&i.isInstancedInterleavedBuffer){for(let t=0;t<n.locationSize;t++)g(n.location+t,i.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=i.meshPerAttribute*i.count)}else for(let t=0;t<n.locationSize;t++)f(n.location+t);t.bindBuffer(34962,h);for(let t=0;t<n.locationSize;t++)y(n.location+t,s/n.locationSize,c,e,l*u,(d+s/n.locationSize*t)*u)}else{if(a.isInstancedBufferAttribute){for(let t=0;t<n.locationSize;t++)g(n.location+t,a.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=a.meshPerAttribute*a.count)}else for(let t=0;t<n.locationSize;t++)f(n.location+t);t.bindBuffer(34962,h);for(let t=0;t<n.locationSize;t++)y(n.location+t,s/n.locationSize,c,e,s*u,s/n.locationSize*t*u)}}else if(void 0!==c){const i=c[e];if(void 0!==i)switch(i.length){case 2:t.vertexAttrib2fv(n.location,i);break;case 3:t.vertexAttrib3fv(n.location,i);break;case 4:t.vertexAttrib4fv(n.location,i);break;default:t.vertexAttrib1fv(n.location,i)}}}}m()}(r,l,u,b),null!==v&&t.bindBuffer(34963,i.get(v).buffer))},reset:b,resetDefaultState:v,dispose:function(){b();for(const t in o){const e=o[t];for(const t in e){const i=e[t];for(const t in i)u(i[t].object),delete i[t];delete e[t]}delete o[t]}},releaseStatesOfGeometry:function(t){if(void 0===o[t.id])return;const e=o[t.id];for(const t in e){const i=e[t];for(const t in i)u(i[t].object),delete i[t];delete e[t]}delete o[t.id]},releaseStatesOfProgram:function(t){for(const e in o){const i=o[e];if(void 0===i[t.id])continue;const n=i[t.id];for(const t in n)u(n[t].object),delete n[t];delete i[t.id]}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:m}}function ei(t,e,i,n){const r=n.isWebGL2;let a;this.setMode=function(t){a=t},this.render=function(e,n){t.drawArrays(a,e,n),i.update(n,a,1)},this.renderInstances=function(n,s,o){if(0===o)return;let l,h;if(r)l=t,h="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),h="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[h](a,n,s,o),i.update(s,a,o)}}function ii(t,e,i){let n;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const a="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let s=void 0!==i.precision?i.precision:"highp";const o=r(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);const l=a||e.has("WEBGL_draw_buffers"),h=!0===i.logarithmicDepthBuffer,c=t.getParameter(34930),u=t.getParameter(35660),d=t.getParameter(3379),p=t.getParameter(34076),f=t.getParameter(34921),g=t.getParameter(36347),m=t.getParameter(36348),y=t.getParameter(36349),b=u>0,v=a||e.has("OES_texture_float");return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===e.has("EXT_texture_filter_anisotropic")){const i=e.get("EXT_texture_filter_anisotropic");n=t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:r,precision:s,logarithmicDepthBuffer:h,maxTextures:c,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:f,maxVertexUniforms:g,maxVaryings:m,maxFragmentUniforms:y,vertexTextures:b,floatFragmentTextures:v,floatVertexTextures:b&&v,maxSamples:a?t.getParameter(36183):0}}function ni(t){const e=this;let i=null,n=0,r=!1,a=!1;const s=new He,o=new g,l={value:null,needsUpdate:!1};function h(){l.value!==i&&(l.value=i,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function c(t,i,n,r){const a=null!==t?t.length:0;let h=null;if(0!==a){if(h=l.value,!0!==r||null===h){const e=n+4*a,r=i.matrixWorldInverse;o.getNormalMatrix(r),(null===h||h.length<e)&&(h=new Float32Array(e));for(let e=0,i=n;e!==a;++e,i+=4)s.copy(t[e]).applyMatrix4(r,o),s.normal.toArray(h,i),h[i+3]=s.constant}l.value=h,l.needsUpdate=!0}return e.numPlanes=a,e.numIntersection=0,h}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,a){const s=0!==t.length||e||0!==n||r;return r=e,i=c(t,a,0),n=t.length,s},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1,h()},this.setState=function(e,s,o){const u=e.clippingPlanes,d=e.clipIntersection,p=e.clipShadows,f=t.get(e);if(!r||null===u||0===u.length||a&&!p)a?c(null):h();else{const t=a?0:n,e=4*t;let r=f.clippingState||null;l.value=r,r=c(u,s,e,o);for(let t=0;t!==e;++t)r[t]=i[t];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function ri(t){let e=new WeakMap;function i(t,e){return 303===e?t.mapping=301:304===e&&(t.mapping=302),t}function n(t){const i=t.target;i.removeEventListener("dispose",n);const r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){const a=r.mapping;if(303===a||304===a){if(e.has(r)){return i(e.get(r).texture,r.mapping)}{const a=r.image;if(a&&a.height>0){const s=t.getRenderTarget(),o=new ze(a.height/2);return o.fromEquirectangularTexture(t,r),e.set(r,o),t.setRenderTarget(s),r.addEventListener("dispose",n),i(o.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}Ke.physical={uniforms:Ue([Ke.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new f(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenTint:{value:new Jt(0)},sheenRoughness:{value:0},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new f},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationTint:{value:new Jt(0)},specularIntensity:{value:0},specularIntensityMap:{value:null},specularTint:{value:new Jt(1,1,1)},specularTintMap:{value:null}}]),vertexShader:Xe.meshphysical_vert,fragmentShader:Xe.meshphysical_frag};class ai extends De{constructor(t=-1,e=1,i=1,n=-1,r=.1,a=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,i,n,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;let r=i-t,a=i+t,s=n+e,o=n-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,a=r+t*this.view.width,s-=e*this.view.offsetY,o=s-e*this.view.height}this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}ai.prototype.isOrthographicCamera=!0;class si extends Re{constructor(t){super(t),this.type="RawShaderMaterial"}}si.prototype.isRawShaderMaterial=!0;const oi=Math.pow(2,8),li=[.125,.215,.35,.446,.526,.582],hi=5+li.length,ci={3e3:0,3001:1,3002:2,3004:3,3005:4,3006:5,3007:6},ui=new ai,{_lodPlanes:di,_sizeLods:pi,_sigmas:fi}=Ai(),gi=new Jt;let mi=null;const yi=(1+Math.sqrt(5))/2,bi=1/yi,vi=[new I(1,1,1),new I(-1,1,1),new I(1,1,-1),new I(-1,1,-1),new I(0,yi,bi),new I(0,yi,-bi),new I(bi,0,yi),new I(-bi,0,yi),new I(yi,bi,0),new I(-yi,bi,0)];class xi{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=function(t){const e=new Float32Array(t),i=new I(0,1,0);return new si({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i},inputEncoding:{value:ci[3e3]},outputEncoding:{value:ci[3e3]}},vertexShader:Ii(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t${Si()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1})}(20),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,i=.1,n=100){mi=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(t,i,n,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Ei(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Mi(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t<di.length;t++)di[t].dispose()}_cleanup(t){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(mi),t.scissorTest=!1,Ci(t,0,0,t.width,t.height)}_fromTexture(t){mi=this._renderer.getRenderTarget();const e=this._allocateTargets(t);return this._textureToCubeUV(t,e),this._applyPMREM(e),this._cleanup(e),e}_allocateTargets(t){const e={magFilter:1003,minFilter:1003,generateMipmaps:!1,type:1009,format:1023,encoding:_i(t)?t.encoding:3002,depthBuffer:!1},i=wi(e);return i.depthBuffer=!t,this._pingPongRenderTarget=wi(e),i}_compileMaterial(t){const e=new Se(di[0],t);this._renderer.compile(e,ui)}_sceneToCubeUV(t,e,i,n){const r=new Ne(90,1,e,i),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,h=o.outputEncoding,c=o.toneMapping;o.getClearColor(gi),o.toneMapping=0,o.outputEncoding=3e3,o.autoClear=!1;const u=new Xt({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),d=new Se(new Be,u);let p=!1;const f=t.background;f?f.isColor&&(u.color.copy(f),t.background=null,p=!0):(u.color.copy(gi),p=!0);for(let e=0;e<6;e++){const i=e%3;0==i?(r.up.set(0,a[e],0),r.lookAt(s[e],0,0)):1==i?(r.up.set(0,0,a[e]),r.lookAt(0,s[e],0)):(r.up.set(0,a[e],0),r.lookAt(0,0,s[e])),Ci(n,i*oi,e>2?oi:0,oi,oi),o.setRenderTarget(n),p&&o.render(d,r),o.render(t,r)}d.geometry.dispose(),d.material.dispose(),o.toneMapping=c,o.outputEncoding=h,o.autoClear=l,t.background=f}_setEncoding(t,e){!0===this._renderer.capabilities.isWebGL2&&1023===e.format&&1009===e.type&&3001===e.encoding?t.value=ci[3e3]:t.value=ci[e.encoding]}_textureToCubeUV(t,e){const i=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Ei()):null==this._equirectShader&&(this._equirectShader=Mi());const n=t.isCubeTexture?this._cubemapShader:this._equirectShader,r=new Se(di[0],n),a=n.uniforms;a.envMap.value=t,t.isCubeTexture||a.texelSize.value.set(1/t.image.width,1/t.image.height),this._setEncoding(a.inputEncoding,t),this._setEncoding(a.outputEncoding,e.texture),Ci(e,0,0,3*oi,2*oi),i.setRenderTarget(e),i.render(r,ui)}_applyPMREM(t){const e=this._renderer,i=e.autoClear;e.autoClear=!1;for(let e=1;e<hi;e++){const i=Math.sqrt(fi[e]*fi[e]-fi[e-1]*fi[e-1]),n=vi[(e-1)%vi.length];this._blur(t,e-1,e,i,n)}e.autoClear=i}_blur(t,e,i,n,r){const a=this._pingPongRenderTarget;this._halfBlur(t,a,e,i,n,"latitudinal",r),this._halfBlur(a,t,i,i,n,"longitudinal",r)}_halfBlur(t,e,i,n,r,a,s){const o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");const h=new Se(di[n],l),c=l.uniforms,u=pi[i]-1,d=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):20;f>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const g=[];let m=0;for(let t=0;t<20;++t){const e=t/p,i=Math.exp(-e*e/2);g.push(i),0==t?m+=i:t<f&&(m+=2*i)}for(let t=0;t<g.length;t++)g[t]=g[t]/m;c.envMap.value=t.texture,c.samples.value=f,c.weights.value=g,c.latitudinal.value="latitudinal"===a,s&&(c.poleAxis.value=s),c.dTheta.value=d,c.mipInt.value=8-i,this._setEncoding(c.inputEncoding,t.texture),this._setEncoding(c.outputEncoding,t.texture);const y=pi[n];Ci(e,3*Math.max(0,oi-2*y),(0===n?0:2*oi)+2*y*(n>4?n-8+4:0),3*y,2*y),o.setRenderTarget(e),o.render(h,ui)}}function _i(t){return void 0!==t&&1009===t.type&&(3e3===t.encoding||3001===t.encoding||3007===t.encoding)}function Ai(){const t=[],e=[],i=[];let n=8;for(let r=0;r<hi;r++){const a=Math.pow(2,n);e.push(a);let s=1/a;r>4?s=li[r-8+4-1]:0==r&&(s=0),i.push(s);const o=1/(a-1),l=-o/2,h=1+o/2,c=[l,l,h,l,h,h,l,l,h,h,l,h],u=6,d=6,p=3,f=2,g=1,m=new Float32Array(p*d*u),y=new Float32Array(f*d*u),b=new Float32Array(g*d*u);for(let t=0;t<u;t++){const e=t%3*2/3-1,i=t>2?0:-1,n=[e,i,0,e+2/3,i,0,e+2/3,i+1,0,e,i,0,e+2/3,i+1,0,e,i+1,0];m.set(n,p*d*t),y.set(c,f*d*t);const r=[t,t,t,t,t,t];b.set(r,g*d*t)}const v=new ce;v.setAttribute("position",new $t(m,p)),v.setAttribute("uv",new $t(y,f)),v.setAttribute("faceIndex",new $t(b,g)),t.push(v),n>4&&n--}return{_lodPlanes:t,_sizeLods:e,_sigmas:i}}function wi(t){const e=new C(3*oi,3*oi,t);return e.texture.mapping=306,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Ci(t,e,i,n,r){t.viewport.set(e,i,n,r),t.scissor.set(e,i,n,r)}function Mi(){const t=new f(1,1);return new si({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:ci[3e3]},outputEncoding:{value:ci[3e3]}},vertexShader:Ii(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform vec2 texelSize;\n\n\t\t\t${Si()}\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1})}function Ei(){return new si({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:ci[3e3]},outputEncoding:{value:ci[3e3]}},vertexShader:Ii(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t${Si()}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1})}function Ii(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Si(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include <encodings_pars_fragment>\n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}function Ti(t){let e=new WeakMap,i=null;function n(t){const i=t.target;i.removeEventListener("dispose",n);const r=e.get(i);void 0!==r&&(e.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){const a=r.mapping,s=303===a||304===a,o=301===a||302===a;if(s||o){if(e.has(r))return e.get(r).texture;{const a=r.image;if(s&&a&&a.height>0||o&&a&&function(t){let e=0;for(let i=0;i<6;i++)void 0!==t[i]&&e++;return 6===e}(a)){const a=t.getRenderTarget();null===i&&(i=new xi(t));const o=s?i.fromEquirectangular(r):i.fromCubemap(r);return e.set(r,o),t.setRenderTarget(a),r.addEventListener("dispose",n),o.texture}return null}}}return r},dispose:function(){e=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function Bi(t){const e={};function i(i){if(void 0!==e[i])return e[i];let n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return e[i]=n,n}return{has:function(t){return null!==i(t)},init:function(t){t.isWebGL2?i("EXT_color_buffer_float"):(i("WEBGL_depth_texture"),i("OES_texture_float"),i("OES_texture_half_float"),i("OES_texture_half_float_linear"),i("OES_standard_derivatives"),i("OES_element_index_uint"),i("OES_vertex_array_object"),i("ANGLE_instanced_arrays")),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("EXT_multisampled_render_to_texture")},get:function(t){const e=i(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function Fi(t,e,i,n){const r={},a=new WeakMap;function s(t){const o=t.target;null!==o.index&&e.remove(o.index);for(const t in o.attributes)e.remove(o.attributes[t]);o.removeEventListener("dispose",s),delete r[o.id];const l=a.get(o);l&&(e.remove(l),a.delete(o)),n.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,i.memory.geometries--}function o(t){const i=[],n=t.index,r=t.attributes.position;let s=0;if(null!==n){const t=n.array;s=n.version;for(let e=0,n=t.length;e<n;e+=3){const n=t[e+0],r=t[e+1],a=t[e+2];i.push(n,r,r,a,a,n)}}else{const t=r.array;s=r.version;for(let e=0,n=t.length/3-1;e<n;e+=3){const t=e+0,n=e+1,r=e+2;i.push(t,n,n,r,r,t)}}const o=new(m(i)>65535?ee:te)(i,1);o.version=s;const l=a.get(t);l&&e.remove(l),a.set(t,o)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",s),r[e.id]=!0,i.memory.geometries++),e},update:function(t){const i=t.attributes;for(const t in i)e.update(i[t],34962);const n=t.morphAttributes;for(const t in n){const i=n[t];for(let t=0,n=i.length;t<n;t++)e.update(i[t],34962)}},getWireframeAttribute:function(t){const e=a.get(t);if(e){const i=t.index;null!==i&&e.version<i.version&&o(t)}else o(t);return a.get(t)}}}function Ui(t,e,i,n){const r=n.isWebGL2;let a,s,o;this.setMode=function(t){a=t},this.setIndex=function(t){s=t.type,o=t.bytesPerElement},this.render=function(e,n){t.drawElements(a,n,s,e*o),i.update(n,a,1)},this.renderInstances=function(n,l,h){if(0===h)return;let c,u;if(r)c=t,u="drawElementsInstanced";else if(c=e.get("ANGLE_instanced_arrays"),u="drawElementsInstancedANGLE",null===c)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[u](a,l,s,n*o,h),i.update(l,a,h)}}function Li(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,i,n){switch(e.calls++,i){case 4:e.triangles+=n*(t/3);break;case 1:e.lines+=n*(t/2);break;case 3:e.lines+=n*(t-1);break;case 2:e.lines+=n*t;break;case 0:e.points+=n*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}class Ri extends _{constructor(t=null,e=1,i=1,n=1){super(null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}function Di(t,e){return t[0]-e[0]}function Ni(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Pi(t,e){let i=1;const n=e.isInterleavedBufferAttribute?e.data.array:e.array;n instanceof Int8Array?i=127:n instanceof Int16Array?i=32767:n instanceof Int32Array?i=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",n),t.divideScalar(i)}function ki(t,e,i){const n={},r=new Float32Array(8),a=new WeakMap,s=new I,o=[];for(let t=0;t<8;t++)o[t]=[t,0];return{update:function(l,h,c,u){const d=l.morphTargetInfluences;if(!0===e.isWebGL2){const n=h.morphAttributes.position.length;let r=a.get(h);if(void 0===r||r.count!==n){void 0!==r&&r.texture.dispose();const t=void 0!==h.morphAttributes.normal,i=h.morphAttributes.position,o=h.morphAttributes.normal||[],l=!0===t?2:1;let c=h.attributes.position.count*l,u=1;c>e.maxTextureSize&&(u=Math.ceil(c/e.maxTextureSize),c=e.maxTextureSize);const d=new Float32Array(c*u*4*n),p=new Ri(d,c,u,n);p.format=1023,p.type=1015;const g=4*l;for(let e=0;e<n;e++){const n=i[e],r=o[e],a=c*u*4*e;for(let e=0;e<n.count;e++){s.fromBufferAttribute(n,e),!0===n.normalized&&Pi(s,n);const i=e*g;d[a+i+0]=s.x,d[a+i+1]=s.y,d[a+i+2]=s.z,d[a+i+3]=0,!0===t&&(s.fromBufferAttribute(r,e),!0===r.normalized&&Pi(s,r),d[a+i+4]=s.x,d[a+i+5]=s.y,d[a+i+6]=s.z,d[a+i+7]=0)}}r={count:n,texture:p,size:new f(c,u)},a.set(h,r)}let o=0;for(let t=0;t<d.length;t++)o+=d[t];const l=h.morphTargetsRelative?1:1-o;u.getUniforms().setValue(t,"morphTargetBaseInfluence",l),u.getUniforms().setValue(t,"morphTargetInfluences",d),u.getUniforms().setValue(t,"morphTargetsTexture",r.texture,i),u.getUniforms().setValue(t,"morphTargetsTextureSize",r.size)}else{const e=void 0===d?0:d.length;let i=n[h.id];if(void 0===i||i.length!==e){i=[];for(let t=0;t<e;t++)i[t]=[t,0];n[h.id]=i}for(let t=0;t<e;t++){const e=i[t];e[0]=t,e[1]=d[t]}i.sort(Ni);for(let t=0;t<8;t++)t<e&&i[t][1]?(o[t][0]=i[t][0],o[t][1]=i[t][1]):(o[t][0]=Number.MAX_SAFE_INTEGER,o[t][1]=0);o.sort(Di);const a=h.morphAttributes.position,s=h.morphAttributes.normal;let l=0;for(let t=0;t<8;t++){const e=o[t],i=e[0],n=e[1];i!==Number.MAX_SAFE_INTEGER&&n?(a&&h.getAttribute("morphTarget"+t)!==a[i]&&h.setAttribute("morphTarget"+t,a[i]),s&&h.getAttribute("morphNormal"+t)!==s[i]&&h.setAttribute("morphNormal"+t,s[i]),r[t]=n,l+=n):(a&&!0===h.hasAttribute("morphTarget"+t)&&h.deleteAttribute("morphTarget"+t),s&&!0===h.hasAttribute("morphNormal"+t)&&h.deleteAttribute("morphNormal"+t),r[t]=0)}const c=h.morphTargetsRelative?1:1-l;u.getUniforms().setValue(t,"morphTargetBaseInfluence",c),u.getUniforms().setValue(t,"morphTargetInfluences",r)}}}}function zi(t,e,i,n){let r=new WeakMap;function a(t){const e=t.target;e.removeEventListener("dispose",a),i.remove(e.instanceMatrix),null!==e.instanceColor&&i.remove(e.instanceColor)}return{update:function(t){const s=n.render.frame,o=t.geometry,l=e.get(t,o);return r.get(l)!==s&&(e.update(l),r.set(l,s)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",a)&&t.addEventListener("dispose",a),i.update(t.instanceMatrix,34962),null!==t.instanceColor&&i.update(t.instanceColor,34962)),l},dispose:function(){r=new WeakMap}}}Ri.prototype.isDataTexture2DArray=!0;class Oi extends _{constructor(t=null,e=1,i=1,n=1){super(null),this.image={data:t,width:e,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}Oi.prototype.isDataTexture3D=!0;const Qi=new _,Vi=new Ri,Hi=new Oi,Gi=new ke,ji=[],Wi=[],qi=new Float32Array(16),Zi=new Float32Array(9),Ji=new Float32Array(4);function Xi(t,e,i){const n=t[0];if(n<=0||n>0)return t;const r=e*i;let a=ji[r];if(void 0===a&&(a=new Float32Array(r),ji[r]=a),0!==e){n.toArray(a,0);for(let n=1,r=0;n!==e;++n)r+=i,t[n].toArray(a,r)}return a}function Yi(t,e){if(t.length!==e.length)return!1;for(let i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function Ki(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function $i(t,e){let i=Wi[e];void 0===i&&(i=new Int32Array(e),Wi[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function tn(t,e){const i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function en(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Yi(i,e))return;t.uniform2fv(this.addr,e),Ki(i,e)}}function nn(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(void 0!==e.r)i[0]===e.r&&i[1]===e.g&&i[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(Yi(i,e))return;t.uniform3fv(this.addr,e),Ki(i,e)}}function rn(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Yi(i,e))return;t.uniform4fv(this.addr,e),Ki(i,e)}}function an(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Yi(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),Ki(i,e)}else{if(Yi(i,n))return;Ji.set(n),t.uniformMatrix2fv(this.addr,!1,Ji),Ki(i,n)}}function sn(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Yi(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),Ki(i,e)}else{if(Yi(i,n))return;Zi.set(n),t.uniformMatrix3fv(this.addr,!1,Zi),Ki(i,n)}}function on(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Yi(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),Ki(i,e)}else{if(Yi(i,n))return;qi.set(n),t.uniformMatrix4fv(this.addr,!1,qi),Ki(i,n)}}function ln(t,e){const i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function hn(t,e){const i=this.cache;Yi(i,e)||(t.uniform2iv(this.addr,e),Ki(i,e))}function cn(t,e){const i=this.cache;Yi(i,e)||(t.uniform3iv(this.addr,e),Ki(i,e))}function un(t,e){const i=this.cache;Yi(i,e)||(t.uniform4iv(this.addr,e),Ki(i,e))}function dn(t,e){const i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function pn(t,e){const i=this.cache;Yi(i,e)||(t.uniform2uiv(this.addr,e),Ki(i,e))}function fn(t,e){const i=this.cache;Yi(i,e)||(t.uniform3uiv(this.addr,e),Ki(i,e))}function gn(t,e){const i=this.cache;Yi(i,e)||(t.uniform4uiv(this.addr,e),Ki(i,e))}function mn(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.safeSetTexture2D(e||Qi,r)}function yn(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(e||Hi,r)}function bn(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.safeSetTextureCube(e||Gi,r)}function vn(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(e||Vi,r)}function xn(t,e){t.uniform1fv(this.addr,e)}function _n(t,e){const i=Xi(e,this.size,2);t.uniform2fv(this.addr,i)}function An(t,e){const i=Xi(e,this.size,3);t.uniform3fv(this.addr,i)}function wn(t,e){const i=Xi(e,this.size,4);t.uniform4fv(this.addr,i)}function Cn(t,e){const i=Xi(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function Mn(t,e){const i=Xi(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function En(t,e){const i=Xi(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function In(t,e){t.uniform1iv(this.addr,e)}function Sn(t,e){t.uniform2iv(this.addr,e)}function Tn(t,e){t.uniform3iv(this.addr,e)}function Bn(t,e){t.uniform4iv(this.addr,e)}function Fn(t,e){t.uniform1uiv(this.addr,e)}function Un(t,e){t.uniform2uiv(this.addr,e)}function Ln(t,e){t.uniform3uiv(this.addr,e)}function Rn(t,e){t.uniform4uiv(this.addr,e)}function Dn(t,e,i){const n=e.length,r=$i(i,n);t.uniform1iv(this.addr,r);for(let t=0;t!==n;++t)i.safeSetTexture2D(e[t]||Qi,r[t])}function Nn(t,e,i){const n=e.length,r=$i(i,n);t.uniform1iv(this.addr,r);for(let t=0;t!==n;++t)i.safeSetTextureCube(e[t]||Gi,r[t])}function Pn(t,e,i){this.id=t,this.addr=i,this.cache=[],this.setValue=function(t){switch(t){case 5126:return tn;case 35664:return en;case 35665:return nn;case 35666:return rn;case 35674:return an;case 35675:return sn;case 35676:return on;case 5124:case 35670:return ln;case 35667:case 35671:return hn;case 35668:case 35672:return cn;case 35669:case 35673:return un;case 5125:return dn;case 36294:return pn;case 36295:return fn;case 36296:return gn;case 35678:case 36198:case 36298:case 36306:case 35682:return mn;case 35679:case 36299:case 36307:return yn;case 35680:case 36300:case 36308:case 36293:return bn;case 36289:case 36303:case 36311:case 36292:return vn}}(e.type)}function kn(t,e,i){this.id=t,this.addr=i,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return xn;case 35664:return _n;case 35665:return An;case 35666:return wn;case 35674:return Cn;case 35675:return Mn;case 35676:return En;case 5124:case 35670:return In;case 35667:case 35671:return Sn;case 35668:case 35672:return Tn;case 35669:case 35673:return Bn;case 5125:return Fn;case 36294:return Un;case 36295:return Ln;case 36296:return Rn;case 35678:case 36198:case 36298:case 36306:case 35682:return Dn;case 35680:case 36300:case 36308:case 36293:return Nn}}(e.type)}function zn(t){this.id=t,this.seq=[],this.map={}}kn.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),Ki(e,t)},zn.prototype.setValue=function(t,e,i){const n=this.seq;for(let r=0,a=n.length;r!==a;++r){const a=n[r];a.setValue(t,e[a.id],i)}};const On=/(\w+)(\])?(\[|\.)?/g;function Qn(t,e){t.seq.push(e),t.map[e.id]=e}function Vn(t,e,i){const n=t.name,r=n.length;for(On.lastIndex=0;;){const a=On.exec(n),s=On.lastIndex;let o=a[1];const l="]"===a[2],h=a[3];if(l&&(o|=0),void 0===h||"["===h&&s+2===r){Qn(i,void 0===h?new Pn(o,t,e):new kn(o,t,e));break}{let t=i.map[o];void 0===t&&(t=new zn(o),Qn(i,t)),i=t}}}function Hn(t,e){this.seq=[],this.map={};const i=t.getProgramParameter(e,35718);for(let n=0;n<i;++n){const i=t.getActiveUniform(e,n);Vn(i,t.getUniformLocation(e,i.name),this)}}function Gn(t,e,i){const n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}Hn.prototype.setValue=function(t,e,i,n){const r=this.map[e];void 0!==r&&r.setValue(t,i,n)},Hn.prototype.setOptional=function(t,e,i){const n=e[i];void 0!==n&&this.setValue(t,i,n)},Hn.upload=function(t,e,i,n){for(let r=0,a=e.length;r!==a;++r){const a=e[r],s=i[a.id];!1!==s.needsUpdate&&a.setValue(t,s.value,n)}},Hn.seqWithValue=function(t,e){const i=[];for(let n=0,r=t.length;n!==r;++n){const r=t[n];r.id in e&&i.push(r)}return i};let jn=0;function Wn(t){switch(t){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];case 3002:return["RGBE","( value )"];case 3004:return["RGBM","( value, 7.0 )"];case 3005:return["RGBM","( value, 16.0 )"];case 3006:return["RGBD","( value, 256.0 )"];case 3007:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case 3003:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}function qn(t,e,i){const n=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();return n&&""===r?"":i.toUpperCase()+"\n\n"+r+"\n\n"+function(t){const e=t.split("\n");for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join("\n")}(t.getShaderSource(e))}function Zn(t,e){const i=Wn(e);return"vec4 "+t+"( vec4 value ) { return "+i[0]+"ToLinear"+i[1]+"; }"}function Jn(t,e){const i=Wn(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function Xn(t,e){let i;switch(e){case 1:i="Linear";break;case 2:i="Reinhard";break;case 3:i="OptimizedCineon";break;case 4:i="ACESFilmic";break;case 5:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),i="Linear"}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function Yn(t){return""!==t}function Kn(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function $n(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const tr=/^[ \t]*#include +<([\w\d./]+)>/gm;function er(t){return t.replace(tr,ir)}function ir(t,e){const i=Xe[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return er(i)}const nr=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,rr=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function ar(t){return t.replace(rr,or).replace(nr,sr)}function sr(t,e,i,n){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),or(t,e,i,n)}function or(t,e,i,n){let r="";for(let t=parseInt(e);t<parseInt(i);t++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function lr(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function hr(t,e,i,n){const r=t.getContext(),a=i.defines;let s=i.vertexShader,o=i.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(i),h=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case 301:case 302:e="ENVMAP_TYPE_CUBE";break;case 306:case 307:e="ENVMAP_TYPE_CUBE_UV"}return e}(i),c=function(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case 302:case 307:e="ENVMAP_MODE_REFRACTION"}return e}(i),u=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(i),d=t.gammaFactor>0?t.gammaFactor:1,p=i.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Yn).join("\n")}(i),f=function(t){const e=[];for(const i in t){const n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(a),g=r.createProgram();let m,y,b=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?(m=[f].filter(Yn).join("\n"),m.length>0&&(m+="\n"),y=[p,f].filter(Yn).join("\n"),y.length>0&&(y+="\n")):(m=[lr(i),"#define SHADER_NAME "+i.shaderName,f,i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+d,"#define MAX_BONES "+i.maxBones,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+c:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularTintMap?"#define USE_SPECULARTINTMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphTargets&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",i.morphTargets&&i.isWebGL2?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Yn).join("\n"),y=[p,lr(i),"#define SHADER_NAME "+i.shaderName,f,"#define GAMMA_FACTOR "+d,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+h:"",i.envMap?"#define "+c:"",i.envMap?"#define "+u:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularTintMap?"#define USE_SPECULARTINTMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.sheen?"#define USE_SHEEN":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(i.extensionShaderTextureLOD||i.envMap)&&i.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?Xe.tonemapping_pars_fragment:"",0!==i.toneMapping?Xn("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",1022===i.format?"#define OPAQUE":"",Xe.encodings_pars_fragment,i.map?Zn("mapTexelToLinear",i.mapEncoding):"",i.matcap?Zn("matcapTexelToLinear",i.matcapEncoding):"",i.envMap?Zn("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMap?Zn("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.specularTintMap?Zn("specularTintMapTexelToLinear",i.specularTintMapEncoding):"",i.lightMap?Zn("lightMapTexelToLinear",i.lightMapEncoding):"",Jn("linearToOutputTexel",i.outputEncoding),i.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Yn).join("\n")),s=er(s),s=Kn(s,i),s=$n(s,i),o=er(o),o=Kn(o,i),o=$n(o,i),s=ar(s),o=ar(o),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(b="#version 300 es\n",m=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+m,y=["#define varying in","300 es"===i.glslVersion?"":"out highp vec4 pc_fragColor;","300 es"===i.glslVersion?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+y);const v=b+y+o,x=Gn(r,35633,b+m+s),_=Gn(r,35632,v);if(r.attachShader(g,x),r.attachShader(g,_),void 0!==i.index0AttributeName?r.bindAttribLocation(g,0,i.index0AttributeName):!0===i.morphTargets&&r.bindAttribLocation(g,0,"position"),r.linkProgram(g),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(g).trim(),e=r.getShaderInfoLog(x).trim(),i=r.getShaderInfoLog(_).trim();let n=!0,a=!0;if(!1===r.getProgramParameter(g,35714)){n=!1;const e=qn(r,x,"vertex"),i=qn(r,_,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(g,35715)+"\n\nProgram Info Log: "+t+"\n"+e+"\n"+i)}else""!==t?console.warn("THREE.WebGLProgram: Program Info Log:",t):""!==e&&""!==i||(a=!1);a&&(this.diagnostics={runnable:n,programLog:t,vertexShader:{log:e,prefix:m},fragmentShader:{log:i,prefix:y}})}let A,w;return r.deleteShader(x),r.deleteShader(_),this.getUniforms=function(){return void 0===A&&(A=new Hn(r,g)),A},this.getAttributes=function(){return void 0===w&&(w=function(t,e){const i={},n=t.getProgramParameter(e,35721);for(let r=0;r<n;r++){const n=t.getActiveAttrib(e,r),a=n.name;let s=1;35674===n.type&&(s=2),35675===n.type&&(s=3),35676===n.type&&(s=4),i[a]={type:n.type,location:t.getAttribLocation(e,a),locationSize:s}}return i}(r,g)),w},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(g),this.program=void 0},this.name=i.shaderName,this.id=jn++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=x,this.fragmentShader=_,this}function cr(t,e,i,n,r,a,s){const o=[],l=r.isWebGL2,h=r.logarithmicDepthBuffer,c=r.floatVertexTextures,u=r.maxVertexUniforms,d=r.vertexTextures;let p=r.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},g=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoat","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","specularIntensityMap","specularTintMap","specularTintMapEncoding","roughnessMap","metalnessMap","gradientMap","alphaMap","alphaTest","combine","vertexColors","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","morphTargetsCount","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","format","sheen","transmission","transmissionMap","thicknessMap"];function m(t){let e;return t&&t.isTexture?e=t.encoding:t&&t.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),e=t.texture.encoding):e=3e3,l&&t&&t.isTexture&&1023===t.format&&1009===t.type&&3001===t.encoding&&(e=3e3),e}return{getParameters:function(a,o,g,y,b){const v=y.fog,x=a.isMeshStandardMaterial?y.environment:null,_=(a.isMeshStandardMaterial?i:e).get(a.envMap||x),A=f[a.type],w=b.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(c)return 1024;{const t=u,i=Math.floor((t-20)/4),n=Math.min(i,e.length);return n<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+n+"."),0):n}}(b):0;let C,M;if(null!==a.precision&&(p=r.getMaxPrecision(a.precision),p!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead.")),A){const t=Ke[A];C=t.vertexShader,M=t.fragmentShader}else C=a.vertexShader,M=a.fragmentShader;const E=t.getRenderTarget(),I=a.alphaTest>0,S=a.clearcoat>0;return{isWebGL2:l,shaderID:A,shaderName:a.type,vertexShader:C,fragmentShader:M,defines:a.defines,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,instancing:!0===b.isInstancedMesh,instancingColor:!0===b.isInstancedMesh&&null!==b.instanceColor,supportsVertexTextures:d,outputEncoding:null!==E?m(E.texture):t.outputEncoding,map:!!a.map,mapEncoding:m(a.map),matcap:!!a.matcap,matcapEncoding:m(a.matcap),envMap:!!_,envMapMode:_&&_.mapping,envMapEncoding:m(_),envMapCubeUV:!!_&&(306===_.mapping||307===_.mapping),lightMap:!!a.lightMap,lightMapEncoding:m(a.lightMap),aoMap:!!a.aoMap,emissiveMap:!!a.emissiveMap,emissiveMapEncoding:m(a.emissiveMap),bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,objectSpaceNormalMap:1===a.normalMapType,tangentSpaceNormalMap:0===a.normalMapType,clearcoat:S,clearcoatMap:S&&!!a.clearcoatMap,clearcoatRoughnessMap:S&&!!a.clearcoatRoughnessMap,clearcoatNormalMap:S&&!!a.clearcoatNormalMap,displacementMap:!!a.displacementMap,roughnessMap:!!a.roughnessMap,metalnessMap:!!a.metalnessMap,specularMap:!!a.specularMap,specularIntensityMap:!!a.specularIntensityMap,specularTintMap:!!a.specularTintMap,specularTintMapEncoding:m(a.specularTintMap),alphaMap:!!a.alphaMap,alphaTest:I,gradientMap:!!a.gradientMap,sheen:a.sheen>0,transmission:a.transmission>0,transmissionMap:!!a.transmissionMap,thicknessMap:!!a.thicknessMap,combine:a.combine,vertexTangents:!!a.normalMap&&!!b.geometry&&!!b.geometry.attributes.tangent,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!b.geometry&&!!b.geometry.attributes.color&&4===b.geometry.attributes.color.itemSize,vertexUvs:!!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatMap||a.clearcoatRoughnessMap||a.clearcoatNormalMap||a.displacementMap||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularTintMap),uvsVertexOnly:!(a.map||a.bumpMap||a.normalMap||a.specularMap||a.alphaMap||a.emissiveMap||a.roughnessMap||a.metalnessMap||a.clearcoatNormalMap||a.transmission>0||a.transmissionMap||a.thicknessMap||a.specularIntensityMap||a.specularTintMap||!a.displacementMap),fog:!!v,useFog:a.fog,fogExp2:v&&v.isFogExp2,flatShading:!!a.flatShading,sizeAttenuation:a.sizeAttenuation,logarithmicDepthBuffer:h,skinning:!0===b.isSkinnedMesh&&w>0,maxBones:w,useVertexTexture:c,morphTargets:!!b.geometry&&!!b.geometry.morphAttributes.position,morphNormals:!!b.geometry&&!!b.geometry.morphAttributes.normal,morphTargetsCount:b.geometry&&b.geometry.morphAttributes.position?b.geometry.morphAttributes.position.length:0,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,format:a.format,dithering:a.dithering,shadowMapEnabled:t.shadowMap.enabled&&g.length>0,shadowMapType:t.shadowMap.type,toneMapping:a.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,depthPacking:void 0!==a.depthPacking&&a.depthPacking,index0AttributeName:a.index0AttributeName,extensionDerivatives:a.extensions&&a.extensions.derivatives,extensionFragDepth:a.extensions&&a.extensions.fragDepth,extensionDrawBuffers:a.extensions&&a.extensions.drawBuffers,extensionShaderTextureLOD:a.extensions&&a.extensions.shaderTextureLOD,rendererExtensionFragDepth:l||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:l||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:l||n.has("EXT_shader_texture_lod"),customProgramCacheKey:a.customProgramCacheKey()}},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.fragmentShader),i.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t<g.length;t++)i.push(e[g[t]]);i.push(t.outputEncoding),i.push(t.gammaFactor)}return i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=f[t.type];let i;if(e){const t=Ke[e];i=Le.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n;for(let t=0,e=o.length;t<e;t++){const e=o[t];if(e.cacheKey===i){n=e,++n.usedTimes;break}}return void 0===n&&(n=new hr(t,i,e,a),o.push(n)),n},releaseProgram:function(t){if(0==--t.usedTimes){const e=o.indexOf(t);o[e]=o[o.length-1],o.pop(),t.destroy()}},programs:o}}function ur(){let t=new WeakMap;return{get:function(e){let i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i},remove:function(e){t.delete(e)},update:function(e,i,n){t.get(e)[i]=n},dispose:function(){t=new WeakMap}}}function dr(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function pr(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function fr(t){const e=[];let i=0;const n=[],r=[],a=[],s={id:-1};function o(n,r,a,o,l,h){let c=e[i];const u=t.get(a);return void 0===c?(c={id:n.id,object:n,geometry:r,material:a,program:u.program||s,groupOrder:o,renderOrder:n.renderOrder,z:l,group:h},e[i]=c):(c.id=n.id,c.object=n,c.geometry=r,c.material=a,c.program=u.program||s,c.groupOrder=o,c.renderOrder=n.renderOrder,c.z=l,c.group=h),i++,c}return{opaque:n,transmissive:r,transparent:a,init:function(){i=0,n.length=0,r.length=0,a.length=0},push:function(t,e,i,s,l,h){const c=o(t,e,i,s,l,h);i.transmission>0?r.push(c):!0===i.transparent?a.push(c):n.push(c)},unshift:function(t,e,i,s,l,h){const c=o(t,e,i,s,l,h);i.transmission>0?r.unshift(c):!0===i.transparent?a.unshift(c):n.unshift(c)},finish:function(){for(let t=i,n=e.length;t<n;t++){const i=e[t];if(null===i.id)break;i.id=null,i.object=null,i.geometry=null,i.material=null,i.program=null,i.group=null}},sort:function(t,e){n.length>1&&n.sort(t||dr),r.length>1&&r.sort(e||pr),a.length>1&&a.sort(e||pr)}}}function gr(t){let e=new WeakMap;return{get:function(i,n){let r;return!1===e.has(i)?(r=new fr(t),e.set(i,[r])):n>=e.get(i).length?(r=new fr(t),e.get(i).push(r)):r=e.get(i)[n],r},dispose:function(){e=new WeakMap}}}function mr(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":i={direction:new I,color:new Jt};break;case"SpotLight":i={position:new I,direction:new I,color:new Jt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new I,color:new Jt,distance:0,decay:0};break;case"HemisphereLight":i={direction:new I,skyColor:new Jt,groundColor:new Jt};break;case"RectAreaLight":i={color:new Jt,position:new I,halfWidth:new I,halfHeight:new I}}return t[e.id]=i,i}}}let yr=0;function br(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function vr(t,e){const i=new mr,n=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new f};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new f,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)r.probe.push(new I);const a=new I,s=new rt,o=new rt;return{setup:function(a,s){let o=0,l=0,h=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let c=0,u=0,d=0,p=0,f=0,g=0,m=0,y=0;a.sort(br);const b=!0!==s?Math.PI:1;for(let t=0,e=a.length;t<e;t++){const e=a[t],s=e.color,v=e.intensity,x=e.distance,_=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)o+=s.r*v*b,l+=s.g*v*b,h+=s.b*v*b;else if(e.isLightProbe)for(let t=0;t<9;t++)r.probe[t].addScaledVector(e.sh.coefficients[t],v);else if(e.isDirectionalLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*b),e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,r.directionalShadow[c]=i,r.directionalShadowMap[c]=_,r.directionalShadowMatrix[c]=e.shadow.matrix,g++}r.directional[c]=t,c++}else if(e.isSpotLight){const t=i.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(s).multiplyScalar(v*b),t.distance=x,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,r.spotShadow[d]=i,r.spotShadowMap[d]=_,r.spotShadowMatrix[d]=e.shadow.matrix,y++}r.spot[d]=t,d++}else if(e.isRectAreaLight){const t=i.get(e);t.color.copy(s).multiplyScalar(v),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),r.rectArea[p]=t,p++}else if(e.isPointLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*b),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,i.shadowCameraNear=t.camera.near,i.shadowCameraFar=t.camera.far,r.pointShadow[u]=i,r.pointShadowMap[u]=_,r.pointShadowMatrix[u]=e.shadow.matrix,m++}r.point[u]=t,u++}else if(e.isHemisphereLight){const t=i.get(e);t.skyColor.copy(e.color).multiplyScalar(v*b),t.groundColor.copy(e.groundColor).multiplyScalar(v*b),r.hemi[f]=t,f++}}p>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Ye.LTC_FLOAT_1,r.rectAreaLTC2=Ye.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Ye.LTC_HALF_1,r.rectAreaLTC2=Ye.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=l,r.ambient[2]=h;const v=r.hash;v.directionalLength===c&&v.pointLength===u&&v.spotLength===d&&v.rectAreaLength===p&&v.hemiLength===f&&v.numDirectionalShadows===g&&v.numPointShadows===m&&v.numSpotShadows===y||(r.directional.length=c,r.spot.length=d,r.rectArea.length=p,r.point.length=u,r.hemi.length=f,r.directionalShadow.length=g,r.directionalShadowMap.length=g,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=y,r.spotShadowMap.length=y,r.directionalShadowMatrix.length=g,r.pointShadowMatrix.length=m,r.spotShadowMatrix.length=y,v.directionalLength=c,v.pointLength=u,v.spotLength=d,v.rectAreaLength=p,v.hemiLength=f,v.numDirectionalShadows=g,v.numPointShadows=m,v.numSpotShadows=y,r.version=yr++)},setupView:function(t,e){let i=0,n=0,l=0,h=0,c=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=r.directional[i];t.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(u),i++}else if(d.isSpotLight){const t=r.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),t.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(a),t.direction.transformDirection(u),l++}else if(d.isRectAreaLight){const t=r.rectArea[h];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),o.identity(),s.copy(d.matrixWorld),s.premultiply(u),o.extractRotation(s),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(o),t.halfHeight.applyMatrix4(o),h++}else if(d.isPointLight){const t=r.point[n];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),n++}else if(d.isHemisphereLight){const t=r.hemi[c];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(u),t.direction.normalize(),c++}}},state:r}}function xr(t,e){const i=new vr(t,e),n=[],r=[];return{init:function(){n.length=0,r.length=0},state:{lightsArray:n,shadowsArray:r,lights:i},setupLights:function(t){i.setup(n,t)},setupLightsView:function(t){i.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){r.push(t)}}}function _r(t,e){let i=new WeakMap;return{get:function(n,r=0){let a;return!1===i.has(n)?(a=new xr(t,e),i.set(n,[a])):r>=i.get(n).length?(a=new xr(t,e),i.get(n).push(a)):a=i.get(n)[r],a},dispose:function(){i=new WeakMap}}}class Ar extends Vt{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}Ar.prototype.isMeshDepthMaterial=!0;class wr extends Vt{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new I,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}wr.prototype.isMeshDistanceMaterial=!0;function Cr(t,e,i){let n=new We;const r=new f,a=new f,s=new w,o=new Ar({depthPacking:3201}),l=new wr,h={},c=i.maxTextureSize,u={0:1,1:0,2:2},d=new Re({uniforms:{shadow_pass:{value:null},resolution:{value:new f},radius:{value:4},samples:{value:8}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nuniform float samples;\n#include <packing>\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const g=new ce;g.setAttribute("position",new $t(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new Se(g,d),y=this;function b(i,n){const r=e.update(m);d.uniforms.shadow_pass.value=i.map.texture,d.uniforms.resolution.value=i.mapSize,d.uniforms.radius.value=i.radius,d.uniforms.samples.value=i.blurSamples,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,r,d,m,null),p.uniforms.shadow_pass.value=i.mapPass.texture,p.uniforms.resolution.value=i.mapSize,p.uniforms.radius.value=i.radius,p.uniforms.samples.value=i.blurSamples,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,r,p,m,null)}function v(e,i,n,r,a,s,c){let d=null;const p=!0===r.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(d=void 0!==p?p:!0===r.isPointLight?l:o,t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0){const t=d.uuid,e=n.uuid;let i=h[t];void 0===i&&(i={},h[t]=i);let r=i[e];void 0===r&&(r=d.clone(),i[e]=r),d=r}return d.visible=n.visible,d.wireframe=n.wireframe,d.side=3===c?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:u[n.side],d.alphaMap=n.alphaMap,d.alphaTest=n.alphaTest,d.clipShadows=n.clipShadows,d.clippingPlanes=n.clippingPlanes,d.clipIntersection=n.clipIntersection,d.displacementMap=n.displacementMap,d.displacementScale=n.displacementScale,d.displacementBias=n.displacementBias,d.wireframeLinewidth=n.wireframeLinewidth,d.linewidth=n.linewidth,!0===r.isPointLight&&!0===d.isMeshDistanceMaterial&&(d.referencePosition.setFromMatrixPosition(r.matrixWorld),d.nearDistance=a,d.farDistance=s),d}function x(i,r,a,s,o){if(!1===i.visible)return;if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&3===o)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,i.matrixWorld);const n=e.update(i),r=i.material;if(Array.isArray(r)){const e=n.groups;for(let l=0,h=e.length;l<h;l++){const h=e[l],c=r[h.materialIndex];if(c&&c.visible){const e=v(i,0,c,s,a.near,a.far,o);t.renderBufferDirect(a,null,n,e,i,h)}}}else if(r.visible){const e=v(i,0,r,s,a.near,a.far,o);t.renderBufferDirect(a,null,n,e,i,null)}}const l=i.children;for(let t=0,e=l.length;t<e;t++)x(l[t],r,a,s,o)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,i,o){if(!1===y.enabled)return;if(!1===y.autoUpdate&&!1===y.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),h=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),d=t.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(let l=0,h=e.length;l<h;l++){const h=e[l],u=h.shadow;if(void 0===u){console.warn("THREE.WebGLShadowMap:",h,"has no shadow.");continue}if(!1===u.autoUpdate&&!1===u.needsUpdate)continue;r.copy(u.mapSize);const p=u.getFrameExtents();if(r.multiply(p),a.copy(u.mapSize),(r.x>c||r.y>c)&&(r.x>c&&(a.x=Math.floor(c/p.x),r.x=a.x*p.x,u.mapSize.x=a.x),r.y>c&&(a.y=Math.floor(c/p.y),r.y=a.y*p.y,u.mapSize.y=a.y)),null===u.map&&!u.isPointLightShadow&&3===this.type){const t={minFilter:1006,magFilter:1006,format:1023};u.map=new C(r.x,r.y,t),u.map.texture.name=h.name+".shadowMap",u.mapPass=new C(r.x,r.y,t),u.camera.updateProjectionMatrix()}if(null===u.map){const t={minFilter:1003,magFilter:1003,format:1023};u.map=new C(r.x,r.y,t),u.map.texture.name=h.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const f=u.getViewportCount();for(let t=0;t<f;t++){const e=u.getViewport(t);s.set(a.x*e.x,a.y*e.y,a.x*e.z,a.y*e.w),d.viewport(s),u.updateMatrices(h,t),n=u.getFrustum(),x(i,o,u.camera,h,this.type)}u.isPointLightShadow||3!==this.type||b(u,o),u.needsUpdate=!1}y.needsUpdate=!1,t.setRenderTarget(l,h,u)}}function Mr(t,e,i){const n=i.isWebGL2;const r=new function(){let e=!1;const i=new w;let n=null;const r=new w(0,0,0,0);return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,a,s,o){!0===o&&(e*=s,n*=s,a*=s),i.set(e,n,a,s),!1===r.equals(i)&&(t.clearColor(e,n,a,s),r.copy(i))},reset:function(){e=!1,n=null,r.set(-1,0,0,0)}}},a=new function(){let e=!1,i=null,n=null,r=null;return{setTest:function(t){t?k(2929):z(2929)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){if(e)switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517);break;default:t.depthFunc(515)}else t.depthFunc(515);n=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,i=null,n=null,r=null}}},s=new function(){let e=!1,i=null,n=null,r=null,a=null,s=null,o=null,l=null,h=null;return{setTest:function(t){e||(t?k(2960):z(2960))},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,s){n===e&&r===i&&a===s||(t.stencilFunc(e,i,s),n=e,r=i,a=s)},setOp:function(e,i,n){s===e&&o===i&&l===n||(t.stencilOp(e,i,n),s=e,o=i,l=n)},setLocked:function(t){e=t},setClear:function(e){h!==e&&(t.clearStencil(e),h=e)},reset:function(){e=!1,i=null,n=null,r=null,a=null,s=null,o=null,l=null,h=null}}};let o={},l=null,h={},c=null,u=!1,d=null,p=null,f=null,g=null,m=null,y=null,b=null,v=!1,x=null,_=null,A=null,C=null,M=null;const E=t.getParameter(35661);let I=!1,S=0;const T=t.getParameter(7938);-1!==T.indexOf("WebGL")?(S=parseFloat(/^WebGL (\d)/.exec(T)[1]),I=S>=1):-1!==T.indexOf("OpenGL ES")&&(S=parseFloat(/^OpenGL ES (\d)/.exec(T)[1]),I=S>=2);let B=null,F={};const U=t.getParameter(3088),L=t.getParameter(2978),R=(new w).fromArray(U),D=(new w).fromArray(L);function N(e,i,n){const r=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<n;e++)t.texImage2D(i+e,0,6408,1,1,0,6408,5121,r);return a}const P={};function k(e){!0!==o[e]&&(t.enable(e),o[e]=!0)}function z(e){!1!==o[e]&&(t.disable(e),o[e]=!1)}P[3553]=N(3553,3553,1),P[34067]=N(34067,34069,6),r.setClear(0,0,0,1),a.setClear(1),s.setClear(0),k(2929),a.setFunc(3),H(!1),G(1),k(2884),V(0);const O={100:32774,101:32778,102:32779};if(n)O[103]=32775,O[104]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(O[103]=t.MIN_EXT,O[104]=t.MAX_EXT)}const Q={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function V(e,i,n,r,a,s,o,l){if(0!==e){if(!1===u&&(k(3042),u=!0),5===e)a=a||i,s=s||n,o=o||r,i===p&&a===m||(t.blendEquationSeparate(O[i],O[a]),p=i,m=a),n===f&&r===g&&s===y&&o===b||(t.blendFuncSeparate(Q[n],Q[r],Q[s],Q[o]),f=n,g=r,y=s,b=o),d=e,v=null;else if(e!==d||l!==v){if(100===p&&100===m||(t.blendEquation(32774),p=100,m=100),l)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,0,769,771);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFunc(0,769);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}f=null,g=null,y=null,b=null,d=e,v=l}}else!0===u&&(z(3042),u=!1)}function H(e){x!==e&&(e?t.frontFace(2304):t.frontFace(2305),x=e)}function G(e){0!==e?(k(2884),e!==_&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):z(2884),_=e}function j(e,i,n){e?(k(32823),C===i&&M===n||(t.polygonOffset(i,n),C=i,M=n)):z(32823)}function W(e){void 0===e&&(e=33984+E-1),B!==e&&(t.activeTexture(e),B=e)}return{buffers:{color:r,depth:a,stencil:s},enable:k,disable:z,bindFramebuffer:function(e,i){return null===i&&null!==l&&(i=l),h[e]!==i&&(t.bindFramebuffer(e,i),h[e]=i,n&&(36009===e&&(h[36160]=i),36160===e&&(h[36009]=i)),!0)},bindXRFramebuffer:function(e){e!==l&&(t.bindFramebuffer(36160,e),l=e)},useProgram:function(e){return c!==e&&(t.useProgram(e),c=e,!0)},setBlending:V,setMaterial:function(t,e){2===t.side?z(2884):k(2884);let i=1===t.side;e&&(i=!i),H(i),1===t.blending&&!1===t.transparent?V(0):V(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),a.setFunc(t.depthFunc),a.setTest(t.depthTest),a.setMask(t.depthWrite),r.setMask(t.colorWrite);const n=t.stencilWrite;s.setTest(n),n&&(s.setMask(t.stencilWriteMask),s.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),s.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),j(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?k(32926):z(32926)},setFlipSided:H,setCullFace:G,setLineWidth:function(e){e!==A&&(I&&t.lineWidth(e),A=e)},setPolygonOffset:j,setScissorTest:function(t){t?k(3089):z(3089)},activeTexture:W,bindTexture:function(e,i){null===B&&W();let n=F[B];void 0===n&&(n={type:void 0,texture:void 0},F[B]=n),n.type===e&&n.texture===i||(t.bindTexture(e,i||P[e]),n.type=e,n.texture=i)},unbindTexture:function(){const e=F[B];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===R.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),R.copy(e))},viewport:function(e){!1===D.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),D.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.disable(32926),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.bindFramebuffer(36160,null),!0===n&&(t.bindFramebuffer(36009,null),t.bindFramebuffer(36008,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),o={},B=null,F={},l=null,h={},c=null,u=!1,d=null,p=null,f=null,g=null,m=null,y=null,b=null,v=!1,x=null,_=null,A=null,C=null,M=null,R.set(0,0,t.canvas.width,t.canvas.height),D.set(0,0,t.canvas.width,t.canvas.height),r.reset(),a.reset(),s.reset()}}}function Er(t,e,i,n,r,a,s){const o=r.isWebGL2,l=r.maxTextures,h=r.maxCubemapSize,c=r.maxTextureSize,u=r.maxSamples,f=new WeakMap;let g,m=!1;try{m="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function b(t,e){return m?new OffscreenCanvas(t,e):y("canvas")}function v(t,e,i,n){let r=1;if((t.width>n||t.height>n)&&(r=n/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const n=e?p:Math.floor,a=n(r*t.width),s=n(r*t.height);void 0===g&&(g=b(a,s));const o=i?b(a,s):g;o.width=a,o.height=s;return o.getContext("2d").drawImage(t,0,0,a,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+a+"x"+s+")."),o}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function x(t){return d(t.width)&&d(t.height)}function _(t,e){return t.generateMipmaps&&e&&1003!==t.minFilter&&1006!==t.minFilter}function A(e,i,r,a,s=1){t.generateMipmap(e);n.get(i).__maxMipLevel=Math.log2(Math.max(r,a,s))}function w(i,n,r,a){if(!1===o)return n;if(null!==i){if(void 0!==t[i])return t[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let s=n;return 6403===n&&(5126===r&&(s=33326),5131===r&&(s=33325),5121===r&&(s=33321)),6407===n&&(5126===r&&(s=34837),5131===r&&(s=34843),5121===r&&(s=32849)),6408===n&&(5126===r&&(s=34836),5131===r&&(s=34842),5121===r&&(s=3001===a?35907:32856)),33325!==s&&33326!==s&&34842!==s&&34836!==s||e.get("EXT_color_buffer_float"),s}function C(t){return 1003===t||1004===t||1005===t?9728:9729}function M(e){const i=e.target;i.removeEventListener("dispose",M),function(e){const i=n.get(e);if(void 0===i.__webglInit)return;t.deleteTexture(i.__webglTexture),n.remove(e)}(i),i.isVideoTexture&&f.delete(i),s.memory.textures--}function E(e){const i=e.target;i.removeEventListener("dispose",E),function(e){const i=e.texture,r=n.get(e),a=n.get(i);if(!e)return;void 0!==a.__webglTexture&&(t.deleteTexture(a.__webglTexture),s.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&t.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(let e=0,r=i.length;e<r;e++){const r=n.get(i[e]);r.__webglTexture&&(t.deleteTexture(r.__webglTexture),s.memory.textures--),n.remove(i[e])}n.remove(i),n.remove(e)}(i)}let I=0;function S(t,e){const r=n.get(t);if(t.isVideoTexture&&function(t){const e=s.render.frame;f.get(t)!==e&&(f.set(t,e),t.update())}(t),t.version>0&&r.__version!==t.version){const i=t.image;if(void 0===i)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==i.complete)return void R(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.activeTexture(33984+e),i.bindTexture(3553,r.__webglTexture)}function T(e,r){const s=n.get(e);e.version>0&&s.__version!==e.version?function(e,n,r){if(6!==n.image.length)return;L(e,n),i.activeTexture(33984+r),i.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment),t.pixelStorei(37443,0);const s=n&&(n.isCompressedTexture||n.image[0].isCompressedTexture),l=n.image[0]&&n.image[0].isDataTexture,c=[];for(let t=0;t<6;t++)c[t]=s||l?l?n.image[t].image:n.image[t]:v(n.image[t],!1,!0,h);const u=c[0],d=x(u)||o,p=a.convert(n.format),f=a.convert(n.type),g=w(n.internalFormat,p,f,n.encoding);let m;if(U(34067,n,d),s){for(let t=0;t<6;t++){m=c[t].mipmaps;for(let e=0;e<m.length;e++){const r=m[e];1023!==n.format&&1022!==n.format?null!==p?i.compressedTexImage2D(34069+t,e,g,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(34069+t,e,g,r.width,r.height,0,p,f,r.data)}}e.__maxMipLevel=m.length-1}else{m=n.mipmaps;for(let t=0;t<6;t++)if(l){i.texImage2D(34069+t,0,g,c[t].width,c[t].height,0,p,f,c[t].data);for(let e=0;e<m.length;e++){const n=m[e].image[t].image;i.texImage2D(34069+t,e+1,g,n.width,n.height,0,p,f,n.data)}}else{i.texImage2D(34069+t,0,g,p,f,c[t]);for(let e=0;e<m.length;e++){const n=m[e];i.texImage2D(34069+t,e+1,g,p,f,n.image[t])}}e.__maxMipLevel=m.length}_(n,d)&&A(34067,n,u.width,u.height);e.__version=n.version,n.onUpdate&&n.onUpdate(n)}(s,e,r):(i.activeTexture(33984+r),i.bindTexture(34067,s.__webglTexture))}const B={1e3:10497,1001:33071,1002:33648},F={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function U(i,a,s){if(s?(t.texParameteri(i,10242,B[a.wrapS]),t.texParameteri(i,10243,B[a.wrapT]),32879!==i&&35866!==i||t.texParameteri(i,32882,B[a.wrapR]),t.texParameteri(i,10240,F[a.magFilter]),t.texParameteri(i,10241,F[a.minFilter])):(t.texParameteri(i,10242,33071),t.texParameteri(i,10243,33071),32879!==i&&35866!==i||t.texParameteri(i,32882,33071),1001===a.wrapS&&1001===a.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(i,10240,C(a.magFilter)),t.texParameteri(i,10241,C(a.minFilter)),1003!==a.minFilter&&1006!==a.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const s=e.get("EXT_texture_filter_anisotropic");if(1015===a.type&&!1===e.has("OES_texture_float_linear"))return;if(!1===o&&1016===a.type&&!1===e.has("OES_texture_half_float_linear"))return;(a.anisotropy>1||n.get(a).__currentAnisotropy)&&(t.texParameterf(i,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),n.get(a).__currentAnisotropy=a.anisotropy)}}function L(e,i){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",M),e.__webglTexture=t.createTexture(),s.memory.textures++)}function R(e,n,r){let s=3553;n.isDataTexture2DArray&&(s=35866),n.isDataTexture3D&&(s=32879),L(e,n),i.activeTexture(33984+r),i.bindTexture(s,e.__webglTexture),t.pixelStorei(37440,n.flipY),t.pixelStorei(37441,n.premultiplyAlpha),t.pixelStorei(3317,n.unpackAlignment),t.pixelStorei(37443,0);const l=function(t){return!o&&(1001!==t.wrapS||1001!==t.wrapT||1003!==t.minFilter&&1006!==t.minFilter)}(n)&&!1===x(n.image),h=v(n.image,l,!1,c),u=x(h)||o,d=a.convert(n.format);let p,f=a.convert(n.type),g=w(n.internalFormat,d,f,n.encoding);U(s,n,u);const m=n.mipmaps;if(n.isDepthTexture)g=6402,o?g=1015===n.type?36012:1014===n.type?33190:1020===n.type?35056:33189:1015===n.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===n.format&&6402===g&&1012!==n.type&&1014!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),n.type=1012,f=a.convert(n.type)),1027===n.format&&6402===g&&(g=34041,1020!==n.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),n.type=1020,f=a.convert(n.type))),i.texImage2D(3553,0,g,h.width,h.height,0,d,f,null);else if(n.isDataTexture)if(m.length>0&&u){for(let t=0,e=m.length;t<e;t++)p=m[t],i.texImage2D(3553,t,g,p.width,p.height,0,d,f,p.data);n.generateMipmaps=!1,e.__maxMipLevel=m.length-1}else i.texImage2D(3553,0,g,h.width,h.height,0,d,f,h.data),e.__maxMipLevel=0;else if(n.isCompressedTexture){for(let t=0,e=m.length;t<e;t++)p=m[t],1023!==n.format&&1022!==n.format?null!==d?i.compressedTexImage2D(3553,t,g,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(3553,t,g,p.width,p.height,0,d,f,p.data);e.__maxMipLevel=m.length-1}else if(n.isDataTexture2DArray)i.texImage3D(35866,0,g,h.width,h.height,h.depth,0,d,f,h.data),e.__maxMipLevel=0;else if(n.isDataTexture3D)i.texImage3D(32879,0,g,h.width,h.height,h.depth,0,d,f,h.data),e.__maxMipLevel=0;else if(m.length>0&&u){for(let t=0,e=m.length;t<e;t++)p=m[t],i.texImage2D(3553,t,g,d,f,p);n.generateMipmaps=!1,e.__maxMipLevel=m.length-1}else i.texImage2D(3553,0,g,d,f,h),e.__maxMipLevel=0;_(n,u)&&A(s,n,h.width,h.height),e.__version=n.version,n.onUpdate&&n.onUpdate(n)}function D(e,r,s,o,l){const h=a.convert(s.format),c=a.convert(s.type),u=w(s.internalFormat,h,c,s.encoding);32879===l||35866===l?i.texImage3D(l,0,u,r.width,r.height,r.depth,0,h,c,null):i.texImage2D(l,0,u,r.width,r.height,0,h,c,null),i.bindFramebuffer(36160,e),t.framebufferTexture2D(36160,o,l,n.get(s).__webglTexture,0),i.bindFramebuffer(36160,null)}function N(e,i,n){if(t.bindRenderbuffer(36161,e),i.depthBuffer&&!i.stencilBuffer){let r=33189;if(n){const e=i.depthTexture;e&&e.isDepthTexture&&(1015===e.type?r=36012:1014===e.type&&(r=33190));const n=k(i);t.renderbufferStorageMultisample(36161,n,r,i.width,i.height)}else t.renderbufferStorage(36161,r,i.width,i.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(i.depthBuffer&&i.stencilBuffer){if(n){const e=k(i);t.renderbufferStorageMultisample(36161,e,35056,i.width,i.height)}else t.renderbufferStorage(36161,34041,i.width,i.height);t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===i.isWebGLMultipleRenderTargets?i.texture[0]:i.texture,r=a.convert(e.format),s=a.convert(e.type),o=w(e.internalFormat,r,s,e.encoding);if(n){const e=k(i);t.renderbufferStorageMultisample(36161,e,o,i.width,i.height)}else t.renderbufferStorage(36161,o,i.width,i.height)}t.bindRenderbuffer(36161,null)}function P(e){const r=n.get(e),a=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture){if(a)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(36160,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),S(r.depthTexture,0);const a=n.get(r.depthTexture).__webglTexture;if(1026===r.depthTexture.format)t.framebufferTexture2D(36160,36096,3553,a,0);else{if(1027!==r.depthTexture.format)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(36160,33306,3553,a,0)}}(r.__webglFramebuffer,e)}else if(a){r.__webglDepthbuffer=[];for(let n=0;n<6;n++)i.bindFramebuffer(36160,r.__webglFramebuffer[n]),r.__webglDepthbuffer[n]=t.createRenderbuffer(),N(r.__webglDepthbuffer[n],e,!1)}else i.bindFramebuffer(36160,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),N(r.__webglDepthbuffer,e,!1);i.bindFramebuffer(36160,null)}function k(t){return o&&t.isWebGLMultisampleRenderTarget?Math.min(u,t.samples):0}let z=!1,O=!1;this.allocateTextureUnit=function(){const t=I;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),I+=1,t},this.resetTextureUnits=function(){I=0},this.setTexture2D=S,this.setTexture2DArray=function(t,e){const r=n.get(t);t.version>0&&r.__version!==t.version?R(r,t,e):(i.activeTexture(33984+e),i.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){const r=n.get(t);t.version>0&&r.__version!==t.version?R(r,t,e):(i.activeTexture(33984+e),i.bindTexture(32879,r.__webglTexture))},this.setTextureCube=T,this.setupRenderTarget=function(e){const l=e.texture,h=n.get(e),c=n.get(l);e.addEventListener("dispose",E),!0!==e.isWebGLMultipleRenderTargets&&(c.__webglTexture=t.createTexture(),c.__version=l.version,s.memory.textures++);const u=!0===e.isWebGLCubeRenderTarget,d=!0===e.isWebGLMultipleRenderTargets,p=!0===e.isWebGLMultisampleRenderTarget,f=l.isDataTexture3D||l.isDataTexture2DArray,g=x(e)||o;if(!o||1022!==l.format||1015!==l.type&&1016!==l.type||(l.format=1023,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),u){h.__webglFramebuffer=[];for(let e=0;e<6;e++)h.__webglFramebuffer[e]=t.createFramebuffer()}else if(h.__webglFramebuffer=t.createFramebuffer(),d)if(r.drawBuffers){const i=e.texture;for(let e=0,r=i.length;e<r;e++){const r=n.get(i[e]);void 0===r.__webglTexture&&(r.__webglTexture=t.createTexture(),s.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(p)if(o){h.__webglMultisampledFramebuffer=t.createFramebuffer(),h.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,h.__webglColorRenderbuffer);const n=a.convert(l.format),r=a.convert(l.type),s=w(l.internalFormat,n,r,l.encoding),o=k(e);t.renderbufferStorageMultisample(36161,o,s,e.width,e.height),i.bindFramebuffer(36160,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,h.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(h.__webglDepthRenderbuffer=t.createRenderbuffer(),N(h.__webglDepthRenderbuffer,e,!0)),i.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(u){i.bindTexture(34067,c.__webglTexture),U(34067,l,g);for(let t=0;t<6;t++)D(h.__webglFramebuffer[t],e,l,36064,34069+t);_(l,g)&&A(34067,l,e.width,e.height),i.unbindTexture()}else if(d){const t=e.texture;for(let r=0,a=t.length;r<a;r++){const a=t[r],s=n.get(a);i.bindTexture(3553,s.__webglTexture),U(3553,a,g),D(h.__webglFramebuffer,e,a,36064+r,3553),_(a,g)&&A(3553,a,e.width,e.height)}i.unbindTexture()}else{let t=3553;if(f)if(o){t=l.isDataTexture3D?32879:35866}else console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.");i.bindTexture(t,c.__webglTexture),U(t,l,g),D(h.__webglFramebuffer,e,l,36064,t),_(l,g)&&A(t,l,e.width,e.height,e.depth),i.unbindTexture()}e.depthBuffer&&P(e)},this.updateRenderTargetMipmap=function(t){const e=x(t)||o,r=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture];for(let a=0,s=r.length;a<s;a++){const s=r[a];if(_(s,e)){const e=t.isWebGLCubeRenderTarget?34067:3553,r=n.get(s).__webglTexture;i.bindTexture(e,r),A(e,s,t.width,t.height),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(o){const r=e.width,a=e.height;let s=16384;e.depthBuffer&&(s|=256),e.stencilBuffer&&(s|=1024);const o=n.get(e);i.bindFramebuffer(36008,o.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,o.__webglFramebuffer),t.blitFramebuffer(0,0,r,a,0,0,r,a,s,9728),i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,o.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===z&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),z=!0),t=t.texture),S(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===O&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),O=!0),t=t.texture),T(t,e)}}function Ir(t,e,i){const n=i.isWebGL2;return{convert:function(t){let i;if(1009===t)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1019===t)return 33635;if(1010===t)return 5120;if(1011===t)return 5122;if(1012===t)return 5123;if(1013===t)return 5124;if(1014===t)return 5125;if(1015===t)return 5126;if(1016===t)return n?5131:(i=e.get("OES_texture_half_float"),null!==i?i.HALF_FLOAT_OES:null);if(1021===t)return 6406;if(1022===t)return 6407;if(1023===t)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(1026===t)return 6402;if(1027===t)return 34041;if(1028===t)return 6403;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1032===t)return 36248;if(1033===t)return 36249;if(33776===t||33777===t||33778===t||33779===t){if(i=e.get("WEBGL_compressed_texture_s3tc"),null===i)return null;if(33776===t)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===t)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===t)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===t)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===t||35841===t||35842===t||35843===t){if(i=e.get("WEBGL_compressed_texture_pvrtc"),null===i)return null;if(35840===t)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===t)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===t)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===t)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return i=e.get("WEBGL_compressed_texture_etc1"),null!==i?i.COMPRESSED_RGB_ETC1_WEBGL:null;if((37492===t||37496===t)&&(i=e.get("WEBGL_compressed_texture_etc"),null!==i)){if(37492===t)return i.COMPRESSED_RGB8_ETC2;if(37496===t)return i.COMPRESSED_RGBA8_ETC2_EAC}return 37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t||37840===t||37841===t||37842===t||37843===t||37844===t||37845===t||37846===t||37847===t||37848===t||37849===t||37850===t||37851===t||37852===t||37853===t?(i=e.get("WEBGL_compressed_texture_astc"),null!==i?t:null):36492===t?(i=e.get("EXT_texture_compression_bptc"),null!==i?t:null):1020===t?n?34042:(i=e.get("WEBGL_depth_texture"),null!==i?i.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class Sr extends Ne{constructor(t=[]){super(),this.cameras=t}}Sr.prototype.isArrayCamera=!0;class Tr extends Tt{constructor(){super(),this.type="Group"}}Tr.prototype.isGroup=!0;const Br={type:"move"};class Fr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Tr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Tr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new I,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new I),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Tr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new I,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new I),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let n=null,r=null,a=null;const s=this._targetRay,o=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==s&&(n=e.getPose(t.targetRaySpace,i),null!==n&&(s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),n.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(n.linearVelocity)):s.hasLinearVelocity=!1,n.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(n.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(Br))),l&&t.hand){a=!0;for(const n of t.hand.values()){const t=e.getJointPose(n,i);if(void 0===l.joints[n.jointName]){const t=new Tr;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[n.jointName]=t,l.add(t)}const r=l.joints[n.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const n=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=n.position.distanceTo(r.position),o=.02,h=.005;l.inputState.pinching&&s>o+h?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&s<=o-h&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,i),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));return null!==s&&(s.visible=null!==n),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}}class Ur extends n{constructor(t,e){super();const i=this,n=t.state;let r=null,a=1,s=null,o="local-floor",l=null,h=null,c=null,u=null,d=null,p=!1,f=null,g=null,m=null,y=null,b=null,v=null;const x=t.extensions.has("EXT_multisampled_render_to_texture");let _=null;const A=[],C=new Map,M=new Ne;M.layers.enable(1),M.viewport=new w;const E=new Ne;E.layers.enable(2),E.viewport=new w;const S=[M,E],T=new Sr;T.layers.enable(1),T.layers.enable(2);let B=null,F=null;function U(t){const e=C.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function L(){C.forEach((function(t,e){t.disconnect(e)})),C.clear(),B=null,F=null,n.bindXRFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),c&&e.deleteFramebuffer(c),f&&e.deleteFramebuffer(f),g&&e.deleteRenderbuffer(g),m&&e.deleteRenderbuffer(m),c=null,f=null,g=null,m=null,d=null,u=null,h=null,r=null,z.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function R(t){const e=r.inputSources;for(let t=0;t<A.length;t++)C.set(e[t],A[t]);for(let e=0;e<t.removed.length;e++){const i=t.removed[e],n=C.get(i);n&&(n.dispatchEvent({type:"disconnected",data:i}),C.delete(i))}for(let e=0;e<t.added.length;e++){const i=t.added[e],n=C.get(i);n&&n.dispatchEvent({type:"connected",data:i})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=A[t];return void 0===e&&(e=new Fr,A[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=A[t];return void 0===e&&(e=new Fr,A[t]=e),e.getGripSpace()},this.getHand=function(t){let e=A[t];return void 0===e&&(e=new Fr,A[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){a=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){o=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return h},this.getFrame=function(){return y},this.getSession=function(){return r},this.setSession=async function(l){if(r=l,null!==r){r.addEventListener("select",U),r.addEventListener("selectstart",U),r.addEventListener("selectend",U),r.addEventListener("squeeze",U),r.addEventListener("squeezestart",U),r.addEventListener("squeezeend",U),r.addEventListener("end",L),r.addEventListener("inputsourceschange",R);const l=e.getContextAttributes();if(!0!==l.xrCompatible&&await e.makeXRCompatible(),void 0===r.renderState.layers){const t={antialias:l.antialias,alpha:l.alpha,depth:l.depth,stencil:l.stencil,framebufferScaleFactor:a};d=new XRWebGLLayer(r,e,t),r.updateRenderState({baseLayer:d})}else if(e instanceof WebGLRenderingContext){const t={antialias:!0,alpha:l.alpha,depth:l.depth,stencil:l.stencil,framebufferScaleFactor:a};d=new XRWebGLLayer(r,e,t),r.updateRenderState({layers:[d]})}else{p=l.antialias;let i=null;l.depth&&(v=256,l.stencil&&(v|=1024),b=l.stencil?33306:36096,i=l.stencil?35056:33190);const s={colorFormat:l.alpha?32856:32849,depthFormat:i,scaleFactor:a};h=new XRWebGLBinding(r,e),u=h.createProjectionLayer(s),c=e.createFramebuffer(),r.updateRenderState({layers:[u]}),p&&x?_=t.extensions.get("EXT_multisampled_render_to_texture"):p&&(f=e.createFramebuffer(),g=e.createRenderbuffer(),e.bindRenderbuffer(36161,g),e.renderbufferStorageMultisample(36161,4,32856,u.textureWidth,u.textureHeight),n.bindFramebuffer(36160,f),e.framebufferRenderbuffer(36160,36064,36161,g),e.bindRenderbuffer(36161,null),null!==i&&(m=e.createRenderbuffer(),e.bindRenderbuffer(36161,m),e.renderbufferStorageMultisample(36161,4,i,u.textureWidth,u.textureHeight),e.framebufferRenderbuffer(36160,b,36161,m),e.bindRenderbuffer(36161,null)),n.bindFramebuffer(36160,null))}s=await r.requestReferenceSpace(o),z.setContext(r),z.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};const D=new I,N=new I;function P(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===r)return;T.near=E.near=M.near=t.near,T.far=E.far=M.far=t.far,B===T.near&&F===T.far||(r.updateRenderState({depthNear:T.near,depthFar:T.far}),B=T.near,F=T.far);const e=t.parent,i=T.cameras;P(T,e);for(let t=0;t<i.length;t++)P(i[t],e);T.matrixWorld.decompose(T.position,T.quaternion,T.scale),t.position.copy(T.position),t.quaternion.copy(T.quaternion),t.scale.copy(T.scale),t.matrix.copy(T.matrix),t.matrixWorld.copy(T.matrixWorld);const n=t.children;for(let t=0,e=n.length;t<e;t++)n[t].updateMatrixWorld(!0);2===i.length?function(t,e,i){D.setFromMatrixPosition(e.matrixWorld),N.setFromMatrixPosition(i.matrixWorld);const n=D.distanceTo(N),r=e.projectionMatrix.elements,a=i.projectionMatrix.elements,s=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],h=(r[9]-1)/r[5],c=(r[8]-1)/r[0],u=(a[8]+1)/a[0],d=s*c,p=s*u,f=n/(-c+u),g=f*-c;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(g),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const m=s+f,y=o+f,b=d-g,v=p+(n-g),x=l*o/y*m,_=h*o/y*m;t.projectionMatrix.makePerspective(b,v,x,_,m,y)}(T,M,E):T.projectionMatrix.copy(M.projectionMatrix)},this.getCamera=function(){return T},this.getFoveation=function(){return null!==u?u.fixedFoveation:null!==d?d.fixedFoveation:void 0},this.setFoveation=function(t){null!==u&&(u.fixedFoveation=t),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=t)};let k=null;const z=new qe;z.setAnimationLoop((function(t,i){if(l=i.getViewerPose(s),y=i,null!==l){const t=l.views;null!==d&&n.bindXRFramebuffer(d.framebuffer);let i=!1;t.length!==T.cameras.length&&(T.cameras.length=0,i=!0);for(let r=0;r<t.length;r++){const a=t[r];let s=null;if(null!==d)s=d.getViewport(a);else{const t=h.getViewSubImage(u,a);n.bindXRFramebuffer(c),p&&x?(void 0!==t.depthStencilTexture&&_.framebufferTexture2DMultisampleEXT(36160,b,3553,t.depthStencilTexture,0,4),_.framebufferTexture2DMultisampleEXT(36160,36064,3553,t.colorTexture,0,4)):(void 0!==t.depthStencilTexture&&e.framebufferTexture2D(36160,b,3553,t.depthStencilTexture,0),e.framebufferTexture2D(36160,36064,3553,t.colorTexture,0)),s=t.viewport}const o=S[r];o.matrix.fromArray(a.transform.matrix),o.projectionMatrix.fromArray(a.projectionMatrix),o.viewport.set(s.x,s.y,s.width,s.height),0===r&&T.matrix.copy(o.matrix),!0===i&&T.cameras.push(o)}p&&!x&&(n.bindXRFramebuffer(f),null!==v&&e.clear(v))}const a=r.inputSources;for(let t=0;t<A.length;t++){const e=A[t],n=a[t];e.update(n,i,s)}if(k&&k(t,i),p&&!x){const t=u.textureWidth,i=u.textureHeight;n.bindFramebuffer(36008,f),n.bindFramebuffer(36009,c),e.invalidateFramebuffer(36008,[b]),e.invalidateFramebuffer(36009,[b]),e.blitFramebuffer(0,0,t,i,0,0,t,i,16384,9728),e.invalidateFramebuffer(36008,[36064]),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,null),n.bindFramebuffer(36160,f)}y=null})),this.setAnimationLoop=function(t){k=t},this.dispose=function(){}}}function Lr(t){function e(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map),i.alphaMap&&(e.alphaMap.value=i.alphaMap),i.specularMap&&(e.specularMap.value=i.specularMap),i.alphaTest>0&&(e.alphaTest.value=i.alphaTest);const n=t.get(i).envMap;if(n){e.envMap.value=n,e.flipEnvMap.value=n.isCubeTexture&&!1===n.isRenderTargetTexture?-1:1,e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio;const r=t.get(n).__maxMipLevel;void 0!==r&&(e.maxMipLevel.value=r)}let r,a;i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity),i.map?r=i.map:i.specularMap?r=i.specularMap:i.displacementMap?r=i.displacementMap:i.normalMap?r=i.normalMap:i.bumpMap?r=i.bumpMap:i.roughnessMap?r=i.roughnessMap:i.metalnessMap?r=i.metalnessMap:i.alphaMap?r=i.alphaMap:i.emissiveMap?r=i.emissiveMap:i.clearcoatMap?r=i.clearcoatMap:i.clearcoatNormalMap?r=i.clearcoatNormalMap:i.clearcoatRoughnessMap?r=i.clearcoatRoughnessMap:i.specularIntensityMap?r=i.specularIntensityMap:i.specularTintMap?r=i.specularTintMap:i.transmissionMap?r=i.transmissionMap:i.thicknessMap&&(r=i.thicknessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix)),i.aoMap?a=i.aoMap:i.lightMap&&(a=i.lightMap),void 0!==a&&(a.isWebGLRenderTarget&&(a=a.texture),!0===a.matrixAutoUpdate&&a.updateMatrix(),e.uv2Transform.value.copy(a.matrix))}function i(e,i){e.roughness.value=i.roughness,e.metalness.value=i.metalness,i.roughnessMap&&(e.roughnessMap.value=i.roughnessMap),i.metalnessMap&&(e.metalnessMap.value=i.metalnessMap),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap),i.bumpMap&&(e.bumpMap.value=i.bumpMap,e.bumpScale.value=i.bumpScale,1===i.side&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,e.normalScale.value.copy(i.normalScale),1===i.side&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias);t.get(i).envMap&&(e.envMapIntensity.value=i.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,n,r,a,s){n.isMeshBasicMaterial?e(t,n):n.isMeshLambertMaterial?(e(t,n),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,n)):n.isMeshToonMaterial?(e(t,n),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap);e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshPhongMaterial?(e(t,n),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshStandardMaterial?(e(t,n),n.isMeshPhysicalMaterial?function(t,e,n){i(t,e),t.ior.value=e.ior,e.sheen>0&&(t.sheenTint.value.copy(e.sheenTint).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness);e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate()));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap),t.attenuationDistance.value=e.attenuationDistance,t.attenuationTint.value.copy(e.attenuationTint));t.specularIntensity.value=e.specularIntensity,t.specularTint.value.copy(e.specularTint),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap);e.specularTintMap&&(t.specularTintMap.value=e.specularTintMap)}(t,n,s):i(t,n)):n.isMeshMatcapMaterial?(e(t,n),function(t,e){e.matcap&&(t.matcap.value=e.matcap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshDepthMaterial?(e(t,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isMeshDistanceMaterial?(e(t,n),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,n)):n.isMeshNormalMaterial?(e(t,n),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,n)):n.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,n),n.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,n)):n.isPointsMaterial?function(t,e,i,n){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*n,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let r;e.map?r=e.map:e.alphaMap&&(r=e.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,n,r,a):n.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let i;e.map?i=e.map:e.alphaMap&&(i=e.alphaMap);void 0!==i&&(!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix))}(t,n):n.isShadowMaterial?(t.color.value.copy(n.color),t.opacity.value=n.opacity):n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)}}}function Rr(t={}){const e=void 0!==t.canvas?t.canvas:function(){const t=y("canvas");return t.style.display="block",t}(),i=void 0!==t.context?t.context:null,n=void 0!==t.alpha&&t.alpha,r=void 0===t.depth||t.depth,a=void 0===t.stencil||t.stencil,s=void 0!==t.antialias&&t.antialias,o=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,h=void 0!==t.powerPreference?t.powerPreference:"default",c=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let u=null,d=null;const p=[],f=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const g=this;let m=!1,b=0,v=0,x=null,_=-1,A=null;const E=new w,S=new w;let T=null,B=e.width,F=e.height,U=1,L=null,R=null;const D=new w(0,0,B,F),N=new w(0,0,B,F);let P=!1;const k=[],z=new We;let O=!1,Q=!1,V=null;const H=new rt,G=new I,j={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function W(){return null===x?U:1}let q,Z,J,X,Y,K,$,tt,et,it,nt,at,st,ot,lt,ht,ct,ut,dt,pt,ft,gt,mt,yt=i;function bt(t,i){for(let n=0;n<t.length;n++){const r=t[n],a=e.getContext(r,i);if(null!==a)return a}return null}try{const t={alpha:n,depth:r,stencil:a,antialias:s,premultipliedAlpha:o,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:c};if(e.addEventListener("webglcontextlost",_t,!1),e.addEventListener("webglcontextrestored",At,!1),null===yt){const e=["webgl2","webgl","experimental-webgl"];if(!0===g.isWebGL1Renderer&&e.shift(),yt=bt(e,t),null===yt)throw bt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===yt.getShaderPrecisionFormat&&(yt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function vt(){q=new Bi(yt),Z=new ii(yt,q,t),q.init(Z),gt=new Ir(yt,q,Z),J=new Mr(yt,q,Z),k[0]=1029,X=new Li(yt),Y=new ur,K=new Er(yt,q,J,Y,Z,gt,X),$=new ri(g),tt=new Ti(g),et=new Ze(yt,Z),mt=new ti(yt,q,et,Z),it=new Fi(yt,et,X,mt),nt=new zi(yt,it,et,X),dt=new ki(yt,Z,K),ht=new ni(Y),at=new cr(g,$,tt,q,Z,mt,ht),st=new Lr(Y),ot=new gr(Y),lt=new _r(q,Z),ut=new $e(g,$,J,nt,o),ct=new Cr(g,nt,Z),pt=new ei(yt,q,X,Z),ft=new Ui(yt,q,X,Z),X.programs=at.programs,g.capabilities=Z,g.extensions=q,g.properties=Y,g.renderLists=ot,g.shadowMap=ct,g.state=J,g.info=X}vt();const xt=new Ur(g,yt);function _t(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),m=!0}function At(){console.log("THREE.WebGLRenderer: Context Restored."),m=!1;const t=X.autoReset,e=ct.enabled,i=ct.autoUpdate,n=ct.needsUpdate,r=ct.type;vt(),X.autoReset=t,ct.enabled=e,ct.autoUpdate=i,ct.needsUpdate=n,ct.type=r}function wt(t){const e=t.target;e.removeEventListener("dispose",wt),function(t){(function(t){const e=Y.get(t).programs;void 0!==e&&e.forEach((function(t){at.releaseProgram(t)}))})(t),Y.remove(t)}(e)}this.xr=xt,this.getContext=function(){return yt},this.getContextAttributes=function(){return yt.getContextAttributes()},this.forceContextLoss=function(){const t=q.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=q.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return U},this.setPixelRatio=function(t){void 0!==t&&(U=t,this.setSize(B,F,!1))},this.getSize=function(t){return t.set(B,F)},this.setSize=function(t,i,n){xt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(B=t,F=i,e.width=Math.floor(t*U),e.height=Math.floor(i*U),!1!==n&&(e.style.width=t+"px",e.style.height=i+"px"),this.setViewport(0,0,t,i))},this.getDrawingBufferSize=function(t){return t.set(B*U,F*U).floor()},this.setDrawingBufferSize=function(t,i,n){B=t,F=i,U=n,e.width=Math.floor(t*n),e.height=Math.floor(i*n),this.setViewport(0,0,t,i)},this.getCurrentViewport=function(t){return t.copy(E)},this.getViewport=function(t){return t.copy(D)},this.setViewport=function(t,e,i,n){t.isVector4?D.set(t.x,t.y,t.z,t.w):D.set(t,e,i,n),J.viewport(E.copy(D).multiplyScalar(U).floor())},this.getScissor=function(t){return t.copy(N)},this.setScissor=function(t,e,i,n){t.isVector4?N.set(t.x,t.y,t.z,t.w):N.set(t,e,i,n),J.scissor(S.copy(N).multiplyScalar(U).floor())},this.getScissorTest=function(){return P},this.setScissorTest=function(t){J.setScissorTest(P=t)},this.setOpaqueSort=function(t){L=t},this.setTransparentSort=function(t){R=t},this.getClearColor=function(t){return t.copy(ut.getClearColor())},this.setClearColor=function(){ut.setClearColor.apply(ut,arguments)},this.getClearAlpha=function(){return ut.getClearAlpha()},this.setClearAlpha=function(){ut.setClearAlpha.apply(ut,arguments)},this.clear=function(t,e,i){let n=0;(void 0===t||t)&&(n|=16384),(void 0===e||e)&&(n|=256),(void 0===i||i)&&(n|=1024),yt.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",_t,!1),e.removeEventListener("webglcontextrestored",At,!1),ot.dispose(),lt.dispose(),Y.dispose(),$.dispose(),tt.dispose(),nt.dispose(),mt.dispose(),xt.dispose(),xt.removeEventListener("sessionstart",Mt),xt.removeEventListener("sessionend",Et),V&&(V.dispose(),V=null),It.stop()},this.renderBufferImmediate=function(t,e){mt.initAttributes();const i=Y.get(t);t.hasPositions&&!i.position&&(i.position=yt.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=yt.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=yt.createBuffer()),t.hasColors&&!i.color&&(i.color=yt.createBuffer());const n=e.getAttributes();t.hasPositions&&(yt.bindBuffer(34962,i.position),yt.bufferData(34962,t.positionArray,35048),mt.enableAttribute(n.position.location),yt.vertexAttribPointer(n.position.location,3,5126,!1,0,0)),t.hasNormals&&(yt.bindBuffer(34962,i.normal),yt.bufferData(34962,t.normalArray,35048),mt.enableAttribute(n.normal.location),yt.vertexAttribPointer(n.normal.location,3,5126,!1,0,0)),t.hasUvs&&(yt.bindBuffer(34962,i.uv),yt.bufferData(34962,t.uvArray,35048),mt.enableAttribute(n.uv.location),yt.vertexAttribPointer(n.uv.location,2,5126,!1,0,0)),t.hasColors&&(yt.bindBuffer(34962,i.color),yt.bufferData(34962,t.colorArray,35048),mt.enableAttribute(n.color.location),yt.vertexAttribPointer(n.color.location,3,5126,!1,0,0)),mt.disableUnusedAttributes(),yt.drawArrays(4,0,t.count),t.count=0},this.renderBufferDirect=function(t,e,i,n,r,a){null===e&&(e=j);const s=r.isMesh&&r.matrixWorld.determinant()<0,o=Lt(t,e,n,r);J.setMaterial(n,s);let l=i.index;const h=i.attributes.position;if(null===l){if(void 0===h||0===h.count)return}else if(0===l.count)return;let c,u=1;!0===n.wireframe&&(l=it.getWireframeAttribute(i),u=2),void 0===i.morphAttributes.position&&void 0===i.morphAttributes.normal||dt.update(r,i,n,o),mt.setup(r,n,o,i,l);let d=pt;null!==l&&(c=et.get(l),d=ft,d.setIndex(c));const p=null!==l?l.count:h.count,f=i.drawRange.start*u,g=i.drawRange.count*u,m=null!==a?a.start*u:0,y=null!==a?a.count*u:1/0,b=Math.max(f,m),v=Math.min(p,f+g,m+y)-1,x=Math.max(0,v-b+1);if(0!==x){if(r.isMesh)!0===n.wireframe?(J.setLineWidth(n.wireframeLinewidth*W()),d.setMode(1)):d.setMode(4);else if(r.isLine){let t=n.linewidth;void 0===t&&(t=1),J.setLineWidth(t*W()),r.isLineSegments?d.setMode(1):r.isLineLoop?d.setMode(2):d.setMode(3)}else r.isPoints?d.setMode(0):r.isSprite&&d.setMode(4);if(r.isInstancedMesh)d.renderInstances(b,x,r.count);else if(i.isInstancedBufferGeometry){const t=Math.min(i.instanceCount,i._maxInstanceCount);d.renderInstances(b,x,t)}else d.render(b,x)}},this.compile=function(t,e){d=lt.get(t),d.init(),f.push(d),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(d.pushLight(t),t.castShadow&&d.pushShadow(t))})),d.setupLights(g.physicallyCorrectLights),t.traverse((function(e){const i=e.material;if(i)if(Array.isArray(i))for(let n=0;n<i.length;n++){Ft(i[n],t,e)}else Ft(i,t,e)})),f.pop(),d=null};let Ct=null;function Mt(){It.stop()}function Et(){It.start()}const It=new qe;function St(t,e,i,n){const r=t.opaque,a=t.transmissive,o=t.transparent;d.setupLightsView(i),a.length>0&&function(t,e,i){if(null===V){const t=!0===s&&!0===Z.isWebGL2;V=new(t?M:C)(1024,1024,{generateMipmaps:!0,type:null!==gt.convert(1016)?1016:1009,minFilter:1008,magFilter:1003,wrapS:1001,wrapT:1001})}const n=g.getRenderTarget();g.setRenderTarget(V),g.clear();const r=g.toneMapping;g.toneMapping=0,Tt(t,e,i),g.toneMapping=r,K.updateMultisampleRenderTarget(V),K.updateRenderTargetMipmap(V),g.setRenderTarget(n)}(r,e,i),n&&J.viewport(E.copy(n)),r.length>0&&Tt(r,e,i),a.length>0&&Tt(a,e,i),o.length>0&&Tt(o,e,i)}function Tt(t,e,i){const n=!0===e.isScene?e.overrideMaterial:null;for(let r=0,a=t.length;r<a;r++){const a=t[r],s=a.object,o=a.geometry,l=null===n?a.material:n,h=a.group;s.layers.test(i.layers)&&Bt(s,e,i,o,l,h)}}function Bt(t,e,i,n,r,a){if(t.onBeforeRender(g,e,i,n,r,a),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(g,e,i,n,t,a),t.isImmediateRenderObject){const n=Lt(i,e,r,t);J.setMaterial(r),mt.reset(),function(t,e){t.render((function(t){g.renderBufferImmediate(t,e)}))}(t,n)}else!0===r.transparent&&2===r.side?(r.side=1,r.needsUpdate=!0,g.renderBufferDirect(i,e,n,r,t,a),r.side=0,r.needsUpdate=!0,g.renderBufferDirect(i,e,n,r,t,a),r.side=2):g.renderBufferDirect(i,e,n,r,t,a);t.onAfterRender(g,e,i,n,r,a)}function Ft(t,e,i){!0!==e.isScene&&(e=j);const n=Y.get(t),r=d.state.lights,a=d.state.shadowsArray,s=r.state.version,o=at.getParameters(t,r.state,a,e,i),l=at.getProgramCacheKey(o);let h=n.programs;n.environment=t.isMeshStandardMaterial?e.environment:null,n.fog=e.fog,n.envMap=(t.isMeshStandardMaterial?tt:$).get(t.envMap||n.environment),void 0===h&&(t.addEventListener("dispose",wt),h=new Map,n.programs=h);let c=h.get(l);if(void 0!==c){if(n.currentProgram===c&&n.lightsStateVersion===s)return Ut(t,o),c}else o.uniforms=at.getUniforms(t),t.onBuild(o,g),t.onBeforeCompile(o,g),c=at.acquireProgram(o,l),h.set(l,c),n.uniforms=o.uniforms;const u=n.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(u.clippingPlanes=ht.uniform),Ut(t,o),n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),n.lightsStateVersion=s,n.needsLights&&(u.ambientLightColor.value=r.state.ambient,u.lightProbe.value=r.state.probe,u.directionalLights.value=r.state.directional,u.directionalLightShadows.value=r.state.directionalShadow,u.spotLights.value=r.state.spot,u.spotLightShadows.value=r.state.spotShadow,u.rectAreaLights.value=r.state.rectArea,u.ltc_1.value=r.state.rectAreaLTC1,u.ltc_2.value=r.state.rectAreaLTC2,u.pointLights.value=r.state.point,u.pointLightShadows.value=r.state.pointShadow,u.hemisphereLights.value=r.state.hemi,u.directionalShadowMap.value=r.state.directionalShadowMap,u.directionalShadowMatrix.value=r.state.directionalShadowMatrix,u.spotShadowMap.value=r.state.spotShadowMap,u.spotShadowMatrix.value=r.state.spotShadowMatrix,u.pointShadowMap.value=r.state.pointShadowMap,u.pointShadowMatrix.value=r.state.pointShadowMatrix);const p=c.getUniforms(),f=Hn.seqWithValue(p.seq,u);return n.currentProgram=c,n.uniformsList=f,c}function Ut(t,e){const i=Y.get(t);i.outputEncoding=e.outputEncoding,i.instancing=e.instancing,i.skinning=e.skinning,i.morphTargets=e.morphTargets,i.morphNormals=e.morphNormals,i.morphTargetsCount=e.morphTargetsCount,i.numClippingPlanes=e.numClippingPlanes,i.numIntersection=e.numClipIntersection,i.vertexAlphas=e.vertexAlphas,i.vertexTangents=e.vertexTangents}function Lt(t,e,i,n){!0!==e.isScene&&(e=j),K.resetTextureUnits();const r=e.fog,a=i.isMeshStandardMaterial?e.environment:null,s=null===x?g.outputEncoding:x.texture.encoding,o=(i.isMeshStandardMaterial?tt:$).get(i.envMap||a),l=!0===i.vertexColors&&!!n.geometry&&!!n.geometry.attributes.color&&4===n.geometry.attributes.color.itemSize,h=!!i.normalMap&&!!n.geometry&&!!n.geometry.attributes.tangent,c=!!n.geometry&&!!n.geometry.morphAttributes.position,u=!!n.geometry&&!!n.geometry.morphAttributes.normal,p=n.geometry&&n.geometry.morphAttributes.position?n.geometry.morphAttributes.position.length:0,f=Y.get(i),m=d.state.lights;if(!0===O&&(!0===Q||t!==A)){const e=t===A&&i.id===_;ht.setState(i,t,e)}let y=!1;i.version===f.__version?f.needsLights&&f.lightsStateVersion!==m.state.version||f.outputEncoding!==s||n.isInstancedMesh&&!1===f.instancing?y=!0:n.isInstancedMesh||!0!==f.instancing?n.isSkinnedMesh&&!1===f.skinning?y=!0:n.isSkinnedMesh||!0!==f.skinning?f.envMap!==o||i.fog&&f.fog!==r?y=!0:void 0===f.numClippingPlanes||f.numClippingPlanes===ht.numPlanes&&f.numIntersection===ht.numIntersection?(f.vertexAlphas!==l||f.vertexTangents!==h||f.morphTargets!==c||f.morphNormals!==u||!0===Z.isWebGL2&&f.morphTargetsCount!==p)&&(y=!0):y=!0:y=!0:y=!0:(y=!0,f.__version=i.version);let b=f.currentProgram;!0===y&&(b=Ft(i,e,n));let v=!1,w=!1,C=!1;const M=b.getUniforms(),E=f.uniforms;if(J.useProgram(b.program)&&(v=!0,w=!0,C=!0),i.id!==_&&(_=i.id,w=!0),v||A!==t){if(M.setValue(yt,"projectionMatrix",t.projectionMatrix),Z.logarithmicDepthBuffer&&M.setValue(yt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),A!==t&&(A=t,w=!0,C=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshStandardMaterial||i.envMap){const e=M.map.cameraPosition;void 0!==e&&e.setValue(yt,G.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&M.setValue(yt,"isOrthographic",!0===t.isOrthographicCamera),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.isShadowMaterial||n.isSkinnedMesh)&&M.setValue(yt,"viewMatrix",t.matrixWorldInverse)}if(n.isSkinnedMesh){M.setOptional(yt,n,"bindMatrix"),M.setOptional(yt,n,"bindMatrixInverse");const t=n.skeleton;t&&(Z.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),M.setValue(yt,"boneTexture",t.boneTexture,K),M.setValue(yt,"boneTextureSize",t.boneTextureSize)):M.setOptional(yt,t,"boneMatrices"))}var I,S;return(w||f.receiveShadow!==n.receiveShadow)&&(f.receiveShadow=n.receiveShadow,M.setValue(yt,"receiveShadow",n.receiveShadow)),w&&(M.setValue(yt,"toneMappingExposure",g.toneMappingExposure),f.needsLights&&(S=C,(I=E).ambientLightColor.needsUpdate=S,I.lightProbe.needsUpdate=S,I.directionalLights.needsUpdate=S,I.directionalLightShadows.needsUpdate=S,I.pointLights.needsUpdate=S,I.pointLightShadows.needsUpdate=S,I.spotLights.needsUpdate=S,I.spotLightShadows.needsUpdate=S,I.rectAreaLights.needsUpdate=S,I.hemisphereLights.needsUpdate=S),r&&i.fog&&st.refreshFogUniforms(E,r),st.refreshMaterialUniforms(E,i,U,F,V),Hn.upload(yt,f.uniformsList,E,K)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Hn.upload(yt,f.uniformsList,E,K),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&M.setValue(yt,"center",n.center),M.setValue(yt,"modelViewMatrix",n.modelViewMatrix),M.setValue(yt,"normalMatrix",n.normalMatrix),M.setValue(yt,"modelMatrix",n.matrixWorld),b}It.setAnimationLoop((function(t){Ct&&Ct(t)})),"undefined"!=typeof window&&It.setContext(window),this.setAnimationLoop=function(t){Ct=t,xt.setAnimationLoop(t),null===t?It.stop():It.start()},xt.addEventListener("sessionstart",Mt),xt.addEventListener("sessionend",Et),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===m)return;!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===xt.enabled&&!0===xt.isPresenting&&(!0===xt.cameraAutoUpdate&&xt.updateCamera(e),e=xt.getCamera()),!0===t.isScene&&t.onBeforeRender(g,t,e,x),d=lt.get(t,f.length),d.init(),f.push(d),H.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),z.setFromProjectionMatrix(H),Q=this.localClippingEnabled,O=ht.init(this.clippingPlanes,Q,e),u=ot.get(t,p.length),u.init(),p.push(u),function t(e,i,n,r){if(!1===e.visible)return;if(e.layers.test(i.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(i);else if(e.isLight)d.pushLight(e),e.castShadow&&d.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||z.intersectsSprite(e)){r&&G.setFromMatrixPosition(e.matrixWorld).applyMatrix4(H);const t=nt.update(e),i=e.material;i.visible&&u.push(e,t,i,n,G.z,null)}}else if(e.isImmediateRenderObject)r&&G.setFromMatrixPosition(e.matrixWorld).applyMatrix4(H),u.push(e,null,e.material,n,G.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==X.render.frame&&(e.skeleton.update(),e.skeleton.frame=X.render.frame),!e.frustumCulled||z.intersectsObject(e))){r&&G.setFromMatrixPosition(e.matrixWorld).applyMatrix4(H);const t=nt.update(e),i=e.material;if(Array.isArray(i)){const r=t.groups;for(let a=0,s=r.length;a<s;a++){const s=r[a],o=i[s.materialIndex];o&&o.visible&&u.push(e,t,o,n,G.z,s)}}else i.visible&&u.push(e,t,i,n,G.z,null)}const a=e.children;for(let e=0,s=a.length;e<s;e++)t(a[e],i,n,r)}(t,e,0,g.sortObjects),u.finish(),!0===g.sortObjects&&u.sort(L,R),!0===O&&ht.beginShadows();const i=d.state.shadowsArray;if(ct.render(i,t,e),!0===O&&ht.endShadows(),!0===this.info.autoReset&&this.info.reset(),ut.render(u,t),d.setupLights(g.physicallyCorrectLights),e.isArrayCamera){const i=e.cameras;for(let e=0,n=i.length;e<n;e++){const n=i[e];St(u,t,n,n.viewport)}}else St(u,t,e);null!==x&&(K.updateMultisampleRenderTarget(x),K.updateRenderTargetMipmap(x)),!0===t.isScene&&t.onAfterRender(g,t,e),J.buffers.depth.setTest(!0),J.buffers.depth.setMask(!0),J.buffers.color.setMask(!0),J.setPolygonOffset(!1),mt.resetDefaultState(),_=-1,A=null,f.pop(),d=f.length>0?f[f.length-1]:null,p.pop(),u=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return v},this.getRenderTarget=function(){return x},this.setRenderTarget=function(t,e=0,i=0){x=t,b=e,v=i,t&&void 0===Y.get(t).__webglFramebuffer&&K.setupRenderTarget(t);let n=null,r=!1,a=!1;if(t){const i=t.texture;(i.isDataTexture3D||i.isDataTexture2DArray)&&(a=!0);const s=Y.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(n=s[e],r=!0):n=t.isWebGLMultisampleRenderTarget?Y.get(t).__webglMultisampledFramebuffer:s,E.copy(t.viewport),S.copy(t.scissor),T=t.scissorTest}else E.copy(D).multiplyScalar(U).floor(),S.copy(N).multiplyScalar(U).floor(),T=P;if(J.bindFramebuffer(36160,n)&&Z.drawBuffers){let e=!1;if(t)if(t.isWebGLMultipleRenderTargets){const i=t.texture;if(k.length!==i.length||36064!==k[0]){for(let t=0,e=i.length;t<e;t++)k[t]=36064+t;k.length=i.length,e=!0}}else 1===k.length&&36064===k[0]||(k[0]=36064,k.length=1,e=!0);else 1===k.length&&1029===k[0]||(k[0]=1029,k.length=1,e=!0);e&&(Z.isWebGL2?yt.drawBuffers(k):q.get("WEBGL_draw_buffers").drawBuffersWEBGL(k))}if(J.viewport(E),J.scissor(S),J.setScissorTest(T),r){const n=Y.get(t.texture);yt.framebufferTexture2D(36160,36064,34069+e,n.__webglTexture,i)}else if(a){const n=Y.get(t.texture),r=e||0;yt.framebufferTextureLayer(36160,36064,n.__webglTexture,i||0,r)}_=-1},this.readRenderTargetPixels=function(t,e,i,n,r,a,s){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=Y.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){J.bindFramebuffer(36160,o);try{const s=t.texture,o=s.format,l=s.type;if(1023!==o&&gt.convert(o)!==yt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const h=1016===l&&(q.has("EXT_color_buffer_half_float")||Z.isWebGL2&&q.has("EXT_color_buffer_float"));if(!(1009===l||gt.convert(l)===yt.getParameter(35738)||1015===l&&(Z.isWebGL2||q.has("OES_texture_float")||q.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===yt.checkFramebufferStatus(36160)?e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&yt.readPixels(e,i,n,r,gt.convert(o),gt.convert(l),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const t=null!==x?Y.get(x).__webglFramebuffer:null;J.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,i=0){const n=Math.pow(2,-i),r=Math.floor(e.image.width*n),a=Math.floor(e.image.height*n);let s=gt.convert(e.format);Z.isWebGL2&&(6407===s&&(s=32849),6408===s&&(s=32856)),K.setTexture2D(e,0),yt.copyTexImage2D(3553,i,s,t.x,t.y,r,a,0),J.unbindTexture()},this.copyTextureToTexture=function(t,e,i,n=0){const r=e.image.width,a=e.image.height,s=gt.convert(i.format),o=gt.convert(i.type);K.setTexture2D(i,0),yt.pixelStorei(37440,i.flipY),yt.pixelStorei(37441,i.premultiplyAlpha),yt.pixelStorei(3317,i.unpackAlignment),e.isDataTexture?yt.texSubImage2D(3553,n,t.x,t.y,r,a,s,o,e.image.data):e.isCompressedTexture?yt.compressedTexSubImage2D(3553,n,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,s,e.mipmaps[0].data):yt.texSubImage2D(3553,n,t.x,t.y,s,o,e.image),0===n&&i.generateMipmaps&&yt.generateMipmap(3553),J.unbindTexture()},this.copyTextureToTexture3D=function(t,e,i,n,r=0){if(g.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const a=t.max.x-t.min.x+1,s=t.max.y-t.min.y+1,o=t.max.z-t.min.z+1,l=gt.convert(n.format),h=gt.convert(n.type);let c;if(n.isDataTexture3D)K.setTexture3D(n,0),c=32879;else{if(!n.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");K.setTexture2DArray(n,0),c=35866}yt.pixelStorei(37440,n.flipY),yt.pixelStorei(37441,n.premultiplyAlpha),yt.pixelStorei(3317,n.unpackAlignment);const u=yt.getParameter(3314),d=yt.getParameter(32878),p=yt.getParameter(3316),f=yt.getParameter(3315),m=yt.getParameter(32877),y=i.isCompressedTexture?i.mipmaps[0]:i.image;yt.pixelStorei(3314,y.width),yt.pixelStorei(32878,y.height),yt.pixelStorei(3316,t.min.x),yt.pixelStorei(3315,t.min.y),yt.pixelStorei(32877,t.min.z),i.isDataTexture||i.isDataTexture3D?yt.texSubImage3D(c,r,e.x,e.y,e.z,a,s,o,l,h,y.data):i.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),yt.compressedTexSubImage3D(c,r,e.x,e.y,e.z,a,s,o,l,y.data)):yt.texSubImage3D(c,r,e.x,e.y,e.z,a,s,o,l,h,y),yt.pixelStorei(3314,u),yt.pixelStorei(32878,d),yt.pixelStorei(3316,p),yt.pixelStorei(3315,f),yt.pixelStorei(32877,m),0===r&&n.generateMipmaps&&yt.generateMipmap(c),J.unbindTexture()},this.initTexture=function(t){K.setTexture2D(t,0),J.unbindTexture()},this.resetState=function(){b=0,v=0,x=null,J.reset(),mt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}(class extends Rr{}).prototype.isWebGL1Renderer=!0;class Dr{constructor(t,e=25e-5){this.name="",this.color=new Jt(t),this.density=e}clone(){return new Dr(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}Dr.prototype.isFogExp2=!0;class Nr{constructor(t,e=1,i=1e3){this.name="",this.color=new Jt(t),this.near=e,this.far=i}clone(){return new Nr(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}Nr.prototype.isFog=!0;class Pr extends Tt{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}Pr.prototype.isScene=!0;class kr{constructor(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=l()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let n=0,r=this.stride;n<r;n++)this.array[t+n]=e.array[i+n];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=l()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(e,this.stride);return i.setUsage(this.usage),i}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=l()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}kr.prototype.isInterleavedBuffer=!0;const zr=new I;class Or{constructor(t,e,i,n=!1){this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=!0===n}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,i=this.data.count;e<i;e++)zr.x=this.getX(e),zr.y=this.getY(e),zr.z=this.getZ(e),zr.applyMatrix4(t),this.setXYZ(e,zr.x,zr.y,zr.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)zr.x=this.getX(e),zr.y=this.getY(e),zr.z=this.getZ(e),zr.applyNormalMatrix(t),this.setXYZ(e,zr.x,zr.y,zr.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)zr.x=this.getX(e),zr.y=this.getY(e),zr.z=this.getZ(e),zr.transformDirection(t),this.setXYZ(e,zr.x,zr.y,zr.z);return this}setX(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){return this.data.array[t*this.data.stride+this.offset]}getY(t){return this.data.array[t*this.data.stride+this.offset+1]}getZ(t){return this.data.array[t*this.data.stride+this.offset+2]}getW(t){return this.data.array[t*this.data.stride+this.offset+3]}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this}setXYZ(t,e,i,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this.data.array[t+3]=r,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return new $t(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Or(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}Or.prototype.isInterleavedBufferAttribute=!0;class Qr extends Vt{constructor(t){super(),this.type="SpriteMaterial",this.color=new Jt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this}}let Vr;Qr.prototype.isSpriteMaterial=!0;const Hr=new I,Gr=new I,jr=new I,Wr=new f,qr=new f,Zr=new rt,Jr=new I,Xr=new I,Yr=new I,Kr=new f,$r=new f,ta=new f;class ea extends Tt{constructor(t){if(super(),this.type="Sprite",void 0===Vr){Vr=new ce;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new kr(t,5);Vr.setIndex([0,1,2,0,2,3]),Vr.setAttribute("position",new Or(e,3,0,!1)),Vr.setAttribute("uv",new Or(e,2,3,!1))}this.geometry=Vr,this.material=void 0!==t?t:new Qr,this.center=new f(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Gr.setFromMatrixScale(this.matrixWorld),Zr.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),jr.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Gr.multiplyScalar(-jr.z);const i=this.material.rotation;let n,r;0!==i&&(r=Math.cos(i),n=Math.sin(i));const a=this.center;ia(Jr.set(-.5,-.5,0),jr,a,Gr,n,r),ia(Xr.set(.5,-.5,0),jr,a,Gr,n,r),ia(Yr.set(.5,.5,0),jr,a,Gr,n,r),Kr.set(0,0),$r.set(1,0),ta.set(1,1);let s=t.ray.intersectTriangle(Jr,Xr,Yr,!1,Hr);if(null===s&&(ia(Xr.set(-.5,.5,0),jr,a,Gr,n,r),$r.set(0,1),s=t.ray.intersectTriangle(Jr,Yr,Xr,!1,Hr),null===s))return;const o=t.ray.origin.distanceTo(Hr);o<t.near||o>t.far||e.push({distance:o,point:Hr.clone(),uv:Ot.getUV(Hr,Jr,Xr,Yr,Kr,$r,ta,new f),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function ia(t,e,i,n,r,a){Wr.subVectors(t,i).addScalar(.5).multiply(n),void 0!==r?(qr.x=a*Wr.x-r*Wr.y,qr.y=r*Wr.x+a*Wr.y):qr.copy(Wr),t.copy(e),t.x+=qr.x,t.y+=qr.y,t.applyMatrix4(Zr)}ea.prototype.isSprite=!0;const na=new I,ra=new w,aa=new w,sa=new I,oa=new rt;class la extends Se{constructor(t,e){super(t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new rt,this.bindMatrixInverse=new rt}copy(t){return super.copy(t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new w,e=this.geometry.attributes.skinWeight;for(let i=0,n=e.count;i<n;i++){t.x=e.getX(i),t.y=e.getY(i),t.z=e.getZ(i),t.w=e.getW(i);const n=1/t.manhattanLength();n!==1/0?t.multiplyScalar(n):t.set(1,0,0,0),e.setXYZW(i,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(t,e){const i=this.skeleton,n=this.geometry;ra.fromBufferAttribute(n.attributes.skinIndex,t),aa.fromBufferAttribute(n.attributes.skinWeight,t),na.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const n=aa.getComponent(t);if(0!==n){const r=ra.getComponent(t);oa.multiplyMatrices(i.bones[r].matrixWorld,i.boneInverses[r]),e.addScaledVector(sa.copy(na).applyMatrix4(oa),n)}}return e.applyMatrix4(this.bindMatrixInverse)}}la.prototype.isSkinnedMesh=!0;class ha extends Tt{constructor(){super(),this.type="Bone"}}ha.prototype.isBone=!0;class ca extends _{constructor(t=null,e=1,i=1,n,r,a,s,o,l=1003,h=1003,c,u){super(null,a,s,o,l,h,n,r,c,u),this.image={data:t,width:e,height:i},this.magFilter=l,this.minFilter=h,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}ca.prototype.isDataTexture=!0;class ua extends $t{constructor(t,e,i,n=1){"number"==typeof i&&(n=i,i=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(t,e,i),this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}ua.prototype.isInstancedBufferAttribute=!0;const da=new rt,pa=new rt,fa=[],ga=new Se;class ma extends Se{constructor(t,e,i){super(t,e),this.instanceMatrix=new ua(new Float32Array(16*i),16),this.instanceColor=null,this.count=i,this.frustumCulled=!1}copy(t){return super.copy(t),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}raycast(t,e){const i=this.matrixWorld,n=this.count;if(ga.geometry=this.geometry,ga.material=this.material,void 0!==ga.material)for(let r=0;r<n;r++){this.getMatrixAt(r,da),pa.multiplyMatrices(i,da),ga.matrixWorld=pa,ga.raycast(t,fa);for(let t=0,i=fa.length;t<i;t++){const i=fa[t];i.instanceId=r,i.object=this,e.push(i)}fa.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new ua(new Float32Array(3*this.instanceMatrix.count),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}ma.prototype.isInstancedMesh=!0;class ya extends Vt{constructor(t){super(),this.type="LineBasicMaterial",this.color=new Jt(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this}}ya.prototype.isLineBasicMaterial=!0;const ba=new I,va=new I,xa=new rt,_a=new nt,Aa=new J;class wa extends Tt{constructor(t=new ce,e=new ya){super(),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,i=[0];for(let t=1,n=e.count;t<n;t++)ba.fromBufferAttribute(e,t-1),va.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=ba.distanceTo(va);t.setAttribute("lineDistance",new ie(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(t,e){const i=this.geometry,n=this.matrixWorld,r=t.params.Line.threshold,a=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),Aa.copy(i.boundingSphere),Aa.applyMatrix4(n),Aa.radius+=r,!1===t.ray.intersectsSphere(Aa))return;xa.copy(n).invert(),_a.copy(t.ray).applyMatrix4(xa);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=new I,h=new I,c=new I,u=new I,d=this.isLineSegments?2:1;if(i.isBufferGeometry){const n=i.index,r=i.attributes.position;if(null!==n){for(let i=Math.max(0,a.start),s=Math.min(n.count,a.start+a.count)-1;i<s;i+=d){const a=n.getX(i),s=n.getX(i+1);l.fromBufferAttribute(r,a),h.fromBufferAttribute(r,s);if(_a.distanceSqToSegment(l,h,u,c)>o)continue;u.applyMatrix4(this.matrixWorld);const d=t.ray.origin.distanceTo(u);d<t.near||d>t.far||e.push({distance:d,point:c.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else{for(let i=Math.max(0,a.start),n=Math.min(r.count,a.start+a.count)-1;i<n;i+=d){l.fromBufferAttribute(r,i),h.fromBufferAttribute(r,i+1);if(_a.distanceSqToSegment(l,h,u,c)>o)continue;u.applyMatrix4(this.matrixWorld);const n=t.ray.origin.distanceTo(u);n<t.near||n>t.far||e.push({distance:n,point:c.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}}else i.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}wa.prototype.isLine=!0;const Ca=new I,Ma=new I;class Ea extends wa{constructor(t,e){super(t,e),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,i=[];for(let t=0,n=e.count;t<n;t+=2)Ca.fromBufferAttribute(e,t),Ma.fromBufferAttribute(e,t+1),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+Ca.distanceTo(Ma);t.setAttribute("lineDistance",new ie(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}Ea.prototype.isLineSegments=!0;class Ia extends wa{constructor(t,e){super(t,e),this.type="LineLoop"}}Ia.prototype.isLineLoop=!0;class Sa extends Vt{constructor(t){super(),this.type="PointsMaterial",this.color=new Jt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this}}Sa.prototype.isPointsMaterial=!0;const Ta=new rt,Ba=new nt,Fa=new J,Ua=new I;class La extends Tt{constructor(t=new ce,e=new Sa){super(),this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}raycast(t,e){const i=this.geometry,n=this.matrixWorld,r=t.params.Points.threshold,a=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),Fa.copy(i.boundingSphere),Fa.applyMatrix4(n),Fa.radius+=r,!1===t.ray.intersectsSphere(Fa))return;Ta.copy(n).invert(),Ba.copy(t.ray).applyMatrix4(Ta);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s;if(i.isBufferGeometry){const r=i.index,s=i.attributes.position;if(null!==r){for(let i=Math.max(0,a.start),l=Math.min(r.count,a.start+a.count);i<l;i++){const a=r.getX(i);Ua.fromBufferAttribute(s,a),Ra(Ua,a,o,n,t,e,this)}}else{for(let i=Math.max(0,a.start),r=Math.min(s.count,a.start+a.count);i<r;i++)Ua.fromBufferAttribute(s,i),Ra(Ua,i,o,n,t,e,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,i=Object.keys(e);if(i.length>0){const t=e[i[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,i=t.length;e<i;e++){const i=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function Ra(t,e,i,n,r,a,s){const o=Ba.distanceSqToPoint(t);if(o<i){const i=new I;Ba.closestPointToPoint(t,i),i.applyMatrix4(n);const l=r.ray.origin.distanceTo(i);if(l<r.near||l>r.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:i,index:e,face:null,object:s})}}La.prototype.isPoints=!0;(class extends _{constructor(t,e,i,n,r,a,s,o,l){super(t,e,i,n,r,a,s,o,l),this.format=void 0!==s?s:1022,this.minFilter=void 0!==a?a:1006,this.magFilter=void 0!==r?r:1006,this.generateMipmaps=!1;const h=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){h.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}).prototype.isVideoTexture=!0;class Da extends _{constructor(t,e,i,n,r,a,s,o,l,h,c,u){super(null,a,s,o,l,h,n,r,c,u),this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}Da.prototype.isCompressedTexture=!0;(class extends _{constructor(t,e,i,n,r,a,s,o,l){super(t,e,i,n,r,a,s,o,l),this.needsUpdate=!0}}).prototype.isCanvasTexture=!0;(class extends _{constructor(t,e,i,n,r,a,s,o,l,h){if(1026!==(h=void 0!==h?h:1026)&&1027!==h)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&1026===h&&(i=1012),void 0===i&&1027===h&&(i=1020),super(null,n,r,a,s,o,h,i,l),this.image={width:t,height:e},this.magFilter=void 0!==s?s:1003,this.minFilter=void 0!==o?o:1003,this.flipY=!1,this.generateMipmaps=!1}}).prototype.isDepthTexture=!0;class Na extends ce{constructor(t=1,e=1,i=1,n=8,r=1,a=!1,s=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:r,openEnded:a,thetaStart:s,thetaLength:o};const l=this;n=Math.floor(n),r=Math.floor(r);const h=[],c=[],u=[],d=[];let p=0;const g=[],m=i/2;let y=0;function b(i){const r=p,a=new f,g=new I;let b=0;const v=!0===i?t:e,x=!0===i?1:-1;for(let t=1;t<=n;t++)c.push(0,m*x,0),u.push(0,x,0),d.push(.5,.5),p++;const _=p;for(let t=0;t<=n;t++){const e=t/n*o+s,i=Math.cos(e),r=Math.sin(e);g.x=v*r,g.y=m*x,g.z=v*i,c.push(g.x,g.y,g.z),u.push(0,x,0),a.x=.5*i+.5,a.y=.5*r*x+.5,d.push(a.x,a.y),p++}for(let t=0;t<n;t++){const e=r+t,n=_+t;!0===i?h.push(n,n+1,e):h.push(n+1,n,e),b+=3}l.addGroup(y,b,!0===i?1:2),y+=b}!function(){const a=new I,f=new I;let b=0;const v=(e-t)/i;for(let l=0;l<=r;l++){const h=[],y=l/r,b=y*(e-t)+t;for(let t=0;t<=n;t++){const e=t/n,r=e*o+s,l=Math.sin(r),g=Math.cos(r);f.x=b*l,f.y=-y*i+m,f.z=b*g,c.push(f.x,f.y,f.z),a.set(l,v,g).normalize(),u.push(a.x,a.y,a.z),d.push(e,1-y),h.push(p++)}g.push(h)}for(let t=0;t<n;t++)for(let e=0;e<r;e++){const i=g[e][t],n=g[e+1][t],r=g[e+1][t+1],a=g[e][t+1];h.push(i,n,a),h.push(n,r,a),b+=6}l.addGroup(y,b,0),y+=b}(),!1===a&&(t>0&&b(!0),e>0&&b(!1)),this.setIndex(h),this.setAttribute("position",new ie(c,3)),this.setAttribute("normal",new ie(u,3)),this.setAttribute("uv",new ie(d,2))}static fromJSON(t){return new Na(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Pa extends Na{constructor(t=1,e=1,i=8,n=1,r=!1,a=0,s=2*Math.PI){super(0,t,e,i,n,r,a,s),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:r,thetaStart:a,thetaLength:s}}static fromJSON(t){return new Pa(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}new I,new I,new I,new Ot;class ka{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,n=this.getPoint(0),r=0;e.push(0);for(let a=1;a<=t;a++)i=this.getPoint(a/t),r+=i.distanceTo(n),e.push(r),n=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const i=this.getLengths();let n=0;const r=i.length;let a;a=e||t*i[r-1];let s,o=0,l=r-1;for(;o<=l;)if(n=Math.floor(o+(l-o)/2),s=i[n]-a,s<0)o=n+1;else{if(!(s>0)){l=n;break}l=n-1}if(n=l,i[n]===a)return n/(r-1);const h=i[n];return(n+(a-h)/(i[n+1]-h))/(r-1)}getTangent(t,e){let i=t-1e-4,n=t+1e-4;i<0&&(i=0),n>1&&(n=1);const r=this.getPoint(i),a=this.getPoint(n),s=e||(r.isVector2?new f:new I);return s.copy(a).sub(r).normalize(),s}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e){const i=new I,n=[],r=[],a=[],s=new I,o=new rt;for(let e=0;e<=t;e++){const i=e/t;n[e]=this.getTangentAt(i,new I)}r[0]=new I,a[0]=new I;let l=Number.MAX_VALUE;const c=Math.abs(n[0].x),u=Math.abs(n[0].y),d=Math.abs(n[0].z);c<=l&&(l=c,i.set(1,0,0)),u<=l&&(l=u,i.set(0,1,0)),d<=l&&i.set(0,0,1),s.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],s),a[0].crossVectors(n[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),a[e]=a[e-1].clone(),s.crossVectors(n[e-1],n[e]),s.length()>Number.EPSILON){s.normalize();const t=Math.acos(h(n[e-1].dot(n[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(s,t))}a[e].crossVectors(n[e],r[e])}if(!0===e){let e=Math.acos(h(r[0].dot(r[t]),-1,1));e/=t,n[0].dot(s.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(o.makeRotationAxis(n[i],e*i)),a[i].crossVectors(n[i],r[i])}return{tangents:n,normals:r,binormals:a}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class za extends ka{constructor(t=0,e=0,i=1,n=1,r=0,a=2*Math.PI,s=!1,o=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(t,e){const i=e||new f,n=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const a=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(r=a?0:n),!0!==this.aClockwise||a||(r===n?r=-n:r-=n);const s=this.aStartAngle+t*r;let o=this.aX+this.xRadius*Math.cos(s),l=this.aY+this.yRadius*Math.sin(s);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),i=o-this.aX,n=l-this.aY;o=i*t-n*e+this.aX,l=i*e+n*t+this.aY}return i.set(o,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}za.prototype.isEllipseCurve=!0;class Oa extends za{constructor(t,e,i,n,r,a){super(t,e,i,i,n,r,a),this.type="ArcCurve"}}function Qa(){let t=0,e=0,i=0,n=0;function r(r,a,s,o){t=r,e=s,i=-3*r+3*a-2*s-o,n=2*r-2*a+s+o}return{initCatmullRom:function(t,e,i,n,a){r(e,i,a*(i-t),a*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,a,s,o){let l=(e-t)/a-(i-t)/(a+s)+(i-e)/s,h=(i-e)/s-(n-e)/(s+o)+(n-i)/o;l*=s,h*=s,r(e,i,l,h)},calc:function(r){const a=r*r;return t+e*r+i*a+n*(a*r)}}}Oa.prototype.isArcCurve=!0;const Va=new I,Ha=new Qa,Ga=new Qa,ja=new Qa;class Wa extends ka{constructor(t=[],e=!1,i="centripetal",n=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}getPoint(t,e=new I){const i=e,n=this.points,r=n.length,a=(r-(this.closed?0:1))*t;let s,o,l=Math.floor(a),h=a-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===h&&l===r-1&&(l=r-2,h=1),this.closed||l>0?s=n[(l-1)%r]:(Va.subVectors(n[0],n[1]).add(n[0]),s=Va);const c=n[l%r],u=n[(l+1)%r];if(this.closed||l+2<r?o=n[(l+2)%r]:(Va.subVectors(n[r-1],n[r-2]).add(n[r-1]),o=Va),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(s.distanceToSquared(c),t),i=Math.pow(c.distanceToSquared(u),t),n=Math.pow(u.distanceToSquared(o),t);i<1e-4&&(i=1),e<1e-4&&(e=i),n<1e-4&&(n=i),Ha.initNonuniformCatmullRom(s.x,c.x,u.x,o.x,e,i,n),Ga.initNonuniformCatmullRom(s.y,c.y,u.y,o.y,e,i,n),ja.initNonuniformCatmullRom(s.z,c.z,u.z,o.z,e,i,n)}else"catmullrom"===this.curveType&&(Ha.initCatmullRom(s.x,c.x,u.x,o.x,this.tension),Ga.initCatmullRom(s.y,c.y,u.y,o.y,this.tension),ja.initCatmullRom(s.z,c.z,u.z,o.z,this.tension));return i.set(Ha.calc(h),Ga.calc(h),ja.calc(h)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new I).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function qa(t,e,i,n,r){const a=.5*(n-e),s=.5*(r-i),o=t*t;return(2*i-2*n+a+s)*(t*o)+(-3*i+3*n-2*a-s)*o+a*t+i}function Za(t,e,i,n){return function(t,e){const i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function Ja(t,e,i,n,r){return function(t,e){const i=1-t;return i*i*i*e}(t,e)+function(t,e){const i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,r)}Wa.prototype.isCatmullRomCurve3=!0;class Xa extends ka{constructor(t=new f,e=new f,i=new f,n=new f){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new f){const i=e,n=this.v0,r=this.v1,a=this.v2,s=this.v3;return i.set(Ja(t,n.x,r.x,a.x,s.x),Ja(t,n.y,r.y,a.y,s.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}Xa.prototype.isCubicBezierCurve=!0;class Ya extends ka{constructor(t=new I,e=new I,i=new I,n=new I){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new I){const i=e,n=this.v0,r=this.v1,a=this.v2,s=this.v3;return i.set(Ja(t,n.x,r.x,a.x,s.x),Ja(t,n.y,r.y,a.y,s.y),Ja(t,n.z,r.z,a.z,s.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}Ya.prototype.isCubicBezierCurve3=!0;class Ka extends ka{constructor(t=new f,e=new f){super(),this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new f){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){const i=e||new f;return i.copy(this.v2).sub(this.v1).normalize(),i}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Ka.prototype.isLineCurve=!0;class $a extends ka{constructor(t=new f,e=new f,i=new f){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new f){const i=e,n=this.v0,r=this.v1,a=this.v2;return i.set(Za(t,n.x,r.x,a.x),Za(t,n.y,r.y,a.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}$a.prototype.isQuadraticBezierCurve=!0;class ts extends ka{constructor(t=new I,e=new I,i=new I){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new I){const i=e,n=this.v0,r=this.v1,a=this.v2;return i.set(Za(t,n.x,r.x,a.x),Za(t,n.y,r.y,a.y),Za(t,n.z,r.z,a.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}ts.prototype.isQuadraticBezierCurve3=!0;class es extends ka{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,e=new f){const i=e,n=this.points,r=(n.length-1)*t,a=Math.floor(r),s=r-a,o=n[0===a?a:a-1],l=n[a],h=n[a>n.length-2?n.length-1:a+1],c=n[a>n.length-3?n.length-1:a+2];return i.set(qa(s,o.x,l.x,h.x,c.x),qa(s,o.y,l.y,h.y,c.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new f).fromArray(i))}return this}}es.prototype.isSplineCurve=!0;var is=Object.freeze({__proto__:null,ArcCurve:Oa,CatmullRomCurve3:Wa,CubicBezierCurve:Xa,CubicBezierCurve3:Ya,EllipseCurve:za,LineCurve:Ka,LineCurve3:class extends ka{constructor(t=new I,e=new I){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=e}getPoint(t,e=new I){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:$a,QuadraticBezierCurve3:ts,SplineCurve:es});class ns extends ka{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Ka(e,t))}getPoint(t,e){const i=t*this.getLength(),n=this.getCurveLengths();let r=0;for(;r<n.length;){if(n[r]>=i){const t=n[r]-i,a=this.curves[r],s=a.getLength(),o=0===s?0:1-t/s;return a.getPointAt(o,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let i;for(let n=0,r=this.curves;n<r.length;n++){const a=r[n],s=a&&a.isEllipseCurve?2*t:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?t*a.points.length:t,o=a.getPoints(s);for(let t=0;t<o.length;t++){const n=o[t];i&&i.equals(n)||(e.push(n),i=n)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push((new is[i.type]).fromJSON(i))}return this}}class rs extends ns{constructor(t){super(),this.type="Path",this.currentPoint=new f,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const i=new Ka(this.currentPoint.clone(),new f(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,n){const r=new $a(this.currentPoint.clone(),new f(t,e),new f(i,n));return this.curves.push(r),this.currentPoint.set(i,n),this}bezierCurveTo(t,e,i,n,r,a){const s=new Xa(this.currentPoint.clone(),new f(t,e),new f(i,n),new f(r,a));return this.curves.push(s),this.currentPoint.set(r,a),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),i=new es(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,n,r,a){const s=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+s,e+o,i,n,r,a),this}absarc(t,e,i,n,r,a){return this.absellipse(t,e,i,i,n,r,a),this}ellipse(t,e,i,n,r,a,s,o){const l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(t+l,e+h,i,n,r,a,s,o),this}absellipse(t,e,i,n,r,a,s,o){const l=new za(t,e,i,n,r,a,s,o);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const h=l.getPoint(1);return this.currentPoint.copy(h),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class as extends rs{constructor(t){super(t),this.uuid=l(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push((new rs).fromJSON(i))}return this}}const ss=function(t,e,i=2){const n=e&&e.length,r=n?e[0]*i:t.length;let a=os(t,0,r,i,!0);const s=[];if(!a||a.next===a.prev)return s;let o,l,h,c,u,d,p;if(n&&(a=function(t,e,i,n){const r=[];let a,s,o,l,h;for(a=0,s=e.length;a<s;a++)o=e[a]*n,l=a<s-1?e[a+1]*n:t.length,h=os(t,o,l,n,!1),h===h.next&&(h.steiner=!0),r.push(bs(h));for(r.sort(fs),a=0;a<r.length;a++)gs(r[a],i),i=ls(i,i.next);return i}(t,e,a,i)),t.length>80*i){o=h=t[0],l=c=t[1];for(let e=i;e<r;e+=i)u=t[e],d=t[e+1],u<o&&(o=u),d<l&&(l=d),u>h&&(h=u),d>c&&(c=d);p=Math.max(h-o,c-l),p=0!==p?1/p:0}return hs(a,s,i,o,l,p),s};function os(t,e,i,n,r){let a,s;if(r===function(t,e,i,n){let r=0;for(let a=e,s=i-n;a<i;a+=n)r+=(t[s]-t[a])*(t[a+1]+t[s+1]),s=a;return r}(t,e,i,n)>0)for(a=e;a<i;a+=n)s=Ss(a,t[a],t[a+1],s);else for(a=i-n;a>=e;a-=n)s=Ss(a,t[a],t[a+1],s);return s&&As(s,s.next)&&(Ts(s),s=s.next),s}function ls(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!As(n,n.next)&&0!==_s(n.prev,n,n.next))n=n.next;else{if(Ts(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function hs(t,e,i,n,r,a,s){if(!t)return;!s&&a&&function(t,e,i,n){let r=t;do{null===r.z&&(r.z=ys(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i,n,r,a,s,o,l,h=1;do{for(i=t,t=null,a=null,s=0;i;){for(s++,n=i,o=0,e=0;e<h&&(o++,n=n.nextZ,n);e++);for(l=h;o>0||l>0&&n;)0!==o&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,o--):(r=n,n=n.nextZ,l--),a?a.nextZ=r:t=r,r.prevZ=a,a=r;i=n}a.nextZ=null,h*=2}while(s>1)}(r)}(t,n,r,a);let o,l,h=t;for(;t.prev!==t.next;)if(o=t.prev,l=t.next,a?us(t,n,r,a):cs(t))e.push(o.i/i),e.push(t.i/i),e.push(l.i/i),Ts(t),t=l.next,h=l.next;else if((t=l)===h){s?1===s?hs(t=ds(ls(t),e,i),e,i,n,r,a,2):2===s&&ps(t,e,i,n,r,a):hs(ls(t),e,i,n,r,a,1);break}}function cs(t){const e=t.prev,i=t,n=t.next;if(_s(e,i,n)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(vs(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&_s(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function us(t,e,i,n){const r=t.prev,a=t,s=t.next;if(_s(r,a,s)>=0)return!1;const o=r.x<a.x?r.x<s.x?r.x:s.x:a.x<s.x?a.x:s.x,l=r.y<a.y?r.y<s.y?r.y:s.y:a.y<s.y?a.y:s.y,h=r.x>a.x?r.x>s.x?r.x:s.x:a.x>s.x?a.x:s.x,c=r.y>a.y?r.y>s.y?r.y:s.y:a.y>s.y?a.y:s.y,u=ys(o,l,e,i,n),d=ys(h,c,e,i,n);let p=t.prevZ,f=t.nextZ;for(;p&&p.z>=u&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&vs(r.x,r.y,a.x,a.y,s.x,s.y,p.x,p.y)&&_s(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&vs(r.x,r.y,a.x,a.y,s.x,s.y,f.x,f.y)&&_s(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&vs(r.x,r.y,a.x,a.y,s.x,s.y,p.x,p.y)&&_s(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&vs(r.x,r.y,a.x,a.y,s.x,s.y,f.x,f.y)&&_s(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function ds(t,e,i){let n=t;do{const r=n.prev,a=n.next.next;!As(r,a)&&ws(r,n,n.next,a)&&Es(r,a)&&Es(a,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(a.i/i),Ts(n),Ts(n.next),n=t=a),n=n.next}while(n!==t);return ls(n)}function ps(t,e,i,n,r,a){let s=t;do{let t=s.next.next;for(;t!==s.prev;){if(s.i!==t.i&&xs(s,t)){let o=Is(s,t);return s=ls(s,s.next),o=ls(o,o.next),hs(s,e,i,n,r,a),void hs(o,e,i,n,r,a)}t=t.next}s=s.next}while(s!==t)}function fs(t,e){return t.x-e.x}function gs(t,e){if(e=function(t,e){let i=e;const n=t.x,r=t.y;let a,s=-1/0;do{if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const t=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>s){if(s=t,t===n){if(r===i.y)return i;if(r===i.next.y)return i.next}a=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!a)return null;if(n===s)return a;const o=a,l=a.x,h=a.y;let c,u=1/0;i=a;do{n>=i.x&&i.x>=l&&n!==i.x&&vs(r<h?n:s,r,l,h,r<h?s:n,r,i.x,i.y)&&(c=Math.abs(r-i.y)/(n-i.x),Es(i,t)&&(c<u||c===u&&(i.x>a.x||i.x===a.x&&ms(a,i)))&&(a=i,u=c)),i=i.next}while(i!==o);return a}(t,e)){const i=Is(e,t);ls(e,e.next),ls(i,i.next)}}function ms(t,e){return _s(t.prev,t,e.prev)<0&&_s(e.next,t,t.next)<0}function ys(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function bs(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function vs(t,e,i,n,r,a,s,o){return(r-s)*(e-o)-(t-s)*(a-o)>=0&&(t-s)*(n-o)-(i-s)*(e-o)>=0&&(i-s)*(a-o)-(r-s)*(n-o)>=0}function xs(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&ws(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Es(t,e)&&Es(e,t)&&function(t,e){let i=t,n=!1;const r=(t.x+e.x)/2,a=(t.y+e.y)/2;do{i.y>a!=i.next.y>a&&i.next.y!==i.y&&r<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(_s(t.prev,t,e.prev)||_s(t,e.prev,e))||As(t,e)&&_s(t.prev,t,t.next)>0&&_s(e.prev,e,e.next)>0)}function _s(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function As(t,e){return t.x===e.x&&t.y===e.y}function ws(t,e,i,n){const r=Ms(_s(t,e,i)),a=Ms(_s(t,e,n)),s=Ms(_s(i,n,t)),o=Ms(_s(i,n,e));return r!==a&&s!==o||(!(0!==r||!Cs(t,i,e))||(!(0!==a||!Cs(t,n,e))||(!(0!==s||!Cs(i,t,n))||!(0!==o||!Cs(i,e,n)))))}function Cs(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Ms(t){return t>0?1:t<0?-1:0}function Es(t,e){return _s(t.prev,t,t.next)<0?_s(t,e,t.next)>=0&&_s(t,t.prev,e)>=0:_s(t,e,t.prev)<0||_s(t,t.next,e)<0}function Is(t,e){const i=new Bs(t.i,t.x,t.y),n=new Bs(e.i,e.x,e.y),r=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,a.next=n,n.prev=a,n}function Ss(t,e,i,n){const r=new Bs(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Ts(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Bs(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Fs{static area(t){const e=t.length;let i=0;for(let n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i}static isClockWise(t){return Fs.area(t)<0}static triangulateShape(t,e){const i=[],n=[],r=[];Us(t),Ls(i,t);let a=t.length;e.forEach(Us);for(let t=0;t<e.length;t++)n.push(a),a+=e[t].length,Ls(i,e[t]);const s=ss(i,n);for(let t=0;t<s.length;t+=3)r.push(s.slice(t,t+3));return r}}function Us(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Ls(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}class Rs extends ce{constructor(t=new as([new f(.5,.5),new f(-.5,.5),new f(-.5,-.5),new f(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const i=this,n=[],r=[];for(let e=0,i=t.length;e<i;e++){a(t[e])}function a(t){const a=[],s=void 0!==e.curveSegments?e.curveSegments:12,o=void 0!==e.steps?e.steps:1;let l=void 0!==e.depth?e.depth:1,h=void 0===e.bevelEnabled||e.bevelEnabled,c=void 0!==e.bevelThickness?e.bevelThickness:.2,u=void 0!==e.bevelSize?e.bevelSize:c-.1,d=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const g=e.extrudePath,m=void 0!==e.UVGenerator?e.UVGenerator:Ds;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=e.amount);let y,b,v,x,_,A=!1;g&&(y=g.getSpacedPoints(o),A=!0,h=!1,b=g.computeFrenetFrames(o,!1),v=new I,x=new I,_=new I),h||(p=0,c=0,u=0,d=0);const w=t.extractPoints(s);let C=w.shape;const M=w.holes;if(!Fs.isClockWise(C)){C=C.reverse();for(let t=0,e=M.length;t<e;t++){const e=M[t];Fs.isClockWise(e)&&(M[t]=e.reverse())}}const E=Fs.triangulateShape(C,M),S=C;for(let t=0,e=M.length;t<e;t++){const e=M[t];C=C.concat(e)}function T(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(i).add(t)}const B=C.length,F=E.length;function U(t,e,i){let n,r,a;const s=t.x-e.x,o=t.y-e.y,l=i.x-t.x,h=i.y-t.y,c=s*s+o*o,u=s*h-o*l;if(Math.abs(u)>Number.EPSILON){const u=Math.sqrt(c),d=Math.sqrt(l*l+h*h),p=e.x-o/u,g=e.y+s/u,m=((i.x-h/d-p)*h-(i.y+l/d-g)*l)/(s*h-o*l);n=p+s*m-t.x,r=g+o*m-t.y;const y=n*n+r*r;if(y<=2)return new f(n,r);a=Math.sqrt(y/2)}else{let t=!1;s>Number.EPSILON?l>Number.EPSILON&&(t=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(h)&&(t=!0),t?(n=-o,r=s,a=Math.sqrt(c)):(n=s,r=o,a=Math.sqrt(c/2))}return new f(n/a,r/a)}const L=[];for(let t=0,e=S.length,i=e-1,n=t+1;t<e;t++,i++,n++)i===e&&(i=0),n===e&&(n=0),L[t]=U(S[t],S[i],S[n]);const R=[];let D,N=L.concat();for(let t=0,e=M.length;t<e;t++){const e=M[t];D=[];for(let t=0,i=e.length,n=i-1,r=t+1;t<i;t++,n++,r++)n===i&&(n=0),r===i&&(r=0),D[t]=U(e[t],e[n],e[r]);R.push(D),N=N.concat(D)}for(let t=0;t<p;t++){const e=t/p,i=c*Math.cos(e*Math.PI/2),n=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=S.length;t<e;t++){const e=T(S[t],L[t],n);z(e.x,e.y,-i)}for(let t=0,e=M.length;t<e;t++){const e=M[t];D=R[t];for(let t=0,r=e.length;t<r;t++){const r=T(e[t],D[t],n);z(r.x,r.y,-i)}}}const P=u+d;for(let t=0;t<B;t++){const e=h?T(C[t],N[t],P):C[t];A?(x.copy(b.normals[0]).multiplyScalar(e.x),v.copy(b.binormals[0]).multiplyScalar(e.y),_.copy(y[0]).add(x).add(v),z(_.x,_.y,_.z)):z(e.x,e.y,0)}for(let t=1;t<=o;t++)for(let e=0;e<B;e++){const i=h?T(C[e],N[e],P):C[e];A?(x.copy(b.normals[t]).multiplyScalar(i.x),v.copy(b.binormals[t]).multiplyScalar(i.y),_.copy(y[t]).add(x).add(v),z(_.x,_.y,_.z)):z(i.x,i.y,l/o*t)}for(let t=p-1;t>=0;t--){const e=t/p,i=c*Math.cos(e*Math.PI/2),n=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=S.length;t<e;t++){const e=T(S[t],L[t],n);z(e.x,e.y,l+i)}for(let t=0,e=M.length;t<e;t++){const e=M[t];D=R[t];for(let t=0,r=e.length;t<r;t++){const r=T(e[t],D[t],n);A?z(r.x,r.y+y[o-1].y,y[o-1].x+i):z(r.x,r.y,l+i)}}}function k(t,e){let i=t.length;for(;--i>=0;){const n=i;let r=i-1;r<0&&(r=t.length-1);for(let t=0,i=o+2*p;t<i;t++){const i=B*t,a=B*(t+1);Q(e+n+i,e+r+i,e+r+a,e+n+a)}}}function z(t,e,i){a.push(t),a.push(e),a.push(i)}function O(t,e,r){V(t),V(e),V(r);const a=n.length/3,s=m.generateTopUV(i,n,a-3,a-2,a-1);H(s[0]),H(s[1]),H(s[2])}function Q(t,e,r,a){V(t),V(e),V(a),V(e),V(r),V(a);const s=n.length/3,o=m.generateSideWallUV(i,n,s-6,s-3,s-2,s-1);H(o[0]),H(o[1]),H(o[3]),H(o[1]),H(o[2]),H(o[3])}function V(t){n.push(a[3*t+0]),n.push(a[3*t+1]),n.push(a[3*t+2])}function H(t){r.push(t.x),r.push(t.y)}!function(){const t=n.length/3;if(h){let t=0,e=B*t;for(let t=0;t<F;t++){const i=E[t];O(i[2]+e,i[1]+e,i[0]+e)}t=o+2*p,e=B*t;for(let t=0;t<F;t++){const i=E[t];O(i[0]+e,i[1]+e,i[2]+e)}}else{for(let t=0;t<F;t++){const e=E[t];O(e[2],e[1],e[0])}for(let t=0;t<F;t++){const e=E[t];O(e[0]+B*o,e[1]+B*o,e[2]+B*o)}}i.addGroup(t,n.length/3-t,0)}(),function(){const t=n.length/3;let e=0;k(S,e),e+=S.length;for(let t=0,i=M.length;t<i;t++){const i=M[t];k(i,e),e+=i.length}i.addGroup(t,n.length/3-t,1)}()}this.setAttribute("position",new ie(n,3)),this.setAttribute("uv",new ie(r,2)),this.computeVertexNormals()}toJSON(){const t=super.toJSON();return function(t,e,i){if(i.shapes=[],Array.isArray(t))for(let e=0,n=t.length;e<n;e++){const n=t[e];i.shapes.push(n.uuid)}else i.shapes.push(t.uuid);void 0!==e.extrudePath&&(i.options.extrudePath=e.extrudePath.toJSON());return i}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const i=[];for(let n=0,r=t.shapes.length;n<r;n++){const r=e[t.shapes[n]];i.push(r)}const n=t.options.extrudePath;return void 0!==n&&(t.options.extrudePath=(new is[n.type]).fromJSON(n)),new Rs(i,t.options)}}const Ds={generateTopUV:function(t,e,i,n,r){const a=e[3*i],s=e[3*i+1],o=e[3*n],l=e[3*n+1],h=e[3*r],c=e[3*r+1];return[new f(a,s),new f(o,l),new f(h,c)]},generateSideWallUV:function(t,e,i,n,r,a){const s=e[3*i],o=e[3*i+1],l=e[3*i+2],h=e[3*n],c=e[3*n+1],u=e[3*n+2],d=e[3*r],p=e[3*r+1],g=e[3*r+2],m=e[3*a],y=e[3*a+1],b=e[3*a+2];return Math.abs(o-c)<Math.abs(s-h)?[new f(s,1-l),new f(h,1-u),new f(d,1-g),new f(m,1-b)]:[new f(o,1-l),new f(c,1-u),new f(p,1-g),new f(y,1-b)]}};class Ns extends ce{constructor(t=new as([new f(0,.5),new f(-.5,-.5),new f(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const i=[],n=[],r=[],a=[];let s=0,o=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(s,o,e),s+=o,o=0;function l(t){const s=n.length/3,l=t.extractPoints(e);let h=l.shape;const c=l.holes;!1===Fs.isClockWise(h)&&(h=h.reverse());for(let t=0,e=c.length;t<e;t++){const e=c[t];!0===Fs.isClockWise(e)&&(c[t]=e.reverse())}const u=Fs.triangulateShape(h,c);for(let t=0,e=c.length;t<e;t++){const e=c[t];h=h.concat(e)}for(let t=0,e=h.length;t<e;t++){const e=h[t];n.push(e.x,e.y,0),r.push(0,0,1),a.push(e.x,e.y)}for(let t=0,e=u.length;t<e;t++){const e=u[t],n=e[0]+s,r=e[1]+s,a=e[2]+s;i.push(n,r,a),o+=3}}this.setIndex(i),this.setAttribute("position",new ie(n,3)),this.setAttribute("normal",new ie(r,3)),this.setAttribute("uv",new ie(a,2))}toJSON(){const t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let i=0,n=t.length;i<n;i++){const n=t[i];e.shapes.push(n.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){const i=[];for(let n=0,r=t.shapes.length;n<r;n++){const r=e[t.shapes[n]];i.push(r)}return new Ns(i,t.curveSegments)}}class Ps extends ce{constructor(t=1,e=32,i=16,n=0,r=2*Math.PI,a=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:s},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));const o=Math.min(a+s,Math.PI);let l=0;const h=[],c=new I,u=new I,d=[],p=[],f=[],g=[];for(let d=0;d<=i;d++){const m=[],y=d/i;let b=0;0==d&&0==a?b=.5/e:d==i&&o==Math.PI&&(b=-.5/e);for(let i=0;i<=e;i++){const o=i/e;c.x=-t*Math.cos(n+o*r)*Math.sin(a+y*s),c.y=t*Math.cos(a+y*s),c.z=t*Math.sin(n+o*r)*Math.sin(a+y*s),p.push(c.x,c.y,c.z),u.copy(c).normalize(),f.push(u.x,u.y,u.z),g.push(o+b,1-y),m.push(l++)}h.push(m)}for(let t=0;t<i;t++)for(let n=0;n<e;n++){const e=h[t][n+1],r=h[t][n],s=h[t+1][n],l=h[t+1][n+1];(0!==t||a>0)&&d.push(e,r,l),(t!==i-1||o<Math.PI)&&d.push(r,s,l)}this.setIndex(d),this.setAttribute("position",new ie(p,3)),this.setAttribute("normal",new ie(f,3)),this.setAttribute("uv",new ie(g,2))}static fromJSON(t){return new Ps(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class ks extends ce{constructor(t=new ts(new I(-1,-1,0),new I(-1,1,0),new I(1,1,0)),e=64,i=1,n=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:r};const a=t.computeFrenetFrames(e,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const s=new I,o=new I,l=new f;let h=new I;const c=[],u=[],d=[],p=[];function g(r){h=t.getPointAt(r/e,h);const l=a.normals[r],d=a.binormals[r];for(let t=0;t<=n;t++){const e=t/n*Math.PI*2,r=Math.sin(e),a=-Math.cos(e);o.x=a*l.x+r*d.x,o.y=a*l.y+r*d.y,o.z=a*l.z+r*d.z,o.normalize(),u.push(o.x,o.y,o.z),s.x=h.x+i*o.x,s.y=h.y+i*o.y,s.z=h.z+i*o.z,c.push(s.x,s.y,s.z)}}!function(){for(let t=0;t<e;t++)g(t);g(!1===r?e:0),function(){for(let t=0;t<=e;t++)for(let i=0;i<=n;i++)l.x=t/e,l.y=i/n,d.push(l.x,l.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=n;e++){const i=(n+1)*(t-1)+(e-1),r=(n+1)*t+(e-1),a=(n+1)*t+e,s=(n+1)*(t-1)+e;p.push(i,r,s),p.push(r,a,s)}}()}(),this.setIndex(p),this.setAttribute("position",new ie(c,3)),this.setAttribute("normal",new ie(u,3)),this.setAttribute("uv",new ie(d,2))}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new ks((new is[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class zs extends Vt{constructor(t){super(),this.type="ShadowMaterial",this.color=new Jt(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}zs.prototype.isShadowMaterial=!0;class Os extends Vt{constructor(t){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Jt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Jt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new f(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}Os.prototype.isMeshStandardMaterial=!0;class Qs extends Os{constructor(t){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new f(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return h(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenTint=new Jt(0),this.sheenRoughness=1,this.transmissionMap=null,this.thickness=.01,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationTint=new Jt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularTint=new Jt(1,1,1),this.specularTintMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(t)}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.sheen=t.sheen,this.sheenTint.copy(t.sheenTint),this.sheenRoughness=t.sheenRoughness,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationTint.copy(t.attenuationTint),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularTint.copy(t.specularTint),this.specularTintMap=t.specularTintMap,this}}Qs.prototype.isMeshPhysicalMaterial=!0;class Vs extends Vt{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new Jt(16777215),this.specular=new Jt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Jt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new f(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}Vs.prototype.isMeshPhongMaterial=!0;class Hs extends Vt{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Jt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Jt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new f(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Hs.prototype.isMeshToonMaterial=!0;class Gs extends Vt{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new f(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}Gs.prototype.isMeshNormalMaterial=!0;class js extends Vt{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new Jt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Jt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}js.prototype.isMeshLambertMaterial=!0;class Ws extends Vt{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Jt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new f(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this}}Ws.prototype.isMeshMatcapMaterial=!0;class qs extends ya{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}qs.prototype.isLineDashedMaterial=!0;const Zs={arraySlice:function(t,e,i){return Zs.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)},convertArray:function(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,i=new Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort((function(e,i){return t[e]-t[i]})),i},sortedArray:function(t,e,i){const n=t.length,r=new t.constructor(n);for(let a=0,s=0;s!==n;++a){const n=i[a]*e;for(let i=0;i!==e;++i)r[s++]=t[n+i]}return r},flattenJSON:function(t,e,i,n){let r=1,a=t[0];for(;void 0!==a&&void 0===a[n];)a=t[r++];if(void 0===a)return;let s=a[n];if(void 0!==s)if(Array.isArray(s))do{s=a[n],void 0!==s&&(e.push(a.time),i.push.apply(i,s)),a=t[r++]}while(void 0!==a);else if(void 0!==s.toArray)do{s=a[n],void 0!==s&&(e.push(a.time),s.toArray(i,i.length)),a=t[r++]}while(void 0!==a);else do{s=a[n],void 0!==s&&(e.push(a.time),i.push(s)),a=t[r++]}while(void 0!==a)},subclip:function(t,e,i,n,r=30){const a=t.clone();a.name=e;const s=[];for(let t=0;t<a.tracks.length;++t){const e=a.tracks[t],o=e.getValueSize(),l=[],h=[];for(let t=0;t<e.times.length;++t){const a=e.times[t]*r;if(!(a<i||a>=n)){l.push(e.times[t]);for(let i=0;i<o;++i)h.push(e.values[t*o+i])}}0!==l.length&&(e.times=Zs.convertArray(l,e.times.constructor),e.values=Zs.convertArray(h,e.values.constructor),s.push(e))}a.tracks=s;let o=1/0;for(let t=0;t<a.tracks.length;++t)o>a.tracks[t].times[0]&&(o=a.tracks[t].times[0]);for(let t=0;t<a.tracks.length;++t)a.tracks[t].shift(-1*o);return a.resetDuration(),a},makeClipAdditive:function(t,e=0,i=t,n=30){n<=0&&(n=30);const r=i.tracks.length,a=e/n;for(let e=0;e<r;++e){const n=i.tracks[e],r=n.ValueTypeName;if("bool"===r||"string"===r)continue;const s=t.tracks.find((function(t){return t.name===n.name&&t.ValueTypeName===r}));if(void 0===s)continue;let o=0;const l=n.getValueSize();n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(o=l/3);let h=0;const c=s.getValueSize();s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=c/3);const u=n.times.length-1;let d;if(a<=n.times[0]){const t=o,e=l-o;d=Zs.arraySlice(n.values,t,e)}else if(a>=n.times[u]){const t=u*l+o,e=t+l-o;d=Zs.arraySlice(n.values,t,e)}else{const t=n.createInterpolant(),e=o,i=l-o;t.evaluate(a),d=Zs.arraySlice(t.resultBuffer,e,i)}if("quaternion"===r){(new E).fromArray(d).normalize().conjugate().toArray(d)}const p=s.times.length;for(let t=0;t<p;++t){const e=t*c+h;if("quaternion"===r)E.multiplyQuaternionsFlat(s.values,e,d,0,s.values,e);else{const t=c-2*h;for(let i=0;i<t;++i)s.values[e+i]-=d[i]}}}return t.blendMode=2501,t}};class Js{constructor(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{let a;i:{n:if(!(t<n)){for(let a=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,t,r)}if(i===a)break;if(r=n,n=e[++i],t<n)break e}a=e.length;break i}if(t>=r)break t;{const s=e[1];t<s&&(i=2,r=s);for(let a=i-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(i===a)break;if(n=r,r=e[--i-1],t>=r)break e}a=i,i=0}}for(;i<a;){const n=i+a>>>1;t<e[n]?a=n:i=n+1}if(n=e[i],r=e[i-1],void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,n);if(void 0===n)return i=e.length,this._cachedIndex=i,this.afterEnd_(i-1,r,t)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n;for(let t=0;t!==n;++t)e[t]=i[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}Js.prototype.beforeStart_=Js.prototype.copySampleValue_,Js.prototype.afterEnd_=Js.prototype.copySampleValue_;class Xs extends Js{constructor(t,e,i,n){super(t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(t,e,i){const n=this.parameterPositions;let r=t-2,a=t+1,s=n[r],o=n[a];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:r=t,s=2*e-i;break;case 2402:r=n.length-2,s=e+n[r]-n[r+1];break;default:r=t,s=i}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:a=t,o=2*i-e;break;case 2402:a=1,o=i+n[1]-n[0];break;default:a=t-1,o=e}const l=.5*(i-e),h=this.valueSize;this._weightPrev=l/(e-s),this._weightNext=l/(o-i),this._offsetPrev=r*h,this._offsetNext=a*h}interpolate_(t,e,i,n){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=t*s,l=o-s,h=this._offsetPrev,c=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(i-e)/(n-e),f=p*p,g=f*p,m=-u*g+2*u*f-u*p,y=(1+u)*g+(-1.5-2*u)*f+(-.5+u)*p+1,b=(-1-d)*g+(1.5+d)*f+.5*p,v=d*g-d*f;for(let t=0;t!==s;++t)r[t]=m*a[h+t]+y*a[l+t]+b*a[o+t]+v*a[c+t];return r}}class Ys extends Js{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=t*s,l=o-s,h=(i-e)/(n-e),c=1-h;for(let t=0;t!==s;++t)r[t]=a[l+t]*c+a[o+t]*h;return r}}class Ks extends Js{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t){return this.copySampleValue_(t-1)}}class $s{constructor(t,e,i,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Zs.convertArray(e,this.TimeBufferType),this.values=Zs.convertArray(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Zs.convertArray(t.times,Array),values:Zs.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new Ks(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Ys(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Xs(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]*=t}return this}trim(t,e){const i=this.times,n=i.length;let r=0,a=n-1;for(;r!==n&&i[r]<t;)++r;for(;-1!==a&&i[a]>e;)--a;if(++a,0!==r||a!==n){r>=a&&(a=Math.max(a,1),r=a-1);const t=this.getValueSize();this.times=Zs.arraySlice(i,r,a),this.values=Zs.arraySlice(this.values,r*t,a*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const i=this.times,n=this.values,r=i.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let e=0;e!==r;e++){const n=i[e];if("number"==typeof n&&isNaN(n)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,n),t=!1;break}if(null!==a&&a>n){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,n,a),t=!1;break}a=n}if(void 0!==n&&Zs.isTypedArray(n))for(let e=0,i=n.length;e!==i;++e){const i=n[e];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){const t=Zs.arraySlice(this.times),e=Zs.arraySlice(this.values),i=this.getValueSize(),n=2302===this.getInterpolation(),r=t.length-1;let a=1;for(let s=1;s<r;++s){let r=!1;const o=t[s];if(o!==t[s+1]&&(1!==s||o!==t[0]))if(n)r=!0;else{const t=s*i,n=t-i,a=t+i;for(let s=0;s!==i;++s){const i=e[t+s];if(i!==e[n+s]||i!==e[a+s]){r=!0;break}}}if(r){if(s!==a){t[a]=t[s];const n=s*i,r=a*i;for(let t=0;t!==i;++t)e[r+t]=e[n+t]}++a}}if(r>0){t[a]=t[r];for(let t=r*i,n=a*i,s=0;s!==i;++s)e[n+s]=e[t+s];++a}return a!==t.length?(this.times=Zs.arraySlice(t,0,a),this.values=Zs.arraySlice(e,0,a*i)):(this.times=t,this.values=e),this}clone(){const t=Zs.arraySlice(this.times,0),e=Zs.arraySlice(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}$s.prototype.TimeBufferType=Float32Array,$s.prototype.ValueBufferType=Float32Array,$s.prototype.DefaultInterpolation=2301;class to extends $s{}to.prototype.ValueTypeName="bool",to.prototype.ValueBufferType=Array,to.prototype.DefaultInterpolation=2300,to.prototype.InterpolantFactoryMethodLinear=void 0,to.prototype.InterpolantFactoryMethodSmooth=void 0;class eo extends $s{}eo.prototype.ValueTypeName="color";class io extends $s{}io.prototype.ValueTypeName="number";class no extends Js{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(i-e)/(n-e);let l=t*s;for(let t=l+s;l!==t;l+=4)E.slerpFlat(r,0,a,l-s,a,l,o);return r}}class ro extends $s{InterpolantFactoryMethodLinear(t){return new no(this.times,this.values,this.getValueSize(),t)}}ro.prototype.ValueTypeName="quaternion",ro.prototype.DefaultInterpolation=2301,ro.prototype.InterpolantFactoryMethodSmooth=void 0;class ao extends $s{}ao.prototype.ValueTypeName="string",ao.prototype.ValueBufferType=Array,ao.prototype.DefaultInterpolation=2300,ao.prototype.InterpolantFactoryMethodLinear=void 0,ao.prototype.InterpolantFactoryMethodSmooth=void 0;class so extends $s{}so.prototype.ValueTypeName="vector";class oo{constructor(t,e=-1,i,n=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=n,this.uuid=l(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],i=t.tracks,n=1/(t.fps||1);for(let t=0,r=i.length;t!==r;++t)e.push(lo(i[t]).scale(n));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,n=i.length;t!==n;++t)e.push($s.toJSON(i[t]));return n}static CreateFromMorphTargetSequence(t,e,i,n){const r=e.length,a=[];for(let t=0;t<r;t++){let s=[],o=[];s.push((t+r-1)%r,t,(t+1)%r),o.push(0,1,0);const l=Zs.getKeyframeOrder(s);s=Zs.sortedArray(s,1,l),o=Zs.sortedArray(o,1,l),n||0!==s[0]||(s.push(r),o.push(o[0])),a.push(new io(".morphTargetInfluences["+e[t].name+"]",s,o).scale(1/i))}return new this(t,-1,a)}static findByName(t,e){let i=t;if(!Array.isArray(t)){const e=t;i=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<i.length;t++)if(i[t].name===e)return i[t];return null}static CreateClipsFromMorphTargetSequences(t,e,i){const n={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,i=t.length;e<i;e++){const i=t[e],a=i.name.match(r);if(a&&a.length>1){const t=a[1];let e=n[t];e||(n[t]=e=[]),e.push(i)}}const a=[];for(const t in n)a.push(this.CreateFromMorphTargetSequence(t,n[t],e,i));return a}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(t,e,i,n,r){if(0!==i.length){const a=[],s=[];Zs.flattenJSON(i,a,s,n),0!==a.length&&r.push(new t(e,a,s))}},n=[],r=t.name||"default",a=t.fps||30,s=t.blendMode;let o=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const r=l[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let i=0;i<r[e].morphTargets.length;i++)t[r[e].morphTargets[i]]=-1;for(const i in t){const t=[],a=[];for(let n=0;n!==r[e].morphTargets.length;++n){const n=r[e];t.push(n.time),a.push(n.morphTarget===i?1:0)}n.push(new io(".morphTargetInfluence["+i+"]",t,a))}o=t.length*(a||1)}else{const a=".bones["+e[t].name+"]";i(so,a+".position",r,"pos",n),i(ro,a+".quaternion",r,"rot",n),i(so,a+".scale",r,"scl",n)}}if(0===n.length)return null;return new this(r,o,n,s)}resetDuration(){let t=0;for(let e=0,i=this.tracks.length;e!==i;++e){const i=this.tracks[e];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function lo(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return io;case"vector":case"vector2":case"vector3":case"vector4":return so;case"color":return eo;case"quaternion":return ro;case"bool":case"boolean":return to;case"string":return ao}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],i=[];Zs.flattenJSON(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const ho={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class co{constructor(t,e,i){const n=this;let r=!1,a=0,s=0,o=void 0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){s++,!1===r&&void 0!==n.onStart&&n.onStart(t,a,s),r=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,s),a===s&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return o?o(t):t},this.setURLModifier=function(t){return o=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=l.length;e<i;e+=2){const i=l[e],n=l[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null}}}const uo=new co;class po{constructor(t){this.manager=void 0!==t?t:uo,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const i=this;return new Promise((function(n,r){i.load(t,n,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}const fo={};class go extends po{constructor(t){super(t)}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,a=ho.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;if(void 0!==fo[t])return void fo[t].push({onLoad:e,onProgress:i,onError:n});const s=t.match(/^data:(.*?)(;base64)?,(.*)$/);let o;if(s){const i=s[1],a=!!s[2];let o=s[3];o=decodeURIComponent(o),a&&(o=atob(o));try{let n;const a=(this.responseType||"").toLowerCase();switch(a){case"arraybuffer":case"blob":const t=new Uint8Array(o.length);for(let e=0;e<o.length;e++)t[e]=o.charCodeAt(e);n="blob"===a?new Blob([t.buffer],{type:i}):t.buffer;break;case"document":const e=new DOMParser;n=e.parseFromString(o,i);break;case"json":n=JSON.parse(o);break;default:n=o}setTimeout((function(){e&&e(n),r.manager.itemEnd(t)}),0)}catch(e){setTimeout((function(){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}),0)}}else{fo[t]=[],fo[t].push({onLoad:e,onProgress:i,onError:n}),o=new XMLHttpRequest,o.open("GET",t,!0),o.addEventListener("load",(function(e){const i=this.response,n=fo[t];if(delete fo[t],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),ho.add(t,i);for(let t=0,e=n.length;t<e;t++){const e=n[t];e.onLoad&&e.onLoad(i)}r.manager.itemEnd(t)}else{for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}}),!1),o.addEventListener("progress",(function(e){const i=fo[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onProgress&&n.onProgress(e)}}),!1),o.addEventListener("error",(function(e){const i=fo[t];delete fo[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),o.addEventListener("abort",(function(e){const i=fo[t];delete fo[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}r.manager.itemError(t),r.manager.itemEnd(t)}),!1),void 0!==this.responseType&&(o.responseType=this.responseType),void 0!==this.withCredentials&&(o.withCredentials=this.withCredentials),o.overrideMimeType&&o.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(const t in this.requestHeader)o.setRequestHeader(t,this.requestHeader[t]);o.send(null)}return r.manager.itemStart(t),o}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class mo extends po{constructor(t){super(t)}load(t,e,i,n){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,a=ho.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;const s=y("img");function o(){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1),ho.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1),n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)}return s.addEventListener("load",o,!1),s.addEventListener("error",l,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),r.manager.itemStart(t),s.src=t,s}}class yo extends po{constructor(t){super(t)}load(t,e,i,n){const r=new ke,a=new mo(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let s=0;function o(i){a.load(t[i],(function(t){r.images[i]=t,s++,6===s&&(r.needsUpdate=!0,e&&e(r))}),void 0,n)}for(let e=0;e<t.length;++e)o(e);return r}}class bo extends po{constructor(t){super(t)}load(t,e,i,n){const r=new _,a=new mo(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,(function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)}),i,n),r}}class vo extends Tt{constructor(t,e=1){super(),this.type="Light",this.color=new Jt(t),this.intensity=e}dispose(){}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}vo.prototype.isLight=!0;class xo extends vo{constructor(t,e,i){super(t,i),this.type="HemisphereLight",this.position.copy(Tt.DefaultUp),this.updateMatrix(),this.groundColor=new Jt(e)}copy(t){return vo.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}xo.prototype.isHemisphereLight=!0;const _o=new rt,Ao=new I,wo=new I;class Co{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new f(512,512),this.map=null,this.mapPass=null,this.matrix=new rt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new We,this._frameExtents=new f(1,1),this._viewportCount=1,this._viewports=[new w(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,i=this.matrix;Ao.setFromMatrixPosition(t.matrixWorld),e.position.copy(Ao),wo.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(wo),e.updateMatrixWorld(),_o.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_o),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(e.projectionMatrix),i.multiply(e.matrixWorldInverse)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Mo extends Co{constructor(){super(new Ne(50,1,.5,500)),this.focus=1}updateMatrices(t){const e=this.camera,i=2*a*t.angle*this.focus,n=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;i===e.fov&&n===e.aspect&&r===e.far||(e.fov=i,e.aspect=n,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}Mo.prototype.isSpotLightShadow=!0;class Eo extends vo{constructor(t,e,i=0,n=Math.PI/3,r=0,a=1){super(t,e),this.type="SpotLight",this.position.copy(Tt.DefaultUp),this.updateMatrix(),this.target=new Tt,this.distance=i,this.angle=n,this.penumbra=r,this.decay=a,this.shadow=new Mo}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Eo.prototype.isSpotLight=!0;const Io=new rt,So=new I,To=new I;class Bo extends Co{constructor(){super(new Ne(90,1,.5,500)),this._frameExtents=new f(4,2),this._viewportCount=6,this._viewports=[new w(2,1,1,1),new w(0,1,1,1),new w(3,1,1,1),new w(1,1,1,1),new w(3,0,1,1),new w(1,0,1,1)],this._cubeDirections=[new I(1,0,0),new I(-1,0,0),new I(0,0,1),new I(0,0,-1),new I(0,1,0),new I(0,-1,0)],this._cubeUps=[new I(0,1,0),new I(0,1,0),new I(0,1,0),new I(0,1,0),new I(0,0,1),new I(0,0,-1)]}updateMatrices(t,e=0){const i=this.camera,n=this.matrix,r=t.distance||i.far;r!==i.far&&(i.far=r,i.updateProjectionMatrix()),So.setFromMatrixPosition(t.matrixWorld),i.position.copy(So),To.copy(i.position),To.add(this._cubeDirections[e]),i.up.copy(this._cubeUps[e]),i.lookAt(To),i.updateMatrixWorld(),n.makeTranslation(-So.x,-So.y,-So.z),Io.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Io)}}Bo.prototype.isPointLightShadow=!0;class Fo extends vo{constructor(t,e,i=0,n=1){super(t,e),this.type="PointLight",this.distance=i,this.decay=n,this.shadow=new Bo}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}Fo.prototype.isPointLight=!0;class Uo extends Co{constructor(){super(new ai(-5,5,5,-5,.5,500))}}Uo.prototype.isDirectionalLightShadow=!0;class Lo extends vo{constructor(t,e){super(t,e),this.type="DirectionalLight",this.position.copy(Tt.DefaultUp),this.updateMatrix(),this.target=new Tt,this.shadow=new Uo}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Lo.prototype.isDirectionalLight=!0;class Ro extends vo{constructor(t,e){super(t,e),this.type="AmbientLight"}}Ro.prototype.isAmbientLight=!0;class Do extends vo{constructor(t,e,i=10,n=10){super(t,e),this.type="RectAreaLight",this.width=i,this.height=n}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}Do.prototype.isRectAreaLight=!0;class No{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new I)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const i=t.x,n=t.y,r=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.282095),e.addScaledVector(a[1],.488603*n),e.addScaledVector(a[2],.488603*r),e.addScaledVector(a[3],.488603*i),e.addScaledVector(a[4],i*n*1.092548),e.addScaledVector(a[5],n*r*1.092548),e.addScaledVector(a[6],.315392*(3*r*r-1)),e.addScaledVector(a[7],i*r*1.092548),e.addScaledVector(a[8],.546274*(i*i-n*n)),e}getIrradianceAt(t,e){const i=t.x,n=t.y,r=t.z,a=this.coefficients;return e.copy(a[0]).multiplyScalar(.886227),e.addScaledVector(a[1],1.023328*n),e.addScaledVector(a[2],1.023328*r),e.addScaledVector(a[3],1.023328*i),e.addScaledVector(a[4],.858086*i*n),e.addScaledVector(a[5],.858086*n*r),e.addScaledVector(a[6],.743125*r*r-.247708),e.addScaledVector(a[7],.858086*i*r),e.addScaledVector(a[8],.429043*(i*i-n*n)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(t.coefficients[i],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let i=0;i<9;i++)this.coefficients[i].lerp(t.coefficients[i],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const i=this.coefficients;for(let n=0;n<9;n++)i[n].fromArray(t,e+3*n);return this}toArray(t=[],e=0){const i=this.coefficients;for(let n=0;n<9;n++)i[n].toArray(t,e+3*n);return t}static getBasisAt(t,e){const i=t.x,n=t.y,r=t.z;e[0]=.282095,e[1]=.488603*n,e[2]=.488603*r,e[3]=.488603*i,e[4]=1.092548*i*n,e[5]=1.092548*n*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*i*r,e[8]=.546274*(i*i-n*n)}}No.prototype.isSphericalHarmonics3=!0;class Po extends vo{constructor(t=new No,e=1){super(void 0,e),this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}Po.prototype.isLightProbe=!0;class ko{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let i=0,n=t.length;i<n;i++)e+=String.fromCharCode(t[i]);try{return decodeURIComponent(escape(e))}catch(t){return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.substr(0,e+1)}}class zo extends ce{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}clone(){return(new this.constructor).copy(this)}toJSON(){const t=super.toJSON(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}zo.prototype.isInstancedBufferGeometry=!0;let Oo;(class extends po{constructor(t){super(t),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,a=ho.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;const s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,fetch(t,s).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(i){ho.add(t,i),e&&e(i),r.manager.itemEnd(t)})).catch((function(e){n&&n(e),r.manager.itemError(t),r.manager.itemEnd(t)})),r.manager.itemStart(t)}}).prototype.isImageBitmapLoader=!0;const Qo=function(){return void 0===Oo&&(Oo=new(window.AudioContext||window.webkitAudioContext)),Oo};class Vo extends po{constructor(t){super(t)}load(t,e,i,n){const r=this,a=new go(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(i){try{const t=i.slice(0);Qo().decodeAudioData(t,(function(t){e(t)}))}catch(e){n?n(e):console.error(e),r.manager.itemError(t)}}),i,n)}}(class extends Po{constructor(t,e,i=1){super(void 0,i);const n=(new Jt).set(t),r=(new Jt).set(e),a=new I(n.r,n.g,n.b),s=new I(r.r,r.g,r.b),o=Math.sqrt(Math.PI),l=o*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(s).multiplyScalar(o),this.sh.coefficients[1].copy(a).sub(s).multiplyScalar(l)}}).prototype.isHemisphereLightProbe=!0;(class extends Po{constructor(t,e=1){super(void 0,e);const i=(new Jt).set(t);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}}).prototype.isAmbientLightProbe=!0;class Ho extends Tt{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}class Go{constructor(t,e,i){let n,r,a;switch(this.binding=t,this.valueSize=i,e){case"quaternion":n=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":n=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(5*i);break;default:n=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=r,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const i=this.buffer,n=this.valueSize,r=t*n+n;let a=this.cumulativeWeight;if(0===a){for(let t=0;t!==n;++t)i[r+t]=i[t];a=e}else{a+=e;const t=e/a;this._mixBufferRegion(i,r,0,t,n)}this.cumulativeWeight=a}accumulateAdditive(t){const e=this.buffer,i=this.valueSize,n=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,n,0,t,i),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,i=this.buffer,n=t*e+e,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(i,n,t,1-r,e)}a>0&&this._mixBufferRegionAdditive(i,n,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(i[t]!==i[t+e]){s.setValue(i,n);break}}saveOriginalState(){const t=this.binding,e=this.buffer,i=this.valueSize,n=i*this._origIndex;t.getValue(e,n);for(let t=i,r=n;t!==r;++t)e[t]=e[n+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i<e;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[e+i]=this.buffer[t+i]}_select(t,e,i,n,r){if(n>=.5)for(let n=0;n!==r;++n)t[e+n]=t[i+n]}_slerp(t,e,i,n){E.slerpFlat(t,e,t,e,t,i,n)}_slerpAdditive(t,e,i,n,r){const a=this._workIndex*r;E.multiplyQuaternionsFlat(t,a,t,e,t,i),E.slerpFlat(t,e,t,e,t,a,n)}_lerp(t,e,i,n,r){const a=1-n;for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]*a+t[i+s]*n}}_lerpAdditive(t,e,i,n,r){for(let a=0;a!==r;++a){const r=e+a;t[r]=t[r]+t[i+a]*n}}}const jo=new RegExp("[\\[\\]\\.:\\/]","g"),Wo="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",qo=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),Zo=/(WCOD+)?/.source.replace("WCOD",Wo),Jo=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Xo=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),Yo=new RegExp("^"+qo+Zo+Jo+Xo+"$"),Ko=["material","materials","bones"];class $o{constructor(t,e,i){this.path=e,this.parsedPath=i||$o.parseTrackName(e),this.node=$o.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new $o.Composite(t,e,i):new $o(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(jo,"")}static parseTrackName(t){const e=Yo.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){const t=i.nodeName.substring(n+1);-1!==Ko.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){const i=function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.name===e||r.uuid===e)return r;const a=i(r.children);if(a)return a}return null},n=i(t.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)t[e++]=i[n]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,i=e.objectName,n=e.propertyName;let r=e.propertyIndex;if(t||(t=$o.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(i){let n=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===n){n=e;break}break;default:if(void 0===t[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==n){if(void 0===t[n])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[n]}}const a=t[n];if(void 0===a){const i=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+i+"."+n+" but it wasn't found.",t)}let s=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else void 0!==a.fromArray&&void 0!==a.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(o=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=n;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}$o.Composite=class{constructor(t,e,i){const n=i||$o.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}getValue(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)}setValue(t,e){const i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},$o.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},$o.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},$o.prototype.GetterByBindingType=[$o.prototype._getValue_direct,$o.prototype._getValue_array,$o.prototype._getValue_arrayElement,$o.prototype._getValue_toArray],$o.prototype.SetterByBindingTypeAndVersioning=[[$o.prototype._setValue_direct,$o.prototype._setValue_direct_setNeedsUpdate,$o.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[$o.prototype._setValue_array,$o.prototype._setValue_array_setNeedsUpdate,$o.prototype._setValue_array_setMatrixWorldNeedsUpdate],[$o.prototype._setValue_arrayElement,$o.prototype._setValue_arrayElement_setNeedsUpdate,$o.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[$o.prototype._setValue_fromArray,$o.prototype._setValue_fromArray_setNeedsUpdate,$o.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];(class{constructor(){this.uuid=l(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let e=0,i=arguments.length;e!==i;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,i=this._paths,n=this._parsedPaths,r=this._bindings,a=r.length;let s=void 0,o=t.length,l=this.nCachedObjects_;for(let h=0,c=arguments.length;h!==c;++h){const c=arguments[h],u=c.uuid;let d=e[u];if(void 0===d){d=o++,e[u]=d,t.push(c);for(let t=0,e=a;t!==e;++t)r[t].push(new $o(c,i[t],n[t]))}else if(d<l){s=t[d];const o=--l,h=t[o];e[h.uuid]=d,t[d]=h,e[u]=o,t[o]=c;for(let t=0,e=a;t!==e;++t){const e=r[t],a=e[o];let s=e[d];e[d]=a,void 0===s&&(s=new $o(c,i[t],n[t])),e[o]=s}}else t[d]!==s&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,n=i.length;let r=this.nCachedObjects_;for(let a=0,s=arguments.length;a!==s;++a){const s=arguments[a],o=s.uuid,l=e[o];if(void 0!==l&&l>=r){const a=r++,h=t[a];e[h.uuid]=l,t[l]=h,e[o]=a,t[a]=s;for(let t=0,e=n;t!==e;++t){const e=i[t],n=e[a],r=e[l];e[l]=n,e[a]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,n=i.length;let r=this.nCachedObjects_,a=t.length;for(let s=0,o=arguments.length;s!==o;++s){const o=arguments[s].uuid,l=e[o];if(void 0!==l)if(delete e[o],l<r){const s=--r,o=t[s],h=--a,c=t[h];e[o.uuid]=l,t[l]=o,e[c.uuid]=s,t[s]=c,t.pop();for(let t=0,e=n;t!==e;++t){const e=i[t],n=e[s],r=e[h];e[l]=n,e[s]=r,e.pop()}}else{const r=--a,s=t[r];r>0&&(e[s.uuid]=l),t[l]=s,t.pop();for(let t=0,e=n;t!==e;++t){const e=i[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const i=this._bindingsIndicesByPath;let n=i[t];const r=this._bindings;if(void 0!==n)return r[n];const a=this._paths,s=this._parsedPaths,o=this._objects,l=o.length,h=this.nCachedObjects_,c=new Array(l);n=r.length,i[t]=n,a.push(t),s.push(e),r.push(c);for(let i=h,n=o.length;i!==n;++i){const n=o[i];c[i]=new $o(n,t,e)}return c}unsubscribe_(t){const e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){const n=this._paths,r=this._parsedPaths,a=this._bindings,s=a.length-1,o=a[s];e[t[s]]=i,a[i]=o,a.pop(),r[i]=r[s],r.pop(),n[i]=n[s],n.pop()}}}).prototype.isAnimationObjectGroup=!0;class tl{constructor(t,e,i=null,n=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=n;const r=e.tracks,a=r.length,s=new Array(a),o={endingStart:2400,endingEnd:2400};for(let t=0;t!==a;++t){const e=r[t].createInterpolant(null);s[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=s,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i){if(t.fadeOut(e),this.fadeIn(e),i){const i=this._clip.duration,n=t._clip.duration,r=n/i,a=i/n;t.warp(1,r,e),this.warp(a,1,e)}return this}crossFadeTo(t,e,i){return t.crossFadeFrom(this,e,i)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){const n=this._mixer,r=n.time,a=this.timeScale;let s=this._timeScaleInterpolant;null===s&&(s=n._lendControlInterpolant(),this._timeScaleInterpolant=s);const o=s.parameterPositions,l=s.sampleValues;return o[0]=r,o[1]=r+i,l[0]=t/a,l[1]=e/a,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,n){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const n=(t-r)*i;if(n<0||0===i)return;this._startTime=null,e=i*n}e*=this._updateTimeScale(t);const a=this._updateTime(e),s=this._updateWeight(t);if(s>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case 2501:for(let i=0,n=t.length;i!==n;++i)t[i].evaluate(a),e[i].accumulateAdditive(s);break;case 2500:default:for(let i=0,r=t.length;i!==r;++i)t[i].evaluate(a),e[i].accumulate(n,s)}}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const i=this._weightInterpolant;if(null!==i){const n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const i=this._timeScaleInterpolant;if(null!==i){e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,i=this.loop;let n=this.time+t,r=this._loopCount;const a=2202===i;if(0===t)return-1===r?n:a&&1==(1&r)?e-n:n;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(n>=e)n=e;else{if(!(n<0)){this.time=n;break t}n=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),n>=e||n<0){const i=Math.floor(n/e);n-=e*i,r+=Math.abs(i);const s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=t>0?e:0,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){const e=t<0;this._setEndings(e,!e,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=n;if(a&&1==(1&r))return e-n}return n}_setEndings(t,e,i){const n=this._interpolantSettings;i?(n.endingStart=2401,n.endingEnd=2401):(n.endingStart=t?this.zeroSlopeAtStart?2401:2400:2402,n.endingEnd=e?this.zeroSlopeAtEnd?2401:2400:2402)}_scheduleFading(t,e,i){const n=this._mixer,r=n.time;let a=this._weightInterpolant;null===a&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);const s=a.parameterPositions,o=a.sampleValues;return s[0]=r,o[0]=e,s[1]=r+t,o[1]=i,this}}(class extends n{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,a=t._propertyBindings,s=t._interpolants,o=i.uuid,l=this._bindingsByRootAndName;let h=l[o];void 0===h&&(h={},l[o]=h);for(let t=0;t!==r;++t){const r=n[t],l=r.name;let c=h[l];if(void 0!==c)a[t]=c;else{if(c=a[t],void 0!==c){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,o,l));continue}const n=e&&e._propertyBindings[t].binding.parsedPath;c=new Go($o.create(i,l,n),r.ValueTypeName,r.getValueSize()),++c.referenceCount,this._addInactiveBinding(c,o,l),a[t]=c}s[t].resultBuffer=c.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,i){const n=this._actions,r=this._actionsByClip;let a=r[e];if(void 0===a)a={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=a;else{const e=a.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=n.length,n.push(t),a.actionByRoot[i]=t}_removeInactiveAction(t){const e=this._actions,i=e[e.length-1],n=t._cacheIndex;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,a=this._actionsByClip,s=a[r],o=s.knownActions,l=o[o.length-1],h=t._byClipCacheIndex;l._byClipCacheIndex=h,o[h]=l,o.pop(),t._byClipCacheIndex=null;delete s.actionByRoot[(t._localRoot||this._root).uuid],0===o.length&&delete a[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.referenceCount&&this._removeInactiveBinding(i)}}_lendAction(t){const e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_takeBackAction(t){const e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_addInactiveBinding(t,e,i){const n=this._bindingsByRootAndName,r=this._bindings;let a=n[e];void 0===a&&(a={},n[e]=a),a[i]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,i=t.binding,n=i.rootNode.uuid,r=i.path,a=this._bindingsByRootAndName,s=a[n],o=e[e.length-1],l=t._cacheIndex;o._cacheIndex=l,e[l]=o,e.pop(),delete s[r],0===Object.keys(s).length&&delete a[n]}_lendBinding(t){const e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_takeBackBinding(t){const e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let i=t[e];return void 0===i&&(i=new Ys(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),i.__cacheIndex=e,t[e]=i),i}_takeBackControlInterpolant(t){const e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,r=e[n];t.__cacheIndex=n,e[n]=t,r.__cacheIndex=i,e[i]=r}clipAction(t,e,i){const n=e||this._root,r=n.uuid;let a="string"==typeof t?oo.findByName(n,t):t;const s=null!==a?a.uuid:t,o=this._actionsByClip[s];let l=null;if(void 0===i&&(i=null!==a?a.blendMode:2500),void 0!==o){const t=o.actionByRoot[r];if(void 0!==t&&t.blendMode===i)return t;l=o.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;const h=new tl(this,a,e,i);return this._bindAction(h,l),this._addInactiveAction(h,s,r),h}existingAction(t,e){const i=e||this._root,n=i.uuid,r="string"==typeof t?oo.findByName(i,t):t,a=r?r.uuid:t,s=this._actionsByClip[a];return void 0!==s&&s.actionByRoot[n]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),a=this._accuIndex^=1;for(let s=0;s!==i;++s){e[s]._update(n,t,r,a)}const s=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)s[t].apply(a);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){const t=r.knownActions;for(let i=0,n=t.length;i!==n;++i){const n=t[i];this._deactivateAction(n);const r=n._cacheIndex,a=e[e.length-1];n._cacheIndex=null,n._byClipCacheIndex=null,a._cacheIndex=r,e[r]=a,e.pop(),this._removeInactiveBindingsForAction(n)}delete n[i]}}uncacheRoot(t){const e=t.uuid,i=this._actionsByClip;for(const t in i){const n=i[t].actionByRoot[e];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}const n=this._bindingsByRootAndName[e];if(void 0!==n)for(const t in n){const e=n[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}).prototype._controlInterpolantsResultBuffer=new Float32Array(1);class el{constructor(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new el(void 0===this.value.clone?this.value:this.value.clone())}}(class extends kr{constructor(t,e,i=1){super(t,e),this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}).prototype.isInstancedInterleavedBuffer=!0;(class{constructor(t,e,i,n,r){this.buffer=t,this.type=e,this.itemSize=i,this.elementSize=n,this.count=r,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}).prototype.isGLBufferAttribute=!0;const il=new f;class nl{constructor(t=new f(1/0,1/0),e=new f(-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=il.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return il.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}nl.prototype.isBox2=!0;const rl=new I,al=new I;(class extends Tt{constructor(t){super(),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}}).prototype.isImmediateRenderObject=!0;const sl=new I,ol=new rt,ll=new rt;const hl=new Float32Array(1);new Int32Array(hl.buffer);ka.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(ka.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},rs.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},class extends Ea{constructor(t=10,e=10,i=4473924,n=8947848){i=new Jt(i),n=new Jt(n);const r=e/2,a=t/e,s=t/2,o=[],l=[];for(let t=0,h=0,c=-s;t<=e;t++,c+=a){o.push(-s,0,c,s,0,c),o.push(c,0,-s,c,0,s);const e=t===r?i:n;e.toArray(l,h),h+=3,e.toArray(l,h),h+=3,e.toArray(l,h),h+=3,e.toArray(l,h),h+=3}const h=new ce;h.setAttribute("position",new ie(o,3)),h.setAttribute("color",new ie(l,3));super(h,new ya({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},class extends Ea{constructor(t){const e=function t(e){const i=[];e&&e.isBone&&i.push(e);for(let n=0;n<e.children.length;n++)i.push.apply(i,t(e.children[n]));return i}(t),i=new ce,n=[],r=[],a=new Jt(0,0,1),s=new Jt(0,1,0);for(let t=0;t<e.length;t++){const i=e[t];i.parent&&i.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),r.push(a.r,a.g,a.b),r.push(s.r,s.g,s.b))}i.setAttribute("position",new ie(n,3)),i.setAttribute("color",new ie(r,3));super(i,new ya({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,i=this.geometry,n=i.getAttribute("position");ll.copy(this.root.matrixWorld).invert();for(let t=0,i=0;t<e.length;t++){const r=e[t];r.parent&&r.parent.isBone&&(ol.multiplyMatrices(ll,r.matrixWorld),sl.setFromMatrixPosition(ol),n.setXYZ(i,sl.x,sl.y,sl.z),ol.multiplyMatrices(ll,r.parent.matrixWorld),sl.setFromMatrixPosition(ol),n.setXYZ(i+1,sl.x,sl.y,sl.z),i+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},po.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),ko.extractUrlBase(t)},po.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},nl.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},nl.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},nl.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},nl.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},B.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},B.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},B.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},B.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},B.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},J.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},We.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},class{constructor(t=new I,e=new I){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){rl.subVectors(t,this.start),al.subVectors(this.end,this.start);const i=al.dot(al);let n=al.dot(rl)/i;return e&&(n=h(n,0,1)),n}closestPointToPoint(t,e,i){const n=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(n).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},g.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},g.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},g.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},g.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},g.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},g.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},rt.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},rt.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},rt.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new I).setFromMatrixColumn(this,3)},rt.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},rt.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},rt.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},rt.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},rt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rt.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},rt.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},rt.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},rt.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rt.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rt.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rt.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},rt.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},rt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},rt.prototype.makeFrustum=function(t,e,i,n,r,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,n,i,r,a)},rt.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},He.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},E.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},E.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},nt.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},nt.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},nt.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Ot.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},Ot.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},Ot.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},Ot.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},Ot.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},Ot.barycoordFromPoint=function(t,e,i,n,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Ot.getBarycoord(t,e,i,n,r)},Ot.normal=function(t,e,i,n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Ot.getNormal(t,e,i,n)},as.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},as.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Rs(this,t)},as.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Ns(this,t)},f.prototype.fromAttribute=function(t,e,i){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},f.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},f.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},I.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},I.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},I.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},I.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},I.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},I.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},I.prototype.fromAttribute=function(t,e,i){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},I.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},I.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},w.prototype.fromAttribute=function(t,e,i){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,i)},w.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Tt.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Tt.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Tt.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Tt.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Tt.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Tt.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Se.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(Se.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),la.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Ne.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(vo.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties($t.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),35048===this.usage},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(35048)}}}),$t.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?35048:35044),this},$t.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},$t.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},ce.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},ce.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new $t(arguments[1],arguments[2])))},ce.prototype.addDrawCall=function(t,e,i){void 0!==i&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},ce.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},ce.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},ce.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},ce.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(ce.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),kr.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?35048:35044),this},kr.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Rs.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Rs.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Rs.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},Pr.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},el.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(Vt.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new Jt}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(Re.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Rr.prototype.clearTarget=function(t,e,i,n){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,i,n)},Rr.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},Rr.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},Rr.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},Rr.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},Rr.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},Rr.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},Rr.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},Rr.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},Rr.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},Rr.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},Rr.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},Rr.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},Rr.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},Rr.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},Rr.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},Rr.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},Rr.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},Rr.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},Rr.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},Rr.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},Rr.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},Rr.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},Rr.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},Rr.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(Rr.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?3001:3e3}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(Cr.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(C.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Ho.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new Vo).load(t,(function(t){e.setBuffer(t)})),this},class{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let i=0;i<e.length;i++)t+=e[i];return t/e.length}}.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Pe.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},Pe.prototype.clear=function(t,e,i,n){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,i,n)},v.crossOrigin=void 0,v.loadTexture=function(t,e,i,n){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new bo;r.setCrossOrigin(this.crossOrigin);const a=r.load(t,i,void 0,n);return e&&(a.mapping=e),a},v.loadTextureCube=function(t,e,i,n){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new yo;r.setCrossOrigin(this.crossOrigin);const a=r.load(t,i,void 0,n);return e&&(a.mapping=e),a},v.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},v.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"133"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="133");var cl={value:()=>{}};function ul(){for(var t,e=0,i=arguments.length,n={};e<i;++e){if(!(t=arguments[e]+"")||t in n||/[\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new dl(n)}function dl(t){this._=t}function pl(t,e){return t.trim().split(/^|\s+/).map((function(t){var i="",n=t.indexOf(".");if(n>=0&&(i=t.slice(n+1),t=t.slice(0,n)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:i}}))}function fl(t,e){for(var i,n=0,r=t.length;n<r;++n)if((i=t[n]).name===e)return i.value}function gl(t,e,i){for(var n=0,r=t.length;n<r;++n)if(t[n].name===e){t[n]=cl,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=i&&t.push({name:e,value:i}),t}dl.prototype=ul.prototype={constructor:dl,on:function(t,e){var i,n=this._,r=pl(t+"",n),a=-1,s=r.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(i=(t=r[a]).type)n[i]=gl(n[i],t.name,e);else if(null==e)for(i in n)n[i]=gl(n[i],t.name,null);return this}for(;++a<s;)if((i=(t=r[a]).type)&&(i=fl(n[i],t.name)))return i},copy:function(){var t={},e=this._;for(var i in e)t[i]=e[i].slice();return new dl(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var i,n,r=new Array(i),a=0;a<i;++a)r[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,i=(n=this._[t]).length;a<i;++a)n[a].value.apply(e,r)},apply:function(t,e,i){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],r=0,a=n.length;r<a;++r)n[r].value.apply(e,i)}};var ml,yl,bl=ul,vl=0,xl=0,_l=0,Al=0,wl=0,Cl=0,Ml="object"==typeof performance&&performance.now?performance:Date,El="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Il(){return wl||(El(Sl),wl=Ml.now()+Cl)}function Sl(){wl=0}function Tl(){this._call=this._time=this._next=null}function Bl(t,e,i){var n=new Tl;return n.restart(t,e,i),n}function Fl(){wl=(Al=Ml.now())+Cl,vl=xl=0;try{!function(){Il(),++vl;for(var t,e=ml;e;)(t=wl-e._time)>=0&&e._call.call(void 0,t),e=e._next;--vl}()}finally{vl=0,function(){var t,e,i=ml,n=1/0;for(;i;)i._call?(n>i._time&&(n=i._time),t=i,i=i._next):(e=i._next,i._next=null,i=t?t._next=e:ml=e);yl=t,Ll(n)}(),wl=0}}function Ul(){var t=Ml.now(),e=t-Al;e>1e3&&(Cl-=e,Al=t)}function Ll(t){vl||(xl&&(xl=clearTimeout(xl)),t-wl>24?(t<1/0&&(xl=setTimeout(Fl,t-Ml.now()-Cl)),_l&&(_l=clearInterval(_l))):(_l||(Al=Ml.now(),_l=setInterval(Ul,1e3)),vl=1,El(Fl)))}Tl.prototype=Bl.prototype={constructor:Tl,restart:function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?Il():+i)+(null==e?0:+e),this._next||yl===this||(yl?yl._next=this:ml=this,yl=this),this._call=t,this._time=i,Ll()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ll())}};const Rl=4294967296;function Dl(t){return t.x}function Nl(t){return t.y}function Pl(t){return t.z}var kl=Math.PI*(3-Math.sqrt(5)),zl=20*Math.PI/(9+Math.sqrt(221)),Ol=function(t,e){e=e||2;var i,n=Math.min(3,Math.max(1,Math.round(e))),r=1,a=.001,s=1-Math.pow(a,1/300),o=0,l=.6,h=new Map,c=Bl(p),u=bl("tick","end"),d=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Rl)/Rl}();function p(){f(),u.call("tick",i),r<a&&(c.stop(),u.call("end",i))}function f(e){var a,c,u=t.length;void 0===e&&(e=1);for(var d=0;d<e;++d)for(r+=(o-r)*s,h.forEach((function(t){t(r)})),a=0;a<u;++a)null==(c=t[a]).fx?c.x+=c.vx*=l:(c.x=c.fx,c.vx=0),n>1&&(null==c.fy?c.y+=c.vy*=l:(c.y=c.fy,c.vy=0)),n>2&&(null==c.fz?c.z+=c.vz*=l:(c.z=c.fz,c.vz=0));return i}function g(){for(var e,i=0,r=t.length;i<r;++i){if((e=t[i]).index=i,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||n>1&&isNaN(e.y)||n>2&&isNaN(e.z)){var a=10*(n>2?Math.cbrt(.5+i):n>1?Math.sqrt(.5+i):i),s=i*kl,o=i*zl;1===n?e.x=a:2===n?(e.x=a*Math.cos(s),e.y=a*Math.sin(s)):(e.x=a*Math.sin(s)*Math.cos(o),e.y=a*Math.cos(s),e.z=a*Math.sin(s)*Math.sin(o))}(isNaN(e.vx)||n>1&&isNaN(e.vy)||n>2&&isNaN(e.vz))&&(e.vx=0,n>1&&(e.vy=0),n>2&&(e.vz=0))}}function m(e){return e.initialize&&e.initialize(t,d,n),e}return null==t&&(t=[]),g(),i={tick:f,restart:function(){return c.restart(p),i},stop:function(){return c.stop(),i},numDimensions:function(t){return arguments.length?(n=Math.min(3,Math.max(1,Math.round(t))),h.forEach(m),i):n},nodes:function(e){return arguments.length?(t=e,g(),h.forEach(m),i):t},alpha:function(t){return arguments.length?(r=+t,i):r},alphaMin:function(t){return arguments.length?(a=+t,i):a},alphaDecay:function(t){return arguments.length?(s=+t,i):+s},alphaTarget:function(t){return arguments.length?(o=+t,i):o},velocityDecay:function(t){return arguments.length?(l=1-t,i):1-l},randomSource:function(t){return arguments.length?(d=t,h.forEach(m),i):d},force:function(t,e){return arguments.length>1?(null==e?h.delete(t):h.set(t,m(e)),i):h.get(t)},find:function(){var e,i,r,a,s,o,l=Array.prototype.slice.call(arguments),h=l.shift()||0,c=(n>1?l.shift():null)||0,u=(n>2?l.shift():null)||0,d=l.shift()||1/0,p=0,f=t.length;for(d*=d,p=0;p<f;++p)(a=(e=h-(s=t[p]).x)*e+(i=c-(s.y||0))*i+(r=u-(s.z||0))*r)<d&&(o=s,d=a);return o},on:function(t,e){return arguments.length>1?(u.on(t,e),i):u.on(t)}}},Ql=function(t){return function(){return t}},Vl=function(t){return 1e-6*(t()-.5)};function Hl(t){return t.index}function Gl(t,e){var i=t.get(e);if(!i)throw new Error("node not found: "+e);return i}var jl=function(t){var e,i,n,r,a,s,o,l=Hl,h=function(t){return 1/Math.min(a[t.source.index],a[t.target.index])},c=Ql(30),u=1;function d(n){for(var a=0,l=t.length;a<u;++a)for(var h,c,d,p,f,g=0,m=0,y=0,b=0;g<l;++g)c=(h=t[g]).source,m=(d=h.target).x+d.vx-c.x-c.vx||Vl(o),r>1&&(y=d.y+d.vy-c.y-c.vy||Vl(o)),r>2&&(b=d.z+d.vz-c.z-c.vz||Vl(o)),m*=p=((p=Math.sqrt(m*m+y*y+b*b))-i[g])/p*n*e[g],y*=p,b*=p,d.vx-=m*(f=s[g]),r>1&&(d.vy-=y*f),r>2&&(d.vz-=b*f),c.vx+=m*(f=1-f),r>1&&(c.vy+=y*f),r>2&&(c.vz+=b*f)}function p(){if(n){var r,o,h=n.length,c=t.length,u=new Map(n.map((t,e)=>[l(t,e,n),t]));for(r=0,a=new Array(h);r<c;++r)(o=t[r]).index=r,"object"!=typeof o.source&&(o.source=Gl(u,o.source)),"object"!=typeof o.target&&(o.target=Gl(u,o.target)),a[o.source.index]=(a[o.source.index]||0)+1,a[o.target.index]=(a[o.target.index]||0)+1;for(r=0,s=new Array(c);r<c;++r)o=t[r],s[r]=a[o.source.index]/(a[o.source.index]+a[o.target.index]);e=new Array(c),f(),i=new Array(c),g()}}function f(){if(n)for(var i=0,r=t.length;i<r;++i)e[i]=+h(t[i],i,t)}function g(){if(n)for(var e=0,r=t.length;e<r;++e)i[e]=+c(t[e],e,t)}return null==t&&(t=[]),d.initialize=function(t,...e){n=t,o=e.find(t=>"function"==typeof t)||Math.random,r=e.find(t=>[1,2,3].includes(t))||2,p()},d.links=function(e){return arguments.length?(t=e,p(),d):t},d.id=function(t){return arguments.length?(l=t,d):l},d.iterations=function(t){return arguments.length?(u=+t,d):u},d.strength=function(t){return arguments.length?(h="function"==typeof t?t:Ql(+t),f(),d):h},d.distance=function(t){return arguments.length?(c="function"==typeof t?t:Ql(+t),g(),d):c},d};function Wl(t,e,i){if(isNaN(e))return t;var n,r,a,s,o,l,h=t._root,c={data:i},u=t._x0,d=t._x1;if(!h)return t._root=c,t;for(;h.length;)if((s=e>=(r=(u+d)/2))?u=r:d=r,n=h,!(h=h[o=+s]))return n[o]=c,t;if(e===(a=+t._x.call(null,h.data)))return c.next=h,n?n[o]=c:t._root=c,t;do{n=n?n[o]=new Array(2):t._root=new Array(2),(s=e>=(r=(u+d)/2))?u=r:d=r}while((o=+s)==(l=+(a>=r)));return n[l]=h,n[o]=c,t}var ql=function(t,e,i){this.node=t,this.x0=e,this.x1=i};function Zl(t){return t[0]}function Jl(t,e){var i=new Xl(null==e?Zl:e,NaN,NaN);return null==t?i:i.addAll(t)}function Xl(t,e,i){this._x=t,this._x0=e,this._x1=i,this._root=void 0}function Yl(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}var Kl=Jl.prototype=Xl.prototype;Kl.copy=function(){var t,e,i=new Xl(this._x,this._x0,this._x1),n=this._root;if(!n)return i;if(!n.length)return i._root=Yl(n),i;for(t=[{source:n,target:i._root=new Array(2)}];n=t.pop();)for(var r=0;r<2;++r)(e=n.source[r])&&(e.length?t.push({source:e,target:n.target[r]=new Array(2)}):n.target[r]=Yl(e));return i},Kl.add=function(t){var e=+this._x.call(null,t);return Wl(this.cover(e),e,t)},Kl.addAll=function(t){var e,i,n=t.length,r=new Array(n),a=1/0,s=-1/0;for(e=0;e<n;++e)isNaN(i=+this._x.call(null,t[e]))||(r[e]=i,i<a&&(a=i),i>s&&(s=i));if(a>s)return this;for(this.cover(a).cover(s),e=0;e<n;++e)Wl(this,r[e],t[e]);return this},Kl.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,i=this._x1;if(isNaN(e))i=(e=Math.floor(t))+1;else{for(var n,r,a=i-e||1,s=this._root;e>t||t>=i;)switch(r=+(t<e),(n=new Array(2))[r]=s,s=n,a*=2,r){case 0:i=e+a;break;case 1:e=i-a}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._x1=i,this},Kl.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},Kl.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},Kl.find=function(t,e){var i,n,r,a,s,o=this._x0,l=this._x1,h=[],c=this._root;for(c&&h.push(new ql(c,o,l)),null==e?e=1/0:(o=t-e,l=t+e);a=h.pop();)if(!(!(c=a.node)||(n=a.x0)>l||(r=a.x1)<o))if(c.length){var u=(n+r)/2;h.push(new ql(c[1],u,r),new ql(c[0],n,u)),(s=+(t>=u))&&(a=h[h.length-1],h[h.length-1]=h[h.length-1-s],h[h.length-1-s]=a)}else{var d=Math.abs(t-+this._x.call(null,c.data));d<e&&(e=d,o=t-d,l=t+d,i=c.data)}return i},Kl.remove=function(t){if(isNaN(a=+this._x.call(null,t)))return this;var e,i,n,r,a,s,o,l,h,c=this._root,u=this._x0,d=this._x1;if(!c)return this;if(c.length)for(;;){if((o=a>=(s=(u+d)/2))?u=s:d=s,e=c,!(c=c[l=+o]))return this;if(!c.length)break;e[l+1&1]&&(i=e,h=l)}for(;c.data!==t;)if(n=c,!(c=c.next))return this;return(r=c.next)&&delete c.next,n?(r?n.next=r:delete n.next,this):e?(r?e[l]=r:delete e[l],(c=e[0]||e[1])&&c===(e[1]||e[0])&&!c.length&&(i?i[h]=c:this._root=c),this):(this._root=r,this)},Kl.removeAll=function(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this},Kl.root=function(){return this._root},Kl.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},Kl.visit=function(t){var e,i,n,r,a=[],s=this._root;for(s&&a.push(new ql(s,this._x0,this._x1));e=a.pop();)if(!t(s=e.node,n=e.x0,r=e.x1)&&s.length){var o=(n+r)/2;(i=s[1])&&a.push(new ql(i,o,r)),(i=s[0])&&a.push(new ql(i,n,o))}return this},Kl.visitAfter=function(t){var e,i=[],n=[];for(this._root&&i.push(new ql(this._root,this._x0,this._x1));e=i.pop();){var r=e.node;if(r.length){var a,s=e.x0,o=e.x1,l=(s+o)/2;(a=r[0])&&i.push(new ql(a,s,l)),(a=r[1])&&i.push(new ql(a,l,o))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.x1);return this},Kl.x=function(t){return arguments.length?(this._x=t,this):this._x};function $l(t,e,i,n){if(isNaN(e)||isNaN(i))return t;var r,a,s,o,l,h,c,u,d,p=t._root,f={data:n},g=t._x0,m=t._y0,y=t._x1,b=t._y1;if(!p)return t._root=f,t;for(;p.length;)if((h=e>=(a=(g+y)/2))?g=a:y=a,(c=i>=(s=(m+b)/2))?m=s:b=s,r=p,!(p=p[u=c<<1|h]))return r[u]=f,t;if(o=+t._x.call(null,p.data),l=+t._y.call(null,p.data),e===o&&i===l)return f.next=p,r?r[u]=f:t._root=f,t;do{r=r?r[u]=new Array(4):t._root=new Array(4),(h=e>=(a=(g+y)/2))?g=a:y=a,(c=i>=(s=(m+b)/2))?m=s:b=s}while((u=c<<1|h)==(d=(l>=s)<<1|o>=a));return r[d]=p,r[u]=f,t}var th=function(t,e,i,n,r){this.node=t,this.x0=e,this.y0=i,this.x1=n,this.y1=r};function eh(t){return t[0]}function ih(t){return t[1]}function nh(t,e,i){var n=new rh(null==e?eh:e,null==i?ih:i,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function rh(t,e,i,n,r,a){this._x=t,this._y=e,this._x0=i,this._y0=n,this._x1=r,this._y1=a,this._root=void 0}function ah(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}var sh=nh.prototype=rh.prototype;sh.copy=function(){var t,e,i=new rh(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return i;if(!n.length)return i._root=ah(n),i;for(t=[{source:n,target:i._root=new Array(4)}];n=t.pop();)for(var r=0;r<4;++r)(e=n.source[r])&&(e.length?t.push({source:e,target:n.target[r]=new Array(4)}):n.target[r]=ah(e));return i},sh.add=function(t){const e=+this._x.call(null,t),i=+this._y.call(null,t);return $l(this.cover(e,i),e,i,t)},sh.addAll=function(t){var e,i,n,r,a=t.length,s=new Array(a),o=new Array(a),l=1/0,h=1/0,c=-1/0,u=-1/0;for(i=0;i<a;++i)isNaN(n=+this._x.call(null,e=t[i]))||isNaN(r=+this._y.call(null,e))||(s[i]=n,o[i]=r,n<l&&(l=n),n>c&&(c=n),r<h&&(h=r),r>u&&(u=r));if(l>c||h>u)return this;for(this.cover(l,h).cover(c,u),i=0;i<a;++i)$l(this,s[i],o[i],t[i]);return this},sh.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var i=this._x0,n=this._y0,r=this._x1,a=this._y1;if(isNaN(i))r=(i=Math.floor(t))+1,a=(n=Math.floor(e))+1;else{for(var s,o,l=r-i||1,h=this._root;i>t||t>=r||n>e||e>=a;)switch(o=(e<n)<<1|t<i,(s=new Array(4))[o]=h,h=s,l*=2,o){case 0:r=i+l,a=n+l;break;case 1:i=r-l,a=n+l;break;case 2:r=i+l,n=a-l;break;case 3:i=r-l,n=a-l}this._root&&this._root.length&&(this._root=h)}return this._x0=i,this._y0=n,this._x1=r,this._y1=a,this},sh.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},sh.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},sh.find=function(t,e,i){var n,r,a,s,o,l,h,c=this._x0,u=this._y0,d=this._x1,p=this._y1,f=[],g=this._root;for(g&&f.push(new th(g,c,u,d,p)),null==i?i=1/0:(c=t-i,u=e-i,d=t+i,p=e+i,i*=i);l=f.pop();)if(!(!(g=l.node)||(r=l.x0)>d||(a=l.y0)>p||(s=l.x1)<c||(o=l.y1)<u))if(g.length){var m=(r+s)/2,y=(a+o)/2;f.push(new th(g[3],m,y,s,o),new th(g[2],r,y,m,o),new th(g[1],m,a,s,y),new th(g[0],r,a,m,y)),(h=(e>=y)<<1|t>=m)&&(l=f[f.length-1],f[f.length-1]=f[f.length-1-h],f[f.length-1-h]=l)}else{var b=t-+this._x.call(null,g.data),v=e-+this._y.call(null,g.data),x=b*b+v*v;if(x<i){var _=Math.sqrt(i=x);c=t-_,u=e-_,d=t+_,p=e+_,n=g.data}}return n},sh.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t)))return this;var e,i,n,r,a,s,o,l,h,c,u,d,p=this._root,f=this._x0,g=this._y0,m=this._x1,y=this._y1;if(!p)return this;if(p.length)for(;;){if((h=a>=(o=(f+m)/2))?f=o:m=o,(c=s>=(l=(g+y)/2))?g=l:y=l,e=p,!(p=p[u=c<<1|h]))return this;if(!p.length)break;(e[u+1&3]||e[u+2&3]||e[u+3&3])&&(i=e,d=u)}for(;p.data!==t;)if(n=p,!(p=p.next))return this;return(r=p.next)&&delete p.next,n?(r?n.next=r:delete n.next,this):e?(r?e[u]=r:delete e[u],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(i?i[d]=p:this._root=p),this):(this._root=r,this)},sh.removeAll=function(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this},sh.root=function(){return this._root},sh.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},sh.visit=function(t){var e,i,n,r,a,s,o=[],l=this._root;for(l&&o.push(new th(l,this._x0,this._y0,this._x1,this._y1));e=o.pop();)if(!t(l=e.node,n=e.x0,r=e.y0,a=e.x1,s=e.y1)&&l.length){var h=(n+a)/2,c=(r+s)/2;(i=l[3])&&o.push(new th(i,h,c,a,s)),(i=l[2])&&o.push(new th(i,n,c,h,s)),(i=l[1])&&o.push(new th(i,h,r,a,c)),(i=l[0])&&o.push(new th(i,n,r,h,c))}return this},sh.visitAfter=function(t){var e,i=[],n=[];for(this._root&&i.push(new th(this._root,this._x0,this._y0,this._x1,this._y1));e=i.pop();){var r=e.node;if(r.length){var a,s=e.x0,o=e.y0,l=e.x1,h=e.y1,c=(s+l)/2,u=(o+h)/2;(a=r[0])&&i.push(new th(a,s,o,c,u)),(a=r[1])&&i.push(new th(a,c,o,l,u)),(a=r[2])&&i.push(new th(a,s,u,c,h)),(a=r[3])&&i.push(new th(a,c,u,l,h))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},sh.x=function(t){return arguments.length?(this._x=t,this):this._x},sh.y=function(t){return arguments.length?(this._y=t,this):this._y};function oh(t,e,i,n,r){if(isNaN(e)||isNaN(i)||isNaN(n))return t;var a,s,o,l,h,c,u,d,p,f,g,m,y=t._root,b={data:r},v=t._x0,x=t._y0,_=t._z0,A=t._x1,w=t._y1,C=t._z1;if(!y)return t._root=b,t;for(;y.length;)if((d=e>=(s=(v+A)/2))?v=s:A=s,(p=i>=(o=(x+w)/2))?x=o:w=o,(f=n>=(l=(_+C)/2))?_=l:C=l,a=y,!(y=y[g=f<<2|p<<1|d]))return a[g]=b,t;if(h=+t._x.call(null,y.data),c=+t._y.call(null,y.data),u=+t._z.call(null,y.data),e===h&&i===c&&n===u)return b.next=y,a?a[g]=b:t._root=b,t;do{a=a?a[g]=new Array(8):t._root=new Array(8),(d=e>=(s=(v+A)/2))?v=s:A=s,(p=i>=(o=(x+w)/2))?x=o:w=o,(f=n>=(l=(_+C)/2))?_=l:C=l}while((g=f<<2|p<<1|d)==(m=(u>=l)<<2|(c>=o)<<1|h>=s));return a[m]=y,a[g]=b,t}var lh=function(t,e,i,n,r,a,s){this.node=t,this.x0=e,this.y0=i,this.z0=n,this.x1=r,this.y1=a,this.z1=s};function hh(t){return t[0]}function ch(t){return t[1]}function uh(t){return t[2]}function dh(t,e,i,n){var r=new ph(null==e?hh:e,null==i?ch:i,null==n?uh:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function ph(t,e,i,n,r,a,s,o,l){this._x=t,this._y=e,this._z=i,this._x0=n,this._y0=r,this._z0=a,this._x1=s,this._y1=o,this._z1=l,this._root=void 0}function fh(t){for(var e={data:t.data},i=e;t=t.next;)i=i.next={data:t.data};return e}var gh=dh.prototype=ph.prototype;gh.copy=function(){var t,e,i=new ph(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root;if(!n)return i;if(!n.length)return i._root=fh(n),i;for(t=[{source:n,target:i._root=new Array(8)}];n=t.pop();)for(var r=0;r<8;++r)(e=n.source[r])&&(e.length?t.push({source:e,target:n.target[r]=new Array(8)}):n.target[r]=fh(e));return i},gh.add=function(t){var e=+this._x.call(null,t),i=+this._y.call(null,t),n=+this._z.call(null,t);return oh(this.cover(e,i,n),e,i,n,t)},gh.addAll=function(t){var e,i,n,r,a,s=t.length,o=new Array(s),l=new Array(s),h=new Array(s),c=1/0,u=1/0,d=1/0,p=-1/0,f=-1/0,g=-1/0;for(i=0;i<s;++i)isNaN(n=+this._x.call(null,e=t[i]))||isNaN(r=+this._y.call(null,e))||isNaN(a=+this._z.call(null,e))||(o[i]=n,l[i]=r,h[i]=a,n<c&&(c=n),n>p&&(p=n),r<u&&(u=r),r>f&&(f=r),a<d&&(d=a),a>g&&(g=a));if(c>p||u>f||d>g)return this;for(this.cover(c,u,d).cover(p,f,g),i=0;i<s;++i)oh(this,o[i],l[i],h[i],t[i]);return this},gh.cover=function(t,e,i){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(i=+i))return this;var n=this._x0,r=this._y0,a=this._z0,s=this._x1,o=this._y1,l=this._z1;if(isNaN(n))s=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1,l=(a=Math.floor(i))+1;else{for(var h,c,u=s-n||1,d=this._root;n>t||t>=s||r>e||e>=o||a>i||i>=l;)switch(c=(i<a)<<2|(e<r)<<1|t<n,(h=new Array(8))[c]=d,d=h,u*=2,c){case 0:s=n+u,o=r+u,l=a+u;break;case 1:n=s-u,o=r+u,l=a+u;break;case 2:s=n+u,r=o-u,l=a+u;break;case 3:n=s-u,r=o-u,l=a+u;break;case 4:s=n+u,o=r+u,a=l-u;break;case 5:n=s-u,o=r+u,a=l-u;break;case 6:s=n+u,r=o-u,a=l-u;break;case 7:n=s-u,r=o-u,a=l-u}this._root&&this._root.length&&(this._root=d)}return this._x0=n,this._y0=r,this._z0=a,this._x1=s,this._y1=o,this._z1=l,this},gh.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},gh.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},gh.find=function(t,e,i,n){var r,a,s,o,l,h,c,u,d,p=this._x0,f=this._y0,g=this._z0,m=this._x1,y=this._y1,b=this._z1,v=[],x=this._root;for(x&&v.push(new lh(x,p,f,g,m,y,b)),null==n?n=1/0:(p=t-n,f=e-n,g=i-n,m=t+n,y=e+n,b=i+n,n*=n);u=v.pop();)if(!(!(x=u.node)||(a=u.x0)>m||(s=u.y0)>y||(o=u.z0)>b||(l=u.x1)<p||(h=u.y1)<f||(c=u.z1)<g))if(x.length){var _=(a+l)/2,A=(s+h)/2,w=(o+c)/2;v.push(new lh(x[7],_,A,w,l,h,c),new lh(x[6],a,A,w,_,h,c),new lh(x[5],_,s,w,l,A,c),new lh(x[4],a,s,w,_,A,c),new lh(x[3],_,A,o,l,h,w),new lh(x[2],a,A,o,_,h,w),new lh(x[1],_,s,o,l,A,w),new lh(x[0],a,s,o,_,A,w)),(d=(i>=w)<<2|(e>=A)<<1|t>=_)&&(u=v[v.length-1],v[v.length-1]=v[v.length-1-d],v[v.length-1-d]=u)}else{var C=t-+this._x.call(null,x.data),M=e-+this._y.call(null,x.data),E=i-+this._z.call(null,x.data),I=C*C+M*M+E*E;if(I<n){var S=Math.sqrt(n=I);p=t-S,f=e-S,g=i-S,m=t+S,y=e+S,b=i+S,r=x.data}}return r},gh.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(s=+this._y.call(null,t))||isNaN(o=+this._z.call(null,t)))return this;var e,i,n,r,a,s,o,l,h,c,u,d,p,f,g,m=this._root,y=this._x0,b=this._y0,v=this._z0,x=this._x1,_=this._y1,A=this._z1;if(!m)return this;if(m.length)for(;;){if((u=a>=(l=(y+x)/2))?y=l:x=l,(d=s>=(h=(b+_)/2))?b=h:_=h,(p=o>=(c=(v+A)/2))?v=c:A=c,e=m,!(m=m[f=p<<2|d<<1|u]))return this;if(!m.length)break;(e[f+1&7]||e[f+2&7]||e[f+3&7]||e[f+4&7]||e[f+5&7]||e[f+6&7]||e[f+7&7])&&(i=e,g=f)}for(;m.data!==t;)if(n=m,!(m=m.next))return this;return(r=m.next)&&delete m.next,n?(r?n.next=r:delete n.next,this):e?(r?e[f]=r:delete e[f],(m=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&m===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!m.length&&(i?i[g]=m:this._root=m),this):(this._root=r,this)},gh.removeAll=function(t){for(var e=0,i=t.length;e<i;++e)this.remove(t[e]);return this},gh.root=function(){return this._root},gh.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},gh.visit=function(t){var e,i,n,r,a,s,o,l,h=[],c=this._root;for(c&&h.push(new lh(c,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=h.pop();)if(!t(c=e.node,n=e.x0,r=e.y0,a=e.z0,s=e.x1,o=e.y1,l=e.z1)&&c.length){var u=(n+s)/2,d=(r+o)/2,p=(a+l)/2;(i=c[7])&&h.push(new lh(i,u,d,p,s,o,l)),(i=c[6])&&h.push(new lh(i,n,d,p,u,o,l)),(i=c[5])&&h.push(new lh(i,u,r,p,s,d,l)),(i=c[4])&&h.push(new lh(i,n,r,p,u,d,l)),(i=c[3])&&h.push(new lh(i,u,d,a,s,o,p)),(i=c[2])&&h.push(new lh(i,n,d,a,u,o,p)),(i=c[1])&&h.push(new lh(i,u,r,a,s,d,p)),(i=c[0])&&h.push(new lh(i,n,r,a,u,d,p))}return this},gh.visitAfter=function(t){var e,i=[],n=[];for(this._root&&i.push(new lh(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=i.pop();){var r=e.node;if(r.length){var a,s=e.x0,o=e.y0,l=e.z0,h=e.x1,c=e.y1,u=e.z1,d=(s+h)/2,p=(o+c)/2,f=(l+u)/2;(a=r[0])&&i.push(new lh(a,s,o,l,d,p,f)),(a=r[1])&&i.push(new lh(a,d,o,l,h,p,f)),(a=r[2])&&i.push(new lh(a,s,p,l,d,c,f)),(a=r[3])&&i.push(new lh(a,d,p,l,h,c,f)),(a=r[4])&&i.push(new lh(a,s,o,f,d,p,u)),(a=r[5])&&i.push(new lh(a,d,o,f,h,p,u)),(a=r[6])&&i.push(new lh(a,s,p,f,d,c,u)),(a=r[7])&&i.push(new lh(a,d,p,f,h,c,u))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},gh.x=function(t){return arguments.length?(this._x=t,this):this._x},gh.y=function(t){return arguments.length?(this._y=t,this):this._y},gh.z=function(t){return arguments.length?(this._z=t,this):this._z};var mh=function(){var t,e,i,n,r,a,s=Ql(-30),o=1,l=1/0,h=.81;function c(n){var a,s=t.length,o=(1===e?Jl(t,Dl):2===e?nh(t,Dl,Nl):3===e?dh(t,Dl,Nl,Pl):null).visitAfter(d);for(r=n,a=0;a<s;++a)i=t[a],o.visit(p)}function u(){if(t){var e,i,n=t.length;for(a=new Array(n),e=0;e<n;++e)i=t[e],a[i.index]=+s(i,e,t)}}function d(t){var i,n,r,s,o,l,h=0,c=0,u=t.length;if(u){for(r=s=o=l=0;l<u;++l)(i=t[l])&&(n=Math.abs(i.value))&&(h+=i.value,c+=n,r+=n*(i.x||0),s+=n*(i.y||0),o+=n*(i.z||0));h*=Math.sqrt(4/u),t.x=r/c,e>1&&(t.y=s/c),e>2&&(t.z=o/c)}else{(i=t).x=i.data.x,e>1&&(i.y=i.data.y),e>2&&(i.z=i.data.z);do{h+=a[i.data.index]}while(i=i.next)}t.value=h}function p(t,s,c,u,d){if(!t.value)return!0;var p=[c,u,d][e-1],f=t.x-i.x,g=e>1?t.y-i.y:0,m=e>2?t.z-i.z:0,y=p-s,b=f*f+g*g+m*m;if(y*y/h<b)return b<l&&(0===f&&(b+=(f=Vl(n))*f),e>1&&0===g&&(b+=(g=Vl(n))*g),e>2&&0===m&&(b+=(m=Vl(n))*m),b<o&&(b=Math.sqrt(o*b)),i.vx+=f*t.value*r/b,e>1&&(i.vy+=g*t.value*r/b),e>2&&(i.vz+=m*t.value*r/b)),!0;if(!(t.length||b>=l)){(t.data!==i||t.next)&&(0===f&&(b+=(f=Vl(n))*f),e>1&&0===g&&(b+=(g=Vl(n))*g),e>2&&0===m&&(b+=(m=Vl(n))*m),b<o&&(b=Math.sqrt(o*b)));do{t.data!==i&&(y=a[t.data.index]*r/b,i.vx+=f*y,e>1&&(i.vy+=g*y),e>2&&(i.vz+=m*y))}while(t=t.next)}}return c.initialize=function(i,...r){t=i,n=r.find(t=>"function"==typeof t)||Math.random,e=r.find(t=>[1,2,3].includes(t))||2,u()},c.strength=function(t){return arguments.length?(s="function"==typeof t?t:Ql(+t),u(),c):s},c.distanceMin=function(t){return arguments.length?(o=t*t,c):Math.sqrt(o)},c.distanceMax=function(t){return arguments.length?(l=t*t,c):Math.sqrt(l)},c.theta=function(t){return arguments.length?(h=t*t,c):Math.sqrt(h)},c},yh=function(t,e,i){var n,r=1;function a(){var a,s,o=n.length,l=0,h=0,c=0;for(a=0;a<o;++a)l+=(s=n[a]).x||0,h+=s.y||0,c+=s.z||0;for(l=(l/o-t)*r,h=(h/o-e)*r,c=(c/o-i)*r,a=0;a<o;++a)s=n[a],l&&(s.x-=l),h&&(s.y-=h),c&&(s.z-=c)}return null==t&&(t=0),null==e&&(e=0),null==i&&(i=0),a.initialize=function(t){n=t},a.x=function(e){return arguments.length?(t=+e,a):t},a.y=function(t){return arguments.length?(e=+t,a):e},a.z=function(t){return arguments.length?(i=+t,a):i},a.strength=function(t){return arguments.length?(r=+t,a):r},a},bh=i(9),vh=i.n(bh),xh=i(10),_h=i.n(xh),Ah=i(11),wh=i.n(Ah);function Ch(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null==i)return;var n,r,a=[],s=!0,o=!1;try{for(i=i.call(t);!(s=(n=i.next()).done)&&(a.push(n.value),!e||a.length!==e);s=!0);}catch(t){o=!0,r=t}finally{try{s||null==i.return||i.return()}finally{if(o)throw r}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return Mh(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Mh(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Mh(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var Eh=function t(e,i){var n=i.default,r=void 0===n?null:n,a=i.triggerUpdate,s=void 0===a||a,o=i.onChange,l=void 0===o?function(t,e){}:o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.name=e,this.defaultVal=r,this.triggerUpdate=s,this.onChange=l};var Ih=function(t){var e=t.stateInit,i=void 0===e?function(){return{}}:e,n=t.props,r=void 0===n?{}:n,a=t.methods,s=void 0===a?{}:a,o=t.aliases,l=void 0===o?{}:o,h=t.init,c=void 0===h?function(){}:h,u=t.update,d=void 0===u?function(){}:u,p=Object.keys(r).map((function(t){return new Eh(t,r[t])}));return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=Object.assign({},i instanceof Function?i(t):i,{initialised:!1}),n={};function r(e){return a(e,t),o(),r}var a=function(t,i){c.call(r,t,e,i),e.initialised=!0},o=wh()((function(){e.initialised&&(d.call(r,e,n),n={})}),1);return p.forEach((function(t){r[t.name]=function(t){var i=t.name,a=t.triggerUpdate,s=void 0!==a&&a,l=t.onChange,h=void 0===l?function(t,e){}:l,c=t.defaultVal,u=void 0===c?null:c;return function(t){var a=e[i];if(!arguments.length)return a;var l=void 0===t?u:t;return e[i]=l,h.call(r,l,e,a),!n.hasOwnProperty(i)&&(n[i]=a),s&&o(),r}}(t)})),Object.keys(s).forEach((function(t){r[t]=function(){for(var i,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return(i=s[t]).call.apply(i,[r,e].concat(a))}})),Object.entries(l).forEach((function(t){var e=Ch(t,2),i=e[0],n=e[1];return r[i]=r[n]})),r.resetProps=function(){return p.forEach((function(t){r[t.name](t.defaultVal)})),r},r.resetProps(),e._rerender=o,r}},Sh=i(1);function Th(t,e){let i;if(void 0===e)for(const e of t)null!=e&&(i>e||void 0===i&&e>=e)&&(i=e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(i>r||void 0===i&&r>=r)&&(i=r)}return i}function Bh(t,e){let i;if(void 0===e)for(const e of t)null!=e&&(i<e||void 0===i&&e>=e)&&(i=e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(i<r||void 0===i&&r>=r)&&(i=r)}return i}function Fh(t,e){if(null==t)return{};var i,n,r=function(t,e){if(null==t)return{};var i,n,r={},a=Object.keys(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}function Uh(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null==i)return;var n,r,a=[],s=!0,o=!1;try{for(i=i.call(t);!(s=(n=i.next()).done)&&(a.push(n.value),!e||a.length!==e);s=!0);}catch(t){o=!0,r=t}finally{try{s||null==i.return||i.return()}finally{if(o)throw r}}return a}(t,e)||Rh(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Lh(t){return function(t){if(Array.isArray(t))return Dh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Rh(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Rh(t,e){if(t){if("string"==typeof t)return Dh(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Dh(t,e):void 0}}function Dh(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function Nh(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var Ph=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=(e instanceof Array?e.length?e:[void 0]:[e]).map((function(t){return{keyAccessor:t,isProp:!(t instanceof Function)}})),a=t.reduce((function(t,e){var n=t,a=e;return r.forEach((function(t,e){var s,o=t.keyAccessor;if(t.isProp){var l=a,h=l[o],c=Fh(l,[o].map(Nh));s=h,a=c}else s=o(a,e);e+1<r.length?(n.hasOwnProperty(s)||(n[s]={}),n=n[s]):i?(n.hasOwnProperty(s)||(n[s]=[]),n[s].push(a)):n[s]=a})),t}),{});i instanceof Function&&function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;n===r.length?Object.keys(e).forEach((function(t){return e[t]=i(e[t])})):Object.values(e).forEach((function(e){return t(e,n+1)}))}(a);var s=a;return n&&(s=[],function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];i.length===r.length?s.push({keys:i,vals:e}):Object.entries(e).forEach((function(e){var n=Uh(e,2),r=n[0],a=n[1];return t(a,[].concat(Lh(i),[r]))}))}(a),e instanceof Array&&0===e.length&&1===s.length&&(s[0].keys=[])),s};function kh(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function zh(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Oh(t,e){if(null==t)return{};var i,n,r=function(t,e){if(null==t)return{};var i,n,r={},a=Object.keys(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}function Qh(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null==i)return;var n,r,a=[],s=!0,o=!1;try{for(i=i.call(t);!(s=(n=i.next()).done)&&(a.push(n.value),!e||a.length!==e);s=!0);}catch(t){o=!0,r=t}finally{try{s||null==i.return||i.return()}finally{if(o)throw r}}return a}(t,e)||Hh(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vh(t){return function(t){if(Array.isArray(t))return Gh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Hh(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Hh(t,e){if(t){if("string"==typeof t)return Gh(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Gh(t,e):void 0}}function Gh(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function jh(t,e,i){var n=i.objBindAttr,r=void 0===n?"__obj":n,a=i.dataBindAttr,s=void 0===a?"__data":a,o=i.idAccessor,l=i.purge,h=void 0!==l&&l,c=function(t){return t.hasOwnProperty(s)},u=e.filter((function(t){return!c(t)})),d=e.filter(c).map((function(t){return t[s]})),p=h?{enter:t,exit:d,update:[]}:function(t,e,i){var n={enter:[],update:[],exit:[]};if(i){var r=Ph(t,i,!1),a=Ph(e,i,!1),s=Object.assign({},r,a);Object.entries(s).forEach((function(t){var e=Qh(t,2),i=e[0],s=e[1],o=r.hasOwnProperty(i)?a.hasOwnProperty(i)?"update":"exit":"enter";n[o].push("update"===o?[r[i],a[i]]:s)}))}else{var o=new Set(t),l=new Set(e);new Set([].concat(Vh(o),Vh(l))).forEach((function(t){var e=o.has(t)?l.has(t)?"update":"exit":"enter";n[e].push("update"===e?[t,t]:t)}))}return n}(d,t,o);return p.update=p.update.map((function(t){var e=Qh(t,2),i=e[0],n=e[1];return i!==n&&(n[r]=i[r],n[r][s]=n),n})),p.exit=p.exit.concat(u.map((function(t){return zh({},r,t)}))),p}var Wh=function(t,e,i,n,r){var a=r.createObj,s=void 0===a?function(t){return{}}:a,o=r.updateObj,l=void 0===o?function(t,e){}:o,h=r.exitObj,c=void 0===h?function(t){}:h,u=r.objBindAttr,d=void 0===u?"__obj":u,p=r.dataBindAttr,f=void 0===p?"__data":p,g=Oh(r,["createObj","updateObj","exitObj","objBindAttr","dataBindAttr"]),m=jh(t,e,function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?kh(Object(i),!0).forEach((function(e){zh(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):kh(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({objBindAttr:d,dataBindAttr:f},g)),y=m.enter,b=m.update;m.exit.forEach((function(t){var e=t[d];delete t[d],c(e),n(e)}));var v=function(t){var e=[];return t.forEach((function(t){var i=s(t);i&&(i[f]=t,t[d]=i,e.push(i))})),e}(y);!function(t){t.forEach((function(t){var e=t[d];e&&(e[f]=t,l(e,t))}))}([].concat(Vh(y),Vh(b))),v.forEach(i)};class qh extends Map{constructor(t,e=Yh){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[e,i]of t)this.set(e,i)}get(t){return super.get(Zh(this,t))}has(t){return super.has(Zh(this,t))}set(t,e){return super.set(Jh(this,t),e)}delete(t){return super.delete(Xh(this,t))}}Set;function Zh({_intern:t,_key:e},i){const n=e(i);return t.has(n)?t.get(n):i}function Jh({_intern:t,_key:e},i){const n=e(i);return t.has(n)?t.get(n):(t.set(n,i),i)}function Xh({_intern:t,_key:e},i){const n=e(i);return t.has(n)&&(i=t.get(n),t.delete(n)),i}function Yh(t){return null!==t&&"object"==typeof t?t.valueOf():t}function Kh(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}const $h=Symbol("implicit");var tc=function(t){for(var e=t.length/6|0,i=new Array(e),n=0;n<e;)i[n]="#"+t.slice(6*n,6*++n);return i}("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),ec=i(5),ic=i.n(ec);function nc(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function rc(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?nc(Object(i),!0).forEach((function(e){oc(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):nc(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function ac(t){return(ac="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function sc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function oc(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function lc(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&cc(t,e)}function hc(t){return(hc=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function cc(t,e){return(cc=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function uc(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function dc(t,e,i){return(dc=uc()?Reflect.construct:function(t,e,i){var n=[null];n.push.apply(n,e);var r=new(Function.bind.apply(t,n));return i&&cc(r,i.prototype),r}).apply(null,arguments)}function pc(t,e){if(null==t)return{};var i,n,r=function(t,e){if(null==t)return{};var i,n,r={},a=Object.keys(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||(r[i]=t[i]);return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)i=a[n],e.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(t,i)&&(r[i]=t[i])}return r}function fc(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function gc(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?fc(t):e}function mc(t){var e=uc();return function(){var i,n=hc(t);if(e){var r=hc(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return gc(this,i)}}function yc(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==i)return;var n,r,a=[],s=!0,o=!1;try{for(i=i.call(t);!(s=(n=i.next()).done)&&(a.push(n.value),!e||a.length!==e);s=!0);}catch(t){o=!0,r=t}finally{try{s||null==i.return||i.return()}finally{if(o)throw r}}return a}(t,e)||vc(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bc(t){return function(t){if(Array.isArray(t))return xc(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||vc(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vc(t,e){if(t){if("string"==typeof t)return xc(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?xc(t,e):void 0}}function xc(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var _c=function t(e){e.geometry&&e.geometry.dispose(),e.material&&function t(e){e instanceof Array?e.forEach(t):(e.map&&e.map.dispose(),e.dispose())}(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(t)},Ac=function(t){for(;t.children.length;){var e=t.children[0];t.remove(e),_c(e)}},wc=["objFilter"];function Cc(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.objFilter,r=void 0===n?function(){return!0}:n,a=pc(i,wc);return Wh(t,e.children.filter(r),(function(t){return e.add(t)}),(function(t){e.remove(t),Ac(t)}),rc({objBindAttr:"__threeObj"},a))}var Mc=function(t){return isNaN(t)?parseInt(ic()(t).toHex(),16):t},Ec=function(t){return isNaN(t)?ic()(t).getAlpha():1},Ic=function t(){var e=new qh,i=[],n=[],r=$h;function a(t){let a=e.get(t);if(void 0===a){if(r!==$h)return r;e.set(t,a=i.push(t)-1)}return n[a%n.length]}return a.domain=function(t){if(!arguments.length)return i.slice();i=[],e=new qh;for(const n of t)e.has(n)||e.set(n,i.push(n)-1);return a},a.range=function(t){return arguments.length?(n=Array.from(t),a):n.slice()},a.unknown=function(t){return arguments.length?(r=t,a):r},a.copy=function(){return t(i,n).unknown(r)},Kh.apply(a,arguments),a}(tc);function Sc(t,e,i){e&&"string"==typeof i&&t.filter((function(t){return!t[i]})).forEach((function(t){t[i]=Ic(e(t))}))}var Tc=window.THREE?window.THREE:{Group:Tr,Mesh:Se,MeshLambertMaterial:js,Color:Jt,BufferGeometry:ce,BufferAttribute:$t,Matrix4:rt,Vector3:I,SphereBufferGeometry:Ps,CylinderBufferGeometry:Na,TubeBufferGeometry:ks,ConeBufferGeometry:Pa,Line:wa,LineBasicMaterial:ya,QuadraticBezierCurve3:ts,CubicBezierCurve3:Ya,Box3:B},Bc={graph:vh.a,forcelayout:_h.a},Fc=(new Tc.BufferGeometry).setAttribute?"setAttribute":"addAttribute",Uc=(new Tc.BufferGeometry).applyMatrix4?"applyMatrix4":"applyMatrix";var Lc=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=function(e){lc(r,e);var n=mc(r);function r(){var e;sc(this,r);for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return(e=n.call.apply(n,[this].concat(s))).__kapsuleInstance=t().apply(void 0,[].concat(bc(i?[fc(e)]:[]),s)),e}return r}(e);return Object.keys(t()).forEach((function(t){return n.prototype[t]=function(){var e,i=(e=this.__kapsuleInstance)[t].apply(e,arguments);return i===this.__kapsuleInstance?this:i}})),n}(Ih({props:{jsonUrl:{onChange:function(t,e){var i=this;t&&!e.fetchingJson&&(e.fetchingJson=!0,e.onLoading(),fetch(t).then((function(t){return t.json()})).then((function(t){e.fetchingJson=!1,e.onFinishLoading(t),i.graphData(t)})))},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(t,e){e.engineRunning=!1}},numDimensions:{default:3,onChange:function(t,e){var i=e.d3ForceLayout.force("charge");function n(t,e){t.forEach((function(t){delete t[e],delete t["v".concat(e)]}))}i&&i.strength(t>2?-60:-30),t<3&&n(e.graphData.nodes,"z"),t<2&&n(e.graphData.nodes,"y")}},dagMode:{onChange:function(t,e){!t&&"d3"===e.forceEngine&&(e.graphData.nodes||[]).forEach((function(t){return t.fx=t.fy=t.fz=void 0}))}},dagLevelDistance:{},dagNodeFilter:{default:function(t){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4},nodeId:{default:"id"},nodeVal:{default:"val"},nodeResolution:{default:8},nodeColor:{default:"color"},nodeAutoColorBy:{},nodeOpacity:{default:.75},nodeVisibility:{default:!0},nodeThreeObject:{},nodeThreeObjectExtend:{default:!1},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0},linkColor:{default:"color"},linkAutoColorBy:{},linkOpacity:{default:.2},linkWidth:{},linkResolution:{default:6},linkCurvature:{default:0,triggerUpdate:!1},linkCurveRotation:{default:0,triggerUpdate:!1},linkMaterial:{},linkThreeObject:{},linkThreeObjectExtend:{default:!1},linkPositionUpdate:{triggerUpdate:!1},linkDirectionalArrowLength:{default:0},linkDirectionalArrowColor:{},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1},linkDirectionalArrowResolution:{default:8},linkDirectionalParticles:{default:0},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleWidth:{default:.5},linkDirectionalParticleColor:{},linkDirectionalParticleResolution:{default:4},forceEngine:{default:"d3"},d3AlphaMin:{default:0},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(t,e){e.d3ForceLayout.alphaDecay(t)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(t,e){e.d3ForceLayout.alphaTarget(t)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(t,e){e.d3ForceLayout.velocityDecay(t)}},ngraphPhysics:{default:{timeStep:20,gravity:-1.2,theta:.8,springLength:30,springCoefficient:8e-4,dragCoefficient:.02}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onLoading:{default:function(){},triggerUpdate:!1},onFinishLoading:{default:function(){},triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1}},methods:{refresh:function(t){return t._flushObjects=!0,t._rerender(),this},d3Force:function(t,e,i){return void 0===i?t.d3ForceLayout.force(e):(t.d3ForceLayout.force(e,i),this)},d3ReheatSimulation:function(t){return t.d3ForceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(t){return t.cntTicks=0,t.startTickTime=new Date,t.engineRunning=!0,this},tickFrame:function(t){var e,i,n,r,a="ngraph"!==t.forceEngine;return t.engineRunning&&function(){++t.cntTicks>t.cooldownTicks||new Date-t.startTickTime>t.cooldownTime||a&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin?(t.engineRunning=!1,t.onEngineStop()):(t.layout[a?"tick":"step"](),t.onEngineTick());t.graphData.nodes.forEach((function(e){var i=e.__threeObj;if(i){var n=a?e:t.layout.getNodePosition(e[t.nodeId]);i.position.x=n.x,i.position.y=n.y||0,i.position.z=n.z||0}}));var e=Object(Sh.default)(t.linkWidth),i=Object(Sh.default)(t.linkCurvature),n=Object(Sh.default)(t.linkCurveRotation),r=Object(Sh.default)(t.linkThreeObjectExtend);t.graphData.links.forEach((function(s){var o=s.__lineObj;if(o){var l=a?s:t.layout.getLinkPosition(t.layout.graph.getLink(s.source,s.target).id),h=l[a?"source":"from"],c=l[a?"target":"to"];if(h&&c&&h.hasOwnProperty("x")&&c.hasOwnProperty("x")){!function(e){var r=a?e:t.layout.getLinkPosition(t.layout.graph.getLink(e.source,e.target).id),s=r[a?"source":"from"],o=r[a?"target":"to"];if(s&&o&&s.hasOwnProperty("x")&&o.hasOwnProperty("x")){var l=i(e);if(l){var h,c=new Tc.Vector3(s.x,s.y||0,s.z||0),u=new Tc.Vector3(o.x,o.y||0,o.z||0),d=c.distanceTo(u),p=n(e);if(d>0){var f=o.x-s.x,g=o.y-s.y||0,m=(new Tc.Vector3).subVectors(u,c),y=m.clone().multiplyScalar(l).cross(0!==f||0!==g?new Tc.Vector3(0,0,1):new Tc.Vector3(0,1,0)).applyAxisAngle(m.normalize(),p).add((new Tc.Vector3).addVectors(c,u).divideScalar(2));h=new Tc.QuadraticBezierCurve3(c,y,u)}else{var b=70*l,v=-p,x=v+Math.PI/2;h=new Tc.CubicBezierCurve3(c,new Tc.Vector3(b*Math.cos(x),b*Math.sin(x),0).add(c),new Tc.Vector3(b*Math.cos(v),b*Math.sin(v),0).add(c),u)}e.__curve=h}else e.__curve=null}}(s);var u=r(s);if(!t.linkPositionUpdate||!t.linkPositionUpdate(u?o.children[1]:o,{start:{x:h.x,y:h.y,z:h.z},end:{x:c.x,y:c.y,z:c.z}},s)||u){var d=s.__curve,p=o.children.length?o.children[0]:o;if("Line"===p.type){if(d)p.geometry.setFromPoints(d.getPoints(30));else{var f=p.geometry.getAttribute("position");f&&f.array&&6===f.array.length||p.geometry[Fc]("position",f=new Tc.BufferAttribute(new Float32Array(6),3)),f.array[0]=h.x,f.array[1]=h.y||0,f.array[2]=h.z||0,f.array[3]=c.x,f.array[4]=c.y||0,f.array[5]=c.z||0,f.needsUpdate=!0}p.geometry.computeBoundingSphere()}else if("Mesh"===p.type)if(d){p.geometry.type.match(/^Tube(Buffer)?Geometry$/)||(p.position.set(0,0,0),p.rotation.set(0,0,0),p.scale.set(1,1,1));var g=Math.ceil(10*e(s))/10/2,m=new Tc.TubeBufferGeometry(d,30,g,t.linkResolution,!1);p.geometry.dispose(),p.geometry=m}else{if(!p.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var y=Math.ceil(10*e(s))/10/2,b=new Tc.CylinderBufferGeometry(y,y,1,t.linkResolution,1,!1);b[Uc]((new Tc.Matrix4).makeTranslation(0,.5,0)),b[Uc]((new Tc.Matrix4).makeRotationX(Math.PI/2)),p.geometry.dispose(),p.geometry=b}var v=new Tc.Vector3(h.x,h.y||0,h.z||0),x=new Tc.Vector3(c.x,c.y||0,c.z||0),_=v.distanceTo(x);p.position.x=v.x,p.position.y=v.y,p.position.z=v.z,p.scale.z=_,p.parent.localToWorld(x),p.lookAt(x)}}}}}))}(),e=Object(Sh.default)(t.linkDirectionalArrowRelPos),i=Object(Sh.default)(t.linkDirectionalArrowLength),n=Object(Sh.default)(t.nodeVal),t.graphData.links.forEach((function(r){var s=r.__arrowObj;if(s){var o=a?r:t.layout.getLinkPosition(t.layout.graph.getLink(r.source,r.target).id),l=o[a?"source":"from"],h=o[a?"target":"to"];if(l&&h&&l.hasOwnProperty("x")&&h.hasOwnProperty("x")){var c=Math.sqrt(Math.max(0,n(l)||1))*t.nodeRelSize,u=Math.sqrt(Math.max(0,n(h)||1))*t.nodeRelSize,d=i(r),p=e(r),f=r.__curve?function(t){return r.__curve.getPoint(t)}:function(t){var e=function(t,e,i,n){return e[t]+(i[t]-e[t])*n||0};return{x:e("x",l,h,t),y:e("y",l,h,t),z:e("z",l,h,t)}},g=r.__curve?r.__curve.getLength():Math.sqrt(["x","y","z"].map((function(t){return Math.pow((h[t]||0)-(l[t]||0),2)})).reduce((function(t,e){return t+e}),0)),m=c+d+(g-c-u-d)*p,y=f(m/g),b=f((m-d)/g);["x","y","z"].forEach((function(t){return s.position[t]=b[t]}));var v=dc(Tc.Vector3,bc(["x","y","z"].map((function(t){return y[t]}))));s.parent.localToWorld(v),s.lookAt(v)}}})),r=Object(Sh.default)(t.linkDirectionalParticleSpeed),t.graphData.links.forEach((function(e){var i=e.__photonsObj&&e.__photonsObj.children,n=e.__singleHopPhotonsObj&&e.__singleHopPhotonsObj.children;if(n&&n.length||i&&i.length){var s=a?e:t.layout.getLinkPosition(t.layout.graph.getLink(e.source,e.target).id),o=s[a?"source":"from"],l=s[a?"target":"to"];if(o&&l&&o.hasOwnProperty("x")&&l.hasOwnProperty("x")){var h=r(e),c=e.__curve?function(t){return e.__curve.getPoint(t)}:function(t){var e=function(t,e,i,n){return e[t]+(i[t]-e[t])*n||0};return{x:e("x",o,l,t),y:e("y",o,l,t),z:e("z",o,l,t)}};[].concat(bc(i||[]),bc(n||[])).forEach((function(t,e){var n="singleHopPhotons"===t.parent.__linkThreeObjType;if(t.hasOwnProperty("__progressRatio")||(t.__progressRatio=n?0:e/i.length),t.__progressRatio+=h,t.__progressRatio>=1){if(n)return t.parent.remove(t),void Ac(t);t.__progressRatio=t.__progressRatio%1}var r=t.__progressRatio,a=c(r);["x","y","z"].forEach((function(e){return t.position[e]=a[e]}))}))}}})),this},emitParticle:function(t,e){if(e){if(!e.__singleHopPhotonsObj){var i=new Tc.Group;i.__linkThreeObjType="singleHopPhotons",e.__singleHopPhotonsObj=i,t.graphScene.add(i)}var n=Object(Sh.default)(t.linkDirectionalParticleWidth),r=Math.ceil(10*n(e))/10/2,a=t.linkDirectionalParticleResolution,s=new Tc.SphereBufferGeometry(r,a,a),o=Object(Sh.default)(t.linkColor),l=Object(Sh.default)(t.linkDirectionalParticleColor)(e)||o(e)||"#f0f0f0",h=new Tc.Color(Mc(l)),c=3*t.linkOpacity,u=new Tc.MeshLambertMaterial({color:h,transparent:!0,opacity:c});e.__singleHopPhotonsObj.add(new Tc.Mesh(s,u))}return this},getGraphBbox:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){return!0};if(!t.initialised)return null;var i=function t(i){var n=[];if(i.geometry){i.geometry.computeBoundingBox();var r=new Tc.Box3;r.copy(i.geometry.boundingBox).applyMatrix4(i.matrixWorld),n.push(r)}return n.concat.apply(n,bc((i.children||[]).filter((function(t){return!t.hasOwnProperty("__graphObjType")||"node"===t.__graphObjType&&e(t.__data)})).map(t)))}(t.graphScene);return i.length?Object.assign.apply(Object,bc(["x","y","z"].map((function(t){return oc({},t,[Th(i,(function(e){return e.min[t]})),Bh(i,(function(e){return e.max[t]}))])})))):null}},stateInit:function(){return{d3ForceLayout:Ol().force("link",jl()).force("charge",mh()).force("center",yh()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(t,e){e.graphScene=t},update:function(t,e){var i=function(t){return t.some((function(t){return e.hasOwnProperty(t)}))};if(t.engineRunning=!1,t.onUpdate(),null!==t.nodeAutoColorBy&&i(["nodeAutoColorBy","graphData","nodeColor"])&&Sc(t.graphData.nodes,Object(Sh.default)(t.nodeAutoColorBy),t.nodeColor),null!==t.linkAutoColorBy&&i(["linkAutoColorBy","graphData","linkColor"])&&Sc(t.graphData.links,Object(Sh.default)(t.linkAutoColorBy),t.linkColor),t._flushObjects||i(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var n=Object(Sh.default)(t.nodeThreeObject),r=Object(Sh.default)(t.nodeThreeObjectExtend),a=Object(Sh.default)(t.nodeVal),s=Object(Sh.default)(t.nodeColor),o=Object(Sh.default)(t.nodeVisibility),l={},h={};Cc(t.graphData.nodes.filter(o),t.graphScene,{purge:t._flushObjects||i(["nodeThreeObject","nodeThreeObjectExtend"]),objFilter:function(t){return"node"===t.__graphObjType},createObj:function(e){var i,a=n(e),s=r(e);return a&&t.nodeThreeObject===a&&(a=a.clone()),a&&!s?i=a:((i=new Tc.Mesh).__graphDefaultObj=!0,a&&s&&i.add(a)),i.__graphObjType="node",i},updateObj:function(e,i){if(e.__graphDefaultObj){var n=a(i)||1,r=Math.cbrt(n)*t.nodeRelSize,o=t.nodeResolution;e.geometry.type.match(/^Sphere(Buffer)?Geometry$/)&&e.geometry.parameters.radius===r&&e.geometry.parameters.widthSegments===o||(l.hasOwnProperty(n)||(l[n]=new Tc.SphereBufferGeometry(r,o,o)),e.geometry.dispose(),e.geometry=l[n]);var c=s(i),u=new Tc.Color(Mc(c||"#ffffaa")),d=t.nodeOpacity*Ec(c);"MeshLambertMaterial"===e.material.type&&e.material.color.equals(u)&&e.material.opacity===d||(h.hasOwnProperty(c)||(h[c]=new Tc.MeshLambertMaterial({color:u,transparent:!0,opacity:d})),e.material.dispose(),e.material=h[c])}}})}if(t._flushObjects||i(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution"])){var c=Object(Sh.default)(t.linkThreeObject),u=Object(Sh.default)(t.linkThreeObjectExtend),d=Object(Sh.default)(t.linkMaterial),p=Object(Sh.default)(t.linkVisibility),f=Object(Sh.default)(t.linkColor),g=Object(Sh.default)(t.linkWidth),m={},y={},b={},v=t.graphData.links.filter(p);if(Cc(v,t.graphScene,{objBindAttr:"__lineObj",purge:t._flushObjects||i(["linkThreeObject","linkThreeObjectExtend","linkWidth"]),objFilter:function(t){return"link"===t.__graphObjType},createObj:function(e){var i,n,r=c(e),a=u(e);if(r&&t.linkThreeObject===r&&(r=r.clone()),!r||a)if(!!g(e))i=new Tc.Mesh;else{var s=new Tc.BufferGeometry;s[Fc]("position",new Tc.BufferAttribute(new Float32Array(6),3)),i=new Tc.Line(s)}return r?a?((n=new Tc.Group).__graphDefaultObj=!0,n.add(i),n.add(r)):n=r:(n=i).__graphDefaultObj=!0,n.renderOrder=10,n.__graphObjType="link",n},updateObj:function(e,i){if(e.__graphDefaultObj){var n=e.children.length?e.children[0]:e,r=Math.ceil(10*g(i))/10,a=!!r;if(a){var s=r/2,o=t.linkResolution;if(!n.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||n.geometry.parameters.radiusTop!==s||n.geometry.parameters.radialSegments!==o){if(!m.hasOwnProperty(r)){var l=new Tc.CylinderBufferGeometry(s,s,1,o,1,!1);l[Uc]((new Tc.Matrix4).makeTranslation(0,.5,0)),l[Uc]((new Tc.Matrix4).makeRotationX(Math.PI/2)),m[r]=l}n.geometry.dispose(),n.geometry=m[r]}}var h=d(i);if(h)n.material=h;else{var c=f(i),u=new Tc.Color(Mc(c||"#f0f0f0")),p=t.linkOpacity*Ec(c),v=a?"MeshLambertMaterial":"LineBasicMaterial";if(n.material.type!==v||!n.material.color.equals(u)||n.material.opacity!==p){var x=a?y:b;x.hasOwnProperty(c)||(x[c]=new Tc[v]({color:u,transparent:p<1,opacity:p,depthWrite:p>=1})),n.material.dispose(),n.material=x[c]}}}}}),t.linkDirectionalArrowLength||e.hasOwnProperty("linkDirectionalArrowLength")){var x=Object(Sh.default)(t.linkDirectionalArrowLength),_=Object(Sh.default)(t.linkDirectionalArrowColor);Cc(v.filter(x),t.graphScene,{objBindAttr:"__arrowObj",objFilter:function(t){return"arrow"===t.__linkThreeObjType},createObj:function(){var t=new Tc.Mesh(void 0,new Tc.MeshLambertMaterial({transparent:!0}));return t.__linkThreeObjType="arrow",t},updateObj:function(e,i){var n=x(i),r=t.linkDirectionalArrowResolution;if(!e.geometry.type.match(/^Cone(Buffer)?Geometry$/)||e.geometry.parameters.height!==n||e.geometry.parameters.radialSegments!==r){var a=new Tc.ConeBufferGeometry(.25*n,n,r);a.translate(0,n/2,0),a.rotateX(Math.PI/2),e.geometry.dispose(),e.geometry=a}e.material.color=new Tc.Color(_(i)||f(i)||"#f0f0f0"),e.material.opacity=3*t.linkOpacity}})}if(t.linkDirectionalParticles||e.hasOwnProperty("linkDirectionalParticles")){var A=Object(Sh.default)(t.linkDirectionalParticles),w=Object(Sh.default)(t.linkDirectionalParticleWidth),C=Object(Sh.default)(t.linkDirectionalParticleColor),M={},E={};Cc(v.filter(A),t.graphScene,{objBindAttr:"__photonsObj",objFilter:function(t){return"photons"===t.__linkThreeObjType},createObj:function(){var t=new Tc.Group;return t.__linkThreeObjType="photons",t},updateObj:function(e,i){var n,r=Math.round(Math.abs(A(i))),a=!!e.children.length&&e.children[0],s=Math.ceil(10*w(i))/10/2,o=t.linkDirectionalParticleResolution;a&&a.geometry.parameters.radius===s&&a.geometry.parameters.widthSegments===o?n=a.geometry:(E.hasOwnProperty(s)||(E[s]=new Tc.SphereBufferGeometry(s,o,o)),n=E[s],a&&a.geometry.dispose());var l,h=C(i)||f(i)||"#f0f0f0",c=new Tc.Color(Mc(h)),u=3*t.linkOpacity;a&&a.material.color.equals(c)&&a.material.opacity===u?l=a.material:(M.hasOwnProperty(h)||(M[h]=new Tc.MeshLambertMaterial({color:c,transparent:!0,opacity:u})),l=M[h],a&&a.material.dispose()),Cc(bc(new Array(r)).map((function(t,e){return{idx:e}})),e,{idAccessor:function(t){return t.idx},createObj:function(){return new Tc.Mesh(n,l)},updateObj:function(t){t.geometry=n,t.material=l}})}})}}if(t._flushObjects=!1,i(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){t.engineRunning=!1,t.graphData.links.forEach((function(e){e.source=e[t.linkSource],e.target=e[t.linkTarget]}));var I,S="ngraph"!==t.forceEngine;if(S){(I=t.d3ForceLayout).stop().alpha(1).numDimensions(t.numDimensions).nodes(t.graphData.nodes);var T=t.d3ForceLayout.force("link");T&&T.id((function(e){return e[t.nodeId]})).links(t.graphData.links);var B=t.dagMode&&function(t,e){var i=t.nodes,n=t.links,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=r.nodeFilter,s=void 0===a?function(){return!0}:a,o=r.onLoopError,l=void 0===o?function(t){throw"Invalid DAG structure! Found cycle in node path: ".concat(t.join(" -> "),".")}:o,h={};i.forEach((function(t){return h[e(t)]={data:t,out:[],depth:-1,skip:!s(t)}})),n.forEach((function(t){var i=t.source,n=t.target,r=l(i),a=l(n);if(!h.hasOwnProperty(r))throw"Missing source node with id: ".concat(r);if(!h.hasOwnProperty(a))throw"Missing target node with id: ".concat(a);var s=h[r],o=h[a];function l(t){return"object"===ac(t)?e(t):t}s.out.push(o)}));var c=[];d(Object.values(h));var u=Object.assign.apply(Object,[{}].concat(bc(Object.entries(h).filter((function(t){return!yc(t,2)[1].skip})).map((function(t){var e=yc(t,2);return oc({},e[0],e[1].depth)})))));return u;function d(t){for(var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=0,a=t.length;r<a;r++){var s=t[r];if(-1!==i.indexOf(s)){var o=function(){var t=[].concat(bc(i.slice(i.indexOf(s))),[s]).map((function(t){return e(t.data)}));return c.some((function(e){return e.length===t.length&&e.every((function(e,i){return e===t[i]}))}))||(c.push(t),l(t)),"continue"}();if("continue"===o)continue}n>s.depth&&(s.depth=n,d(s.out,[].concat(bc(i),[s]),n+(s.skip?0:1)))}}}(t.graphData,(function(e){return e[t.nodeId]}),{nodeFilter:t.dagNodeFilter,onLoopError:t.onDagError||void 0}),F=Math.max.apply(Math,bc(Object.values(B||[]))),U=t.dagLevelDistance||t.graphData.nodes.length/(F||1)*2*(-1!==["radialin","radialout"].indexOf(t.dagMode)?.7:1);if(t.dagMode){var L=function(e,i){return function(n){return e?(B[n[t.nodeId]]-F/2)*U*(i?-1:1):void 0}},R=L(-1!==["lr","rl"].indexOf(t.dagMode),"rl"===t.dagMode),D=L(-1!==["td","bu"].indexOf(t.dagMode),"td"===t.dagMode),N=L(-1!==["zin","zout"].indexOf(t.dagMode),"zout"===t.dagMode);t.graphData.nodes.filter(t.dagNodeFilter).forEach((function(t){t.fx=R(t),t.fy=D(t),t.fz=N(t)}))}t.d3ForceLayout.force("dagRadial",-1!==["radialin","radialout"].indexOf(t.dagMode)?function(t,e,i,n){var r,a,s,o,l=Ql(.1);function h(t){for(var l=0,h=r.length;l<h;++l){var c=r[l],u=c.x-e||1e-6,d=(c.y||0)-i||1e-6,p=(c.z||0)-n||1e-6,f=Math.sqrt(u*u+d*d+p*p),g=(o[l]-f)*s[l]*t/f;c.vx+=u*g,a>1&&(c.vy+=d*g),a>2&&(c.vz+=p*g)}}function c(){if(r){var e,i=r.length;for(s=new Array(i),o=new Array(i),e=0;e<i;++e)o[e]=+t(r[e],e,r),s[e]=isNaN(o[e])?0:+l(r[e],e,r)}}return"function"!=typeof t&&(t=Ql(+t)),null==e&&(e=0),null==i&&(i=0),null==n&&(n=0),h.initialize=function(t,...e){r=t,a=e.find(t=>[1,2,3].includes(t))||2,c()},h.strength=function(t){return arguments.length?(l="function"==typeof t?t:Ql(+t),c(),h):l},h.radius=function(e){return arguments.length?(t="function"==typeof e?e:Ql(+e),c(),h):t},h.x=function(t){return arguments.length?(e=+t,h):e},h.y=function(t){return arguments.length?(i=+t,h):i},h.z=function(t){return arguments.length?(n=+t,h):n},h}((function(e){var i=B[e[t.nodeId]]||-1;return("radialin"===t.dagMode?F-i:i)*U})).strength((function(e){return t.dagNodeFilter(e)?1:0})):null)}else{var P=Bc.graph();t.graphData.nodes.forEach((function(e){P.addNode(e[t.nodeId])})),t.graphData.links.forEach((function(t){P.addLink(t.source,t.target)})),(I=Bc.forcelayout(P,rc({dimensions:t.numDimensions},t.ngraphPhysics))).graph=P}for(var k=0;k<t.warmupTicks&&!(S&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin);k++)I[S?"tick":"step"]();t.layout=I,this.resetCountdown()}t.engineRunning=!0,t.onFinishUpdate()}}),(window.THREE?window.THREE:{Group:Tr}).Group,!0);e.default=Lc}]);
2
8
  //# sourceMappingURL=aframe-babia-components.min.js.map